Skip to content

Commit

Permalink
WIP: test the static-app with Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlafroscia committed Apr 14, 2021
1 parent 8f873e1 commit 974181d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
19 changes: 17 additions & 2 deletions test-packages/static-app/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,24 @@ module.exports = function (defaults) {
return app.toTree();
}

const Webpack = require('@embroider/webpack').Webpack;
return require('@embroider/compat').compatBuild(app, Webpack, {
let packager;

if (process.env.PACKAGER === 'webpack') {
packager = require('@embroider/webpack').Webpack;
} else if (process.env.PACKAGER === 'vite') {
packager = require('@embroider/vite').Vite;
} else if (process.env.PACKAGER) {
throw new Error(`$PACKAGER ${process.env.PACKAGER} not recognised`);
} else {
throw new Error(`$PACKAGER is missing`);
}

return require('@embroider/compat').compatBuild(app, packager, {
workspaceDir: process.env.WORKSPACE_DIR,
viteConfig: {
sourcemap: 'inline',
logLevel: 'info',
},
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticComponents: true,
Expand Down
10 changes: 7 additions & 3 deletions test-packages/static-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
"lint:js": "eslint .",
"start": "ember serve",
"test": "npm-run-all lint:* test:*",
"test:ember": "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"
"test:webpack": "cross-env PACKAGER=webpack ember test --test-port=0",
"test:webpack-custom-root": "cross-env PACKAGER=webpack CUSTOM_ROOT_URL=/custom/ ember test --test-port=0",
"test:webpack-custom-relative-root": "cross-env PACKAGER=webpack CUSTOM_ROOT_URL=custom-relative-root-url/ ember test --test-port=0",
"test:vite": "cross-env PACKAGER=vite ember test --test-port=0",
"test:vite-custom-root": "cross-env PACKAGER=vite CUSTOM_ROOT_URL=/custom/ ember test --test-port=0",
"test:vite-custom-relative-root": "cross-env PACKAGER=vite CUSTOM_ROOT_URL=custom-relative-root-url/ ember test --test-port=0"
},
"devDependencies": {
"@ember/jquery": "^0.5.2",
Expand All @@ -29,6 +32,7 @@
"@embroider/core": "0.39.1",
"@embroider/macros": "0.39.1",
"@embroider/test-support": "0.36.0",
"@embroider/vite": "0.39.1",
"@embroider/webpack": "0.39.1",
"broccoli-asset-rev": "^3.0.0",
"ember-ajax": "^5.0.0",
Expand Down

0 comments on commit 974181d

Please sign in to comment.