Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,24 @@ addons:
firefox: "latest"

cache:
yarn: true
directories:
- $Home/.yarn-cache

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- "phantomjs --version"
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- |
phantomjs --version
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start

sudo apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update -qq
sudo apt-get install -y -qq yarn
yarn --version

install:
- |
yarn install

after_success:
- "./bin/publish_builds"
Expand Down
10 changes: 10 additions & 0 deletions broccoli/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,15 @@ function getFeatures(isDebug) {
return features;
}

function toConst(features) {
let consted = {};
Object.keys(features).forEach((feature) => {
consted[feature.toUpperCase().replace(/-/g, '_')] = features[feature]
});

return consted;
}

module.exports.toConst = toConst;
module.exports.RELEASE = getFeatures(false);
module.exports.DEBUG = getFeatures(true);
3 changes: 3 additions & 0 deletions broccoli/lint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint-env node */
'use strict';

const ESLint = require('broccoli-lint-eslint');

module.exports = function _lint(tree) {
Expand Down
3 changes: 3 additions & 0 deletions broccoli/minify.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint-env node */
'use strict';

const Funnel = require('broccoli-funnel');
const Uglify = require('broccoli-uglify-js');
const path = require('path');
Expand Down
18 changes: 16 additions & 2 deletions broccoli/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ const funnelLib = require('./funnel-lib');
const { VERSION } = require('./version');
const WriteFile = require('broccoli-file-creator');
const StringReplace = require('broccoli-string-replace');
const { RELEASE, DEBUG } = require('./features');
const { RELEASE, DEBUG, toConst } = require('./features');
Copy link
Contributor

Choose a reason for hiding this comment

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

is RELEASE not just !DEBUG?

Copy link
Contributor

Choose a reason for hiding this comment

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

nevermind, I see this isn't a bool

const GlimmerTemplatePrecompiler = require('./glimmer-template-compiler');
const VERSION_PLACEHOLDER = /VERSION_STRING_PLACEHOLDER/g;
const { stripIndent } = require('common-tags');


module.exports.routerES = function _routerES() {
return new Rollup(findLib('router_js', 'lib'), {
Expand Down Expand Up @@ -233,7 +235,19 @@ module.exports.emberLicense = function _emberLicense() {
}

module.exports.emberFeaturesES = function _emberFeaturesES(production = false) {
let content = 'export default ' + JSON.stringify(production ? RELEASE : DEBUG) + ';\n';
let FEATURES = production ? RELEASE : DEBUG;
let content = stripIndent`
import { ENV } from 'ember-environment';
import { assign } from 'ember-utils';
export const DEFAULT_FEATURES = ${JSON.stringify(FEATURES)};
export const FEATURES = assign(DEFAULT_FEATURES, ENV.FEATURES);


${Object.keys(toConst(FEATURES)).map((FEATURE) => {
return `export const ${FEATURE} = FEATURES["${FEATURE.replace(/_/g, '-').toLowerCase()}"];`
}).join('\n')}
`;

return new WriteFile('ember/features.js', content, {
annotation: `ember/features ${production ? 'production' : 'debug' }`
});
Expand Down
31 changes: 18 additions & 13 deletions broccoli/to-es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,30 @@

const Babel = require('broccoli-babel-transpiler');
const injectBabelHelpers = require('./transforms/inject-babel-helpers');
const { RELEASE, DEBUG } = require('./features');
const { RELEASE, DEBUG, toConst } = require('./features');

module.exports = function toES5(tree, _options) {
let options = Object.assign({
environment: 'developement'
}, _options);
options.plugins = [
injectBabelHelpers,
['feature-flags', {
import: {
name: 'isFeatureEnabled',
module: 'ember-debug'
['debug-macros', {
debugTools: {
source: 'ember-debug'
},
features: options.environment === 'production' ? RELEASE : DEBUG
envFlags: {
source: 'ember-env-flags',
flags: { DEBUG: options.environment !== 'production' }
},
features: {
name: 'ember',
source: 'ember/features',
flags: options.environment === 'production' ? toConst(RELEASE) : toConst(DEBUG)
},
externalizeHelpers: {
module: true
}
}],
['transform-es2015-template-literals', {loose: true}],
['transform-es2015-arrow-functions'],
Expand All @@ -28,7 +38,7 @@ module.exports = function toES5(tree, _options) {
['transform-es2015-block-scoping'],
['check-es2015-constants'],
['transform-es2015-classes', {loose: true}],
['transform-proto-to-assign'],
['transform-proto-to-assign']
];

if (options.inlineHelpers) {
Expand All @@ -37,12 +47,7 @@ module.exports = function toES5(tree, _options) {
}

if (options.environment === 'production') {
options.plugins.push([
'filter-imports', {
'ember-debug/deprecate': ['deprecate'],
'ember-debug': ['assert', 'debug', 'deprecate', 'info', 'runInDebug', 'warn', 'debugSeal', 'debugFreeze']
}
]);
options.plugins.push(['minify-dead-code-elimination', { 'optimizeRawSize': true }]);
}

delete options.environment;
Expand Down
1 change: 0 additions & 1 deletion broccoli/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const path = require('path');
module.exports.VERSION = (() => {
let info = getGitInfo(path.resolve(__dirname, '..'));
if (info.tag) {
console.log('herr');
return info.tag.replace(/^v/, '');
}

Expand Down
20 changes: 18 additions & 2 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,24 @@ const SHOULD_ROLLUP = true;

module.exports = function(options) {
let tokenizer = simpleHTMLTokenizerES();
let container = emberPkgES('container', SHOULD_ROLLUP, ['ember-debug', 'ember-utils', 'ember-environment']);
let emberMetal = emberPkgES('ember-metal', SHOULD_ROLLUP, ['ember-debug', 'ember-environment', 'ember-utils', '@glimmer/reference', 'require', 'backburner', 'ember-console']);
let container = emberPkgES('container', SHOULD_ROLLUP, [
'ember-debug',
'ember-utils',
'ember-environment',
'ember-env-flags',
'ember/features'
]);
let emberMetal = emberPkgES('ember-metal', SHOULD_ROLLUP, [
'ember-debug',
'ember-environment',
'ember-utils',
'@glimmer/reference',
'require',
'backburner',
'ember-console',
'ember-env-flags',
'ember/features'
]);
let emberEnvironment = emberPkgES('ember-environment', SHOULD_ROLLUP);
let emberConsole = emberPkgES('ember-console', SHOULD_ROLLUP, ['ember-environment']);
let emberMain = emberPkgES('ember');
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@
"devDependencies": {
"aws-sdk": "~2.2.43",
"babel-plugin-check-es2015-constants": "^6.22.0",
"babel-plugin-debug-macros": "^0.0.6",
"babel-plugin-feature-flags": "^0.3.1",
"babel-plugin-filter-imports": "^0.3.1",
"babel-plugin-minify-dead-code-elimination": "^0.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoping": "^6.23.0",
"babel-plugin-transform-es2015-classes": "^6.23.0",
Expand Down
Loading