Как решить проблему с coffeescript и gulp?

Есть написан проект на angularJs и coffeescript.
Туда нужно допилить фичу.
Но при gulp default
{ C:\OpenServer\domains\ps-angular-js-frontend\app\coffee\modules\accounts\main.coffee:3:17: error: unexpected identifier
  MenuProvider.addItem (UserType, AccessRules)->
 ^^^^^^^^^^^^
  location: { first_line: 2, first_column: 16, last_line: 2, last_column: 27 },
  toString: [Function: syntaxErrorToString],
  filename: 'C:\\OpenServer\\domains\\ps-angular-js-frontend\\app\\coffee\\modules\\accounts\\main.coffee',
  name: 'SyntaxError',
  message: 'unexpected identifier',
  stack: 'C:\\OpenServer\\domains\\ps-angular-js-frontend\\app\\coffee\\modules\\accounts\\main.coffee:3:17: error: unexpected identifier\n  ### Menu ###\r  MenuProvider.addItem (UserType, AccessRules)->\r\n              \r ^^^^^^^^^^^^',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-coffee' }

Файл main.coffee
accounts = ($injector, $stateProvider, MenuProvider) ->

  ### Menu ###
  #= require menu.coffee

  templateUrl = 'views/accounts/

  dependencies =
    templateUrl: templateUrl
    currencyView: tools.currencyView
    endpointFromUrl: endpointFromUrl
    showModal: showModal
    loadById: loadById


  #Controllers

  cashbookCtrl = ($scope, $injector, FormusContainer)->
    alias = 'cashbook'
    $scope.form = form = FormusContainer.get 'cashbookFilter'
    form.data.from = (new Date()).toShortString()
    form.data.to = (new Date()).toShortString()
    $injector.invoke addReportButtonHandler, this, ($scope: $scope, form: form, alias: alias)

  receiptsLedgerCtrl = ($scope, $injector, FormusContainer)->
    alias = 'receipts-ledger'
    $scope.form = form = FormusContainer.get 'receiptsLedgerFilter'
    form.data.from = (new Date()).toShortString()
    form.data.to = (new Date()).toShortString()
    $scope.$watch "form.data.selectBy", (newValue) ->
      switch newValue
        when 1
          $scope.form.fieldset.fields[0].fields[1].hide = false
          $scope.form.fieldset.fields[0].fields[2].hide = true
          $scope.form.fieldset.fields[0].fields[3].hide = true
          $scope.form.fieldset.fields[1].fields[1].hide = false
        when 2
          $scope.form.fieldset.fields[0].fields[1].hide = true
          $scope.form.fieldset.fields[0].fields[2].hide = false
          $scope.form.fieldset.fields[0].fields[3].hide = false
          $scope.form.fieldset.fields[1].fields[1].hide = true
          $scope.form.data.includeDbs = 0

    $injector.invoke addReportButtonHandler, this, ($scope: $scope, form: form, alias: alias)

  #Routes
  $stateProvider
  .state 'accounts',
    parent: 'base'
    url: 'accounts'
    abstract: true
    resolve:
      url: -> 'payments'
      payments: endpointFromUrl
      premises: (Restangular)-> Restangular.all 'premises'
      premisesList: premisesList
      users: (Restangular)-> Restangular.all 'users'
      reservations: (Restangular)-> Restangular.all 'reservations'

    templateUrl: templateUrl + 'base.html'
    data:
      unit: 'accounts'
  .state 'accounts.index',
    url: ''

  .state 'accounts.cashbook',
    url: '/cashbook'
    data:
      section: 'reports'
      subitem: 'cashbook'
      access:
        only: ['administrators']
        fn: (UserType, AccessRules)-> (UserType.isAuditor() && AccessRules.get('auditors', 'accounts', 'trustAccount'))
    controller: cashbookCtrl
    templateUrl: templateUrl + 'cashbook.html'

  .state 'accounts.receipts-ledger',
    url: '/receipts-ledger'
    data:
      section: 'reports'
      subitem: 'receipts-ledger'
      access:
        only: ['administrators']
        fn: (UserType, AccessRules)-> (UserType.isAuditor() && AccessRules.get('auditors', 'accounts', 'trustAccount'))
    controller: receiptsLedgerCtrl
    templateUrl: templateUrl + 'receipts-ledger.html'


  #= require trust.coffee
  $injector.invoke trust, this, dependencies

  #= require property.coffee
  $injector.invoke property, this, dependencies

  #= require misc.coffee
  $injector.invoke misc, this, dependencies

  #= require dbs.coffee
  $injector.invoke dbs, this, dependencies

  #= require agents.coffee
  $injector.invoke agents, this, dependencies

  #= require my-trust.coffee
  $injector.invoke myTrust, this, dependencies

  #= require expenses.coffee
  $injector.invoke expenses, this, dependencies

  #= require credits.coffee
  $injector.invoke credits, this, dependencies

  #= require reconcile.coffee
  $injector.invoke reconcile, this, dependencies

  #= require reconciliations.coffee
  $injector.invoke reconciliations, this, dependencies

  #= require invoices.coffee
  $injector.invoke invoices, this, dependencies

  #= require transaction.coffee
  $injector.invoke transaction, this, dependencies

  #= require report.coffee
  $injector.invoke report, this, dependencies

Файл menu.coffee
MenuProvider.addItem (UserType, AccessRules)->
  menu =
    name: 'accounts', icon: 'credit-card', title: 'Financials', order: 11,
    items: [
      (name: 'trust',       icon: 'shield',       title: 'Trust',               sref: 'accounts.trust')
      (name: 'agents',      icon: 'shield',       title: 'Agent',               sref: 'accounts.agents.list')
      (name: 'expenses',    icon: 'shield',       title: 'Account Expenses',    sref: 'accounts.expenses.list')
      (name: 'credits',     icon: 'money',        title: 'Account Credits',     sref: 'accounts.credits.list')
      (name: 'invoices',    icon: 'list-alt',     title: 'Account Invoices',    sref: 'accounts.invoices')
      (name: 'reconcile',   icon: 'minus-circle', title: 'Generate Accounts',   sref: 'accounts.reconcile.index')
      (name: 'reports',     icon: 'file-text-o',  title: 'Reports', items: [
        (name: 'property',              icon: 'home',           title: 'Premises Pro Forma',    sref: 'accounts.property')
        (name: 'cashbook',              icon: 'file-text',      title: 'Cashbook',              sref: 'accounts.cashbook')
        (name: 'receipts-ledger',       icon: 'file-text',      title: 'Receipts Ledger',       sref: 'accounts.receipts-ledger')
        (name: 'trial-balance',         icon: 'file-text',      title: 'Trial Balance',         sref: 'accounts.report({alias:"trial-balance"})')
        (name: 'owner-summary',         icon: 'file-text',      title: 'Owner Summary',         sref: 'accounts.report({alias:"owner-summary"})')
        (name: 'misc-summary',          icon: 'file-text',      title: 'Other Transactions',    sref: 'accounts.report({alias:"misc-summary"})')
        (name: 'past-period-accounts',  icon: 'floppy-o',       title: 'Past Period Accounts',  sref: 'accounts.reconcile.past')
        (name: 'accounts-summary',      icon: 'folder-open-o',  title: 'Accounts Summary',      sref: 'accounts.reconciliations')
      ])
      (name: 'transactionSummary',   icon: 'shield', title: 'CC Transactions',   sref: 'accounts.transactions')
    ]

Писал не я.
Насколько я понял, то проблема с коментарием и подключением файла menu.
Можете подсказать как ee решить?
На фирме сказали чужой код не править.
А сделать билд надо.
Заранее спасибо.
  • Вопрос задан
  • 115 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы