Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e3a85e1
Add `--minimal` and `--no-compat`
NullVoxPopuli Jul 1, 2025
7c6909b
Remove classicEmberSupport
NullVoxPopuli Dec 9, 2025
e4d122f
Update lint ignores
NullVoxPopuli Dec 9, 2025
b43790c
Update babel configs
NullVoxPopuli Dec 9, 2025
66f8065
Update the HTMLs
NullVoxPopuli Dec 9, 2025
e56bceb
Update app.ts
NullVoxPopuli Dec 9, 2025
c02501a
Update the environment.ts
NullVoxPopuli Dec 9, 2025
957318d
Update app -- wow so messy
NullVoxPopuli Dec 9, 2025
0ce0641
Update package
NullVoxPopuli Dec 9, 2025
bfb8c45
Use conditional-files to clean up the no-compat variance
NullVoxPopuli Dec 9, 2025
35684ef
ope
NullVoxPopuli Dec 9, 2025
5d34dde
progress
NullVoxPopuli Dec 9, 2025
3a4d9da
Upgrade ember-cli
NullVoxPopuli Dec 18, 2025
301cbee
Update watchman usage
NullVoxPopuli Dec 18, 2025
787a9b5
Fix tests
NullVoxPopuli Dec 19, 2025
06a1e4d
Split minimal from no-compat tests, since minimal has no tests
NullVoxPopuli Dec 19, 2025
8653b98
Cleanup test names
NullVoxPopuli Dec 19, 2025
148f80c
Add new fixtures for minimal
NullVoxPopuli Dec 19, 2025
3ff13d4
ope
NullVoxPopuli Dec 20, 2025
553b6c1
Add ts minimal fixture
NullVoxPopuli Dec 20, 2025
1d301c5
Unloop
NullVoxPopuli Dec 22, 2025
f4d15f1
Tests pass
NullVoxPopuli Dec 22, 2025
8491650
Cleanup
NullVoxPopuli Dec 22, 2025
23ee2c3
Update eslint config
NullVoxPopuli Dec 22, 2025
b2997a5
Skip lints on windows
NullVoxPopuli Dec 22, 2025
b4e3fab
Add tests for file generation / removing
NullVoxPopuli Dec 23, 2025
d05e9c1
Compat app can't use the strict resolver quite yet (see embroider's c…
NullVoxPopuli Dec 23, 2025
d87cbe1
Ensure that the compat tests include styles
NullVoxPopuli Dec 23, 2025
461ef93
lint:fix
NullVoxPopuli Dec 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/node_modules/
/my-app/
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,46 @@ If you have an existing app that you would like to upgrade to use Vite consider
```
pnpm dlx ember-cli@latest new my-app-name -b @ember/app-blueprint --pnpm
```

## Options

### `--no-compat`

```
pnpm dlx ember-cli@latest new my-app-name \
--blueprint @ember/app-blueprint@alpha \
--pnpm \
--no-compat
```

Does the following:
- enables `type=module` in package.json (required for vite-ssr, and many ESM tools)
- makes the build and boot _MUCH FASTER_
(in large apps, this can have your app's boot be up to 1 minute faster)
- removes `@embroider/compat`
- removes support for:
- hbs (both for component files, and testing)
- content-for (in the HTML files)
- v1 addons
- node-land config/environment.js
- removes `ember-cli`
- ember-cli brings in a ton of old dependencies, so removing it makes installs much faster
- downside though is that you no longer have scaffolding (`ember g`) -- however, you could use `pnpm dlx ember-cli g ...` (or `npx ember-cli g`)

### `--minimal`

```
pnpm dlx ember-cli@latest new my-app-name \
--blueprint @ember/app-blueprint@alpha \
--pnpm \
--minimal
```

Does the following
- everything listed under `--no-compat`
- Removes all linting, formatting, and testing support
- leaves you with a minimal app that you can use for demos, and PRing to other repositories that have multi-framework support (and probably use other testing tools for that multi-framework support)
- different defaults:
- warp-drive becomes _opt-in_ (pass `--warp-drive` if you want it -- normally requires `--no-warp-drive` to remove)
- ember-welcome-page becomes _opt-in_ (normally requires `--no-welcome` to remove)

10 changes: 10 additions & 0 deletions conditional-files/minimal/app/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% if (warpDrive) { %>import '@warp-drive/ember/install';
<% } %>import Application from 'ember-strict-application-resolver';

export default class App extends Application {
modules = {
...import.meta.glob('./router.*', { eager: true }),
...import.meta.glob('./templates/**/*', { eager: true }),
...import.meta.glob('./services/**/*', { eager: true }),
}
}
7 changes: 7 additions & 0 deletions conditional-files/minimal/app/templates/application.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

<template>
<h1>Welcome to Ember</h1>

{{outlet}}

</template>
47 changes: 47 additions & 0 deletions conditional-files/no-compat/_js_babel.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
<% if (warpDrive) { %>import { setConfig } from '@warp-drive/core/build-config';
<% } %>import { buildMacros } from '@embroider/macros/babel';

<% if (warpDrive) { %>const macros = buildMacros({
configure: (config) => {
setConfig(config, {
// for universal apps this MUST be at least 5.6
compatWith: '5.6',
});
},
});
<% } else { %>const macros = buildMacros();
<% } %>
export default {
plugins: [
[
'babel-plugin-ember-template-compilation',
{
compilerPath: 'ember-source/dist/ember-template-compiler.js',
transforms: [...macros.templateMacros],
},
],
[
'module:decorator-transforms',
{
runtime: {
import: import.meta.resolve('decorator-transforms/runtime-esm'),
},
},
],
[
'@babel/plugin-transform-runtime',
{
absoluteRuntime: dirname(fileURLToPath(import.meta.url)),
useESModules: true,
regenerator: false,
},
],
...macros.babelMacros,
],

generatorOpts: {
compact: false,
},
};
55 changes: 55 additions & 0 deletions conditional-files/no-compat/_ts_babel.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
<% if (warpDrive) { %>import { setConfig } from '@warp-drive/core/build-config';
<% } %>import { buildMacros } from '@embroider/macros/babel';

<% if (warpDrive) { %>const macros = buildMacros({
configure: (config) => {
setConfig(config, {
// for universal apps this MUST be at least 5.6
compatWith: '5.6',
});
},
});
<% } else { %>const macros = buildMacros();
<% } %>
export default {
plugins: [
[
'@babel/plugin-transform-typescript',
{
allExtensions: true,
onlyRemoveTypeImports: true,
allowDeclareFields: true,
},
],
[
'babel-plugin-ember-template-compilation',
{
compilerPath: 'ember-source/dist/ember-template-compiler.js',
transforms: [...macros.templateMacros],
},
],
[
'module:decorator-transforms',
{
runtime: {
import: import.meta.resolve('decorator-transforms/runtime-esm'),
},
},
],
[
'@babel/plugin-transform-runtime',
{
absoluteRuntime: dirname(fileURLToPath(import.meta.url)),
useESModules: true,
regenerator: false,
},
],
...macros.babelMacros,
],

generatorOpts: {
compact: false,
},
};
18 changes: 18 additions & 0 deletions conditional-files/no-compat/app/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<% if (warpDrive) { %>import '@warp-drive/ember/install';<% } %>
import Application from '@ember/application';
import compatModules from '@embroider/virtual/compat-modules';
import Resolver from 'ember-resolver';
import config from '<%= modulePrefix %>/config/environment';
import { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';
import setupInspector from '@embroider/legacy-inspector-support/ember-source-4.12';

if (macroCondition(isDevelopingApp())) {
importSync('./deprecation-workflow');
}

export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;
Resolver = Resolver.withModules(compatModules);
inspector = setupInspector(this);
}
38 changes: 38 additions & 0 deletions conditional-files/no-compat/app/config/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<% if (notMinimal) { %><% if (typescript) { %>// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
<% } %>import { getGlobalConfig } from '@embroider/macros/src/addon/runtime';
<% } %>
interface Config {
isTesting?: boolean;
environment: string;
modulePrefix: string;
podModulePrefix?: string;
locationType: 'history' | 'hash' | 'none' | 'auto';
rootURL: string;
EmberENV?: Record<string, unknown>;
APP: Record<string, unknown> & { rootElement?: string; autoboot?: boolean };
}

const ENV: Config = {
modulePrefix: '<%= name %>',
environment: import.meta.env.DEV ? 'development' : 'production',
rootURL: '/',
locationType: 'history',
EmberENV: {},
APP: {},
};

export default ENV;
<% if (notMinimal) { %>
export function enterTestMode() {
ENV.locationType = 'none';
ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;

<% if (typescript) { %>// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
<% } %>const config = getGlobalConfig()['@embroider/macros'];

<% if (typescript) { %>// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
<% } %>if (config) config.isTesting = true;
}
<% } %>
5 changes: 5 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ export default [
eslintConfigPrettier,
{
ignores: [
'my-app/**',
'tests/fixtures/*',
'files/vite.config.*',
'files/ember-cli-build.js',
'files/testem.cjs',
'conditional-files/_js_*',
'conditional-files/_ts_*',
'conditional-files/no-compat/_js_*',
'conditional-files/no-compat/_ts_*',
],
},
];
4 changes: 2 additions & 2 deletions files/app/templates/application.gts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { pageTitle } from 'ember-page-title';
<% if (welcome) {%>import { WelcomePage } from 'ember-welcome-page';<% } %>
import { pageTitle } from 'ember-page-title';<% if (welcome) {%>
import { WelcomePage } from 'ember-welcome-page';<% } %>

<template>
{{pageTitle "<%= namespace %>"}}<% if (welcome) { %>
Expand Down
13 changes: 8 additions & 5 deletions files/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,28 @@
<title><%= namespace %></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<% if (compat) { %>

{{content-for "head"}}

<link integrity="" rel="stylesheet" href="/@embroider/virtual/vendor.css">
<link integrity="" rel="stylesheet" href="/@embroider/virtual/app.css">
Comment thread
NullVoxPopuli marked this conversation as resolved.

{{content-for "head-footer"}}
</head>
<% } else { %>
<link rel="stylesheet" href="/app/styles/app.css">
<% } %></head>
<body>
{{content-for "body"}}
<% if (compat) { %>{{content-for "body"}}

<script src="/@embroider/virtual/vendor.js"></script>
<script type="module">
<% } %> <script type="module">
import Application from './app/app';
import environment from './app/config/environment';

Application.create(environment.APP);
</script>
<% if (compat) { %>{{content-for "body"}}

{{content-for "body-footer"}}
</body>
<% } %> </body>
</html>
2 changes: 1 addition & 1 deletion files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"decorator-transforms": "^2.3.0",
"ember-cli": "~6.9.0-alpha.1",
"ember-cli-babel": "^8.2.0",
"ember-cli-deprecation-workflow": "^3.4.0",
"ember-cli-deprecation-workflow": "^4.0.0",
"ember-load-initializers": "^3.0.1",
"ember-modifier": "^4.2.2",
"ember-page-title": "^9.0.3",
Expand Down
3 changes: 2 additions & 1 deletion files/testem.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

if (typeof module !== 'undefined') {
module.exports = {
test_page: 'tests/index.html?hidepassed',
test_page: 'tests/index.html?hidepassed',<% if (noCompat) {%>
cwd: 'dist',<% } %>
disable_watching: true,
launch_in_ci: ['Chrome'],
launch_in_dev: ['Chrome'],
Expand Down
13 changes: 10 additions & 3 deletions files/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title><%= namespace %> Tests</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<% if (compat) { %>
{{content-for "head"}}
{{content-for "test-head"}}

Expand All @@ -15,21 +15,26 @@

{{content-for "head-footer"}}
{{content-for "test-head-footer"}}
</head>
<% } else { %>
<link rel="stylesheet" href="/app/styles/app.css">
<% } %> </head>
<body>
<% if (compat) { %>
{{content-for "body"}}
{{content-for "test-body"}}

<div id="qunit"></div>
<% } %> <div id="qunit"></div>
<div id="qunit-fixture">
<div id="ember-testing-container">
<div id="ember-testing"></div>
</div>
</div>

<script src="/testem.js" integrity="" data-embroider-ignore></script>
<% if (compat) { %>
<script src="/@embroider/virtual/vendor.js"></script>
<script src="/@embroider/virtual/test-support.js"></script>
<% } %>
<script type="module">import "ember-testing";</script>

<script type="module">
Expand All @@ -38,6 +43,8 @@
start();
</script>

<% if (compat) { %>
{{content-for "body-footer"}}
<% } %>
</body>
</html>
5 changes: 3 additions & 2 deletions files/tests/test-helper.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<% if (warpDrive) { %>import '@warp-drive/ember/install';<% } %>
import Application from '<%= modulePrefix %>/app';
import config from '<%= modulePrefix %>/config/environment';
import config<% if (noCompat) {%>, { enterTestMode }<% } %> from '<%= modulePrefix %>/config/environment';
import * as QUnit from 'qunit';
import { setApplication } from '@ember/test-helpers';
import { setup } from 'qunit-dom';
import { start as qunitStart, setupEmberOnerrorValidation } from 'ember-qunit';

export function start() {
setApplication(Application.create(config.APP));
<% if (noCompat) { %>enterTestMode();
<% } %>setApplication(Application.create(config.APP));

setup(QUnit.assert);
setupEmberOnerrorValidation();
Expand Down
6 changes: 3 additions & 3 deletions files/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { defineConfig } from 'vite';
import { extensions, classicEmberSupport, ember } from '@embroider/vite';
import { extensions<% if (!noCompat) { %>, classicEmberSupport<% } %>, ember } from '@embroider/vite';
import { babel } from '@rollup/plugin-babel';

export default defineConfig({
plugins: [
classicEmberSupport(),
plugins: [<% if (!noCompat) { %>
classicEmberSupport(),<% } %>
ember(),
// extra plugins here
babel({
Expand Down
Loading