diff --git a/package.json b/package.json index 98abbd163..3be626aa1 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "@types/jest": "^24.0.11", "@typescript-eslint/eslint-plugin": "^4.1.1", "@typescript-eslint/parser": "^4.1.1", + "cross-env": "^7.0.3", "eslint": "^7.14.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-import": "^2.22.0", diff --git a/packages/compat/src/detect-babel-plugins.ts b/packages/compat/src/detect-babel-plugins.ts index de78c4647..4e596811a 100644 --- a/packages/compat/src/detect-babel-plugins.ts +++ b/packages/compat/src/detect-babel-plugins.ts @@ -1,4 +1,5 @@ import { PluginItem } from '@babel/core'; +import { join, sep } from 'path'; export function isEmberAutoImportDynamic(item: PluginItem): boolean { let pluginPath: string; @@ -9,7 +10,8 @@ export function isEmberAutoImportDynamic(item: PluginItem): boolean { } else { return false; } - return /(^|\/)ember-auto-import\//.test(pluginPath); + + return pluginPath.includes(join(sep, 'ember-auto-import', sep)); } export function isCompactReexports(item: PluginItem): boolean { @@ -21,7 +23,8 @@ export function isCompactReexports(item: PluginItem): boolean { } else { return false; } - return /(^|\/)babel-plugin-compact-reexports\//.test(pluginPath); + + return pluginPath.includes(join('babel-plugin-compact-reexports', sep)); } export function isColocationPlugin(item: PluginItem): boolean { @@ -33,5 +36,6 @@ export function isColocationPlugin(item: PluginItem): boolean { } else { return false; } - return /(^|\/)ember-cli-htmlbars\/lib\/colocated-babel-plugin/.test(pluginPath); + + return pluginPath.includes(join('ember-cli-htmlbars', 'lib', 'colocated-babel-plugin', sep)); } diff --git a/packages/compat/src/v1-app.ts b/packages/compat/src/v1-app.ts index 74005622d..2b815c96f 100644 --- a/packages/compat/src/v1-app.ts +++ b/packages/compat/src/v1-app.ts @@ -1,6 +1,6 @@ import { Memoize } from 'typescript-memoize'; import { sync as pkgUpSync } from 'pkg-up'; -import { join, dirname } from 'path'; +import { join, dirname, isAbsolute } from 'path'; import Funnel from 'broccoli-funnel'; import mergeTrees from 'broccoli-merge-trees'; import { WatchedDir } from 'broccoli-source'; @@ -532,7 +532,7 @@ export default class V1App { } // non node assets are local paths. They need an explicit `/` or `.` at // the start. - if (asset.startsWith('/') || asset.startsWith('.')) { + if (asset.startsWith('.') || isAbsolute(asset)) { return asset; } return './' + asset; diff --git a/packages/router/package.json b/packages/router/package.json index a3166d9ec..d1baaebf9 100644 --- a/packages/router/package.json +++ b/packages/router/package.json @@ -25,7 +25,7 @@ "test": "npm-run-all lint:* test:*", "test:all": "ember try:each", "test:ember": "ember test --test-port=0", - "test:classic": "CLASSIC=true ember test --test-port=0" + "test:classic": "cross-env CLASSIC=true ember test --test-port=0" }, "dependencies": { "@embroider/macros": "0.39.1", @@ -40,6 +40,7 @@ "@types/ember__routing": "^3.16.9", "babel-eslint": "^10.1.0", "broccoli-asset-rev": "^3.0.0", + "cross-env": "^7.0.3", "ember-cli": "~3.10.1", "ember-cli-dependency-checker": "^3.1.0", "ember-cli-eslint": "^5.1.0", diff --git a/packages/util/package.json b/packages/util/package.json index 922f90856..b8a76624d 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -23,8 +23,8 @@ "lint:js:fix": "eslint . --fix", "start": "ember serve", "test": "npm-run-all lint test:*", - "test:ember": "EMBROIDER_TEST_SETUP_FORCE=embroider EMBROIDER_TEST_SETUP_OPTIONS=optimized ember test --test-port=0", - "test:classic": "EMBROIDER_TEST_SETUP_FORCE=classic ember test --test-port=0", + "test:ember": "cross-env EMBROIDER_TEST_SETUP_FORCE=embroider EMBROIDER_TEST_SETUP_OPTIONS=optimized ember test --test-port=0", + "test:classic": "cross-env EMBROIDER_TEST_SETUP_FORCE=classic ember test --test-port=0", "test:ember-compatibility": "ember try:each" }, "dependencies": { @@ -46,6 +46,7 @@ "@typescript-eslint/parser": "^4.1.1", "babel-eslint": "^10.1.0", "broccoli-asset-rev": "^3.0.0", + "cross-env": "^7.0.3", "ember-auto-import": "^1.10.1", "ember-cli": "~3.25.2", "ember-cli-dependency-checker": "^3.2.0", diff --git a/packages/webpack/src/ember-webpack.ts b/packages/webpack/src/ember-webpack.ts index 0d48bf491..2922896d3 100644 --- a/packages/webpack/src/ember-webpack.ts +++ b/packages/webpack/src/ember-webpack.ts @@ -141,6 +141,7 @@ const Webpack: Packager = class Webpack implements PackagerInstance { hints: false, }, plugins: [ + //@ts-ignore new MiniCssExtractPlugin({ filename: `chunk.[chunkhash].css`, chunkFilename: `chunk.[chunkhash].css`, diff --git a/test-packages/engines-host-app/fastboot-tests/util.js b/test-packages/engines-host-app/fastboot-tests/util.js index 73e3ff924..254a132e3 100644 --- a/test-packages/engines-host-app/fastboot-tests/util.js +++ b/test-packages/engines-host-app/fastboot-tests/util.js @@ -22,9 +22,9 @@ module.exports = function setup(hooks) { return dom.window.document; } - hooks.before(async function(assert) { + hooks.before(async function (assert) { if (!process.env.REUSE_FASTBOOT_BUILD) { - execFileSync('node', ['./node_modules/.bin/ember', 'build']); + execFileSync('node', ['../../node_modules/ember-cli/bin/ember', 'build']); process.env.REUSE_FASTBOOT_BUILD = 'true'; } fastboot = new FastBoot({ @@ -33,7 +33,7 @@ module.exports = function setup(hooks) { }); this.visit = visit.bind(this, assert); }); - hooks.beforeEach(function(assert) { + hooks.beforeEach(function (assert) { this.visit = visit.bind(this, assert); }); }; diff --git a/test-packages/engines-host-app/package.json b/test-packages/engines-host-app/package.json index b43fc663d..f0298198d 100644 --- a/test-packages/engines-host-app/package.json +++ b/test-packages/engines-host-app/package.json @@ -18,9 +18,9 @@ "start": "ember serve", "test": "npm-run-all lint:* test:*", "test:ember": "ember test --test-port=0", - "test:ember-classic": "CLASSIC=true ember test --test-port=0", + "test:ember-classic": "cross-env CLASSIC=true ember test --test-port=0", "test:fastboot": "qunit fastboot-tests", - "test:fastboot-classic": "CLASSIC=true qunit fastboot-tests" + "test:fastboot-classic": "cross-env CLASSIC=true qunit fastboot-tests" }, "devDependencies": { "@ember/jquery": "^0.6.0", diff --git a/test-packages/fastboot-app/fastboot-tests/util.js b/test-packages/fastboot-app/fastboot-tests/util.js index fa6a6e79d..0e430ee70 100644 --- a/test-packages/fastboot-app/fastboot-tests/util.js +++ b/test-packages/fastboot-app/fastboot-tests/util.js @@ -22,9 +22,9 @@ module.exports = function setup(hooks, buildArgs = []) { return dom.window.document; } - hooks.before(async function(assert) { + hooks.before(async function (assert) { if (!process.env.REUSE_FASTBOOT_BUILD) { - execFileSync('node', ['./node_modules/.bin/ember', 'build', ...buildArgs]); + execFileSync('node', ['../../node_modules/ember-cli/bin/ember', 'build', ...buildArgs]); process.env.REUSE_FASTBOOT_BUILD = 'true'; } fastboot = new FastBoot({ @@ -33,7 +33,7 @@ module.exports = function setup(hooks, buildArgs = []) { }); this.visit = visit.bind(this, assert); }); - hooks.beforeEach(function(assert) { + hooks.beforeEach(function (assert) { this.visit = visit.bind(this, assert); }); }; diff --git a/test-packages/fastboot-app/package.json b/test-packages/fastboot-app/package.json index 414d48cc6..53c7863ee 100644 --- a/test-packages/fastboot-app/package.json +++ b/test-packages/fastboot-app/package.json @@ -18,11 +18,11 @@ "start": "ember serve", "test": "npm-run-all lint:* test:*", "test:ember": "ember test --test-port=0", - "test:ember-classic": "CLASSIC=true ember test --test-port=0", + "test:ember-classic": "cross-env CLASSIC=true ember test --test-port=0", "test:ember-production": "ember test --test-port=0 --environment=production", "test:fastboot": "qunit fastboot-tests", - "test:fastboot-production": "FASTBOOT_APP_PROD=true qunit fastboot-tests", - "test:fastboot-classic": "CLASSIC=true FASTBOOT_APP_PROD=true qunit fastboot-tests" + "test:fastboot-production": "cross-env FASTBOOT_APP_PROD=true qunit fastboot-tests", + "test:fastboot-classic": "cross-env CLASSIC=true FASTBOOT_APP_PROD=true qunit fastboot-tests" }, "devDependencies": { "@ember/optional-features": "^1.3.0", diff --git a/test-packages/macro-sample-addon/package.json b/test-packages/macro-sample-addon/package.json index 51d4bd10b..9cb910530 100644 --- a/test-packages/macro-sample-addon/package.json +++ b/test-packages/macro-sample-addon/package.json @@ -21,7 +21,7 @@ "test": "npm-run-all lint:* test:*", "test:all": "ember try:each", "test:ember": "ember test --test-port=0", - "test:classic:": "CLASSIC=true ember test --test-port=0" + "test:classic:": "cross-env CLASSIC=true ember test --test-port=0" }, "dependencies": { "@embroider/macros": "0.39.1", diff --git a/test-packages/macro-tests/package.json b/test-packages/macro-tests/package.json index fecc8ab04..c0aa06e4b 100644 --- a/test-packages/macro-tests/package.json +++ b/test-packages/macro-tests/package.json @@ -18,7 +18,7 @@ "start": "ember serve", "test": "npm-run-all lint:* test:*", "test:ember": "ember test --test-port=0", - "test:ember-classic": "CLASSIC=true ember test --test-port=0" + "test:ember-classic": "cross-env CLASSIC=true ember test --test-port=0" }, "devDependencies": { "@ember/jquery": "^0.6.0", diff --git a/test-packages/static-app/package.json b/test-packages/static-app/package.json index fdee4984e..82af92cab 100644 --- a/test-packages/static-app/package.json +++ b/test-packages/static-app/package.json @@ -18,9 +18,9 @@ "start": "ember serve", "test": "npm-run-all lint:* test:*", "test:ember": "ember test --test-port=0", - "test:ember-classic": "CLASSIC=true ember test --test-port=0", - "test:custom-root": "CUSTOM_ROOT_URL=/custom/ ember test --test-port=0", - "test:custom-relative-root": "CUSTOM_ROOT_URL=custom-relative-root-url/ ember test --test-port=0" + "test:ember-classic": "cross-env CLASSIC=true ember test --test-port=0", + "test:custom-root": "cross-env CUSTOM_ROOT_URL=/custom/ ember test --test-port=0", + "test:custom-relative-root": "cross-env CUSTOM_ROOT_URL=custom-relative-root-url/ ember test --test-port=0" }, "devDependencies": { "@ember/jquery": "^0.5.2", diff --git a/yarn.lock b/yarn.lock index 537f4ef64..9ff2c5825 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6115,6 +6115,13 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" +cross-env@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" + integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== + dependencies: + cross-spawn "^7.0.1" + cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -6126,7 +6133,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==