@ember-tooling/classic-build-addon-blueprint 0.0.0 → 6.7.0-alpha.3
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/additional-package.json +19 -0
- package/files/.github/workflows/ci.yml +87 -0
- package/files/CONTRIBUTING.md +25 -0
- package/files/LICENSE.md +9 -0
- package/files/README.md +27 -0
- package/files/addon/.gitkeep +0 -0
- package/files/app/.gitkeep +0 -0
- package/files/config/ember-try.js +54 -0
- package/files/config/optional-features.json +6 -0
- package/files/ember-cli-build.js +27 -0
- package/files/index.js +9 -0
- package/files/npmignore +28 -0
- package/files/tsconfig.declarations.json +10 -0
- package/files/tsconfig.json +22 -0
- package/index.js +319 -0
- package/package.json +26 -6
|
@@ -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": "^4.0.0",
|
|
10
|
+
"ember-source-channel-url": "^3.0.0",
|
|
11
|
+
"ember-try": "^4.0.0"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"ember-source": ">= 4.0.0"
|
|
15
|
+
},
|
|
16
|
+
"ember-addon": {
|
|
17
|
+
"configPath": "tests/dummy/config"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- master
|
|
8
|
+
pull_request: {}
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ci-${{ github.head_ref || github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
name: "Tests"
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
timeout-minutes: 10
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v3<% if (pnpm) { %>
|
|
22
|
+
- uses: pnpm/action-setup@v4
|
|
23
|
+
with:
|
|
24
|
+
version: 9<% } %>
|
|
25
|
+
- name: Install Node
|
|
26
|
+
uses: actions/setup-node@v3
|
|
27
|
+
with:
|
|
28
|
+
node-version: 18
|
|
29
|
+
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
|
|
30
|
+
- name: Install Dependencies
|
|
31
|
+
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
|
|
32
|
+
- name: Lint
|
|
33
|
+
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm run' %> lint
|
|
34
|
+
- name: Run Tests
|
|
35
|
+
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm run' %> test:ember
|
|
36
|
+
|
|
37
|
+
floating:
|
|
38
|
+
name: "Floating Dependencies"
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
timeout-minutes: 10
|
|
41
|
+
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v3<% if (pnpm) { %>
|
|
44
|
+
- uses: pnpm/action-setup@v4
|
|
45
|
+
with:
|
|
46
|
+
version: 9<% } %>
|
|
47
|
+
- uses: actions/setup-node@v3
|
|
48
|
+
with:
|
|
49
|
+
node-version: 18
|
|
50
|
+
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
|
|
51
|
+
- name: Install Dependencies
|
|
52
|
+
run: <%= pnpm ? 'pnpm install --no-lockfile' : yarn ? 'yarn install --no-lockfile' : 'npm install --no-shrinkwrap' %>
|
|
53
|
+
- name: Run Tests
|
|
54
|
+
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm run' %> test:ember
|
|
55
|
+
|
|
56
|
+
try-scenarios:
|
|
57
|
+
name: ${{ matrix.try-scenario }}
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
needs: "test"
|
|
60
|
+
timeout-minutes: 10
|
|
61
|
+
|
|
62
|
+
strategy:
|
|
63
|
+
fail-fast: false
|
|
64
|
+
matrix:
|
|
65
|
+
try-scenario:
|
|
66
|
+
- ember-lts-5.8
|
|
67
|
+
- ember-lts-5.12
|
|
68
|
+
- ember-release
|
|
69
|
+
- ember-beta
|
|
70
|
+
- ember-canary
|
|
71
|
+
- embroider-safe
|
|
72
|
+
- embroider-optimized
|
|
73
|
+
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/checkout@v3<% if (pnpm) { %>
|
|
76
|
+
- uses: pnpm/action-setup@v4
|
|
77
|
+
with:
|
|
78
|
+
version: 9<% } %>
|
|
79
|
+
- name: Install Node
|
|
80
|
+
uses: actions/setup-node@v3
|
|
81
|
+
with:
|
|
82
|
+
node-version: 18
|
|
83
|
+
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
|
|
84
|
+
- name: Install Dependencies
|
|
85
|
+
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
|
|
86
|
+
- name: Run Tests
|
|
87
|
+
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# How To Contribute
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
- `git clone <repository-url>`
|
|
6
|
+
- `cd <%= addonDirectory %>`
|
|
7
|
+
- `<% if (pnpm) { %>pnpm<% } else if (yarn) { %>yarn<% } else { %>npm<% } %> install`
|
|
8
|
+
|
|
9
|
+
## Linting
|
|
10
|
+
|
|
11
|
+
- `<%= invokeScriptPrefix %> lint`
|
|
12
|
+
- `<%= invokeScriptPrefix %> lint:fix`
|
|
13
|
+
|
|
14
|
+
## Running tests
|
|
15
|
+
|
|
16
|
+
- `<%= invokeScriptPrefix %> test` – Runs the test suite on the current Ember version
|
|
17
|
+
- `<%= invokeScriptPrefix %> test:ember <% if (npm) { %>-- <% } %>--server` – Runs the test suite in "watch mode"
|
|
18
|
+
- `<%= invokeScriptPrefix %> test:ember-compatibility` – Runs the test suite against multiple Ember versions
|
|
19
|
+
|
|
20
|
+
## Running the dummy application
|
|
21
|
+
|
|
22
|
+
- `<%= invokeScriptPrefix %> start`
|
|
23
|
+
- Visit the dummy application at [http://localhost:4200](http://localhost:4200).
|
|
24
|
+
|
|
25
|
+
For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
|
package/files/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) <%= year %>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/files/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# <%= addonName %>
|
|
2
|
+
|
|
3
|
+
[Short description of the addon.]
|
|
4
|
+
|
|
5
|
+
## Compatibility
|
|
6
|
+
|
|
7
|
+
- Ember.js v5.8 or above
|
|
8
|
+
- Ember CLI v5.8 or above
|
|
9
|
+
- Node.js v18 or above
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
ember install <%= addonName %>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
[Longer description of how to use the addon in apps.]
|
|
20
|
+
|
|
21
|
+
## Contributing
|
|
22
|
+
|
|
23
|
+
See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
This project is licensed under the [MIT License](LICENSE.md).
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getChannelURL = require('ember-source-channel-url');
|
|
4
|
+
const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');
|
|
5
|
+
|
|
6
|
+
module.exports = async function () {
|
|
7
|
+
return {
|
|
8
|
+
packageManager: '<%= packageManager %>',
|
|
9
|
+
scenarios: [
|
|
10
|
+
{
|
|
11
|
+
name: 'ember-lts-5.8',
|
|
12
|
+
npm: {
|
|
13
|
+
devDependencies: {
|
|
14
|
+
'ember-source': '~5.8.0',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'ember-lts-5.12',
|
|
20
|
+
npm: {
|
|
21
|
+
devDependencies: {
|
|
22
|
+
'ember-source': '~5.12.0',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'ember-release',
|
|
28
|
+
npm: {
|
|
29
|
+
devDependencies: {
|
|
30
|
+
'ember-source': await getChannelURL('release'),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'ember-beta',
|
|
36
|
+
npm: {
|
|
37
|
+
devDependencies: {
|
|
38
|
+
'ember-source': await getChannelURL('beta'),
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'ember-canary',
|
|
44
|
+
npm: {
|
|
45
|
+
devDependencies: {
|
|
46
|
+
'ember-source': await getChannelURL('canary'),
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
embroiderSafe(),
|
|
51
|
+
embroiderOptimized(),
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
|
|
4
|
+
|
|
5
|
+
module.exports = function (defaults) {
|
|
6
|
+
const app = new EmberAddon(defaults, {
|
|
7
|
+
<% if (typescript) {%>'ember-cli-babel': { enableTypeScriptTransform: true },
|
|
8
|
+
|
|
9
|
+
<% } %>// Add options here
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
This build file specifies the options for the dummy test app of this
|
|
14
|
+
addon, located in `/tests/dummy`
|
|
15
|
+
This build file does *not* influence how the addon or the app using it
|
|
16
|
+
behave. You most likely want to be modifying `./index.js` or app's build file
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const { maybeEmbroider } = require('@embroider/test-setup');
|
|
20
|
+
return maybeEmbroider(app, {
|
|
21
|
+
skipBabel: [
|
|
22
|
+
{
|
|
23
|
+
package: 'qunit',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
};
|
package/files/index.js
ADDED
package/files/npmignore
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# compiled output
|
|
2
|
+
/dist/
|
|
3
|
+
/tmp/
|
|
4
|
+
|
|
5
|
+
# misc
|
|
6
|
+
/.editorconfig
|
|
7
|
+
/.ember-cli
|
|
8
|
+
/.env*
|
|
9
|
+
/.eslintcache
|
|
10
|
+
/.git/
|
|
11
|
+
/.github/
|
|
12
|
+
/.gitignore
|
|
13
|
+
/.prettierignore
|
|
14
|
+
/.prettierrc.js
|
|
15
|
+
/.stylelintignore
|
|
16
|
+
/.stylelintrc.js
|
|
17
|
+
/.template-lintrc.js
|
|
18
|
+
/.watchmanconfig
|
|
19
|
+
/CONTRIBUTING.md
|
|
20
|
+
/ember-cli-build.js
|
|
21
|
+
/eslint.config.mjs
|
|
22
|
+
/testem.js
|
|
23
|
+
/tests/
|
|
24
|
+
/tsconfig.declarations.json
|
|
25
|
+
/tsconfig.json
|
|
26
|
+
/yarn-error.log
|
|
27
|
+
/yarn.lock
|
|
28
|
+
.gitkeep
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsconfig/ember/tsconfig.json",
|
|
3
|
+
"glint": {
|
|
4
|
+
"environment": ["ember-loose", "ember-template-imports"]
|
|
5
|
+
},
|
|
6
|
+
"compilerOptions": {
|
|
7
|
+
// The combination of `baseUrl` with `paths` allows Ember's classic package
|
|
8
|
+
// layout, which is not resolvable with the Node resolution algorithm, to
|
|
9
|
+
// work with TypeScript.
|
|
10
|
+
"baseUrl": ".",
|
|
11
|
+
"paths": {
|
|
12
|
+
"dummy/tests/*": ["tests/*"],
|
|
13
|
+
"dummy/*": ["tests/dummy/app/*", "app/*"],
|
|
14
|
+
"<%= addonName %>": ["addon"],
|
|
15
|
+
"<%= addonName %>/*": ["addon/*"],
|
|
16
|
+
"<%= addonName %>/test-support": ["addon-test-support"],
|
|
17
|
+
"<%= addonName %>/test-support/*": ["addon-test-support/*"],
|
|
18
|
+
"*": ["types/*"]
|
|
19
|
+
},
|
|
20
|
+
"types": ["ember-source/types"]
|
|
21
|
+
}
|
|
22
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const walkSync = require('walk-sync');
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
const stringUtil = require('ember-cli-string-utils');
|
|
8
|
+
const merge = require('lodash/merge');
|
|
9
|
+
const uniq = require('lodash/uniq');
|
|
10
|
+
const SilentError = require('silent-error');
|
|
11
|
+
const { sortPackageJson } = require('sort-package-json');
|
|
12
|
+
|
|
13
|
+
let date = new Date();
|
|
14
|
+
|
|
15
|
+
const normalizeEntityName = require('ember-cli-normalize-entity-name');
|
|
16
|
+
|
|
17
|
+
const directoryForPackageName = require('@ember-tooling/blueprint-model/utilities/directory-for-package-name');
|
|
18
|
+
const FileInfo = require('@ember-tooling/blueprint-model/utilities/file-info');
|
|
19
|
+
|
|
20
|
+
const blueprintVersion = require('./package.json').version;
|
|
21
|
+
|
|
22
|
+
function stringifyAndNormalize(contents) {
|
|
23
|
+
return `${JSON.stringify(contents, null, 2)}\n`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const replacers = {
|
|
27
|
+
'package.json'(content) {
|
|
28
|
+
return this.updatePackageJson(content);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const ADDITIONAL_PACKAGE = require('./additional-package.json');
|
|
33
|
+
|
|
34
|
+
const description = 'The default blueprint for ember-cli addons.';
|
|
35
|
+
module.exports = {
|
|
36
|
+
description,
|
|
37
|
+
appBlueprintName: 'app',
|
|
38
|
+
|
|
39
|
+
shouldTransformTypeScript: true,
|
|
40
|
+
|
|
41
|
+
filesToRemove: [
|
|
42
|
+
'tests/dummy/app/styles/.gitkeep',
|
|
43
|
+
'tests/dummy/app/templates/.gitkeep',
|
|
44
|
+
'tests/dummy/app/views/.gitkeep',
|
|
45
|
+
'tests/dummy/public/.gitkeep',
|
|
46
|
+
'Brocfile.js',
|
|
47
|
+
'testem.json',
|
|
48
|
+
],
|
|
49
|
+
|
|
50
|
+
updatePackageJson(content) {
|
|
51
|
+
let contents = JSON.parse(content);
|
|
52
|
+
|
|
53
|
+
contents.name = stringUtil.dasherize(this.options.entity.name);
|
|
54
|
+
contents.description = this.description;
|
|
55
|
+
|
|
56
|
+
delete contents.private;
|
|
57
|
+
|
|
58
|
+
contents.dependencies = contents.dependencies || {};
|
|
59
|
+
contents.devDependencies = contents.devDependencies || {};
|
|
60
|
+
|
|
61
|
+
// npm doesn't like it when we have something in both deps and devDeps
|
|
62
|
+
// and dummy app still uses it when in deps
|
|
63
|
+
contents.dependencies['ember-cli-babel'] = contents.devDependencies['ember-cli-babel'];
|
|
64
|
+
delete contents.devDependencies['ember-cli-babel'];
|
|
65
|
+
|
|
66
|
+
// Addons must bring in their own version of `@babel/core` when using
|
|
67
|
+
// `ember-cli-babel` >= v8. More info:
|
|
68
|
+
// https://github.com/babel/ember-cli-babel/blob/master/UPGRADING.md#upgrade-path-for-addons
|
|
69
|
+
contents.dependencies['@babel/core'] = contents.devDependencies['@babel/core'];
|
|
70
|
+
delete contents.devDependencies['@babel/core'];
|
|
71
|
+
|
|
72
|
+
// Move ember-cli-htmlbars into the dependencies of the addon blueprint by default
|
|
73
|
+
// to prevent error:
|
|
74
|
+
// `Addon templates were detected but there are no template compilers registered for (addon-name)`
|
|
75
|
+
contents.dependencies['ember-cli-htmlbars'] = contents.devDependencies['ember-cli-htmlbars'];
|
|
76
|
+
delete contents.devDependencies['ember-cli-htmlbars'];
|
|
77
|
+
|
|
78
|
+
contents.dependencies['ember-template-imports'] = contents.devDependencies['ember-template-imports'];
|
|
79
|
+
delete contents.devDependencies['ember-template-imports'];
|
|
80
|
+
|
|
81
|
+
// 95% of addons don't need ember-data or ember-fetch, make them opt-in instead
|
|
82
|
+
let deps = Object.keys(contents.devDependencies);
|
|
83
|
+
for (let depName of deps) {
|
|
84
|
+
if (depName.includes('ember-data') || depName.includes('warp-drive')) {
|
|
85
|
+
delete contents.devDependencies[depName];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Per RFC #811, addons should not have this dependency.
|
|
90
|
+
// @see https://github.com/emberjs/rfcs/blob/master/text/0811-element-modifiers.md#detailed-design
|
|
91
|
+
delete contents.devDependencies['ember-modifier'];
|
|
92
|
+
|
|
93
|
+
// Per RFC #812, addons should not have this dependency.
|
|
94
|
+
// @see https://github.com/emberjs/rfcs/blob/master/text/0812-tracked-built-ins.md#detailed-design
|
|
95
|
+
delete contents.devDependencies['tracked-built-ins'];
|
|
96
|
+
|
|
97
|
+
// 100% of addons don't need ember-cli-app-version, make it opt-in instead
|
|
98
|
+
delete contents.devDependencies['ember-cli-app-version'];
|
|
99
|
+
|
|
100
|
+
// add scripts to build type declarations for TypeScript addons
|
|
101
|
+
if (this.options.typescript) {
|
|
102
|
+
contents.devDependencies.rimraf = '^5.0.10';
|
|
103
|
+
|
|
104
|
+
contents.scripts.prepack = 'tsc --project tsconfig.declarations.json';
|
|
105
|
+
contents.scripts.postpack = 'rimraf declarations';
|
|
106
|
+
|
|
107
|
+
contents.typesVersions = {
|
|
108
|
+
'*': {
|
|
109
|
+
'test-support': ['declarations/addon-test-support/index.d.ts'],
|
|
110
|
+
'test-support/*': ['declarations/addon-test-support/*', 'declarations/addon-test-support/*/index.d.ts'],
|
|
111
|
+
'*': ['declarations/addon/*', 'declarations/addon/*/index.d.ts'],
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
merge(contents, ADDITIONAL_PACKAGE);
|
|
117
|
+
|
|
118
|
+
return stringifyAndNormalize(sortPackageJson(contents));
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @override
|
|
123
|
+
*
|
|
124
|
+
* This modification of buildFileInfo allows our differing
|
|
125
|
+
* input files to output to a single file, depending on the options.
|
|
126
|
+
* For example:
|
|
127
|
+
*
|
|
128
|
+
* for javascript,
|
|
129
|
+
* _ts_eslint.config.mjs is deleted
|
|
130
|
+
* _js_eslint.config.mjs is renamed to eslint.config.mjs
|
|
131
|
+
*
|
|
132
|
+
* for typescript,
|
|
133
|
+
* _js_eslint.config.mjs is deleted
|
|
134
|
+
* _ts_eslint.config.mjs is renamed to eslint.config.mjs
|
|
135
|
+
*/
|
|
136
|
+
buildFileInfo(intoDir, templateVariables, file, commandOptions) {
|
|
137
|
+
if (file.startsWith('_js_') || file.startsWith('_ts_')) {
|
|
138
|
+
let fileInfo = this._super.buildFileInfo.apply(this, arguments);
|
|
139
|
+
|
|
140
|
+
if (file.includes('_js_')) {
|
|
141
|
+
if (commandOptions.typescript) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
fileInfo.outputBasePath = fileInfo.outputPath.replace('_js_', '');
|
|
146
|
+
fileInfo.outputPath = fileInfo.outputPath.replace('_js_', '');
|
|
147
|
+
fileInfo.displayPath = fileInfo.outputPath.replace('_js_', '');
|
|
148
|
+
return fileInfo;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (file.includes('_ts_')) {
|
|
152
|
+
if (!commandOptions.typescript) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
fileInfo.outputBasePath = fileInfo.outputPath.replace('_ts_', '');
|
|
157
|
+
fileInfo.outputPath = fileInfo.outputPath.replace('_ts_', '');
|
|
158
|
+
fileInfo.displayPath = fileInfo.outputPath.replace('_ts_', '');
|
|
159
|
+
return fileInfo;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return fileInfo;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
let mappedPath = this.mapFile(file, templateVariables);
|
|
166
|
+
let options = {
|
|
167
|
+
action: 'write',
|
|
168
|
+
outputBasePath: path.normalize(intoDir),
|
|
169
|
+
outputPath: path.join(intoDir, mappedPath),
|
|
170
|
+
displayPath: path.normalize(mappedPath),
|
|
171
|
+
inputPath: this.srcPath(file),
|
|
172
|
+
templateVariables,
|
|
173
|
+
ui: this.ui,
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
if (file in replacers) {
|
|
177
|
+
options.replacer = replacers[file].bind(this);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return new FileInfo(options);
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
beforeInstall() {
|
|
184
|
+
const prependEmoji = require('@ember-tooling/blueprint-model/utilities/prepend-emoji');
|
|
185
|
+
|
|
186
|
+
this.ui.writeLine(chalk.blue(`@ember-tooling/classic-build-addon-blueprint v${blueprintVersion}`));
|
|
187
|
+
this.ui.writeLine('');
|
|
188
|
+
this.ui.writeLine(prependEmoji('✨', `Creating a new Ember addon in ${chalk.yellow(process.cwd())}:`));
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
locals(options) {
|
|
192
|
+
let entity = { name: 'dummy' };
|
|
193
|
+
let rawName = entity.name;
|
|
194
|
+
let name = stringUtil.dasherize(rawName);
|
|
195
|
+
let namespace = stringUtil.classify(rawName);
|
|
196
|
+
|
|
197
|
+
let addonEntity = options.entity;
|
|
198
|
+
let addonRawName = addonEntity.name;
|
|
199
|
+
let addonName = stringUtil.dasherize(addonRawName);
|
|
200
|
+
let addonNamespace = stringUtil.classify(addonRawName);
|
|
201
|
+
|
|
202
|
+
let hasOptions = options.welcome || options.packageManager || options.ciProvider;
|
|
203
|
+
let blueprintOptions = '';
|
|
204
|
+
if (hasOptions) {
|
|
205
|
+
let indent = `\n `;
|
|
206
|
+
let outdent = `\n `;
|
|
207
|
+
|
|
208
|
+
blueprintOptions =
|
|
209
|
+
indent +
|
|
210
|
+
[
|
|
211
|
+
options.welcome && '"--welcome"',
|
|
212
|
+
options.packageManager === 'yarn' && '"--yarn"',
|
|
213
|
+
options.packageManager === 'pnpm' && '"--pnpm"',
|
|
214
|
+
options.ciProvider && `"--ci-provider=${options.ciProvider}"`,
|
|
215
|
+
options.typescript && `"--typescript"`,
|
|
216
|
+
]
|
|
217
|
+
.filter(Boolean)
|
|
218
|
+
.join(',\n ') +
|
|
219
|
+
outdent;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
let invokeScriptPrefix = 'npm run';
|
|
223
|
+
|
|
224
|
+
if (options.packageManager === 'yarn') {
|
|
225
|
+
invokeScriptPrefix = 'yarn';
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (options.packageManager === 'pnpm') {
|
|
229
|
+
invokeScriptPrefix = 'pnpm';
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
addonDirectory: directoryForPackageName(addonName),
|
|
234
|
+
name,
|
|
235
|
+
modulePrefix: name,
|
|
236
|
+
namespace,
|
|
237
|
+
addonName,
|
|
238
|
+
addonNamespace,
|
|
239
|
+
blueprintVersion,
|
|
240
|
+
year: date.getFullYear(),
|
|
241
|
+
yarn: options.packageManager === 'yarn',
|
|
242
|
+
pnpm: options.packageManager === 'pnpm',
|
|
243
|
+
npm: options.packageManager !== 'yarn' && options.packageManager !== 'pnpm',
|
|
244
|
+
invokeScriptPrefix,
|
|
245
|
+
welcome: options.welcome,
|
|
246
|
+
blueprint: 'addon',
|
|
247
|
+
blueprintOptions,
|
|
248
|
+
embroider: false,
|
|
249
|
+
lang: options.lang,
|
|
250
|
+
emberData: options.emberData,
|
|
251
|
+
ciProvider: options.ciProvider,
|
|
252
|
+
typescript: options.typescript,
|
|
253
|
+
strict: options.strict,
|
|
254
|
+
packageManager: options.packageManager ?? 'npm',
|
|
255
|
+
};
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
files(options) {
|
|
259
|
+
let appFiles = this.lookupBlueprint(this.appBlueprintName).files(options);
|
|
260
|
+
let addonFilesPath = this.filesPath(this.options);
|
|
261
|
+
let ignore = [];
|
|
262
|
+
|
|
263
|
+
if (this.options.ciProvider !== 'github') {
|
|
264
|
+
ignore.push('.github');
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
let addonFiles = walkSync(addonFilesPath, { ignore });
|
|
268
|
+
|
|
269
|
+
if (options.packageManager !== 'pnpm') {
|
|
270
|
+
addonFiles = addonFiles.filter((file) => !file.endsWith('.npmrc'));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (!options.typescript) {
|
|
274
|
+
addonFiles = addonFiles.filter((file) => !file.startsWith('tsconfig.') && !file.endsWith('.d.ts'));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return uniq(appFiles.concat(addonFiles));
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
mapFile() {
|
|
281
|
+
let result = this._super.mapFile.apply(this, arguments);
|
|
282
|
+
return this.fileMapper(result);
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
fileMap: {
|
|
286
|
+
'^app/.gitkeep': 'app/.gitkeep',
|
|
287
|
+
'^app.*': 'tests/dummy/:path',
|
|
288
|
+
'^config.*': 'tests/dummy/:path',
|
|
289
|
+
'^public.*': 'tests/dummy/:path',
|
|
290
|
+
|
|
291
|
+
'^npmignore': '.npmignore',
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
fileMapper(path) {
|
|
295
|
+
for (let pattern in this.fileMap) {
|
|
296
|
+
if (new RegExp(pattern).test(path)) {
|
|
297
|
+
return this.fileMap[pattern].replace(':path', path);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return path;
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
normalizeEntityName(entityName) {
|
|
305
|
+
entityName = normalizeEntityName(entityName);
|
|
306
|
+
|
|
307
|
+
if (this.project.isEmberCLIProject() && !this.project.isEmberCLIAddon()) {
|
|
308
|
+
throw new SilentError('Generating an addon in an existing ember-cli project is not supported.');
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return entityName;
|
|
312
|
+
},
|
|
313
|
+
|
|
314
|
+
srcPath(file) {
|
|
315
|
+
let path = `${this.path}/files/${file}`;
|
|
316
|
+
let superPath = `${this.lookupBlueprint(this.appBlueprintName).path}/files/${file}`;
|
|
317
|
+
return fs.existsSync(path) ? path : superPath;
|
|
318
|
+
},
|
|
319
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-tooling/classic-build-addon-blueprint",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
3
|
+
"version": "6.7.0-alpha.3",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/ember-cli/ember-cli.git",
|
|
7
|
+
"directory": "packages/addon-blueprint"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"chalk": "^4.1.2",
|
|
11
|
+
"ember-cli-normalize-entity-name": "^1.0.0",
|
|
12
|
+
"ember-cli-string-utils": "^1.1.0",
|
|
13
|
+
"fs-extra": "^11.3.0",
|
|
14
|
+
"lodash": "^4.17.21",
|
|
15
|
+
"silent-error": "^1.1.1",
|
|
16
|
+
"sort-package-json": "^2.12.0",
|
|
17
|
+
"walk-sync": "^3.0.0",
|
|
18
|
+
"@ember-tooling/blueprint-model": "0.0.2"
|
|
19
|
+
},
|
|
20
|
+
"release-plan": {
|
|
21
|
+
"semverIncrementAs": {
|
|
22
|
+
"minor": "prerelease",
|
|
23
|
+
"patch": "prerelease"
|
|
24
|
+
},
|
|
25
|
+
"semverIncrementTag": "alpha",
|
|
26
|
+
"publishTag": "alpha"
|
|
27
|
+
}
|
|
28
|
+
}
|