From 779811459187271fedc6571b6cf63b9be1999fa6 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Thu, 11 Jan 2018 11:31:49 -0500 Subject: [PATCH] Make async/await work nicely. This change does a few things: * Add `ember-maybe-import-regenerator` to the default blueprint. * Drop IE9 from `config/targets.js`, and replace with IE11 (to match Ember 3.0.0's minimum browser requirements). * Modify `config/targets.js` to make development builds target modern browsers. This essentially brings over the configuration discussed in [this blog post](http://rwjblue.com/2017/10/30/async-await-configuration-adventure/): * [Section 30](http://rwjblue.com/2017/10/30/async-await-configuration-adventure/#install-maybe-install-regenerator) * [Section 10](http://rwjblue.com/2017/10/30/async-await-configuration-adventure/#limit-targets-locally) --- blueprints/app/files/config/targets.js | 20 +++++++++++++------ blueprints/app/files/package.json | 1 + .../module-unification-app/files/package.json | 1 + tests/fixtures/addon/npm/package.json | 1 + tests/fixtures/addon/yarn/package.json | 1 + tests/fixtures/app/npm/package.json | 1 + tests/fixtures/app/yarn/package.json | 1 + .../module-unification-app/npm/package.json | 1 + .../module-unification-app/yarn/package.json | 1 + 9 files changed, 22 insertions(+), 6 deletions(-) diff --git a/blueprints/app/files/config/targets.js b/blueprints/app/files/config/targets.js index 082e68b51f..f8936a5437 100644 --- a/blueprints/app/files/config/targets.js +++ b/blueprints/app/files/config/targets.js @@ -1,8 +1,16 @@ +const browsers = [ + 'last 1 Chrome versions', + 'last 1 Firefox versions', + 'last 1 Safari versions' +]; + +const isCI = !!process.env.CI; +const isProduction = process.env.EMBER_ENV === 'production'; + +if (isCI || isProduction) { + browsers.push('ie 11'); +} + module.exports = { - browsers: [ - 'ie 9', - 'last 1 Chrome versions', - 'last 1 Firefox versions', - 'last 1 Safari versions' - ] + browsers }; diff --git a/blueprints/app/files/package.json b/blueprints/app/files/package.json index ea0aa46f02..4d60e5556a 100644 --- a/blueprints/app/files/package.json +++ b/blueprints/app/files/package.json @@ -34,6 +34,7 @@ "ember-data": "~3.0.0-beta.1", "ember-export-application-global": "^2.0.0", "ember-load-initializers": "^1.0.0", + "ember-maybe-import-regenerator": "^0.1.6", "ember-resolver": "^4.0.0", "ember-source": "~3.0.0-beta.1<% if (welcome) { %>", "ember-welcome-page": "^3.0.0<% } %>", diff --git a/blueprints/module-unification-app/files/package.json b/blueprints/module-unification-app/files/package.json index 5598b07df3..31e70ecb1a 100644 --- a/blueprints/module-unification-app/files/package.json +++ b/blueprints/module-unification-app/files/package.json @@ -34,6 +34,7 @@ "ember-data": "~2.18.0-beta.1", "ember-export-application-global": "^2.0.0", "ember-load-initializers": "^1.0.0", + "ember-maybe-import-regenerator": "^0.1.6", "ember-resolver": "^4.0.0<% if (welcome) { %>", "ember-welcome-page": "^3.0.0<% } %>", "eslint-plugin-ember": "^5.0.0", diff --git a/tests/fixtures/addon/npm/package.json b/tests/fixtures/addon/npm/package.json index 9bf8480aa4..7a1c44eab0 100644 --- a/tests/fixtures/addon/npm/package.json +++ b/tests/fixtures/addon/npm/package.json @@ -37,6 +37,7 @@ "ember-disable-prototype-extensions": "^1.1.2", "ember-export-application-global": "^2.0.0", "ember-load-initializers": "^1.0.0", + "ember-maybe-import-regenerator": "^0.1.6", "ember-resolver": "^4.0.0", "ember-source": "~3.0.0-beta.1", "eslint-plugin-ember": "^5.0.0", diff --git a/tests/fixtures/addon/yarn/package.json b/tests/fixtures/addon/yarn/package.json index f8a1099b5f..ca3a25f403 100644 --- a/tests/fixtures/addon/yarn/package.json +++ b/tests/fixtures/addon/yarn/package.json @@ -37,6 +37,7 @@ "ember-disable-prototype-extensions": "^1.1.2", "ember-export-application-global": "^2.0.0", "ember-load-initializers": "^1.0.0", + "ember-maybe-import-regenerator": "^0.1.6", "ember-resolver": "^4.0.0", "ember-source": "~3.0.0-beta.1", "ember-welcome-page": "^3.0.0", diff --git a/tests/fixtures/app/npm/package.json b/tests/fixtures/app/npm/package.json index 67c5b42752..05e5e526d7 100644 --- a/tests/fixtures/app/npm/package.json +++ b/tests/fixtures/app/npm/package.json @@ -34,6 +34,7 @@ "ember-data": "~3.0.0-beta.1", "ember-export-application-global": "^2.0.0", "ember-load-initializers": "^1.0.0", + "ember-maybe-import-regenerator": "^0.1.6", "ember-resolver": "^4.0.0", "ember-source": "~3.0.0-beta.1", "eslint-plugin-ember": "^5.0.0", diff --git a/tests/fixtures/app/yarn/package.json b/tests/fixtures/app/yarn/package.json index a5f729e27f..c6a8696308 100644 --- a/tests/fixtures/app/yarn/package.json +++ b/tests/fixtures/app/yarn/package.json @@ -34,6 +34,7 @@ "ember-data": "~3.0.0-beta.1", "ember-export-application-global": "^2.0.0", "ember-load-initializers": "^1.0.0", + "ember-maybe-import-regenerator": "^0.1.6", "ember-resolver": "^4.0.0", "ember-source": "~3.0.0-beta.1", "ember-welcome-page": "^3.0.0", diff --git a/tests/fixtures/module-unification-app/npm/package.json b/tests/fixtures/module-unification-app/npm/package.json index 1d31fa7bab..6aa314bfc1 100644 --- a/tests/fixtures/module-unification-app/npm/package.json +++ b/tests/fixtures/module-unification-app/npm/package.json @@ -34,6 +34,7 @@ "ember-data": "~2.18.0-beta.1", "ember-export-application-global": "^2.0.0", "ember-load-initializers": "^1.0.0", + "ember-maybe-import-regenerator": "^0.1.6", "ember-resolver": "^4.0.0", "eslint-plugin-ember": "^5.0.0", "loader.js": "^4.2.3" diff --git a/tests/fixtures/module-unification-app/yarn/package.json b/tests/fixtures/module-unification-app/yarn/package.json index 7706c5917d..ad70b47f8d 100644 --- a/tests/fixtures/module-unification-app/yarn/package.json +++ b/tests/fixtures/module-unification-app/yarn/package.json @@ -34,6 +34,7 @@ "ember-data": "~2.18.0-beta.1", "ember-export-application-global": "^2.0.0", "ember-load-initializers": "^1.0.0", + "ember-maybe-import-regenerator": "^0.1.6", "ember-resolver": "^4.0.0", "ember-welcome-page": "^3.0.0", "eslint-plugin-ember": "^5.0.0",