From 4beb2af5e3ecbff77ffcc64c0c1a35552dfb4857 Mon Sep 17 00:00:00 2001 From: 0xADADA <0xadada.pub@0xadada.pub> Date: Sat, 3 Feb 2018 17:12:28 -0500 Subject: [PATCH] Better Workaround for prod build error Workaround for https://github.com/ember-cli/ember-cli-uglify/issues/35 --- config/targets.js | 21 ++++++++++++++++++--- ember-cli-build.js | 6 ------ package.json | 3 ++- tests/acceptance/media/new-test.js | 9 ++++++--- yarn.lock | 18 +++++++++--------- 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/config/targets.js b/config/targets.js index 426ccad..2a67151 100644 --- a/config/targets.js +++ b/config/targets.js @@ -1,7 +1,22 @@ -module.exports = { - browsers: [ +/* + * compilation via Browserlist + * https://github.com/ai/browserslist + * tooling: http://browserl.ist/ + */ + +let browsers; +if (process.env.EMBER_ENV === 'development') { + // development performance optimization: transpile for developers browsers + browsers = ['last 1 Chrome versions', 'last 1 Firefox versions']; +} else { + browsers = [ + // '> 0.5%' /* http://browserl.ist/?q=%3E+0.5%25 */ 'last 1 Chrome versions', 'last 1 Firefox versions', 'last 1 Safari versions' - ] + ]; +} + +module.exports = { + browsers }; diff --git a/ember-cli-build.js b/ember-cli-build.js index 6ac98c1..9e8dbf7 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -12,12 +12,6 @@ module.exports = function(defaults) { extensions: ['css', 'gif', 'js', 'jpg', 'png', 'map', 'svg'] }, - 'ember-cli-uglify': { - uglify: { - compress: false /* TODO: workaround for https://github.com/ember-cli/ember-cli-uglify/issues/35 */ - } - }, - inlineContent: { host: { content: HOST diff --git a/package.json b/package.json index f520fa2..3b38a41 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,7 @@ "node-fetch" ], "resolutions": { - "ember-simple-auth": "0xadada/ember-simple-auth#13a8a1d461fdac769f566b41beda61972118c2b4" + "ember-simple-auth": "0xadada/ember-simple-auth#13a8a1d461fdac769f566b41beda61972118c2b4", + "broccoli-uglify-sourcemap": "0xadada/broccoli-uglify-sourcemap#update-deps" } } diff --git a/tests/acceptance/media/new-test.js b/tests/acceptance/media/new-test.js index e9588c0..d0aa92b 100644 --- a/tests/acceptance/media/new-test.js +++ b/tests/acceptance/media/new-test.js @@ -51,6 +51,7 @@ module('Application | media/new', function(hooks) { }); test('can add and delete valid media', async function(assert) { + server.logging = true; assert.expect(3); // create an OAuth token w/ ember-cli-mirage await visit('/media/new'); @@ -58,13 +59,15 @@ module('Application | media/new', function(hooks) { await fillIn('[name=url]', 'http://t.co'); await click('button'); assert.equal(currentURL(), '/', 'user lands on home route'); - let expected = this.element.querySelector('.ma-MediaListItem').length; + let expected = this.element.querySelectorAll('.ma-MediaListItem').length; let msg = this.element.querySelector('.container').textContent; assert.notEqual(msg.match(/asdf title/), null); // delete new media await click('.ma-MediaListItem .ma-MediaListItem-delete'); - let result = this.element.querySelector('.ma-MediaListItem').length; - assert.equal(result, expected, 'media was deleted'); + let result = this.element.querySelectorAll('.ma-MediaListItem') + ? this.element.querySelectorAll('.ma-MediaListItem').length + : 0; + assert.equal(result, expected - 1, 'media was deleted'); }); test('ma-create-media can gracefully handle errors', async function(assert) { diff --git a/yarn.lock b/yarn.lock index 8fa3a54..00e8ad3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1904,9 +1904,9 @@ broccoli-templater@^1.0.0: broccoli-stew "^1.2.0" lodash.template "^3.3.2" -broccoli-uglify-sourcemap@^2.0.0: +broccoli-uglify-sourcemap@0xadada/broccoli-uglify-sourcemap#update-deps, broccoli-uglify-sourcemap@^2.0.0: version "2.0.2" - resolved "https://registry.yarnpkg.com/broccoli-uglify-sourcemap/-/broccoli-uglify-sourcemap-2.0.2.tgz#f4a73112f1f56b46043e2e89cba5ce7762cddeb3" + resolved "https://codeload.github.com/0xadada/broccoli-uglify-sourcemap/tar.gz/ae34496fe34c208cec15d00bca8389a356d2ebf4" dependencies: broccoli-plugin "^1.2.1" debug "^3.1.0" @@ -1915,7 +1915,7 @@ broccoli-uglify-sourcemap@^2.0.0: mkdirp "^0.5.0" source-map-url "^0.4.0" symlink-or-copy "^1.0.1" - uglify-es "^3.1.3" + uglify-es "^3.1.9" walk-sync "^0.3.2" broccoli-unwatched-tree@^0.1.1: @@ -2338,7 +2338,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@2.12.2, commander@~2.12.1: +commander@2.12.2: version "2.12.2" resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555" @@ -2348,7 +2348,7 @@ commander@2.8.x: dependencies: graceful-readlink ">= 1.0.0" -commander@^2.5.0, commander@^2.6.0, commander@^2.9.0: +commander@^2.5.0, commander@^2.6.0, commander@^2.9.0, commander@~2.13.0: version "2.13.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" @@ -9376,11 +9376,11 @@ uc.micro@^1.0.1, uc.micro@^1.0.3: version "1.0.5" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.5.tgz#0c65f15f815aa08b560a61ce8b4db7ffc3f45376" -uglify-es@^3.1.3: - version "3.3.5" - resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.5.tgz#cf7e695da81999f85196b15e2978862f13212f88" +uglify-es@^3.1.9: + version "3.3.9" + resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677" dependencies: - commander "~2.12.1" + commander "~2.13.0" source-map "~0.6.1" uglify-js@^2.6: