ember-cli 4.8.0 → 4.9.0-beta.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +1 -1
  3. package/bin/ember +3 -0
  4. package/blueprints/addon/additional-package.json +19 -0
  5. package/blueprints/addon/files/npmignore +0 -1
  6. package/blueprints/addon/index.js +18 -18
  7. package/blueprints/app/files/.ember-cli +3 -3
  8. package/blueprints/app/files/.eslintrc.js +12 -3
  9. package/blueprints/app/files/app/{app.js → app.ts} +0 -0
  10. package/blueprints/app/files/app/{router.js → router.ts} +3 -1
  11. package/blueprints/app/files/config/environment.js +1 -0
  12. package/blueprints/app/files/package.json +12 -9
  13. package/blueprints/app/files/tests/helpers/{index.js → index.ts} +4 -3
  14. package/blueprints/app/files/tests/{test-helper.js → test-helper.ts} +0 -0
  15. package/blueprints/app/index.js +10 -0
  16. package/docs/build/data.json +44 -44
  17. package/lib/commands/addon.js +1 -0
  18. package/lib/commands/destroy.js +1 -1
  19. package/lib/commands/generate.js +2 -10
  20. package/lib/commands/init.js +1 -0
  21. package/lib/commands/new.js +32 -4
  22. package/lib/models/asset-size-printer.js +1 -1
  23. package/lib/models/blueprint.js +24 -1
  24. package/lib/models/builder.js +13 -6
  25. package/lib/models/project.js +2 -1
  26. package/lib/models/server-watcher.js +2 -2
  27. package/lib/models/watcher.js +23 -6
  28. package/lib/tasks/build-watch.js +9 -7
  29. package/lib/tasks/generate-from-blueprint.js +1 -1
  30. package/lib/tasks/install-blueprint.js +1 -1
  31. package/lib/tasks/interactive-new.js +153 -0
  32. package/lib/tasks/npm-task.js +1 -1
  33. package/lib/tasks/serve.js +10 -8
  34. package/lib/utilities/find-build-file.js +17 -9
  35. package/lib/utilities/lint-fix.js +11 -10
  36. package/package.json +12 -10
  37. package/blueprints/addon/additional-dev-dependencies.json +0 -8
  38. package/blueprints/addon/files/addon-config/environment.js +0 -5
  39. package/blueprints/app/files/vendor/.gitkeep +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # ember-cli Changelog
2
2
 
3
+ ## v4.9.0-beta.0
4
+
5
+ #### Blueprint Changes
6
+
7
+ - [`ember new` diff](https://github.com/ember-cli/ember-new-output/compare/v4.8.0...v4.9.0-beta.0)
8
+ - [`ember addon` diff](https://github.com/ember-cli/ember-addon-output/compare/v4.8.0...v4.9.0-beta.0)
9
+
10
+ #### Changelog
11
+
12
+ - [#10015](https://github.com/ember-cli/ember-cli/pull/10015) Update `glob` to v8 [@bertdeblock](https://github.com/bertdeblock)
13
+ - [#10016](https://github.com/ember-cli/ember-cli/pull/10016) Fix indentation in `.ember-cli` file in `app` blueprint [@bertdeblock](https://github.com/bertdeblock)
14
+ - [#10017](https://github.com/ember-cli/ember-cli/pull/10017) [ENHANCEMENT] Disable prototype extensions by default in `app` blueprint [@bertdeblock](https://github.com/bertdeblock)
15
+ - [#10018](https://github.com/ember-cli/ember-cli/pull/10018) Trap unhandled failures [@ef4](https://github.com/ef4)
16
+ - [#10020](https://github.com/ember-cli/ember-cli/pull/10020) [INTERNAL] Fix typos in `serve` command test [@bertdeblock](https://github.com/bertdeblock)
17
+ - [#10021](https://github.com/ember-cli/ember-cli/pull/10021) [CLEANUP] Drop support for using `usePods: true` and the `--pod` flag simultaneously [@bertdeblock](https://github.com/bertdeblock)
18
+ - [#10022](https://github.com/ember-cli/ember-cli/pull/10022) [ENHANCEMENT] Use `concurrently` instead of `npm-run-all` in `app` blueprint [@bertdeblock](https://github.com/bertdeblock)
19
+ - [#10024](https://github.com/ember-cli/ember-cli/pull/10024) [ENHANCEMENT] Add `ember-source` to `peerDependencies` in `addon` blueprint [@bertdeblock](https://github.com/bertdeblock)
20
+ - [#10025](https://github.com/ember-cli/ember-cli/pull/10025) [ENHANCEMENT] Update NPM version constraints [@bertdeblock](https://github.com/bertdeblock)
21
+ - [#10026](https://github.com/ember-cli/ember-cli/pull/10026) [ENHANCEMENT] Display info message when running the `lint:fix` script post blueprint generation [@bertdeblock](https://github.com/bertdeblock)
22
+ - [#10038](https://github.com/ember-cli/ember-cli/pull/10038) Update `filesize` to v10 [@bertdeblock](https://github.com/bertdeblock)
23
+ - [#10041](https://github.com/ember-cli/ember-cli/pull/10041) [INTERNAL] Remove end year from copyright notice [@bertdeblock](https://github.com/bertdeblock)
24
+ - [#10049](https://github.com/ember-cli/ember-cli/pull/10049) [ENHANCEMENT] Remove the `config/environment.js` file from the `addon` blueprint [@bertdeblock](https://github.com/bertdeblock)
25
+ - [#10050](https://github.com/ember-cli/ember-cli/pull/10050) [ENHANCEMENT] Remove `vendor` folder from `app` blueprint [@bertdeblock](https://github.com/bertdeblock)
26
+ - [#10051](https://github.com/ember-cli/ember-cli/pull/10051) [ENHANCEMENT] Move `ember-try.js` config file to `tests/dummy/config/ember-try.js` for addons [@bertdeblock](https://github.com/bertdeblock)
27
+ - [#10053](https://github.com/ember-cli/ember-cli/pull/10053) Add support for node ESM addons [@hjdivad](https://github.com/hjdivad)
28
+ - [#9824](https://github.com/ember-cli/ember-cli/pull/9824) [RFC 638] Interactive way to create new Ember apps and addons [@bertdeblock](https://github.com/bertdeblock)
29
+ - [#9972](https://github.com/ember-cli/ember-cli/pull/9972) [ENHANCEMENT] Add support for `--typescript` flag to `app` and `addon` blueprints [@simonihmig](https://github.com/simonihmig)
30
+
31
+ Thank you to all who took the time to contribute!
32
+
3
33
  ## v4.8.0
4
34
 
5
35
  #### Blueprint Changes
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013-2017 Stefan Penner, Robert Jackson and ember-cli contributors
3
+ Copyright (c) 2013 Stefan Penner, Robert Jackson and ember-cli contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/bin/ember CHANGED
@@ -42,4 +42,7 @@ cli({
42
42
 
43
43
  logger.info('Quitting "ember-cli" with exit code: %j', exitCode);
44
44
  exit(exitCode);
45
+ }, function(err) {
46
+ console.log(err);
47
+ process.exit(-1);
45
48
  });
@@ -0,0 +1,19 @@
1
+ {
2
+ "keywords": [
3
+ "ember-addon"
4
+ ],
5
+ "scripts": {
6
+ "test:ember-compatibility": "ember try:each"
7
+ },
8
+ "devDependencies": {
9
+ "@embroider/test-setup": "^1.8.3",
10
+ "ember-source-channel-url": "^3.0.0",
11
+ "ember-try": "^2.0.0"
12
+ },
13
+ "peerDependencies": {
14
+ "ember-source": "^3.28.0 || ^4.0.0"
15
+ },
16
+ "ember-addon": {
17
+ "configPath": "tests/dummy/config"
18
+ }
19
+ }
@@ -22,7 +22,6 @@
22
22
  /.travis.yml
23
23
  /.watchmanconfig
24
24
  /bower.json
25
- /config/ember-try.js
26
25
  /CONTRIBUTING.md
27
26
  /ember-cli-build.js
28
27
  /testem.js
@@ -5,7 +5,7 @@ const path = require('path');
5
5
  const walkSync = require('walk-sync');
6
6
  const chalk = require('chalk');
7
7
  const stringUtil = require('ember-cli-string-utils');
8
- const { uniq } = require('ember-cli-lodash-subset');
8
+ const { merge, uniq } = require('ember-cli-lodash-subset');
9
9
  const SilentError = require('silent-error');
10
10
  const sortPackageJson = require('sort-package-json');
11
11
 
@@ -22,13 +22,15 @@ const replacers = {
22
22
  },
23
23
  };
24
24
 
25
- const ADDITIONAL_DEV_DEPENDENCIES = require('./additional-dev-dependencies.json').devDependencies;
25
+ const ADDITIONAL_PACKAGE = require('./additional-package.json');
26
26
 
27
27
  const description = 'The default blueprint for ember-cli addons.';
28
28
  module.exports = {
29
29
  description,
30
30
  appBlueprintName: 'app',
31
31
 
32
+ shouldTransformTypeScript: true,
33
+
32
34
  filesToRemove: [
33
35
  'tests/dummy/app/styles/.gitkeep',
34
36
  'tests/dummy/app/templates/.gitkeep',
@@ -43,9 +45,9 @@ module.exports = {
43
45
 
44
46
  contents.name = stringUtil.dasherize(this.options.entity.name);
45
47
  contents.description = this.description;
48
+
46
49
  delete contents.private;
47
- contents.scripts = contents.scripts || {};
48
- contents.keywords = contents.keywords || [];
50
+
49
51
  contents.dependencies = contents.dependencies || {};
50
52
  contents.devDependencies = contents.devDependencies || {};
51
53
 
@@ -67,17 +69,7 @@ module.exports = {
67
69
  // 100% of addons don't need ember-cli-app-version, make it opt-in instead
68
70
  delete contents.devDependencies['ember-cli-app-version'];
69
71
 
70
- if (contents.keywords.indexOf('ember-addon') === -1) {
71
- contents.keywords.push('ember-addon');
72
- }
73
-
74
- Object.assign(contents.devDependencies, ADDITIONAL_DEV_DEPENDENCIES);
75
-
76
- // add `ember-compatibility` script in addons
77
- contents.scripts['test:ember-compatibility'] = 'ember try:each';
78
-
79
- contents['ember-addon'] = contents['ember-addon'] || {};
80
- contents['ember-addon'].configPath = 'tests/dummy/config';
72
+ merge(contents, ADDITIONAL_PACKAGE);
81
73
 
82
74
  return stringifyAndNormalize(sortPackageJson(contents));
83
75
  },
@@ -110,13 +102,20 @@ module.exports = {
110
102
  this.ui.writeLine(prependEmoji('✨', `Creating a new Ember addon in ${chalk.yellow(process.cwd())}:`));
111
103
  },
112
104
 
113
- afterInstall() {
105
+ async afterInstall(options) {
114
106
  let packagePath = path.join(this.path, 'files', 'package.json');
115
107
  let bowerPath = path.join(this.path, 'files', 'bower.json');
116
108
 
117
109
  [packagePath, bowerPath].forEach((filePath) => {
118
110
  fs.removeSync(filePath);
119
111
  });
112
+
113
+ if (options.typescript) {
114
+ await this.addAddonToProject({
115
+ name: 'ember-cli-typescript',
116
+ blueprintOptions: { ...options, save: true },
117
+ });
118
+ }
120
119
  },
121
120
 
122
121
  locals(options) {
@@ -142,6 +141,7 @@ module.exports = {
142
141
  options.welcome && '"--welcome"',
143
142
  options.yarn && '"--yarn"',
144
143
  options.ciProvider && `"--ci-provider=${options.ciProvider}"`,
144
+ options.typescript && `"--typescript"`,
145
145
  ]
146
146
  .filter(Boolean)
147
147
  .join(',\n ') +
@@ -164,6 +164,7 @@ module.exports = {
164
164
  embroider: false,
165
165
  lang: options.lang,
166
166
  ciProvider: options.ciProvider,
167
+ typescript: options.typescript,
167
168
  };
168
169
  },
169
170
 
@@ -188,8 +189,7 @@ module.exports = {
188
189
  '^config.*': 'tests/dummy/:path',
189
190
  '^public.*': 'tests/dummy/:path',
190
191
 
191
- '^addon-config/environment.js': 'config/environment.js',
192
- '^addon-config/ember-try.js': 'config/ember-try.js',
192
+ '^addon-config/ember-try.js': 'tests/dummy/config/ember-try.js',
193
193
 
194
194
  '^npmignore': '.npmignore',
195
195
  },
@@ -8,8 +8,8 @@
8
8
  "disableAnalytics": false,
9
9
 
10
10
  /**
11
- Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
12
- rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
11
+ Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
12
+ rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
13
13
  */
14
- "isTypeScriptProject": false
14
+ "isTypeScriptProject": <%= typescript ? 'true' : 'false' %>
15
15
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  module.exports = {
4
4
  root: true,
5
- parser: 'babel-eslint',
5
+ parser: '<%= typescript ? '@typescript-eslint/parser' : 'babel-eslint' %>',
6
6
  parserOptions: {
7
7
  ecmaVersion: 2018,
8
8
  sourceType: 'module',
@@ -10,7 +10,7 @@ module.exports = {
10
10
  legacyDecorators: true,
11
11
  },
12
12
  },
13
- plugins: ['ember'],
13
+ plugins: ['ember'<% if (typescript) { %>, '@typescript-eslint'<% } %>],
14
14
  extends: [
15
15
  'eslint:recommended',
16
16
  'plugin:ember/recommended',
@@ -21,7 +21,16 @@ module.exports = {
21
21
  },
22
22
  rules: {},
23
23
  overrides: [
24
- // node files
24
+ <% if (typescript) { %> // ts files
25
+ {
26
+ files: ['**/*.ts'],
27
+ extends: [
28
+ 'plugin:@typescript-eslint/eslint-recommended',
29
+ 'plugin:@typescript-eslint/recommended',
30
+ ],
31
+ rules: {},
32
+ },
33
+ <% } %> // node files
25
34
  {
26
35
  files: [
27
36
  './.eslintrc.js',
File without changes
@@ -6,4 +6,6 @@ export default class Router extends EmberRouter {
6
6
  rootURL = config.rootURL;
7
7
  }
8
8
 
9
- Router.map(function () {});
9
+ Router.map(function () {<% if (typescript) { %>
10
+ // Add route declarations here
11
+ <% } %>});
@@ -7,6 +7,7 @@ module.exports = function (environment) {
7
7
  rootURL: '/',
8
8
  locationType: 'history',
9
9
  EmberENV: {
10
+ EXTEND_PROTOTYPES: false,
10
11
  FEATURES: {
11
12
  // Here you can enable experimental features on an ember canary build
12
13
  // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
@@ -12,14 +12,15 @@
12
12
  },
13
13
  "scripts": {
14
14
  "build": "ember build --environment=production",
15
- "lint": "npm-run-all --print-name --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
16
- "lint:fix": "npm-run-all --print-name --aggregate-output --continue-on-error --parallel \"lint:*:fix\"",
15
+ "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
16
+ "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
17
17
  "lint:hbs": "ember-template-lint .",
18
18
  "lint:hbs:fix": "ember-template-lint . --fix",
19
19
  "lint:js": "eslint . --cache",
20
- "lint:js:fix": "eslint . --fix",
20
+ "lint:js:fix": "eslint . --fix<% if (typescript) { %>",
21
+ "lint:types": "tsc --noEmit<% } %>",
21
22
  "start": "ember serve",
22
- "test": "npm-run-all --print-name \"lint\" \"test:*\"",
23
+ "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
23
24
  "test:ember": "ember test"
24
25
  },
25
26
  "devDependencies": {
@@ -29,9 +30,12 @@
29
30
  "@embroider/core": "^1.9.0",
30
31
  "@embroider/webpack": "^1.9.0<% } %>",
31
32
  "@glimmer/component": "^1.1.2",
32
- "@glimmer/tracking": "^1.1.2",
33
- "babel-eslint": "^10.1.0",
33
+ "@glimmer/tracking": "^1.1.2<% if (typescript) { %>",
34
+ "@typescript-eslint/eslint-plugin": "^5.40.1",
35
+ "@typescript-eslint/parser": "^5.40.1<% } else { %>",
36
+ "babel-eslint": "^10.1.0<% } %>",
34
37
  "broccoli-asset-rev": "^3.0.0",
38
+ "concurrently": "^7.4.0",
35
39
  "ember-auto-import": "^2.4.3",
36
40
  "ember-cli": "~<%= emberCLIVersion %>",
37
41
  "ember-cli-app-version": "^5.0.0",
@@ -41,13 +45,13 @@
41
45
  "ember-cli-inject-live-reload": "^2.1.0",
42
46
  "ember-cli-sri": "^2.1.1",
43
47
  "ember-cli-terser": "^4.0.2",
44
- "ember-data": "~4.7.3",
48
+ "ember-data": "~4.8.0-beta.0",
45
49
  "ember-fetch": "^8.1.2",
46
50
  "ember-load-initializers": "^2.1.2",
47
51
  "ember-page-title": "^7.0.0",
48
52
  "ember-qunit": "^6.0.0",
49
53
  "ember-resolver": "^8.0.3",
50
- "ember-source": "~4.8.0",
54
+ "ember-source": "~4.9.0-beta.1",
51
55
  "ember-template-lint": "^4.16.1<% if (welcome) { %>",
52
56
  "ember-welcome-page": "^6.2.0<% } %>",
53
57
  "eslint": "^7.32.0",
@@ -57,7 +61,6 @@
57
61
  "eslint-plugin-prettier": "^4.2.1",
58
62
  "eslint-plugin-qunit": "^7.3.1",
59
63
  "loader.js": "^4.7.0",
60
- "npm-run-all": "^4.1.5",
61
64
  "prettier": "^2.7.1",
62
65
  "qunit": "^2.19.2",
63
66
  "qunit-dom": "^2.0.0",
@@ -2,13 +2,14 @@ import {
2
2
  setupApplicationTest as upstreamSetupApplicationTest,
3
3
  setupRenderingTest as upstreamSetupRenderingTest,
4
4
  setupTest as upstreamSetupTest,
5
+ SetupTestOptions,
5
6
  } from 'ember-qunit';
6
7
 
7
8
  // This file exists to provide wrappers around ember-qunit's / ember-mocha's
8
9
  // test setup functions. This way, you can easily extend the setup that is
9
10
  // needed per test type.
10
11
 
11
- function setupApplicationTest(hooks, options) {
12
+ function setupApplicationTest(hooks: NestedHooks, options?: SetupTestOptions) {
12
13
  upstreamSetupApplicationTest(hooks, options);
13
14
 
14
15
  // Additional setup for application tests can be done here.
@@ -27,13 +28,13 @@ function setupApplicationTest(hooks, options) {
27
28
  // setupMirage(hooks); // ember-cli-mirage
28
29
  }
29
30
 
30
- function setupRenderingTest(hooks, options) {
31
+ function setupRenderingTest(hooks: NestedHooks, options?: SetupTestOptions) {
31
32
  upstreamSetupRenderingTest(hooks, options);
32
33
 
33
34
  // Additional setup for rendering tests can be done here.
34
35
  }
35
36
 
36
- function setupTest(hooks, options) {
37
+ function setupTest(hooks: NestedHooks, options?: SetupTestOptions) {
37
38
  upstreamSetupTest(hooks, options);
38
39
 
39
40
  // Additional setup for unit tests can be done here.
@@ -8,6 +8,8 @@ const directoryForPackageName = require('../../lib/utilities/directory-for-packa
8
8
  module.exports = {
9
9
  description: 'The default blueprint for ember-cli projects.',
10
10
 
11
+ shouldTransformTypeScript: true,
12
+
11
13
  filesToRemove: [
12
14
  'app/styles/.gitkeep',
13
15
  'app/templates/.gitkeep',
@@ -37,6 +39,7 @@ module.exports = {
37
39
  options.yarn && '"--yarn"',
38
40
  embroider && '"--embroider"',
39
41
  options.ciProvider && `"--ci-provider=${options.ciProvider}"`,
42
+ options.typescript && `"--typescript"`,
40
43
  ]
41
44
  .filter(Boolean)
42
45
  .join(',\n ') +
@@ -56,6 +59,7 @@ module.exports = {
56
59
  embroider,
57
60
  lang: options.lang,
58
61
  ciProvider: options.ciProvider,
62
+ typescript: options.typescript,
59
63
  };
60
64
  },
61
65
 
@@ -82,4 +86,10 @@ module.exports = {
82
86
  this.ui.writeLine('');
83
87
  this.ui.writeLine(prependEmoji('✨', `Creating a new Ember app in ${chalk.yellow(process.cwd())}:`));
84
88
  },
89
+
90
+ async afterInstall(options) {
91
+ if (options.typescript) {
92
+ await this.addAddonToProject({ name: 'ember-cli-typescript', blueprintOptions: options });
93
+ }
94
+ },
85
95
  };