Skip to content

Commit

Permalink
Merge pull request #233 from thoov/embroider-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue authored Feb 9, 2021
2 parents 4955523 + a978a37 commit dd12d6d
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 42 deletions.
42 changes: 15 additions & 27 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,27 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 10.x
- name: install dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: lint
run: yarn lint
- name: test
run: yarn test:ember
- name: test node
run: yarn test:node
- uses: volta-cli/action@v1
- run: yarn install --frozen-lockfile
- run: yarn lint
- run: yarn test:ember
- run: yarn test:node

floating-dependencies:
name: Floating dependencies
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 10.x
- name: install dependencies
run: yarn install --no-lockfile --non-interactive
- name: test
run: yarn test:ember-compatibility
- uses: volta-cli/action@v1
- run: yarn install --no-lockfile
- run: yarn test:ember
- run: yarn test:node

try-scenarios:
name: ${{ matrix.ember-try-scenario }}

timeout-minutes: 15
runs-on: ubuntu-latest

needs: test

strategy:
Expand All @@ -62,13 +52,11 @@ jobs:
- ember-canary
- ember-default-with-jquery
- ember-classic
- embroider-safe
- embroider-optimized

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 10.x
- name: install dependencies
run: yarn install
- name: test
run: node_modules/.bin/ember try:one ${{ matrix.ember-try-scenario }}
- uses: volta-cli/action@v1
- run: yarn install --frozen-lockfile
- run: node_modules/.bin/ember try:one ${{ matrix.ember-try-scenario }}
3 changes: 3 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const getChannelURL = require('ember-source-channel-url');
const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');

module.exports = async function () {
return {
Expand Down Expand Up @@ -110,6 +111,8 @@ module.exports = async function () {
},
},
},
embroiderSafe(),
embroiderOptimized(),
],
};
};
7 changes: 5 additions & 2 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function (defaults) {
const self = defaults.project.findAddonByName('ember-a11y-testing');
const autoImport = self.options.autoImport;
let app = new EmberAddon(defaults, {
// Add options here
autoImport,
});

/*
Expand All @@ -14,5 +16,6 @@ module.exports = function (defaults) {
behave. You most likely want to be modifying `./index.js` or app's build file
*/

return app.toTree();
const { maybeEmbroider } = require('@embroider/test-setup');
return maybeEmbroider(app);
};
22 changes: 22 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const path = require('path');
const fs = require('fs');
const Funnel = require('broccoli-funnel');
const MergeTrees = require('broccoli-merge-trees');
const VersionChecker = require('ember-cli-version-checker');
const validatePeerDependencies = require('validate-peer-dependencies');
const setupMiddleware = require('./setup-middleware');

Expand All @@ -16,9 +17,30 @@ module.exports = {
init() {
this._super.init.apply(this, arguments);

let versionChecker = new VersionChecker(this.project);

validatePeerDependencies(__dirname, {
resolvePeerDependenciesFrom: this.parent.root,
});

const hasMagicallyProvidedQUnit = versionChecker
.for('ember-qunit')
.lt('5.0.0-beta.1');

// Ember-qunit < 5 provides an AMD shim for qunit but newer version now use
// ember-auto-import to include qunit. This means that qunit is no
// longer available for addons (if the parent app is using ember-qunit > 5) to
// directly import under embroider unless they are using ember-auto-import
// themselves. This condidionally falls back to not using ember-auto-import
// when the parent app is providing qunit because without this we would double
// include qunit resulting in a runtime error (qunit detects if it as
// already be added to the window object and errors if so).
if (hasMagicallyProvidedQUnit) {
this.options = this.options || {};
this.options.autoImport = {
exclude: ['qunit'],
};
}
},

/**
Expand Down
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@
"broccoli-funnel": "^3.0.3",
"broccoli-merge-trees": "^4.2.0",
"date-and-time": "^0.14.1",
"ember-auto-import": "^1.10.1",
"ember-cli-babel": "^7.21.0",
"ember-cli-typescript": "^3.0.0",
"ember-cli-version-checker": "^5.1.2",
"ember-destroyable-polyfill": "^2.0.1",
"fs-extra": "^9.0.1",
"validate-peer-dependencies": "^1.1.0"
Expand All @@ -45,6 +47,7 @@
"@ember/jquery": "^1.1.0",
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.1.0",
"@embroider/test-setup": "^0.36.0",
"@glimmer/component": "^1.0.1",
"@glimmer/tracking": "^1.0.1",
"@types/ember": "^3.16.0",
Expand Down Expand Up @@ -97,7 +100,13 @@
"typescript": "^4.0.0"
},
"peerDependencies": {
"@ember/test-helpers": "^2.0.0"
"@ember/test-helpers": "^2.0.0",
"qunit": ">= 2"
},
"peerDependenciesMeta": {
"qunit": {
"optional": true
}
},
"engines": {
"node": "10.* || >= 12"
Expand Down Expand Up @@ -151,5 +160,9 @@
"Eric Kelly <[email protected]>",
"Sam Selikoff <[email protected]>",
"Renato Iwashima <[email protected]>"
]
],
"volta": {
"node": "12.20.1",
"yarn": "1.22.10"
}
}
7 changes: 0 additions & 7 deletions tests/dummy/config/targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ const browsers = [
'last 1 Safari versions',
];

const isCI = Boolean(process.env.CI);
const isProduction = process.env.EMBER_ENV === 'production';

if (isCI || isProduction) {
browsers.push('ie 11');
}

module.exports = {
browsers,
};
25 changes: 21 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,14 @@
resolve "^1.8.1"
semver "^7.3.2"

"@embroider/test-setup@^0.36.0":
version "0.36.0"
resolved "https://registry.yarnpkg.com/@embroider/test-setup/-/test-setup-0.36.0.tgz#67ace15d69f04f282adde38ee39e4d48208173b7"
integrity sha512-YXa1uPBc5caxuS9hIOLi6TihJ9QFgS9uvlXFOADFL3yDUOuvnGWAoK9a4qHsIuH/ifGJs8xIYhByhlfruB02mw==
dependencies:
lodash "^4.17.20"
resolve "^1.17.0"

"@glimmer/component@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@glimmer/component/-/component-1.0.1.tgz#f304b2f9cf4f2762396abed2b8962486767e0b2e"
Expand Down Expand Up @@ -6038,9 +6046,9 @@ electron-to-chromium@^1.3.47, electron-to-chromium@^1.3.523:
integrity sha512-rM0LWDIstdqfaRUADZetNrL6+zd/0NBmavbMEhBXgc2u/CC1d1GaDyN5hho29fFvBiOVFwrSWZkzmNcZnCEDog==

electron-to-chromium@^1.3.649:
version "1.3.654"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.654.tgz#f1b82d59bdeafa65af75794356df54f92b41c4de"
integrity sha512-Zy2gc/c8KYFg2GkNr7Ruzh5tPEZpFm7EyXqZTFasm1YRDJtpyBRGaOuM0H3t6SuIP53qX4kNmtO9t0WjhBjE9A==
version "1.3.653"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.653.tgz#1d98400eba330538a7fe169808c6bf9d83c44450"
integrity sha512-LehOhcl74u9fkV9Un6WahJ+Xh+0FZLCCDnKYis1Olx1DX2ugRww5PJicE65OG8yznMj8EOQZRcz6FSV1xKxqsA==

elliptic@^6.5.3:
version "6.5.3"
Expand All @@ -6055,7 +6063,7 @@ elliptic@^6.5.3:
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.0"

ember-auto-import@^1.10.0, ember-auto-import@^1.7.0:
ember-auto-import@^1.10.0, ember-auto-import@^1.10.1, ember-auto-import@^1.7.0:
version "1.10.1"
resolved "https://registry.yarnpkg.com/ember-auto-import/-/ember-auto-import-1.10.1.tgz#6c93a875e494aa0a58b759867d3f20adfd514ae3"
integrity sha512-7bOWzPELlVwdWDOkB+phDIjg8BNW+/2RiLLQ+Xa/eIvCLT4ABYhHV5wqW5gs5BnXTDVLfE4ddKZdllnGuPGGDQ==
Expand Down Expand Up @@ -6461,6 +6469,15 @@ ember-cli-version-checker@^5.1.1:
semver "^7.3.2"
silent-error "^1.1.1"

ember-cli-version-checker@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/ember-cli-version-checker/-/ember-cli-version-checker-5.1.2.tgz#649c7b6404902e3b3d69c396e054cea964911ab0"
integrity sha512-rk7GY+FmLn/2e22HsZs0Ycrz8HQ1W3Fv+2TFOuEFW9optnDXDgkntPBIl6gact/LHsfBM5RKbM3dHsIIeLgl0Q==
dependencies:
resolve-package-path "^3.1.0"
semver "^7.3.4"
silent-error "^1.1.1"

ember-cli@^3.20.0:
version "3.20.0"
resolved "https://registry.yarnpkg.com/ember-cli/-/ember-cli-3.20.0.tgz#729c62ce0cb2804237155886619acc54c77255dc"
Expand Down

0 comments on commit dd12d6d

Please sign in to comment.