ember-cli 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,19 @@
1
1
  # ember-cli Changelog
2
2
 
3
- ## v5.1.0-beta.0
3
+ ## v5.2.0
4
+
5
+ #### Blueprint Changes
6
+
7
+ - [`ember new` diff](https://github.com/ember-cli/ember-new-output/compare/v5.1.0...v5.2.0)
8
+ - [`ember addon` diff](https://github.com/ember-cli/ember-addon-output/compare/v5.1.0...v5.2.0)
9
+
10
+ #### Changelog
11
+
12
+ - [#10283](https://github.com/ember-cli/ember-cli/pull/10283) Refactor `--typescript` support in blueprints [@simonihmig](https://github.com/simonihmig)
13
+
14
+ Thank you to all who took the time to contribute!
15
+
16
+ ## v5.1.0
4
17
 
5
18
  #### Blueprint Changes
6
19
 
@@ -8,7 +8,7 @@
8
8
  "devDependencies": {
9
9
  "@embroider/test-setup": "^3.0.1",
10
10
  "ember-source-channel-url": "^3.0.0",
11
- "ember-try": "^2.0.0"
11
+ "ember-try": "^3.0.0"
12
12
  },
13
13
  "peerDependencies": {
14
14
  "ember-source": ">= 4.0.0"
@@ -4,7 +4,9 @@ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
4
4
 
5
5
  module.exports = function (defaults) {
6
6
  const app = new EmberAddon(defaults, {
7
- // Add options here
7
+ <% if (typescript) {%>'ember-cli-babel': { enableTypeScriptTransform: true },
8
+
9
+ <% } %>// Add options here
8
10
  });
9
11
 
10
12
  /*
@@ -1,5 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  module.exports = {
4
- name: require('./package').name,
4
+ name: require('./package').name,<% if (typescript) {%>
5
+
6
+ options: {
7
+ 'ember-cli-babel': { enableTypeScriptTransform: true },
8
+ },<% } %>
5
9
  };
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "declarationDir": "declarations",
5
+ "emitDeclarationOnly": true,
6
+ "noEmit": false,
7
+ "rootDir": "."
8
+ },
9
+ "include": ["addon", "addon-test-support"]
10
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "@tsconfig/ember/tsconfig.json",
3
+ "compilerOptions": {
4
+ // The combination of `baseUrl` with `paths` allows Ember's classic package
5
+ // layout, which is not resolvable with the Node resolution algorithm, to
6
+ // work with TypeScript.
7
+ "baseUrl": ".",
8
+ "paths": {
9
+ "dummy/tests/*": ["tests/*"],
10
+ "dummy/*": ["tests/dummy/app/*", "app/*"],
11
+ "<%= addonName %>": ["addon"],
12
+ "<%= addonName %>/*": ["addon/*"],
13
+ "<%= addonName %>/test-support": ["addon-test-support"],
14
+ "<%= addonName %>/test-support/*": ["addon-test-support/*"],
15
+ "*": ["types/*"]
16
+ }
17
+ }
18
+ }
@@ -64,6 +64,11 @@ module.exports = {
64
64
 
65
65
  // 95% of addons don't need ember-data or ember-fetch, make them opt-in instead
66
66
  delete contents.devDependencies['ember-data'];
67
+ delete contents.devDependencies['@types/ember-data'];
68
+ delete contents.devDependencies['@types/ember-data__adapter'];
69
+ delete contents.devDependencies['@types/ember-data__model'];
70
+ delete contents.devDependencies['@types/ember-data__serializer'];
71
+ delete contents.devDependencies['@types/ember-data__store'];
67
72
  delete contents.devDependencies['ember-fetch'];
68
73
 
69
74
  // Per RFC #811, addons should not have this dependency.
@@ -77,6 +82,22 @@ module.exports = {
77
82
  // 100% of addons don't need ember-cli-app-version, make it opt-in instead
78
83
  delete contents.devDependencies['ember-cli-app-version'];
79
84
 
85
+ // add scripts to build type declarations for TypeScript addons
86
+ if (this.options.typescript) {
87
+ contents.devDependencies.rimraf = '^5.0.1';
88
+
89
+ contents.scripts.prepack = 'tsc --project tsconfig.declarations.json';
90
+ contents.scripts.postpack = 'rimraf declarations';
91
+
92
+ contents.typesVersions = {
93
+ '*': {
94
+ 'test-support': ['declarations/addon-test-support/index.d.ts'],
95
+ 'test-support/*': ['declarations/addon-test-support/*', 'declarations/addon-test-support/*/index.d.ts'],
96
+ '*': ['declarations/addon/*', 'declarations/addon/*/index.d.ts'],
97
+ },
98
+ };
99
+ }
100
+
80
101
  merge(contents, ADDITIONAL_PACKAGE);
81
102
 
82
103
  return stringifyAndNormalize(sortPackageJson(contents));
@@ -110,15 +131,6 @@ module.exports = {
110
131
  this.ui.writeLine(prependEmoji('✨', `Creating a new Ember addon in ${chalk.yellow(process.cwd())}:`));
111
132
  },
112
133
 
113
- async afterInstall(options) {
114
- if (options.typescript) {
115
- await this.addAddonToProject({
116
- name: 'ember-cli-typescript',
117
- blueprintOptions: { ...options, save: true },
118
- });
119
- }
120
- },
121
-
122
134
  locals(options) {
123
135
  let entity = { name: 'dummy' };
124
136
  let rawName = entity.name;
@@ -172,7 +184,9 @@ module.exports = {
172
184
  },
173
185
 
174
186
  files(options) {
175
- let appFiles = this.lookupBlueprint(this.appBlueprintName).files(options);
187
+ let appFiles = this.lookupBlueprint(this.appBlueprintName)
188
+ .files(options)
189
+ .filter((file) => !['types/ember-data/types/registries/model.d.ts'].includes(file));
176
190
  let addonFilesPath = this.filesPath(this.options);
177
191
  let ignoredCITemplate = this.options.ciProvider !== 'travis' ? '.travis.yml' : '.github';
178
192
 
@@ -182,6 +196,10 @@ module.exports = {
182
196
  addonFiles = addonFiles.filter((file) => !file.endsWith('.npmrc'));
183
197
  }
184
198
 
199
+ if (!options.typescript) {
200
+ addonFiles = addonFiles.filter((file) => file !== 'tsconfig.json' && !file.endsWith('.d.ts'));
201
+ }
202
+
185
203
  return uniq(appFiles.concat(addonFiles));
186
204
  },
187
205
 
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Type declarations for
3
+ * import config from '<%= name %>/config/environment'
4
+ */
5
+ declare const config: {
6
+ environment: string;
7
+ modulePrefix: string;
8
+ podModulePrefix: string;
9
+ locationType: 'history' | 'hash' | 'none' | 'auto';
10
+ rootURL: string;
11
+ APP: Record<string, unknown>;
12
+ };
13
+
14
+ export default config;
@@ -4,7 +4,9 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app');
4
4
 
5
5
  module.exports = function (defaults) {
6
6
  const app = new EmberApp(defaults, {
7
- // Add options here
7
+ <% if (typescript) {%>'ember-cli-babel': { enableTypeScriptTransform: true },
8
+
9
+ <% } %>// Add options here
8
10
  });
9
11
 
10
12
  <% if (embroider) { %>const { Webpack } = require('@embroider/webpack');
@@ -1,5 +1,6 @@
1
1
  # compiled output
2
2
  /dist/
3
+ /declarations/
3
4
 
4
5
  # dependencies
5
6
  /node_modules/
@@ -26,55 +26,87 @@
26
26
  "test:ember": "ember test"
27
27
  },
28
28
  "devDependencies": {
29
- "<% if (!typescript) { %>@babel/eslint-parser": "^7.22.5",
30
- "@babel/plugin-proposal-decorators": "^7.22.5",
29
+ "<% if (!typescript) { %>@babel/eslint-parser": "^7.22.10",
30
+ "@babel/plugin-proposal-decorators": "^7.22.10",
31
31
  "<% } %>@ember/optional-features": "^2.0.0",
32
32
  "@ember/string": "^3.1.1",
33
- "@ember/test-helpers": "^3.1.0<% if (embroider) { %>",
34
- "@embroider/compat": "^3.1.3",
35
- "@embroider/core": "^3.1.1",
36
- "@embroider/webpack": "^3.1.1<% } %>",
33
+ "@ember/test-helpers": "^3.2.0<% if (embroider) { %>",
34
+ "@embroider/compat": "^3.2.1",
35
+ "@embroider/core": "^3.2.1",
36
+ "@embroider/webpack": "^3.1.5<% } %>",
37
37
  "@glimmer/component": "^1.1.2",
38
38
  "@glimmer/tracking": "^1.1.2<% if (typescript) { %>",
39
- "@typescript-eslint/eslint-plugin": "^5.60.1",
40
- "@typescript-eslint/parser": "^5.60.1<% } %>",
39
+ "@glint/environment-ember-loose": "^1.1.0",
40
+ "@glint/template": "^1.1.0",
41
+ "@tsconfig/ember": "^3.0.0",
42
+ "@types/ember": "^4.0.4",
43
+ "@types/ember-data": "^4.4.11",
44
+ "@types/ember-data__adapter": "^4.0.2",
45
+ "@types/ember-data__model": "^4.0.1",
46
+ "@types/ember-data__serializer": "^4.0.2",
47
+ "@types/ember-data__store": "^4.0.3",
48
+ "@types/ember__application": "^4.0.6",
49
+ "@types/ember__array": "^4.0.4",
50
+ "@types/ember__component": "^4.0.14",
51
+ "@types/ember__controller": "^4.0.6",
52
+ "@types/ember__debug": "^4.0.4",
53
+ "@types/ember__destroyable": "^4.0.2",
54
+ "@types/ember__engine": "^4.0.5",
55
+ "@types/ember__error": "^4.0.3",
56
+ "@types/ember__helper": "^4.0.2",
57
+ "@types/ember__modifier": "^4.0.5",
58
+ "@types/ember__object": "^4.0.6",
59
+ "@types/ember__owner": "^4.0.5",
60
+ "@types/ember__polyfills": "^4.0.2",
61
+ "@types/ember__routing": "^4.0.13",
62
+ "@types/ember__runloop": "^4.0.4",
63
+ "@types/ember__service": "^4.0.3",
64
+ "@types/ember__string": "^3.0.11",
65
+ "@types/ember__template": "^4.0.2",
66
+ "@types/ember__test": "^4.0.2",
67
+ "@types/ember__utils": "^4.0.3",
68
+ "@types/qunit": "^2.19.6",
69
+ "@types/rsvp": "^4.0.4",
70
+ "@typescript-eslint/eslint-plugin": "^6.4.0",
71
+ "@typescript-eslint/parser": "^6.4.0<% } %>",
41
72
  "broccoli-asset-rev": "^3.0.0",
42
73
  "concurrently": "^8.2.0",
43
74
  "ember-auto-import": "^2.6.3",
44
75
  "ember-cli": "~<%= emberCLIVersion %>",
45
76
  "ember-cli-app-version": "^6.0.1",
46
- "ember-cli-babel": "^7.26.11",
77
+ "ember-cli-babel": "^8.0.0",
47
78
  "ember-cli-clean-css": "^2.0.0",
48
79
  "ember-cli-dependency-checker": "^3.3.2",
49
- "ember-cli-htmlbars": "^6.2.0",
80
+ "ember-cli-htmlbars": "^6.3.0",
50
81
  "ember-cli-inject-live-reload": "^2.1.0<% if (!embroider) { %>",
51
82
  "ember-cli-sri": "^2.1.1",
52
83
  "ember-cli-terser": "^4.0.2<% } %>",
53
- "ember-data": "~5.1.0",
84
+ "ember-data": "~5.2.0",
54
85
  "ember-fetch": "^8.1.2",
55
86
  "ember-load-initializers": "^2.1.2",
56
87
  "ember-modifier": "^4.1.0",
57
- "ember-page-title": "^7.0.0",
88
+ "ember-page-title": "^8.0.0",
58
89
  "ember-qunit": "^7.0.0",
59
- "ember-resolver": "^10.1.1",
60
- "ember-source": "~5.1.1",
61
- "ember-template-lint": "^5.11.0<% if (welcome) { %>",
90
+ "ember-resolver": "^11.0.1",
91
+ "ember-source": "~5.2.0",
92
+ "ember-template-lint": "^5.11.2<% if (welcome) { %>",
62
93
  "ember-welcome-page": "^7.0.2<% } %>",
63
- "eslint": "^8.43.0",
64
- "eslint-config-prettier": "^8.8.0",
65
- "eslint-plugin-ember": "^11.9.0",
94
+ "eslint": "^8.47.0",
95
+ "eslint-config-prettier": "^9.0.0",
96
+ "eslint-plugin-ember": "^11.10.0",
66
97
  "eslint-plugin-n": "^16.0.1",
67
- "eslint-plugin-prettier": "^4.2.1",
98
+ "eslint-plugin-prettier": "^5.0.0",
68
99
  "eslint-plugin-qunit": "^8.0.0",
69
100
  "loader.js": "^4.7.0",
70
- "prettier": "^2.8.8",
101
+ "prettier": "^3.0.2",
71
102
  "qunit": "^2.19.4",
72
103
  "qunit-dom": "^2.0.0",
73
- "stylelint": "^15.9.0",
74
- "stylelint-config-standard": "^33.0.0",
75
- "stylelint-prettier": "^3.0.0",
76
- "tracked-built-ins": "^3.1.1",
77
- "webpack": "^5.88.1"
104
+ "stylelint": "^15.10.3",
105
+ "stylelint-config-standard": "^34.0.0",
106
+ "stylelint-prettier": "^4.0.2",
107
+ "tracked-built-ins": "^3.1.1<% if (typescript) { %>",
108
+ "typescript": "^5.1.6<% } %>",
109
+ "webpack": "^5.88.2"
78
110
  },
79
111
  "engines": {
80
112
  "node": "16.* || >= 18"
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "@tsconfig/ember/tsconfig.json",
3
+ "compilerOptions": {
4
+ // The combination of `baseUrl` with `paths` allows Ember's classic package
5
+ // layout, which is not resolvable with the Node resolution algorithm, to
6
+ // work with TypeScript.
7
+ "baseUrl": ".",
8
+ "paths": {
9
+ "<%= name %>/tests/*": ["tests/*"],
10
+ "<%= name %>/*": ["app/*"],
11
+ "*": ["types/*"]
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Catch-all for ember-data.
3
+ */
4
+ export default interface ModelRegistry {
5
+ [key: string]: any;
6
+ }
@@ -0,0 +1 @@
1
+ import '@glint/environment-ember-loose';
@@ -72,11 +72,19 @@ module.exports = {
72
72
 
73
73
  let files = this._super();
74
74
  if (options.ciProvider !== 'travis') {
75
- this._files = files.filter((file) => file !== '.travis.yml');
75
+ files = files.filter((file) => file !== '.travis.yml');
76
76
  } else {
77
- this._files = files.filter((file) => file.indexOf('.github') < 0);
77
+ files = files.filter((file) => file.indexOf('.github') < 0);
78
78
  }
79
79
 
80
+ if (!options.typescript) {
81
+ files = files.filter(
82
+ (file) => !['tsconfig.json', 'app/config/', 'types/'].includes(file) && !file.endsWith('.d.ts')
83
+ );
84
+ }
85
+
86
+ this._files = files;
87
+
80
88
  return this._files;
81
89
  },
82
90
 
@@ -88,10 +96,4 @@ module.exports = {
88
96
  this.ui.writeLine('');
89
97
  this.ui.writeLine(prependEmoji('✨', `Creating a new Ember app in ${chalk.yellow(process.cwd())}:`));
90
98
  },
91
-
92
- async afterInstall(options) {
93
- if (options.typescript) {
94
- await this.addAddonToProject({ name: 'ember-cli-typescript', blueprintOptions: options });
95
- }
96
- },
97
99
  };
@@ -3,7 +3,7 @@
3
3
  "logo": "https://ember-cli.com/assets/images/ember-cli-logo-small-dark.png",
4
4
  "name": "ember-cli",
5
5
  "description": "Command line tool for developing ambitious ember.js apps",
6
- "version": "5.1.0-release-e8820d9d4e"
6
+ "version": "5.2.0-release-007b731b3c"
7
7
  },
8
8
  "files": {
9
9
  "lib/broccoli/default-packager.js": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-cli",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "Command line tool for developing ambitious ember.js apps",
5
5
  "keywords": [
6
6
  "app",
@@ -72,7 +72,7 @@
72
72
  "execa": "^5.1.1",
73
73
  "exit": "^0.1.2",
74
74
  "express": "^4.18.1",
75
- "filesize": "^10.0.5",
75
+ "filesize": "^10.0.7",
76
76
  "find-up": "^5.0.0",
77
77
  "find-yarn-workspace-root": "^2.0.0",
78
78
  "fixturify-project": "^2.1.1",
@@ -109,7 +109,7 @@
109
109
  "remove-types": "^1.0.0",
110
110
  "resolve": "^1.22.1",
111
111
  "resolve-package-path": "^4.0.3",
112
- "safe-stable-stringify": "^2.4.2",
112
+ "safe-stable-stringify": "^2.4.3",
113
113
  "sane": "^5.0.1",
114
114
  "semver": "^7.3.5",
115
115
  "silent-error": "^1.1.1",
@@ -135,7 +135,7 @@
135
135
  "chai-jest-snapshot": "^2.0.0",
136
136
  "ember-cli-blueprint-test-helpers": "^0.19.2",
137
137
  "ember-cli-internal-test-helpers": "^0.9.1",
138
- "eslint": "^8.37.0",
138
+ "eslint": "^8.44.0",
139
139
  "eslint-config-prettier": "^8.6.0",
140
140
  "eslint-plugin-chai-expect": "^3.0.0",
141
141
  "eslint-plugin-mocha": "^10.1.0",
@@ -152,7 +152,7 @@
152
152
  "rimraf": "^3.0.2",
153
153
  "strip-ansi": "^6.0.0",
154
154
  "supertest": "^6.3.1",
155
- "testdouble": "^3.16.6",
155
+ "testdouble": "^3.18.0",
156
156
  "tmp": "^0.2.1",
157
157
  "websocket": "^1.0.32",
158
158
  "which": "3.0.0",