Skip to content

EmberApp specific helper for an upgradeable default brocfile.#396

Merged
stefanpenner merged 2 commits intomasterfrom
maintainable-brocfile
Apr 21, 2014
Merged

EmberApp specific helper for an upgradeable default brocfile.#396
stefanpenner merged 2 commits intomasterfrom
maintainable-brocfile

Conversation

@stefanpenner
Copy link
Contributor

It has been a common pain point during upgrades, also a little intimidating for early users.

The goal for this is not to hide broccoli, as custom usage should not be discouraged.
Anything reasonable that now cannot be done should be considered a bugfix.

Most if not all features should still be available

Please note, as we improve our add-on story the legacyFilesToAppend + ignoredModules + ignoredModules should vanish.

  • bring back validation
  • finish
  • feedback
  • bugfixes
  • website docs
  • changelog entry

Likely what it would look like today (without the addon work)

/* global require, module */

var env = require('broccoli-env').getEnv();
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var push = Array.prototype.push;

var app = new EmberApp(env, {
  name: require('./package.json').name,

  legacyFilesToAppend: [
    'jquery.js',
    'handlebars.js',
    'ember.js',
    'ic-ajax/dist/named-amd/main.js',
    'ember-data.js',
    'app-shims.js',
    'ember-resolver.js',
    'ember-load-initializers.js',
    'emberfire.js'
  ],

  // AKA whitelisted modules
  ignoredModules: [
    'ember',
    'ember/resolver',
    'ember/load-initializers',
    'ic-ajax'
  ],

 whitelistedImports: {
    // ... again, we don't get enough information from our plugins yet, to do this automatically.
  }
  // hack
  getEnvJSON: require('./config/environment')
});

if (env !== 'production') {
  push.apply(app.ignoredModules, [
    'qunit',
    'ember-qunit'
  ]);

  push.apply(app.legacyFilesToAppend, [
    'qunit/qunit/qunit.js',
    'test-shims.js',
    'ember-qunit/dist/named-amd/main.js'
  ]);
}

module.exports = app.toTree();

Once we have a better add-on solution it will eventually look more like:

var env = require('broccoli-env').getEnv();
var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = new EmberApp(env, {
  name: require('./package.json').name,
  getEnvJSON: require('./config/environment') // hack for now
});

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add this to the prototype to make it easier to use from custom trees (and possible override)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah, I consider this still a hack. Once we have a proper solution for this, i will expose that.

stefanpenner added a commit that referenced this pull request Apr 21, 2014
EmberApp specific helper for an upgradeable default brocfile.
@stefanpenner stefanpenner merged commit 8273ae6 into master Apr 21, 2014
@rwjblue
Copy link
Member

rwjblue commented Apr 21, 2014

@stefanpenner - Excellent work here. From all of our users everywhere: Thank you!

@stefanpenner
Copy link
Contributor Author

@rjackson I hope this to be a foundation for us to iterate on.

@stefanpenner stefanpenner deleted the maintainable-brocfile branch April 21, 2014 02:11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefanpenner This file is not being picked. /assets/qunit.css returns not found.

@twokul twokul mentioned this pull request Apr 29, 2014
@jasalguero jasalguero mentioned this pull request Apr 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants