@ama-sdk/create 10.0.0-next.9 → 11.0.0-next.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/README.md +1 -1
- package/index.js +45 -16
- package/package.json +31 -29
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<h1 align="center">SDK project initializer</h1>
|
|
2
2
|
<p align="center">
|
|
3
|
-
<img src="https://raw.githubusercontent.com/AmadeusITGroup/otter/main
|
|
3
|
+
<img src="https://raw.githubusercontent.com/AmadeusITGroup/otter/main/assets/logo/otter.png" alt="Super cute Otter!" width="40%"/>
|
|
4
4
|
</p>
|
|
5
5
|
|
|
6
6
|
## Create an SDK package
|
package/index.js
CHANGED
|
@@ -8,10 +8,16 @@ const defaultScope = 'sdk';
|
|
|
8
8
|
const binPath = (0, node_path_1.resolve)(require.resolve('@angular-devkit/schematics-cli/package.json'), '../bin/schematics.js');
|
|
9
9
|
const args = process.argv.slice(2);
|
|
10
10
|
const argv = minimist(args);
|
|
11
|
+
const packageManagerEnv = process.env.npm_config_user_agent?.split('/')[0];
|
|
12
|
+
let defaultPackageManager = 'npm';
|
|
13
|
+
if (packageManagerEnv && ['npm', 'yarn'].includes(packageManagerEnv)) {
|
|
14
|
+
defaultPackageManager = packageManagerEnv;
|
|
15
|
+
}
|
|
16
|
+
const packageManager = argv['package-manager'] || defaultPackageManager;
|
|
11
17
|
if (argv._.length < 2) {
|
|
12
18
|
// eslint-disable-next-line no-console
|
|
13
19
|
console.error('The SDK type and project name are mandatory');
|
|
14
|
-
console.info(
|
|
20
|
+
console.info(`usage: ${packageManager} create @ama-sdk typescript <@scope/package>`);
|
|
15
21
|
process.exit(-1);
|
|
16
22
|
}
|
|
17
23
|
const sdkType = argv._[0];
|
|
@@ -32,23 +38,46 @@ const schematicsToRun = [
|
|
|
32
38
|
`${schematicsPackage}:typescript-shell`,
|
|
33
39
|
...(argv['spec-path'] ? [`${schematicsPackage}:typescript-core`] : [])
|
|
34
40
|
];
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
const getYarnVersion = () => {
|
|
42
|
+
try {
|
|
43
|
+
return (0, node_child_process_1.execSync)('yarn --version', {
|
|
44
|
+
encoding: 'utf8',
|
|
45
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
46
|
+
env: {
|
|
47
|
+
...process.env,
|
|
48
|
+
// NPM updater notifier will prevents the child process from closing until it timeout after 3 minutes.
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
50
|
+
NO_UPDATE_NOTIFIER: '1',
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
52
|
+
NPM_CONFIG_UPDATE_NOTIFIER: 'false'
|
|
53
|
+
}
|
|
54
|
+
}).trim();
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return 'latest';
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const schematicArgs = [
|
|
61
|
+
argv.debug !== undefined ? `--debug=${argv.debug}` : '--debug=false',
|
|
62
|
+
'--name', name,
|
|
63
|
+
'--package', pck,
|
|
64
|
+
'--package-manager', packageManager,
|
|
65
|
+
'--directory', targetDirectory,
|
|
66
|
+
...(argv['spec-path'] ? ['--spec-path', argv['spec-path']] : [])
|
|
67
|
+
];
|
|
68
|
+
const getSchematicStepInfo = (schematic) => ({
|
|
69
|
+
args: [binPath, schematic, ...schematicArgs]
|
|
70
|
+
});
|
|
41
71
|
const run = () => {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
'
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
...(argv['spec-path'] ? ['--spec-path', argv['spec-path']] : [])
|
|
72
|
+
const steps = [
|
|
73
|
+
getSchematicStepInfo(schematicsToRun[0]),
|
|
74
|
+
...(packageManager === 'yarn'
|
|
75
|
+
? [{ args: ['yarn', 'set', 'version', getYarnVersion()], cwd: (0, node_path_1.resolve)(process.cwd(), targetDirectory) }]
|
|
76
|
+
: []),
|
|
77
|
+
...schematicsToRun.slice(1).map(getSchematicStepInfo)
|
|
49
78
|
];
|
|
50
|
-
const errors =
|
|
51
|
-
.map((
|
|
79
|
+
const errors = steps
|
|
80
|
+
.map((step) => (0, node_child_process_1.spawnSync)(process.execPath, step.args, { stdio: 'inherit', cwd: step.cwd || process.cwd() }))
|
|
52
81
|
.map(({ error }) => error)
|
|
53
82
|
.filter((err) => !!err);
|
|
54
83
|
if (errors.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ama-sdk/create",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-next.0",
|
|
4
4
|
"description": "Create a new SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"create"
|
|
@@ -14,54 +14,55 @@
|
|
|
14
14
|
"prepare:publish": "prepare-publish ./dist"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ama-sdk/core": "^
|
|
18
|
-
"@ama-sdk/schematics": "^
|
|
19
|
-
"@angular-devkit/core": "~
|
|
20
|
-
"@angular-devkit/schematics": "~
|
|
21
|
-
"@angular-devkit/schematics-cli": "~
|
|
17
|
+
"@ama-sdk/core": "^11.0.0-next.0",
|
|
18
|
+
"@ama-sdk/schematics": "^11.0.0-next.0",
|
|
19
|
+
"@angular-devkit/core": "~17.0.3",
|
|
20
|
+
"@angular-devkit/schematics": "~17.0.3",
|
|
21
|
+
"@angular-devkit/schematics-cli": "~17.0.3",
|
|
22
22
|
"@openapitools/openapi-generator-cli": "~2.7.0",
|
|
23
|
-
"@schematics/angular": "~
|
|
23
|
+
"@schematics/angular": "~17.0.3",
|
|
24
24
|
"minimist": "^1.2.6",
|
|
25
|
-
"typescript": "~5.
|
|
25
|
+
"typescript": "~5.2.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@angular-eslint/eslint-plugin": "~
|
|
29
|
-
"@angular-eslint/eslint-plugin-template": "~
|
|
30
|
-
"@nx/
|
|
31
|
-
"@nx/
|
|
32
|
-
"@nx/
|
|
33
|
-
"@
|
|
34
|
-
"@o3r/
|
|
35
|
-
"@o3r/eslint-config-otter": "^
|
|
36
|
-
"@o3r/eslint-plugin": "^
|
|
37
|
-
"@o3r/test-helpers": "^
|
|
28
|
+
"@angular-eslint/eslint-plugin": "~17.1.0",
|
|
29
|
+
"@angular-eslint/eslint-plugin-template": "~17.1.0",
|
|
30
|
+
"@nx/eslint": "~17.1.1",
|
|
31
|
+
"@nx/eslint-plugin": "~17.1.1",
|
|
32
|
+
"@nx/jest": "~17.1.1",
|
|
33
|
+
"@nx/js": "~17.1.1",
|
|
34
|
+
"@o3r/build-helpers": "^11.0.0-next.0",
|
|
35
|
+
"@o3r/eslint-config-otter": "^11.0.0-next.0",
|
|
36
|
+
"@o3r/eslint-plugin": "^11.0.0-next.0",
|
|
37
|
+
"@o3r/test-helpers": "^11.0.0-next.0",
|
|
38
38
|
"@types/jest": "~29.5.2",
|
|
39
39
|
"@types/minimist": "^1.2.2",
|
|
40
|
-
"@types/node": "^
|
|
40
|
+
"@types/node": "^20.0.0",
|
|
41
41
|
"@types/pid-from-port": "^1.1.0",
|
|
42
42
|
"@types/semver": "^7.3.13",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "
|
|
44
|
-
"@typescript-eslint/parser": "^
|
|
45
|
-
"cpy-cli": "^
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "6.11.0",
|
|
44
|
+
"@typescript-eslint/parser": "^6.11.0",
|
|
45
|
+
"cpy-cli": "^5.0.0",
|
|
46
46
|
"eslint": "^8.42.0",
|
|
47
47
|
"eslint-import-resolver-node": "^0.3.4",
|
|
48
|
-
"eslint-plugin-jest": "~27.
|
|
49
|
-
"eslint-plugin-jsdoc": "~
|
|
48
|
+
"eslint-plugin-jest": "~27.6.0",
|
|
49
|
+
"eslint-plugin-jsdoc": "~48.0.0",
|
|
50
50
|
"eslint-plugin-prefer-arrow": "~1.2.3",
|
|
51
|
-
"eslint-plugin-unicorn": "^
|
|
51
|
+
"eslint-plugin-unicorn": "^50.0.0",
|
|
52
52
|
"jest": "~29.7.0",
|
|
53
53
|
"jest-junit": "~16.0.0",
|
|
54
|
-
"
|
|
54
|
+
"jsonc-eslint-parser": "~2.4.0",
|
|
55
|
+
"nx": "~17.1.1",
|
|
55
56
|
"pid-from-port": "^1.1.3",
|
|
56
57
|
"rimraf": "^5.0.1",
|
|
57
58
|
"rxjs": "^7.8.1",
|
|
58
59
|
"semver": "^7.5.2",
|
|
59
60
|
"ts-jest": "~29.1.1",
|
|
60
61
|
"tslib": "^2.5.3",
|
|
61
|
-
"type-fest": "^3.
|
|
62
|
+
"type-fest": "^4.3.1"
|
|
62
63
|
},
|
|
63
64
|
"engines": {
|
|
64
|
-
"node": ">=
|
|
65
|
+
"node": ">=18.0.0"
|
|
65
66
|
},
|
|
66
67
|
"contributors": [
|
|
67
68
|
{
|
|
@@ -126,5 +127,6 @@
|
|
|
126
127
|
],
|
|
127
128
|
"bugs": "https://github.com/AmadeusITGroup/otter/issues",
|
|
128
129
|
"repository": "https://github.com/AmadeusITGroup/otter",
|
|
129
|
-
"license": "BSD-3-Clause"
|
|
130
|
+
"license": "BSD-3-Clause",
|
|
131
|
+
"homepage": "https://amadeusitgroup.github.io/otter/"
|
|
130
132
|
}
|