Skip to content

Commit 8358855

Browse files
committed
Merge branch 'origin/beta' into master
# Conflicts: # .release-plan.json # CHANGELOG.md # package.json # packages/addon-blueprint/package.json # packages/app-blueprint/files/package.json # packages/app-blueprint/package.json # pnpm-lock.yaml
2 parents a5648f9 + 5e1ce7a commit 8358855

71 files changed

Lines changed: 4388 additions & 977 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
- release
99
- next
1010
- 'v*'
11-
- 'release-*'
1211
- 'lts-*'
1312
pull_request:
1413
workflow_dispatch:

blueprints/http-mock/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
const Blueprint = require('../../lib/models/blueprint');
44
const isPackageMissing = require('ember-cli-is-package-missing');
5+
const SilentError = require('silent-error');
56

67
module.exports = {
7-
description: 'Generates a mock api endpoint in /api prefix.',
8+
description: '[Classic Only] Generates a mock api endpoint in /api prefix.',
89

910
anonymousOptions: ['endpoint-path'],
1011

@@ -15,6 +16,10 @@ module.exports = {
1516
},
1617

1718
beforeInstall(options) {
19+
if (this.project.isViteProject()) {
20+
throw new SilentError('The http-mock blueprint is not supported in Vite projects.');
21+
}
22+
1823
let serverBlueprint = Blueprint.lookup('server', {
1924
ui: this.ui,
2025
project: this.project,

blueprints/http-proxy/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
'use strict';
22

33
const Blueprint = require('../../lib/models/blueprint');
4+
const SilentError = require('silent-error');
45

56
module.exports = {
6-
description: 'Generates a relative proxy to another server.',
7+
description: '[Classic Only] Generates a relative proxy to another server.',
78

89
anonymousOptions: ['local-path', 'remote-url'],
910

@@ -16,6 +17,10 @@ module.exports = {
1617
},
1718

1819
beforeInstall(options) {
20+
if (this.project.isViteProject()) {
21+
throw new SilentError('The http-proxy blueprint is not supported in Vite projects.');
22+
}
23+
1924
let serverBlueprint = Blueprint.lookup('server', {
2025
ui: this.ui,
2126
project: this.project,

blueprints/server/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
'use strict';
22

33
const isPackageMissing = require('ember-cli-is-package-missing');
4+
const SilentError = require('silent-error');
45

56
module.exports = {
6-
description: 'Generates a server directory for mocks and proxies.',
7+
description: '[Classic Only] Generates a server directory for mocks and proxies.',
78

89
normalizeEntityName() {},
910

11+
beforeInstall() {
12+
if (this.project.isViteProject()) {
13+
throw new SilentError('The server blueprint is not supported in Vite projects.');
14+
}
15+
},
16+
1017
afterInstall(options) {
1118
let isMorganMissing = isPackageMissing(this, 'morgan');
1219
let isGlobMissing = isPackageMissing(this, 'glob');

lib/commands/addon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = NewCommand.extend({
4141
{
4242
name: 'strict',
4343
type: Boolean,
44-
default: false,
44+
default: true,
4545
description: 'Use GJS/GTS templates by default for generated components, tests, and route templates',
4646
},
4747
],

lib/commands/asset-sizes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ const Command = require('../models/command');
55
module.exports = Command.extend({
66
name: 'asset-sizes',
77
description: 'Shows the sizes of your asset files.',
8+
skipHelp: true,
89

910
availableOptions: [
1011
{ name: 'output-path', type: 'Path', default: 'dist/', aliases: ['o'] },
1112
{ name: 'json', type: Boolean, default: false },
1213
],
1314

15+
init() {
16+
this._super.apply(this, arguments);
17+
if (!this.isViteProject) {
18+
this.skipHelp = false;
19+
}
20+
},
21+
1422
run(commandOptions) {
1523
return this.runTask('ShowAssetSizes', commandOptions);
1624
},

lib/commands/build.js

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22

33
const Command = require('../models/command');
44
const Win = require('../utilities/windows-admin');
5+
const SilentError = require('silent-error');
6+
7+
const ClassicOptions = [
8+
{ name: 'watch', type: Boolean, default: false, aliases: ['w'] },
9+
{ name: 'watcher', type: String },
10+
];
511

612
module.exports = Command.extend({
713
name: 'build',
8-
description: 'Builds your app and places it into the output path (dist/ by default).',
14+
description: 'Vestigial command in Vite-based projects. Use the `build` script from package.json instead.',
915
aliases: ['b'],
1016

1117
availableOptions: [
@@ -16,13 +22,42 @@ module.exports = Command.extend({
1622
aliases: ['e', { dev: 'development' }, { prod: 'production' }],
1723
description: 'Possible values are "development", "production", and "test".',
1824
},
19-
{ name: 'output-path', type: 'Path', default: 'dist/', aliases: ['o'] },
20-
{ name: 'watch', type: Boolean, default: false, aliases: ['w'] },
21-
{ name: 'watcher', type: String },
2225
{ name: 'suppress-sizes', type: Boolean, default: false },
26+
{ name: 'output-path', type: 'Path', default: 'dist/', aliases: ['o'] },
2327
],
2428

29+
init() {
30+
this._super.apply(this, arguments);
31+
if (!this.isViteProject) {
32+
this.description = 'Builds your app and places it into the output path (dist/ by default).';
33+
this.availableOptions = this.availableOptions.concat(ClassicOptions);
34+
} else if (process.env.EMBROIDER_PREBUILD) {
35+
// having the --watch option available surpresses a warning that you get in Vite prebuild
36+
this.availableOptions = this.availableOptions.concat(ClassicOptions[0]);
37+
}
38+
},
39+
2540
async run(commandOptions) {
41+
if (this.isViteProject && !process.env.EMBROIDER_PREBUILD) {
42+
// --watch is used during Embroider prebuild but should never be used directly so we only throw in this case if
43+
// EMBROIDER_PREBUILD has been set
44+
if (commandOptions.watch) {
45+
return Promise.reject(
46+
new SilentError(
47+
'The `--watch` option to `ember build` is not supported in Vite-based projects. Please use `vite dev` instead.'
48+
)
49+
);
50+
}
51+
52+
if (commandOptions.watcher) {
53+
return Promise.reject(
54+
new SilentError(
55+
'The `--watcher` option to `ember build` is not supported in Vite-based projects. Please use `vite dev` instead.'
56+
)
57+
);
58+
}
59+
}
60+
2661
await Win.checkIfSymlinksNeedToBeEnabled(this.ui);
2762

2863
let buildTaskName = commandOptions.watch ? 'BuildWatch' : 'Build';

lib/commands/destroy.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const mergeBlueprintOptions = require('../utilities/merge-blueprint-options');
66
const merge = require('lodash/merge');
77
const SilentError = require('silent-error');
88

9+
const ClassicOptions = [{ name: 'dummy', type: Boolean, default: false, aliases: ['dum', 'id'] }];
10+
911
module.exports = Command.extend({
1012
name: 'destroy',
1113
description: 'Destroys code generated by `generate` command.',
@@ -17,7 +19,6 @@ module.exports = Command.extend({
1719
{ name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
1820
{ name: 'pod', type: Boolean, default: false, aliases: ['p', 'pods'] },
1921
{ name: 'classic', type: Boolean, default: false, aliases: ['c'] },
20-
{ name: 'dummy', type: Boolean, default: false, aliases: ['dum', 'id'] },
2122
{ name: 'in-repo-addon', type: String, default: null, aliases: ['in-repo', 'ir'] },
2223
{
2324
name: 'in',
@@ -37,9 +38,22 @@ module.exports = Command.extend({
3738

3839
anonymousOptions: ['<blueprint>'],
3940

41+
init() {
42+
this._super.apply(this, arguments);
43+
if (!this.isViteProject) {
44+
this.availableOptions = this.availableOptions.concat(ClassicOptions);
45+
}
46+
},
47+
4048
beforeRun: mergeBlueprintOptions,
4149

4250
run(commandOptions, rawArgs) {
51+
if (this.isViteProject && commandOptions.dummy) {
52+
return Promise.reject(
53+
new SilentError('The `--dummy` option to `ember destroy` is not supported in Vite-based projects.')
54+
);
55+
}
56+
4357
let blueprintName = rawArgs[0];
4458
let entityName = rawArgs[1];
4559

lib/commands/generate.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const UNKNOWN_BLUEPRINT_ERROR =
1515
'blueprint name to be specified. ' +
1616
'For more details, use `ember help`';
1717

18+
const ClassicOptions = [{ name: 'dummy', type: Boolean, default: false, aliases: ['dum', 'id'] }];
19+
1820
module.exports = Command.extend({
1921
name: 'generate',
2022
description: 'Generates new code from blueprints.',
@@ -26,7 +28,6 @@ module.exports = Command.extend({
2628
{ name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
2729
{ name: 'pod', type: Boolean, default: false, aliases: ['p', 'pods'] },
2830
{ name: 'classic', type: Boolean, default: false, aliases: ['c'] },
29-
{ name: 'dummy', type: Boolean, default: false, aliases: ['dum', 'id'] },
3031
{ name: 'in-repo-addon', type: String, default: null, aliases: ['in-repo', 'ir'] },
3132
{ name: 'lint-fix', type: Boolean, default: true },
3233
{
@@ -46,9 +47,22 @@ module.exports = Command.extend({
4647

4748
anonymousOptions: ['<blueprint>'],
4849

50+
init() {
51+
this._super.apply(this, arguments);
52+
if (!this.isViteProject) {
53+
this.availableOptions = this.availableOptions.concat(ClassicOptions);
54+
}
55+
},
56+
4957
beforeRun: mergeBlueprintOptions,
5058

5159
run(commandOptions, rawArgs) {
60+
if (this.isViteProject && commandOptions.dummy) {
61+
return Promise.reject(
62+
new SilentError('The `--dummy` option to `ember generate` is not supported in Vite-based projects.')
63+
);
64+
}
65+
5266
let blueprintName = rawArgs[0];
5367

5468
if (!blueprintName) {

lib/commands/init.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ const { isPnpmProject, isYarnProject } = require('../utilities/package-managers'
1212
const getLangArg = require('../../lib/utilities/get-lang-arg');
1313
const { deprecate, DEPRECATIONS } = require('../debug');
1414

15-
const { isExperimentEnabled } = require('@ember-tooling/blueprint-model/utilities/experiments');
16-
1715
module.exports = Command.extend({
1816
name: 'init',
1917
description: 'Reinitializes a new ember-cli project in the current folder.',
@@ -70,7 +68,7 @@ module.exports = Command.extend({
7068
{
7169
name: 'strict',
7270
type: Boolean,
73-
default: false,
71+
default: true,
7472
description: 'Use GJS/GTS templates by default for generated components, tests, and route templates',
7573
},
7674
],
@@ -126,10 +124,6 @@ module.exports = Command.extend({
126124
let blueprintOpts = clone(commandOptions);
127125
let blueprint = normalizeBlueprint(blueprintOpts.blueprint || this._defaultBlueprint());
128126

129-
if (isExperimentEnabled('VITE') && blueprint === 'app') {
130-
blueprint = '@ember/app-blueprint';
131-
}
132-
133127
merge(blueprintOpts, {
134128
rawName: packageName,
135129
targetFiles: rawArgs || [],

0 commit comments

Comments
 (0)