@o3r/workspace 9.4.0-alpha.26
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/LICENSE +26 -0
- package/README.md +42 -0
- package/builders.json +6 -0
- package/collection.json +35 -0
- package/migration.json +6 -0
- package/package.json +188 -0
- package/schematics/application/index.d.ts +8 -0
- package/schematics/application/index.d.ts.map +1 -0
- package/schematics/application/index.js +68 -0
- package/schematics/application/index.js.map +1 -0
- package/schematics/application/schema.d.ts +14 -0
- package/schematics/application/schema.d.ts.map +1 -0
- package/schematics/application/schema.js +3 -0
- package/schematics/application/schema.js.map +1 -0
- package/schematics/application/schema.json +38 -0
- package/schematics/application/templates/package.json.template +29 -0
- package/schematics/library/index.d.ts +8 -0
- package/schematics/library/index.d.ts.map +1 -0
- package/schematics/library/index.js +40 -0
- package/schematics/library/index.js.map +1 -0
- package/schematics/library/rules/rules.ng.d.ts +12 -0
- package/schematics/library/rules/rules.ng.d.ts.map +1 -0
- package/schematics/library/rules/rules.ng.js +123 -0
- package/schematics/library/rules/rules.ng.js.map +1 -0
- package/schematics/library/rules/rules.nx.d.ts +12 -0
- package/schematics/library/rules/rules.nx.d.ts.map +1 -0
- package/schematics/library/rules/rules.nx.js +127 -0
- package/schematics/library/rules/rules.nx.js.map +1 -0
- package/schematics/library/rules/shared.d.ts +19 -0
- package/schematics/library/rules/shared.d.ts.map +1 -0
- package/schematics/library/rules/shared.js +84 -0
- package/schematics/library/rules/shared.js.map +1 -0
- package/schematics/library/schema.d.ts +18 -0
- package/schematics/library/schema.d.ts.map +1 -0
- package/schematics/library/schema.js +3 -0
- package/schematics/library/schema.js.map +1 -0
- package/schematics/library/schema.json +42 -0
- package/schematics/library/templates/ng/.eslintrc.js.template +19 -0
- package/schematics/library/templates/ng/.gitignore.template +2 -0
- package/schematics/library/templates/ng/.npmignore.template +0 -0
- package/schematics/library/templates/ng/jest.config.js.template +37 -0
- package/schematics/library/templates/ng/testing/setup-jest.ts.template +2 -0
- package/schematics/library/templates/ng/tsconfig.builders.json.template +22 -0
- package/schematics/library/templates/ng/tsconfig.eslint.json.template +8 -0
- package/schematics/library/templates/ng/tsconfig.json.template +12 -0
- package/schematics/library/templates/ng/tsconfig.spec.json.template +17 -0
- package/schematics/library/templates/nx/.eslintrc.js.template +19 -0
- package/schematics/library/templates/nx/.gitignore.template +2 -0
- package/schematics/library/templates/nx/.npmignore.template +0 -0
- package/schematics/library/templates/nx/jest.config.js.template +37 -0
- package/schematics/library/templates/nx/project.json.template +66 -0
- package/schematics/library/templates/nx/testing/setup-jest.ts.template +2 -0
- package/schematics/library/templates/nx/tsconfig.eslint.json.template +8 -0
- package/schematics/ng-add/helpers/gitignore-update.d.ts +6 -0
- package/schematics/ng-add/helpers/gitignore-update.d.ts.map +1 -0
- package/schematics/ng-add/helpers/gitignore-update.js +29 -0
- package/schematics/ng-add/helpers/gitignore-update.js.map +1 -0
- package/schematics/ng-add/helpers/index.d.ts +6 -0
- package/schematics/ng-add/helpers/index.d.ts.map +1 -0
- package/schematics/ng-add/helpers/index.js +9 -0
- package/schematics/ng-add/helpers/index.js.map +1 -0
- package/schematics/ng-add/helpers/linter.d.ts +8 -0
- package/schematics/ng-add/helpers/linter.d.ts.map +1 -0
- package/schematics/ng-add/helpers/linter.js +27 -0
- package/schematics/ng-add/helpers/linter.js.map +1 -0
- package/schematics/ng-add/helpers/npm-workspace.d.ts +16 -0
- package/schematics/ng-add/helpers/npm-workspace.d.ts.map +1 -0
- package/schematics/ng-add/helpers/npm-workspace.js +65 -0
- package/schematics/ng-add/helpers/npm-workspace.js.map +1 -0
- package/schematics/ng-add/helpers/renovate/index.d.ts +8 -0
- package/schematics/ng-add/helpers/renovate/index.d.ts.map +1 -0
- package/schematics/ng-add/helpers/renovate/index.js +27 -0
- package/schematics/ng-add/helpers/renovate/index.js.map +1 -0
- package/schematics/ng-add/helpers/renovate/templates/__dot__renovaterc.json.template +61 -0
- package/schematics/ng-add/index.d.ts +8 -0
- package/schematics/ng-add/index.d.ts.map +1 -0
- package/schematics/ng-add/index.js +34 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/project-setup.d.ts +9 -0
- package/schematics/ng-add/project-setup.d.ts.map +1 -0
- package/schematics/ng-add/project-setup.js +59 -0
- package/schematics/ng-add/project-setup.js.map +1 -0
- package/schematics/ng-add/schema.d.ts +16 -0
- package/schematics/ng-add/schema.d.ts.map +1 -0
- package/schematics/ng-add/schema.js +3 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/ng-add/schema.json +53 -0
- package/schematics/ng-update/index.d.ts +2 -0
- package/schematics/ng-update/index.d.ts.map +1 -0
- package/schematics/ng-update/index.js +3 -0
- package/schematics/ng-update/index.js.map +1 -0
- package/schematics/package.json +3 -0
- package/schematics/sdk/index.d.ts +8 -0
- package/schematics/sdk/index.d.ts.map +1 -0
- package/schematics/sdk/index.js +64 -0
- package/schematics/sdk/index.js.map +1 -0
- package/schematics/sdk/rules/clean-standalone.rule.d.ts +7 -0
- package/schematics/sdk/rules/clean-standalone.rule.d.ts.map +1 -0
- package/schematics/sdk/rules/clean-standalone.rule.js +28 -0
- package/schematics/sdk/rules/clean-standalone.rule.js.map +1 -0
- package/schematics/sdk/rules/rules.ng.d.ts +10 -0
- package/schematics/sdk/rules/rules.ng.d.ts.map +1 -0
- package/schematics/sdk/rules/rules.ng.js +54 -0
- package/schematics/sdk/rules/rules.ng.js.map +1 -0
- package/schematics/sdk/rules/rules.nx.d.ts +11 -0
- package/schematics/sdk/rules/rules.nx.d.ts.map +1 -0
- package/schematics/sdk/rules/rules.nx.js +60 -0
- package/schematics/sdk/rules/rules.nx.js.map +1 -0
- package/schematics/sdk/rules/update-ts-paths.rule.d.ts +10 -0
- package/schematics/sdk/rules/update-ts-paths.rule.d.ts.map +1 -0
- package/schematics/sdk/rules/update-ts-paths.rule.js +41 -0
- package/schematics/sdk/rules/update-ts-paths.rule.js.map +1 -0
- package/schematics/sdk/schema.d.ts +16 -0
- package/schematics/sdk/schema.d.ts.map +1 -0
- package/schematics/sdk/schema.js +3 -0
- package/schematics/sdk/schema.js.map +1 -0
- package/schematics/sdk/schema.json +46 -0
- package/schematics/sdk/templates/jest.config.js.template +12 -0
- package/src/cli/set-version.cjs +59 -0
- package/src/cli/set-version.cjs.map +1 -0
- package/src/cli/set-version.d.cts +3 -0
- package/src/cli/set-version.d.cts.map +1 -0
- package/src/public_api.d.ts +2 -0
- package/src/public_api.d.ts.map +1 -0
- package/src/public_api.js +3 -0
- package/src/public_api.js.map +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "ngAddSchematicsSchema",
|
|
4
|
+
"title": "Add Otter Workspace to an Angular project",
|
|
5
|
+
"description": "ngAdd Otter Framework to the Angular project",
|
|
6
|
+
"properties": {
|
|
7
|
+
"skipLinter": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"description": "Skip the linter process",
|
|
10
|
+
"default": true
|
|
11
|
+
},
|
|
12
|
+
"skipInstall": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Skip the install process",
|
|
15
|
+
"default": true
|
|
16
|
+
},
|
|
17
|
+
"commit": {
|
|
18
|
+
"description": "Initial git repository commit information. (Available at workspace setup only)",
|
|
19
|
+
"oneOf": [
|
|
20
|
+
{
|
|
21
|
+
"type": "boolean"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"name": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"email": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"format": "email"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": [
|
|
35
|
+
"name",
|
|
36
|
+
"email"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"default": true,
|
|
41
|
+
"additionalProperties": true
|
|
42
|
+
},
|
|
43
|
+
"skipGit": {
|
|
44
|
+
"description": "Do not initialize a git repository. (Available at workspace setup only)",
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"default": false,
|
|
47
|
+
"alias": "g"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"additionalProperties": true,
|
|
51
|
+
"required": [
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-update/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-update/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import { NgGenerateSdkSchema } from './schema';
|
|
3
|
+
/**
|
|
4
|
+
* Add an Otter compatible SDK to a monorepo
|
|
5
|
+
* @param options Schematic options
|
|
6
|
+
*/
|
|
7
|
+
export declare function generateSdk(options: NgGenerateSdkSchema): Rule;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8F,IAAI,EAAkD,MAAM,4BAA4B,CAAC;AAG9L,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAQ/C;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAkD9D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateSdk = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const schematics_2 = require("@o3r/schematics");
|
|
7
|
+
const rules_ng_1 = require("./rules/rules.ng");
|
|
8
|
+
const rules_nx_1 = require("./rules/rules.nx");
|
|
9
|
+
const update_ts_paths_rule_1 = require("./rules/update-ts-paths.rule");
|
|
10
|
+
const clean_standalone_rule_1 = require("./rules/clean-standalone.rule");
|
|
11
|
+
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
12
|
+
/**
|
|
13
|
+
* Add an Otter compatible SDK to a monorepo
|
|
14
|
+
* @param options Schematic options
|
|
15
|
+
*/
|
|
16
|
+
function generateSdk(options) {
|
|
17
|
+
const splitName = options.name?.split('/');
|
|
18
|
+
const scope = splitName.length > 1 ? splitName[0].replace(/^@/, '') : '';
|
|
19
|
+
const projectName = schematics_1.strings.dasherize(splitName?.length === 2 ? splitName[1] : options.name);
|
|
20
|
+
const cleanName = schematics_1.strings.dasherize(options.name).replace(/^@/, '').replaceAll(/\//g, '-');
|
|
21
|
+
return (tree, context) => {
|
|
22
|
+
const isNx = (0, schematics_2.isNxContext)(tree);
|
|
23
|
+
const workspaceConfig = (0, schematics_2.getWorkspaceConfig)(tree);
|
|
24
|
+
if (!workspaceConfig) {
|
|
25
|
+
throw new schematics_2.O3rCliError('No workspace configuration file found');
|
|
26
|
+
}
|
|
27
|
+
const defaultRoot = (0, schematics_2.getPackagesBaseRootFolder)(tree, context, workspaceConfig, 'library');
|
|
28
|
+
/** Path to the folder where generate the new SDK */
|
|
29
|
+
const targetPath = path.posix.join(options.path || defaultRoot, cleanName);
|
|
30
|
+
const addModuleSpecificFiles = () => (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates'), [
|
|
31
|
+
(0, schematics_1.template)({
|
|
32
|
+
...options,
|
|
33
|
+
rootRelativePath: path.posix.relative(targetPath, tree.root.path.replace(/^\//, './'))
|
|
34
|
+
}),
|
|
35
|
+
(0, schematics_1.move)(targetPath),
|
|
36
|
+
(0, schematics_1.renameTemplateFiles)()
|
|
37
|
+
]), schematics_1.MergeStrategy.Overwrite);
|
|
38
|
+
return (0, schematics_1.chain)([
|
|
39
|
+
(0, schematics_1.externalSchematic)('@ama-sdk/schematics', 'typescript-shell', {
|
|
40
|
+
...options,
|
|
41
|
+
package: projectName,
|
|
42
|
+
name: scope,
|
|
43
|
+
directory: targetPath,
|
|
44
|
+
packageManager: (0, schematics_2.getPackageManager)({ workspaceConfig }),
|
|
45
|
+
skipInstall: !!options.specPath || options.skipInstall
|
|
46
|
+
}),
|
|
47
|
+
isNx ? (0, rules_nx_1.nxRegisterProjectTasks)(options, targetPath, cleanName) : (0, rules_ng_1.ngRegisterProjectTasks)(options, targetPath, cleanName),
|
|
48
|
+
(0, update_ts_paths_rule_1.updateTsConfig)(targetPath, projectName, scope),
|
|
49
|
+
(0, clean_standalone_rule_1.cleanStandaloneFiles)(targetPath),
|
|
50
|
+
addModuleSpecificFiles(),
|
|
51
|
+
options.specPath ? (_host, c) => {
|
|
52
|
+
const installTaskId = c.addTask(new tasks_1.NodePackageInstallTask());
|
|
53
|
+
c.addTask(new tasks_1.RunSchematicTask('@ama-sdk/schematics', 'typescript-core', {
|
|
54
|
+
...options,
|
|
55
|
+
specPath: options.specPath,
|
|
56
|
+
directory: targetPath,
|
|
57
|
+
packageManager: (0, schematics_2.getPackageManager)({ workspaceConfig })
|
|
58
|
+
}), [installTaskId]);
|
|
59
|
+
} : schematics_1.noop
|
|
60
|
+
])(tree, context);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.generateSdk = generateSdk;
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/sdk/index.ts"],"names":[],"mappings":";;;AAAA,2DAA8L;AAC9L,kCAAkC;AAClC,gDAA6H;AAG7H,+CAA0D;AAC1D,+CAA0D;AAC1D,uEAA8D;AAC9D,yEAAqE;AACrE,4DAA4F;AAE5F;;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;oBAC1B,SAAS,EAAE,UAAU;oBACrB,cAAc,EAAE,IAAA,8BAAiB,EAAC,EAAC,eAAe,EAAC,CAAC;iBACrD,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC,CAAC,iBAAI;SACT,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAlDD,kCAkDC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* Clean files generated to standalone SDK
|
|
4
|
+
* @param targetPath Path where the SDK has been generated
|
|
5
|
+
*/
|
|
6
|
+
export declare function cleanStandaloneFiles(targetPath: string): Rule;
|
|
7
|
+
//# sourceMappingURL=clean-standalone.rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-standalone.rule.d.ts","sourceRoot":"","sources":["../../../../schematics/sdk/rules/clean-standalone.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAIvD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAkB7D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanStandaloneFiles = void 0;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
/**
|
|
6
|
+
* Clean files generated to standalone SDK
|
|
7
|
+
* @param targetPath Path where the SDK has been generated
|
|
8
|
+
*/
|
|
9
|
+
function cleanStandaloneFiles(targetPath) {
|
|
10
|
+
return (tree) => {
|
|
11
|
+
tree.delete(node_path_1.posix.join(targetPath, '.renovaterc.json'));
|
|
12
|
+
tree.delete(node_path_1.posix.join(targetPath, '.vscode', 'settings.json'));
|
|
13
|
+
tree.delete(node_path_1.posix.join(targetPath, '.editorconfig'));
|
|
14
|
+
tree.delete(node_path_1.posix.join(targetPath, '.versionrc.json'));
|
|
15
|
+
tree.delete(node_path_1.posix.join(targetPath, '.commitlintrc.json'));
|
|
16
|
+
tree.delete(node_path_1.posix.join(targetPath, 'CONTRIBUTING.md'));
|
|
17
|
+
tree.delete(node_path_1.posix.join(targetPath, '.husky', 'commit-msg'));
|
|
18
|
+
tree.delete(node_path_1.posix.join(targetPath, '.husky', 'pre-commit'));
|
|
19
|
+
const packageJson = tree.readJson(node_path_1.posix.join(targetPath, 'package.json'));
|
|
20
|
+
if (packageJson.scripts?.postinstall) {
|
|
21
|
+
delete packageJson.scripts.postinstall;
|
|
22
|
+
}
|
|
23
|
+
tree.overwrite(node_path_1.posix.join(targetPath, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
24
|
+
return tree;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
exports.cleanStandaloneFiles = cleanStandaloneFiles;
|
|
28
|
+
//# sourceMappingURL=clean-standalone.rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-standalone.rule.js","sourceRoot":"","sources":["../../../../schematics/sdk/rules/clean-standalone.rule.ts"],"names":[],"mappings":";;;AACA,yCAAkC;AAGlC;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,UAAkB;IACrD,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,IAAI,CAAC,MAAM,CAAC,iBAAK,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,CAAC,iBAAK,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,MAAM,CAAC,iBAAK,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,MAAM,CAAC,iBAAK,CAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM,CAAC,iBAAK,CAAC,IAAI,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,CAAC,iBAAK,CAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM,CAAC,iBAAK,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,CAAC,iBAAK,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;QAE5D,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAgB,CAAC;QACzF,IAAI,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE;YACpC,OAAO,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC;SACxC;QACD,IAAI,CAAC,SAAS,CAAC,iBAAK,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAlBD,oDAkBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import type { NgGenerateSdkSchema } from '../schema';
|
|
3
|
+
/**
|
|
4
|
+
* generate the rules to adapt the SDK generated by ng cli
|
|
5
|
+
* @param _options Schematic options
|
|
6
|
+
* @param targetPath Path where the SDK has been generated
|
|
7
|
+
* @param projectName Name of the project
|
|
8
|
+
*/
|
|
9
|
+
export declare function ngRegisterProjectTasks(_options: NgGenerateSdkSchema, targetPath: string, projectName: string): Rule;
|
|
10
|
+
//# sourceMappingURL=rules.ng.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.ng.d.ts","sourceRoot":"","sources":["../../../../schematics/sdk/rules/rules.ng.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAIrD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAyCnH"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ngRegisterProjectTasks = void 0;
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const schematics_1 = require("@o3r/schematics");
|
|
6
|
+
/**
|
|
7
|
+
* generate the rules to adapt the SDK generated by ng cli
|
|
8
|
+
* @param _options Schematic options
|
|
9
|
+
* @param targetPath Path where the SDK has been generated
|
|
10
|
+
* @param projectName Name of the project
|
|
11
|
+
*/
|
|
12
|
+
function ngRegisterProjectTasks(_options, targetPath, projectName) {
|
|
13
|
+
const project = {
|
|
14
|
+
projectType: 'library',
|
|
15
|
+
root: targetPath,
|
|
16
|
+
sourceRoot: path.posix.join(targetPath, 'src'),
|
|
17
|
+
prefix: 'sdk',
|
|
18
|
+
architect: {
|
|
19
|
+
build: {
|
|
20
|
+
builder: '@o3r/core:run-script',
|
|
21
|
+
options: {
|
|
22
|
+
script: 'build'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
lint: {
|
|
26
|
+
builder: '@o3r/core:run-script',
|
|
27
|
+
options: {
|
|
28
|
+
script: 'lint'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
test: {
|
|
32
|
+
builder: '@o3r/core:run-script',
|
|
33
|
+
options: {
|
|
34
|
+
script: 'test'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return (tree, context) => {
|
|
40
|
+
const angularJson = (0, schematics_1.getWorkspaceConfig)(tree);
|
|
41
|
+
if (!angularJson) {
|
|
42
|
+
context.logger.warn('No angular.json file detected, the update will be skipped.');
|
|
43
|
+
return tree;
|
|
44
|
+
}
|
|
45
|
+
angularJson.projects[projectName] = {
|
|
46
|
+
...angularJson.projects[projectName],
|
|
47
|
+
...project
|
|
48
|
+
};
|
|
49
|
+
tree.overwrite('/angular.json', JSON.stringify(angularJson, null, 2));
|
|
50
|
+
return tree;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
exports.ngRegisterProjectTasks = ngRegisterProjectTasks;
|
|
54
|
+
//# sourceMappingURL=rules.ng.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.ng.js","sourceRoot":"","sources":["../../../../schematics/sdk/rules/rules.ng.ts"],"names":[],"mappings":";;;AAEA,kCAAkC;AAClC,gDAAuE;AAEvE;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,QAA6B,EAAE,UAAkB,EAAE,WAAmB;IAC3G,MAAM,OAAO,GAAqB;QAChC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;QAC9C,MAAM,EAAE,KAAK;QACb,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,OAAO,EAAE,sBAAsB;gBAC/B,OAAO,EAAE;oBACP,MAAM,EAAE,OAAO;iBAChB;aACF;YACD,IAAI,EAAE;gBACJ,OAAO,EAAE,sBAAsB;gBAC/B,OAAO,EAAE;oBACP,MAAM,EAAE,MAAM;iBACf;aACF;YACD,IAAI,EAAE;gBACJ,OAAO,EAAE,sBAAsB;gBAC/B,OAAO,EAAE;oBACP,MAAM,EAAE,MAAM;iBACf;aACF;SACF;KACF,CAAC;IAEF,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACvB,MAAM,WAAW,GAAG,IAAA,+BAAkB,EAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;YAClF,OAAO,IAAI,CAAC;SACb;QACD,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG;YAClC,GAAG,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC;YACpC,GAAG,OAAO;SACX,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAzCD,wDAyCC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import type { NgGenerateSdkSchema } from '../schema';
|
|
3
|
+
/**
|
|
4
|
+
* generate the rules to adapt the SDK generated by nx cli
|
|
5
|
+
*
|
|
6
|
+
* @param _options Schematic options
|
|
7
|
+
* @param targetPath Path where the SDK has been generated
|
|
8
|
+
* @param projectName Name of the project
|
|
9
|
+
*/
|
|
10
|
+
export declare function nxRegisterProjectTasks(_options: NgGenerateSdkSchema, targetPath: string, projectName: string): Rule;
|
|
11
|
+
//# sourceMappingURL=rules.nx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.nx.d.ts","sourceRoot":"","sources":["../../../../schematics/sdk/rules/rules.nx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CA+CnH"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nxRegisterProjectTasks = void 0;
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
/**
|
|
6
|
+
* generate the rules to adapt the SDK generated by nx cli
|
|
7
|
+
*
|
|
8
|
+
* @param _options Schematic options
|
|
9
|
+
* @param targetPath Path where the SDK has been generated
|
|
10
|
+
* @param projectName Name of the project
|
|
11
|
+
*/
|
|
12
|
+
function nxRegisterProjectTasks(_options, targetPath, projectName) {
|
|
13
|
+
const project = {
|
|
14
|
+
$schema: 'https://raw.githubusercontent.com/nrwl/nx/master/packages/nx/schemas/project-schema.json',
|
|
15
|
+
name: projectName,
|
|
16
|
+
projectType: 'library',
|
|
17
|
+
root: targetPath,
|
|
18
|
+
sourceRoot: path.posix.join(targetPath, 'src'),
|
|
19
|
+
prefix: 'sdk',
|
|
20
|
+
targets: {
|
|
21
|
+
build: {
|
|
22
|
+
executor: 'nx:run-script',
|
|
23
|
+
outputs: [
|
|
24
|
+
'{projectRoot}/dist/'
|
|
25
|
+
],
|
|
26
|
+
options: {
|
|
27
|
+
script: 'build'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
lint: {
|
|
31
|
+
executor: '@nx/linter:eslint',
|
|
32
|
+
configurations: {
|
|
33
|
+
ci: {
|
|
34
|
+
quiet: true,
|
|
35
|
+
cacheLocation: '.cache/eslint'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
options: {
|
|
39
|
+
eslintConfig: path.posix.join(targetPath, '.eslintrc.js'),
|
|
40
|
+
lintFilePatterns: [
|
|
41
|
+
path.posix.join(targetPath, 'src', '**', '*.ts')
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
test: {
|
|
46
|
+
executor: '@nx/jest:jest',
|
|
47
|
+
options: {
|
|
48
|
+
jestConfig: path.posix.join(targetPath, 'jest.config.js'),
|
|
49
|
+
silent: true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return (tree) => {
|
|
55
|
+
tree.create(path.posix.join(targetPath, 'project.json'), JSON.stringify(project, null, 2));
|
|
56
|
+
return tree;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
exports.nxRegisterProjectTasks = nxRegisterProjectTasks;
|
|
60
|
+
//# sourceMappingURL=rules.nx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.nx.js","sourceRoot":"","sources":["../../../../schematics/sdk/rules/rules.nx.ts"],"names":[],"mappings":";;;AAEA,kCAAkC;AAElC;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAAC,QAA6B,EAAE,UAAkB,EAAE,WAAmB;IAC3G,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,0FAA0F;QACnG,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;QAC9C,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,QAAQ,EAAE,eAAe;gBACzB,OAAO,EAAE;oBACP,qBAAqB;iBACtB;gBACD,OAAO,EAAE;oBACP,MAAM,EAAE,OAAO;iBAChB;aACF;YACD,IAAI,EAAE;gBACJ,QAAQ,EAAE,mBAAmB;gBAC7B,cAAc,EAAE;oBACd,EAAE,EAAE;wBACF,KAAK,EAAE,IAAI;wBACX,aAAa,EAAE,eAAe;qBAC/B;iBACF;gBACD,OAAO,EAAE;oBACP,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC;oBACzD,gBAAgB,EAAE;wBAChB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC;qBACjD;iBACF;aACF;YACD,IAAI,EAAE;gBACJ,QAAQ,EAAE,eAAe;gBACzB,OAAO,EAAE;oBACP,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC;oBACzD,MAAM,EAAE,IAAI;iBACb;aACF;SACF;KACF,CAAC;IAEF,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3F,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AA/CD,wDA+CC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* Update workspace Tsconfig
|
|
4
|
+
* @param options Schematic options
|
|
5
|
+
* @param targetPath Path where the SDK has been generated
|
|
6
|
+
* @param projectName Name of the project
|
|
7
|
+
* @param scope scope of the package
|
|
8
|
+
*/
|
|
9
|
+
export declare function updateTsConfig(targetPath: string, projectName: string, scope: string): Rule;
|
|
10
|
+
//# sourceMappingURL=update-ts-paths.rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-ts-paths.rule.d.ts","sourceRoot":"","sources":["../../../../schematics/sdk/rules/update-ts-paths.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGvD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAgC3F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateTsConfig = void 0;
|
|
4
|
+
const ts = require("typescript");
|
|
5
|
+
/**
|
|
6
|
+
* Update workspace Tsconfig
|
|
7
|
+
* @param options Schematic options
|
|
8
|
+
* @param targetPath Path where the SDK has been generated
|
|
9
|
+
* @param projectName Name of the project
|
|
10
|
+
* @param scope scope of the package
|
|
11
|
+
*/
|
|
12
|
+
function updateTsConfig(targetPath, projectName, scope) {
|
|
13
|
+
const tsconfigs = ['tsconfig.base.json', 'tsconfig.build.json', 'tsconfig.json'];
|
|
14
|
+
const relativeTargetPath = targetPath.replace(/^\//, '');
|
|
15
|
+
return (tree, context) => {
|
|
16
|
+
const configs = tsconfigs
|
|
17
|
+
.filter((tsconfig) => tree.exists(tsconfig))
|
|
18
|
+
.map((tsconfig) => ({
|
|
19
|
+
tsconfig,
|
|
20
|
+
content: ts.parseConfigFileTextToJson(tsconfig, tree.readText(tsconfig)).config
|
|
21
|
+
}))
|
|
22
|
+
.filter(({ content }) => !!content);
|
|
23
|
+
const configWithPath = configs.find((config) => !!config.content?.compilerOptions?.paths) || configs[0];
|
|
24
|
+
if (!configWithPath) {
|
|
25
|
+
context.logger.warn('No tsconfig found, the path mapping will not be updated');
|
|
26
|
+
return tree;
|
|
27
|
+
}
|
|
28
|
+
configWithPath.content.compilerOptions ||= {};
|
|
29
|
+
configWithPath.content.compilerOptions.paths ||= {};
|
|
30
|
+
configWithPath.content.compilerOptions.paths[`${scope ? `@${scope}/` : ''}${projectName}`] = [
|
|
31
|
+
`${relativeTargetPath}/src/index`
|
|
32
|
+
];
|
|
33
|
+
configWithPath.content.compilerOptions.paths[`${scope ? `@${scope}/` : ''}${projectName}/*`] = [
|
|
34
|
+
`${relativeTargetPath}/src/*`
|
|
35
|
+
];
|
|
36
|
+
tree.overwrite(configWithPath.tsconfig, JSON.stringify(configWithPath.content, null, 2));
|
|
37
|
+
return tree;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
exports.updateTsConfig = updateTsConfig;
|
|
41
|
+
//# sourceMappingURL=update-ts-paths.rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-ts-paths.rule.js","sourceRoot":"","sources":["../../../../schematics/sdk/rules/update-ts-paths.rule.ts"],"names":[],"mappings":";;;AACA,iCAAiC;AAEjC;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,UAAkB,EAAE,WAAmB,EAAE,KAAa;IACnF,MAAM,SAAS,GAAG,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,eAAe,CAAC,CAAC;IACjF,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAEzD,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACvB,MAAM,OAAO,GAAG,SAAS;aACtB,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;aAC3C,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAClB,QAAQ;YACR,OAAO,EAAE,EAAE,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM;SAChF,CAAC,CAAC;aACF,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAEtC,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;QAExG,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;YAC/E,OAAO,IAAI,CAAC;SACb;QAED,cAAc,CAAC,OAAO,CAAC,eAAe,KAAK,EAAE,CAAC;QAC9C,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,KAAK,EAAE,CAAC;QACpD,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC,GAAG;YAC3F,GAAG,kBAAkB,YAAY;SAClC,CAAC;QACF,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,IAAI,CAAC,GAAG;YAC7F,GAAG,kBAAkB,QAAQ;SAC9B,CAAC;QAEF,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACzF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAhCD,wCAgCC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SchematicOptionObject } from '@o3r/schematics';
|
|
2
|
+
export interface NgGenerateSdkSchema extends SchematicOptionObject {
|
|
3
|
+
/** Project name */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Target directory to generate the module */
|
|
6
|
+
path?: string | undefined;
|
|
7
|
+
/** Description of the new module */
|
|
8
|
+
description?: string | undefined;
|
|
9
|
+
/** Skip the linter process */
|
|
10
|
+
skipLinter: boolean;
|
|
11
|
+
/** Do not install dependency packages. */
|
|
12
|
+
skipInstall: boolean;
|
|
13
|
+
/** Path to the swagger specification used to generate the SDK; If not provided, sdk shell will be generated */
|
|
14
|
+
specPath?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/sdk/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;IAChE,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IAEb,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IAEpB,0CAA0C;IAC1C,WAAW,EAAE,OAAO,CAAC;IAErB,+GAA+G;IAC/G,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../schematics/sdk/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "ngGenerateSdkSchematicsSchema",
|
|
4
|
+
"title": "Generate an SDK in an Otter Project",
|
|
5
|
+
"description": "Generate an SDK in an Otter Project",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Name of the SDK package",
|
|
10
|
+
"x-prompt": "Name of the new SDK package?",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "argv",
|
|
13
|
+
"index": 0
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"description": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Description of the new module",
|
|
19
|
+
"default": ""
|
|
20
|
+
},
|
|
21
|
+
"prefix": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Prefix use to package future generation"
|
|
24
|
+
},
|
|
25
|
+
"path": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "Target directory to generate the module"
|
|
28
|
+
},
|
|
29
|
+
"specPath": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Path to the swagger specification used to generate the SDK; If not provided, sdk shell will be generated"
|
|
32
|
+
},
|
|
33
|
+
"skipLinter": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"description": "Skip the linter process",
|
|
36
|
+
"default": true
|
|
37
|
+
},
|
|
38
|
+
"skipInstall": {
|
|
39
|
+
"description": "Do not install dependency packages.",
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"default": false
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": ["name"],
|
|
45
|
+
"additionalProperties": true
|
|
46
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const getJestConfig = require('<%= rootRelativePath %>/jest.config.ut').getJestConfig;
|
|
2
|
+
|
|
3
|
+
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
|
|
4
|
+
module.exports = {
|
|
5
|
+
...getJestConfig(__dirname, false),
|
|
6
|
+
displayName: require('./package.json').name,
|
|
7
|
+
testPathIgnorePatterns: [
|
|
8
|
+
'<rootDir>/dist',
|
|
9
|
+
'<rootDir>/.*/templates/.*',
|
|
10
|
+
'\\.it\\.spec\\.ts$'
|
|
11
|
+
]
|
|
12
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const globby_1 = require("globby");
|
|
6
|
+
const fs = require("node:fs");
|
|
7
|
+
const path = require("node:path");
|
|
8
|
+
const winston = require("winston");
|
|
9
|
+
const semver_1 = require("semver");
|
|
10
|
+
const defaultIncludedFiles = ['**/package.json', '!/**/templates/**/package.json', '!**/node_modules/**/package.json'];
|
|
11
|
+
const collect = (pattern, patterns) => {
|
|
12
|
+
if (patterns === defaultIncludedFiles && pattern) {
|
|
13
|
+
patterns = [];
|
|
14
|
+
}
|
|
15
|
+
patterns.push(pattern);
|
|
16
|
+
return patterns;
|
|
17
|
+
};
|
|
18
|
+
const logger = winston.createLogger({
|
|
19
|
+
format: winston.format.combine(winston.format.colorize(), winston.format.simple()),
|
|
20
|
+
transports: new winston.transports.Console()
|
|
21
|
+
});
|
|
22
|
+
let replaceVersion;
|
|
23
|
+
commander_1.program
|
|
24
|
+
.arguments('<version>')
|
|
25
|
+
.description('Replace the packages version in a monorepos')
|
|
26
|
+
.option('-p, --placeholder <placeholder>', 'Pattern of the version placeholder', '0.0.0(-placeholder)?')
|
|
27
|
+
.option('--include <file>', 'Add files pattern to apply the version replacement', collect, defaultIncludedFiles)
|
|
28
|
+
.option('-v, --verbose', 'Display debug logs')
|
|
29
|
+
.action((version) => {
|
|
30
|
+
const cleanVersion = (0, semver_1.clean)(version);
|
|
31
|
+
if (!cleanVersion) {
|
|
32
|
+
// eslint-disable-next-line no-console
|
|
33
|
+
console.error(`The version "${version}" is invalid`);
|
|
34
|
+
return process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
replaceVersion = cleanVersion;
|
|
37
|
+
})
|
|
38
|
+
.parse(process.argv);
|
|
39
|
+
const options = commander_1.program.opts();
|
|
40
|
+
logger.level = options.verbose ? 'debug' : 'info';
|
|
41
|
+
(0, globby_1.sync)(options.include, { cwd: process.cwd() })
|
|
42
|
+
.map((file) => path.join(process.cwd(), file))
|
|
43
|
+
.map((filePath) => ({
|
|
44
|
+
path: filePath,
|
|
45
|
+
content: fs.readFileSync(filePath).toString()
|
|
46
|
+
}))
|
|
47
|
+
.forEach((pathWithContent) => {
|
|
48
|
+
const newContent = pathWithContent.content
|
|
49
|
+
.replace(new RegExp('"([~^]?)' + options.placeholder.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\\*\./g, '\\.') + '"', 'g'), `"$1${replaceVersion}"`)
|
|
50
|
+
.replace(/"workspace:([~^]?)[^"]*"(,?)$/gm, `"$1${replaceVersion}"$2`);
|
|
51
|
+
if (newContent !== pathWithContent.content) {
|
|
52
|
+
logger.info(`update version in ${pathWithContent.path}`);
|
|
53
|
+
fs.writeFileSync(pathWithContent.path, newContent);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
logger.debug(`No change in ${pathWithContent.path}`);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=set-version.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-version.cjs","sourceRoot":"","sources":["../../../src/cli/set-version.cts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,mCAA4C;AAC5C,8BAA8B;AAC9B,kCAAkC;AAClC,mCAAmC;AACnC,mCAA+B;AAE/B,MAAM,oBAAoB,GAAG,CAAC,iBAAiB,EAAE,gCAAgC,EAAE,kCAAkC,CAAC,CAAC;AAEvH,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,QAAkB,EAAE,EAAE;IACtD,IAAI,QAAQ,KAAK,oBAAoB,IAAI,OAAO,EAAE;QAChD,QAAQ,GAAG,EAAE,CAAC;KACf;IACD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EACzB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CACxB;IACD,UAAU,EAAE,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE;CAC7C,CAAC,CAAC;AAEH,IAAI,cAAsB,CAAC;AAC3B,mBAAO;KACJ,SAAS,CAAC,WAAW,CAAC;KACtB,WAAW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AAI,MAAM,CAAC,UAAU,GAAI,OAAO,CAAC,WAAsB,CAAC,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,cAAc,GAAG,CAAC;SACpK,OAAO,CAAC,iCAAiC,EAAE,MAAM,cAAc,KAAK,CAAC,CAAC;IACzE,IAAI,UAAU,KAAK,eAAe,CAAC,OAAO,EAAE;QAC1C,MAAM,CAAC,IAAI,CAAC,qBAAqB,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;QACzD,EAAE,CAAC,aAAa,CAAC,eAAe,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;KACpD;SAAM;QACL,MAAM,CAAC,KAAK,CAAC,gBAAgB,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;KACtD;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-version.d.cts","sourceRoot":"","sources":["../../../src/cli/set-version.cts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../../src/public_api.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public_api.js","sourceRoot":"","sources":["../../src/public_api.ts"],"names":[],"mappings":""}
|