@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.
Files changed (126) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +42 -0
  3. package/builders.json +6 -0
  4. package/collection.json +35 -0
  5. package/migration.json +6 -0
  6. package/package.json +188 -0
  7. package/schematics/application/index.d.ts +8 -0
  8. package/schematics/application/index.d.ts.map +1 -0
  9. package/schematics/application/index.js +68 -0
  10. package/schematics/application/index.js.map +1 -0
  11. package/schematics/application/schema.d.ts +14 -0
  12. package/schematics/application/schema.d.ts.map +1 -0
  13. package/schematics/application/schema.js +3 -0
  14. package/schematics/application/schema.js.map +1 -0
  15. package/schematics/application/schema.json +38 -0
  16. package/schematics/application/templates/package.json.template +29 -0
  17. package/schematics/library/index.d.ts +8 -0
  18. package/schematics/library/index.d.ts.map +1 -0
  19. package/schematics/library/index.js +40 -0
  20. package/schematics/library/index.js.map +1 -0
  21. package/schematics/library/rules/rules.ng.d.ts +12 -0
  22. package/schematics/library/rules/rules.ng.d.ts.map +1 -0
  23. package/schematics/library/rules/rules.ng.js +123 -0
  24. package/schematics/library/rules/rules.ng.js.map +1 -0
  25. package/schematics/library/rules/rules.nx.d.ts +12 -0
  26. package/schematics/library/rules/rules.nx.d.ts.map +1 -0
  27. package/schematics/library/rules/rules.nx.js +127 -0
  28. package/schematics/library/rules/rules.nx.js.map +1 -0
  29. package/schematics/library/rules/shared.d.ts +19 -0
  30. package/schematics/library/rules/shared.d.ts.map +1 -0
  31. package/schematics/library/rules/shared.js +84 -0
  32. package/schematics/library/rules/shared.js.map +1 -0
  33. package/schematics/library/schema.d.ts +18 -0
  34. package/schematics/library/schema.d.ts.map +1 -0
  35. package/schematics/library/schema.js +3 -0
  36. package/schematics/library/schema.js.map +1 -0
  37. package/schematics/library/schema.json +42 -0
  38. package/schematics/library/templates/ng/.eslintrc.js.template +19 -0
  39. package/schematics/library/templates/ng/.gitignore.template +2 -0
  40. package/schematics/library/templates/ng/.npmignore.template +0 -0
  41. package/schematics/library/templates/ng/jest.config.js.template +37 -0
  42. package/schematics/library/templates/ng/testing/setup-jest.ts.template +2 -0
  43. package/schematics/library/templates/ng/tsconfig.builders.json.template +22 -0
  44. package/schematics/library/templates/ng/tsconfig.eslint.json.template +8 -0
  45. package/schematics/library/templates/ng/tsconfig.json.template +12 -0
  46. package/schematics/library/templates/ng/tsconfig.spec.json.template +17 -0
  47. package/schematics/library/templates/nx/.eslintrc.js.template +19 -0
  48. package/schematics/library/templates/nx/.gitignore.template +2 -0
  49. package/schematics/library/templates/nx/.npmignore.template +0 -0
  50. package/schematics/library/templates/nx/jest.config.js.template +37 -0
  51. package/schematics/library/templates/nx/project.json.template +66 -0
  52. package/schematics/library/templates/nx/testing/setup-jest.ts.template +2 -0
  53. package/schematics/library/templates/nx/tsconfig.eslint.json.template +8 -0
  54. package/schematics/ng-add/helpers/gitignore-update.d.ts +6 -0
  55. package/schematics/ng-add/helpers/gitignore-update.d.ts.map +1 -0
  56. package/schematics/ng-add/helpers/gitignore-update.js +29 -0
  57. package/schematics/ng-add/helpers/gitignore-update.js.map +1 -0
  58. package/schematics/ng-add/helpers/index.d.ts +6 -0
  59. package/schematics/ng-add/helpers/index.d.ts.map +1 -0
  60. package/schematics/ng-add/helpers/index.js +9 -0
  61. package/schematics/ng-add/helpers/index.js.map +1 -0
  62. package/schematics/ng-add/helpers/linter.d.ts +8 -0
  63. package/schematics/ng-add/helpers/linter.d.ts.map +1 -0
  64. package/schematics/ng-add/helpers/linter.js +27 -0
  65. package/schematics/ng-add/helpers/linter.js.map +1 -0
  66. package/schematics/ng-add/helpers/npm-workspace.d.ts +16 -0
  67. package/schematics/ng-add/helpers/npm-workspace.d.ts.map +1 -0
  68. package/schematics/ng-add/helpers/npm-workspace.js +65 -0
  69. package/schematics/ng-add/helpers/npm-workspace.js.map +1 -0
  70. package/schematics/ng-add/helpers/renovate/index.d.ts +8 -0
  71. package/schematics/ng-add/helpers/renovate/index.d.ts.map +1 -0
  72. package/schematics/ng-add/helpers/renovate/index.js +27 -0
  73. package/schematics/ng-add/helpers/renovate/index.js.map +1 -0
  74. package/schematics/ng-add/helpers/renovate/templates/__dot__renovaterc.json.template +61 -0
  75. package/schematics/ng-add/index.d.ts +8 -0
  76. package/schematics/ng-add/index.d.ts.map +1 -0
  77. package/schematics/ng-add/index.js +34 -0
  78. package/schematics/ng-add/index.js.map +1 -0
  79. package/schematics/ng-add/project-setup.d.ts +9 -0
  80. package/schematics/ng-add/project-setup.d.ts.map +1 -0
  81. package/schematics/ng-add/project-setup.js +59 -0
  82. package/schematics/ng-add/project-setup.js.map +1 -0
  83. package/schematics/ng-add/schema.d.ts +16 -0
  84. package/schematics/ng-add/schema.d.ts.map +1 -0
  85. package/schematics/ng-add/schema.js +3 -0
  86. package/schematics/ng-add/schema.js.map +1 -0
  87. package/schematics/ng-add/schema.json +53 -0
  88. package/schematics/ng-update/index.d.ts +2 -0
  89. package/schematics/ng-update/index.d.ts.map +1 -0
  90. package/schematics/ng-update/index.js +3 -0
  91. package/schematics/ng-update/index.js.map +1 -0
  92. package/schematics/package.json +3 -0
  93. package/schematics/sdk/index.d.ts +8 -0
  94. package/schematics/sdk/index.d.ts.map +1 -0
  95. package/schematics/sdk/index.js +64 -0
  96. package/schematics/sdk/index.js.map +1 -0
  97. package/schematics/sdk/rules/clean-standalone.rule.d.ts +7 -0
  98. package/schematics/sdk/rules/clean-standalone.rule.d.ts.map +1 -0
  99. package/schematics/sdk/rules/clean-standalone.rule.js +28 -0
  100. package/schematics/sdk/rules/clean-standalone.rule.js.map +1 -0
  101. package/schematics/sdk/rules/rules.ng.d.ts +10 -0
  102. package/schematics/sdk/rules/rules.ng.d.ts.map +1 -0
  103. package/schematics/sdk/rules/rules.ng.js +54 -0
  104. package/schematics/sdk/rules/rules.ng.js.map +1 -0
  105. package/schematics/sdk/rules/rules.nx.d.ts +11 -0
  106. package/schematics/sdk/rules/rules.nx.d.ts.map +1 -0
  107. package/schematics/sdk/rules/rules.nx.js +60 -0
  108. package/schematics/sdk/rules/rules.nx.js.map +1 -0
  109. package/schematics/sdk/rules/update-ts-paths.rule.d.ts +10 -0
  110. package/schematics/sdk/rules/update-ts-paths.rule.d.ts.map +1 -0
  111. package/schematics/sdk/rules/update-ts-paths.rule.js +41 -0
  112. package/schematics/sdk/rules/update-ts-paths.rule.js.map +1 -0
  113. package/schematics/sdk/schema.d.ts +16 -0
  114. package/schematics/sdk/schema.d.ts.map +1 -0
  115. package/schematics/sdk/schema.js +3 -0
  116. package/schematics/sdk/schema.js.map +1 -0
  117. package/schematics/sdk/schema.json +46 -0
  118. package/schematics/sdk/templates/jest.config.js.template +12 -0
  119. package/src/cli/set-version.cjs +59 -0
  120. package/src/cli/set-version.cjs.map +1 -0
  121. package/src/cli/set-version.d.cts +3 -0
  122. package/src/cli/set-version.d.cts.map +1 -0
  123. package/src/public_api.d.ts +2 -0
  124. package/src/public_api.d.ts.map +1 -0
  125. package/src/public_api.js +3 -0
  126. package/src/public_api.js.map +1 -0
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngGenerateModule = void 0;
4
+ const schematics_1 = require("@o3r/schematics");
5
+ const ts = require("typescript");
6
+ const schematics_2 = require("@angular-devkit/schematics");
7
+ const path = require("node:path");
8
+ const node_fs_1 = require("node:fs");
9
+ const shared_1 = require("./shared");
10
+ /**
11
+ * generate the rules to adapt the library generated by ng cli
12
+ * @param options.targetPath Path where the library has been generated
13
+ * @param options Schematic options
14
+ */
15
+ function ngGenerateModule(options) {
16
+ const relativeTargetPath = options.targetPath.replace(/^\//, '');
17
+ /**
18
+ * Update Ng templates
19
+ * @param tree File tree
20
+ * @param context Context of the schematics
21
+ */
22
+ const updateNgTemplate = (tree, context) => {
23
+ const o3rCorePackageJsonPath = path.resolve(__dirname, '..', '..', '..', 'package.json');
24
+ const o3rCorePackageJson = JSON.parse((0, node_fs_1.readFileSync)(o3rCorePackageJsonPath).toString());
25
+ const otterVersion = o3rCorePackageJson.dependencies['@o3r/schematics'];
26
+ const templateNg = (0, schematics_2.apply)((0, schematics_2.url)('./templates/ng'), [
27
+ (0, schematics_2.template)({
28
+ ...options,
29
+ runner: process.env.npm_execpath && /[\\/][^\\/]yarn[^\\/]js$/.test(process.env.npm_execpath) ? 'yarn run' : 'npm run',
30
+ tsconfigSpecPath: (0, schematics_1.findConfigFileRelativePath)(tree, ['tsconfig.test.json', 'tsconfig.spec.json', 'tsconfig.jest.json', 'tsconfig.jasmine.json', 'tsconfig.base.json', 'tsconfig.json'], options.targetPath),
31
+ tsconfigBasePath: (0, schematics_1.findConfigFileRelativePath)(tree, ['tsconfig.base.json', 'tsconfig.json'], options.targetPath),
32
+ tsconfigBuildPath: (0, schematics_1.findConfigFileRelativePath)(tree, ['tsconfig.build.json', 'tsconfig.base.json', 'tsconfig.json'], options.targetPath),
33
+ eslintRcPath: (0, schematics_1.findConfigFileRelativePath)(tree, ['.eslintrc.json', '.eslintrc.js'], options.targetPath)
34
+ }),
35
+ (0, schematics_2.renameTemplateFiles)(),
36
+ (0, schematics_2.move)(options.targetPath)
37
+ ]);
38
+ return (0, schematics_2.chain)([
39
+ (0, schematics_2.mergeWith)(templateNg, schematics_2.MergeStrategy.Overwrite),
40
+ (0, shared_1.updatePackageDependenciesFactory)(options.targetPath, otterVersion, o3rCorePackageJson, options),
41
+ (0, shared_1.updateNgPackagrFactory)(options.targetPath),
42
+ (t) => {
43
+ const genPackageJsonPath = path.posix.join(options.targetPath, 'package.json');
44
+ const packageJson = t.readJson(genPackageJsonPath);
45
+ packageJson.name = options.packageJsonName;
46
+ t.overwrite(genPackageJsonPath, JSON.stringify(packageJson, null, 2));
47
+ return t;
48
+ }
49
+ ])(tree, context);
50
+ };
51
+ /**
52
+ * Update the tsconfig generated by the Angular library generator
53
+ * @param tree File tree
54
+ * @param context Context of the schematics
55
+ */
56
+ const updateLibTsconfig = (tree, context) => {
57
+ const tsconfigPath = path.posix.join(options.path || '', options.name, 'tsconfig.lib.json');
58
+ if (!tree.exists(tsconfigPath)) {
59
+ context.logger.warn(`The file ${tsconfigPath} was not found, the update will not be applied`);
60
+ return tree;
61
+ }
62
+ const tsconfig = ts.parseConfigFileTextToJson(tsconfigPath, tree.readText(tsconfigPath));
63
+ if (!tsconfig || !tsconfig.config) {
64
+ context.logger.error(`Error parsing ${tsconfigPath}, the update will not be applied`, tsconfig?.error);
65
+ return tree;
66
+ }
67
+ tsconfig.config.extends = path.posix.resolve(path.relative(options.path || '.', '.'), 'tsconfig.base.json');
68
+ tree.overwrite(tsconfigPath, JSON.stringify(tsconfig, null, 2));
69
+ return tree;
70
+ };
71
+ /**
72
+ * Update the root tsconfig files mappings
73
+ * @param tree File tree
74
+ * @param context Context of the schematics
75
+ */
76
+ const updateTsConfigFiles = (tree, context) => {
77
+ const tsconfigBase = (0, schematics_1.findConfigFileRelativePath)(tree, ['tsconfig.base.json', 'tsconfig.json'], '/');
78
+ const tsconfigBuild = (0, schematics_1.findConfigFileRelativePath)(tree, ['tsconfig.build.json'], '/');
79
+ if (tsconfigBase) {
80
+ const configFile = tree.readJson(tsconfigBase);
81
+ if (configFile?.compilerOptions?.paths) {
82
+ configFile.compilerOptions.paths = Object.fromEntries(Object.entries(configFile.compilerOptions.paths).filter(([pathName, _]) => pathName !== options.name));
83
+ configFile.compilerOptions.paths[options.packageJsonName] = [path.posix.join(relativeTargetPath, 'src', 'public_api')];
84
+ tree.overwrite(tsconfigBase, JSON.stringify(configFile, null, 2));
85
+ }
86
+ else {
87
+ context.logger.warn(`${tsconfigBase} does not contain path mapping, the edition will be skipped`);
88
+ }
89
+ }
90
+ else {
91
+ context.logger.warn('No base TsConfig file found');
92
+ }
93
+ if (tsconfigBuild) {
94
+ const configFile = tree.readJson(tsconfigBuild);
95
+ if (configFile?.compilerOptions?.paths) {
96
+ configFile.compilerOptions.paths = Object.fromEntries(Object.entries(configFile.compilerOptions.paths).filter(([pathName, _]) => pathName !== options.name));
97
+ configFile.compilerOptions.paths[options.packageJsonName] = [
98
+ path.posix.join(relativeTargetPath, 'dist'),
99
+ path.posix.join(relativeTargetPath, 'src', 'public_api')
100
+ ];
101
+ tree.overwrite(tsconfigBuild, JSON.stringify(configFile, null, 2));
102
+ }
103
+ else {
104
+ context.logger.warn(`${tsconfigBuild} does not contain path mapping, the edition will be skipped`);
105
+ }
106
+ }
107
+ };
108
+ const ngCliUpdate = (tree, context) => {
109
+ return (0, schematics_2.chain)([
110
+ (t, c) => (0, schematics_2.externalSchematic)('@schematics/angular', 'library', {
111
+ name: options.name,
112
+ projectRoot: relativeTargetPath,
113
+ prefix: options.prefix
114
+ })(t, c),
115
+ updateNgTemplate,
116
+ updateLibTsconfig,
117
+ updateTsConfigFiles
118
+ ])(tree, context);
119
+ };
120
+ return ngCliUpdate;
121
+ }
122
+ exports.ngGenerateModule = ngGenerateModule;
123
+ //# sourceMappingURL=rules.ng.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.ng.js","sourceRoot":"","sources":["../../../../schematics/library/rules/rules.ng.ts"],"names":[],"mappings":";;;AAEA,gDAA6D;AAC7D,iCAAiC;AACjC,2DAAuJ;AACvJ,kCAAkC;AAClC,qCAAuC;AACvC,qCAAoF;AAEpF;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,OAAiF;IAEhH,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAEjE;;;;OAIG;IACH,MAAM,gBAAgB,GAAS,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QAC/C,MAAM,sBAAsB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACzF,MAAM,kBAAkB,GAAqE,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,sBAAsB,CAAE,CAAC,QAAQ,E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AAC,qBAAqB,EAAE,SAAS,EAAE;gBAC5D,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,WAAW,EAAE,kBAAkB;gBAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACR,gBAAgB;YAChB,iBAAiB;YACjB,mBAAmB;SACpB,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC;AArHD,4CAqHC"}
@@ -0,0 +1,12 @@
1
+ import type { NgGenerateModuleSchema } from '../schema';
2
+ import { Rule } from '@angular-devkit/schematics';
3
+ /**
4
+ * generate the rules to adapt the library generated by nx cli
5
+ *
6
+ * @param options
7
+ * @param rootPath
8
+ */
9
+ export declare function nxGenerateModule(options: NgGenerateModuleSchema & {
10
+ packageJsonName: string;
11
+ }): Rule;
12
+ //# sourceMappingURL=rules.nx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.nx.d.ts","sourceRoot":"","sources":["../../../../schematics/library/rules/rules.nx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAwF,IAAI,EAAuB,MAAM,4BAA4B,CAAC;AAM7J;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,sBAAsB,GAAG;IAAC,eAAe,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,CAwHlG"}
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nxGenerateModule = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const path = require("node:path");
6
+ const node_fs_1 = require("node:fs");
7
+ const shared_1 = require("./shared");
8
+ const schematics_2 = require("@o3r/schematics");
9
+ /**
10
+ * generate the rules to adapt the library generated by nx cli
11
+ *
12
+ * @param options
13
+ * @param rootPath
14
+ */
15
+ function nxGenerateModule(options) {
16
+ /**
17
+ * Determine the path where NX schematic will generate the package
18
+ *
19
+ * @param tree
20
+ */
21
+ const determineNxTargetFolder = (tree) => {
22
+ const { workspaceLayout } = tree.readJson('/nx.json');
23
+ return path.posix.join(workspaceLayout.libsDir, options.name);
24
+ };
25
+ /**
26
+ * Save the content of files before the process of Nx generation
27
+ *
28
+ * @param tree
29
+ */
30
+ const savePreCommandContent = (tree) => {
31
+ const files = [
32
+ '/.vscode/extensions.json',
33
+ '.gitignore',
34
+ '.prettierignore',
35
+ '.prettierrc',
36
+ 'jest.preset.js',
37
+ 'nx.json',
38
+ 'package.json'
39
+ ];
40
+ return files.reduce((acc, file) => {
41
+ if (!tree.exists(file)) {
42
+ acc[file] = null;
43
+ return acc;
44
+ }
45
+ acc[file] = tree.read(file);
46
+ return acc;
47
+ }, {});
48
+ };
49
+ /**
50
+ * Restore the file saved
51
+ *
52
+ * @param mem
53
+ */
54
+ const restoreFiles = (mem) => (tree) => {
55
+ Object.entries(mem)
56
+ .forEach(([file, content]) => {
57
+ if (content === null) {
58
+ if (tree.exists(file)) {
59
+ tree.delete(file);
60
+ }
61
+ }
62
+ else {
63
+ tree.overwrite(file, content);
64
+ }
65
+ });
66
+ return tree;
67
+ };
68
+ /**
69
+ * Update Nx templates
70
+ *
71
+ * @param tree File tree
72
+ * @param context Context of the schematics
73
+ */
74
+ const updateNxTemplate = (tree, context) => {
75
+ const rules = [];
76
+ let targetPath = determineNxTargetFolder(tree);
77
+ if (options.path) {
78
+ rules.push((0, schematics_1.move)(targetPath, options.path));
79
+ targetPath = options.path;
80
+ }
81
+ const o3rCorePackageJsonPath = path.resolve(__dirname, '..', '..', '..', 'package.json');
82
+ const o3rCorePackageJson = JSON.parse((0, node_fs_1.readFileSync)(o3rCorePackageJsonPath).toString());
83
+ const otterVersion = o3rCorePackageJson.dependencies['@o3r/schematics'];
84
+ const templateNx = (0, schematics_1.apply)((0, schematics_1.url)('./templates/nx'), [
85
+ (0, schematics_1.template)({
86
+ ...options,
87
+ path: targetPath,
88
+ projectRoot: path.posix.resolve(targetPath, options.name),
89
+ otterVersion,
90
+ runner: (0, schematics_2.getPackageManagerRunner)((0, schematics_2.getWorkspaceConfig)(tree))
91
+ }),
92
+ (0, schematics_1.renameTemplateFiles)(),
93
+ (0, schematics_1.move)(targetPath)
94
+ ]);
95
+ rules.push((0, schematics_1.mergeWith)(templateNx, schematics_1.MergeStrategy.Overwrite));
96
+ return (0, schematics_1.chain)([
97
+ ...rules,
98
+ (0, shared_1.updatePackageDependenciesFactory)(targetPath, otterVersion, o3rCorePackageJson, options),
99
+ (0, shared_1.updateNgPackagrFactory)(targetPath),
100
+ (t) => {
101
+ const packageJson = t.readJson(path.posix.join(targetPath, 'package.json'));
102
+ packageJson.name = options.packageJsonName;
103
+ packageJson.scripts ||= {};
104
+ packageJson.scripts.ng = 'nx';
105
+ t.overwrite(path.posix.join(targetPath, 'package.json'), JSON.stringify(packageJson, null, 2));
106
+ return t;
107
+ }
108
+ ])(tree, context);
109
+ };
110
+ const nxCliUpdate = (tree, context) => {
111
+ const mem = savePreCommandContent(tree);
112
+ const config = {
113
+ name: options.name,
114
+ importPath: options.packageJsonName,
115
+ buildable: true,
116
+ publishable: true
117
+ };
118
+ return (0, schematics_1.chain)([
119
+ (t, c) => (0, schematics_1.externalSchematic)('@nx/angular', 'library', config)(t, c),
120
+ restoreFiles(mem),
121
+ updateNxTemplate
122
+ ])(tree, context);
123
+ };
124
+ return nxCliUpdate;
125
+ }
126
+ exports.nxGenerateModule = nxGenerateModule;
127
+ //# sourceMappingURL=rules.nx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.nx.js","sourceRoot":"","sources":["../../../../schematics/library/rules/rules.nx.ts"],"names":[],"mappings":";;;AAEA,2DAA6J;AAC7J,kCAAkC;AAClC,qCAAuC;AACvC,qCAAoF;AACpF,gDAA8E;AAE9E;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,OAA2D;IA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C;YACnE,YAAY,CAAC,GAAG,CAAC;YACjB,gBAAgB;SACjB,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC;AAxHD,4CAwHC"}
@@ -0,0 +1,19 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
2
+ import type { PackageJson } from 'type-fest';
3
+ import { NgGenerateModuleSchema } from '../schema';
4
+ /**
5
+ * Generate rule to update generated package.json file
6
+ * @param targetPath Path of the generated files
7
+ * @param otterVersion Current version of otter
8
+ * @param o3rCorePackageJson Content of core's package.json
9
+ * @param options Option of the schematic
10
+ */
11
+ export declare function updatePackageDependenciesFactory(targetPath: string, otterVersion: string, o3rCorePackageJson: PackageJson & {
12
+ generatorDependencies?: Record<string, string>;
13
+ }, options: NgGenerateModuleSchema): Rule;
14
+ /**
15
+ * Generate rule to update generated ng-packagr.json file
16
+ * @param targetPath Path of the generated files
17
+ */
18
+ export declare function updateNgPackagrFactory(targetPath: string): Rule;
19
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../schematics/library/rules/shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAGnD;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC5C,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,kBAAkB,EAAE,WAAW,GAAG;IAAE,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAC,EACnF,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAyDzC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAO/D"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateNgPackagrFactory = exports.updatePackageDependenciesFactory = void 0;
4
+ const path = require("node:path");
5
+ const schematics_1 = require("@o3r/schematics");
6
+ /**
7
+ * Generate rule to update generated package.json file
8
+ * @param targetPath Path of the generated files
9
+ * @param otterVersion Current version of otter
10
+ * @param o3rCorePackageJson Content of core's package.json
11
+ * @param options Option of the schematic
12
+ */
13
+ function updatePackageDependenciesFactory(targetPath, otterVersion, o3rCorePackageJson, options) {
14
+ return (tree) => {
15
+ /* eslint-disable @typescript-eslint/naming-convention */
16
+ const packageJson = tree.readJson(path.posix.join(targetPath, 'package.json'));
17
+ const runner = (0, schematics_1.getPackageManagerRunner)((0, schematics_1.getWorkspaceConfig)(tree));
18
+ packageJson.description = options.description || packageJson.description;
19
+ packageJson.scripts ||= {};
20
+ packageJson.scripts.build = `${runner} ng build ${options.name}`;
21
+ packageJson.scripts['prepare:build:builders'] = `${runner} cpy 'collection.json' dist && ${runner} cpy 'schematics/**/*.json' dist/schematics`;
22
+ packageJson.scripts['build:builders'] = 'tsc -b tsconfig.builders.json --pretty';
23
+ packageJson.peerDependencies ||= {};
24
+ packageJson.peerDependencies['@o3r/dev-tools'] = otterVersion;
25
+ packageJson.peerDependencies['@o3r/core'] = otterVersion;
26
+ packageJson.peerDependencies['@o3r/schematics'] = otterVersion;
27
+ packageJson.devDependencies ||= {};
28
+ packageJson.keywords ||= [];
29
+ packageJson.keywords.push('otter-module');
30
+ packageJson.version = '0.0.0-placeholder';
31
+ packageJson.devDependencies = {
32
+ ...packageJson.devDependencies,
33
+ '@angular-devkit/build-angular': o3rCorePackageJson.peerDependencies['@angular-devkit/core'],
34
+ '@angular-devkit/core': o3rCorePackageJson.peerDependencies['@angular-devkit/core'],
35
+ '@angular-eslint/eslint-plugin': o3rCorePackageJson.generatorDependencies['@angular-eslint/eslint-plugin'],
36
+ '@angular/cli': packageJson.peerDependencies['@angular/common'],
37
+ '@angular/common': packageJson.peerDependencies['@angular/common'],
38
+ '@angular/compiler': packageJson.peerDependencies['@angular/common'],
39
+ '@angular/compiler-cli': packageJson.peerDependencies['@angular/common'],
40
+ '@angular/core': packageJson.peerDependencies['@angular/common'],
41
+ '@angular/platform-browser': packageJson.peerDependencies['@angular/common'],
42
+ '@angular/platform-browser-dynamic': packageJson.peerDependencies['@angular/common'],
43
+ '@o3r/core': otterVersion,
44
+ '@o3r/dev-tools': otterVersion,
45
+ '@o3r/eslint-plugin': otterVersion,
46
+ '@schematics/angular': o3rCorePackageJson.peerDependencies['@schematics/angular'],
47
+ '@types/jest': o3rCorePackageJson.generatorDependencies['@types/jest'],
48
+ '@typescript-eslint/eslint-plugin': o3rCorePackageJson.generatorDependencies['@typescript-eslint/parser'],
49
+ '@typescript-eslint/parser': o3rCorePackageJson.generatorDependencies['@typescript-eslint/parser'],
50
+ 'cpy-cli': o3rCorePackageJson.generatorDependencies['cpy-cli'],
51
+ 'eslint': o3rCorePackageJson.generatorDependencies.eslint,
52
+ 'eslint-import-resolver-node': o3rCorePackageJson.generatorDependencies['eslint-import-resolver-node'],
53
+ 'eslint-plugin-jest': o3rCorePackageJson.generatorDependencies['eslint-plugin-jest'],
54
+ 'eslint-plugin-jsdoc': o3rCorePackageJson.generatorDependencies['eslint-plugin-jsdoc'],
55
+ 'eslint-plugin-prefer-arrow': o3rCorePackageJson.generatorDependencies['eslint-plugin-prefer-arrow'],
56
+ 'eslint-plugin-unicorn': o3rCorePackageJson.generatorDependencies['eslint-plugin-unicorn'],
57
+ 'jest': o3rCorePackageJson.generatorDependencies.jest,
58
+ 'jest-environment-jsdom': o3rCorePackageJson.generatorDependencies.jest,
59
+ 'jest-junit': o3rCorePackageJson.generatorDependencies['jest-junit'],
60
+ 'jest-preset-angular': o3rCorePackageJson.generatorDependencies['jest-preset-angular'],
61
+ 'rxjs': o3rCorePackageJson.peerDependencies.rxjs,
62
+ 'typescript': o3rCorePackageJson.peerDependencies.typescript,
63
+ 'zone.js': o3rCorePackageJson.generatorDependencies['zone.js']
64
+ };
65
+ /* eslint-enable @typescript-eslint/naming-convention */
66
+ tree.overwrite(path.posix.join(targetPath, 'package.json'), JSON.stringify(packageJson, null, 2));
67
+ return tree;
68
+ };
69
+ }
70
+ exports.updatePackageDependenciesFactory = updatePackageDependenciesFactory;
71
+ /**
72
+ * Generate rule to update generated ng-packagr.json file
73
+ * @param targetPath Path of the generated files
74
+ */
75
+ function updateNgPackagrFactory(targetPath) {
76
+ return (tree) => {
77
+ const ngPackagr = tree.readJson(path.posix.join(targetPath, 'ng-package.json'));
78
+ ngPackagr.$schema = 'https://raw.githubusercontent.com/ng-packagr/ng-packagr/master/src/ng-package.schema.json';
79
+ tree.overwrite(path.posix.join(targetPath, 'ng-package.json'), JSON.stringify(ngPackagr, null, 2));
80
+ return tree;
81
+ };
82
+ }
83
+ exports.updateNgPackagrFactory = updateNgPackagrFactory;
84
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../schematics/library/rules/shared.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAIlC,gDAA8E;AAE9E;;;;;;GAMG;AACH,SAAgB,gCAAgC,CAC5C,UAAkB,EAClB,YAAoB,EACpB,kBAAmF,EACnF,OAA+B;IACjC,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,yDAAyD;QACzD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAgB,CAAC;QAC9F,MAAM,MAAM,GAAG,IAAA,oCAAuB,EAAC,IAAA,+BAAkB,EAAC,IAAI,CAAC,CAAC,CAAC;QACjE,WAAW,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,WAAW,CAAC,WAAW,CAAC;QACzE,WAAW,CAAC,OAAO,KAAK,EAAE,CAA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,UAAU;YAC7D,SAAS,EAAE,kBAAkB,CAAC,qBAAsB,CAAC,SAAS,CAAC;SAChE,CAAC;QACF,wDAAwD;QACxD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAClG,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AA7DD,4EA6DC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,UAAkB;IACvD,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAQ,CAAC;QACvF,SAAS,CAAC,OAAO,GAAG,2FAA2F,CAAC;QAChH,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACnG,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAPD,wDAOC"}
@@ -0,0 +1,18 @@
1
+ import type { SchematicOptionObject } from '@o3r/schematics';
2
+ export interface NgGenerateModuleSchema 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
+ /** Prefix use to package future generation */
10
+ prefix?: string | undefined;
11
+ /** Name of the Nx Project (applied only in Nx Monorepo) */
12
+ projectName?: string | undefined;
13
+ /** Skip the linter process */
14
+ skipLinter: boolean;
15
+ /** Do not install dependency packages. */
16
+ skipInstall: boolean;
17
+ }
18
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/library/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACnE,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,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IAEpB,0CAA0C;IAC1C,WAAW,EAAE,OAAO,CAAC;CACtB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../schematics/library/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "ngGenerateModuleSchematicsSchema",
4
+ "title": "Generate a new Otter compatible module",
5
+ "description": "Generate a new Otter module",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "Package name",
10
+ "x-prompt": "Name of the package of the new module?",
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
+ "skipLinter": {
30
+ "type": "boolean",
31
+ "description": "Skip the linter process",
32
+ "default": true
33
+ },
34
+ "skipInstall": {
35
+ "description": "Do not install dependency packages.",
36
+ "type": "boolean",
37
+ "default": false
38
+ }
39
+ },
40
+ "required": ["name"],
41
+ "additionalProperties": true
42
+ }
@@ -0,0 +1,19 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ /* eslint-disable quote-props */
3
+
4
+ module.exports = {
5
+ 'root': true,
6
+ 'parserOptions': {
7
+ 'tsconfigRootDir': __dirname,
8
+ 'project': [
9
+ 'tsconfig.build.json',
10
+ 'tsconfig.spec.json',
11
+ 'tsconfig.builders.json',
12
+ 'tsconfig.eslint.json'
13
+ ],
14
+ 'sourceType': 'module'
15
+ },
16
+ 'extends': [
17
+ '<%= eslintRcPath %>'
18
+ ]
19
+ };
@@ -0,0 +1,2 @@
1
+ /dist
2
+ /build
@@ -0,0 +1,37 @@
1
+ const { getJestModuleNameMapper } = require('@o3r/dev-tools');
2
+
3
+ globalThis.ngJest = {
4
+ skipNgcc: true
5
+ };
6
+
7
+ /** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
8
+ module.exports = {
9
+ displayName: require('./package.json').name,
10
+ preset: 'jest-preset-angular',
11
+ setupFilesAfterEnv: ['<rootDir>/testing/setup-jest.ts'],
12
+ rootDir: '.',
13
+ moduleNameMapper: getJestModuleNameMapper(__dirname),
14
+ testPathIgnorePatterns: [
15
+ '<rootDir>/dist',
16
+ ],
17
+ reporters: [
18
+ 'default',
19
+ 'github-actions'
20
+ ],
21
+ globalSetup: 'jest-preset-angular/global-setup',
22
+ transform: {
23
+ // eslint-disable-next-line @typescript-eslint/naming-convention
24
+ '^.+\\.tsx?$': [
25
+ 'jest-preset-angular',
26
+ {
27
+ tsconfig: '<rootDir>/tsconfig.spec.json',
28
+ stringifyContentPathRegex: '\\.html$'
29
+ }
30
+ ]
31
+ },
32
+ snapshotSerializers: [
33
+ 'jest-preset-angular/build/serializers/no-ng-attributes',
34
+ 'jest-preset-angular/build/serializers/ng-snapshot',
35
+ 'jest-preset-angular/build/serializers/html-comment',
36
+ ]
37
+ };
@@ -0,0 +1,2 @@
1
+ import 'jest-preset-angular/setup-jest';
2
+
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": "<%= tsconfigBuildPath %>",
3
+ "compilerOptions": {
4
+ "skipLibCheck": true,
5
+ "incremental": true,
6
+ "composite": true,
7
+ "outDir": "./dist",
8
+ "module": "CommonJS",
9
+ "rootDir": ".",
10
+ "declaration": true,
11
+ "tsBuildInfoFile": "build/.tsbuildinfo.builders"
12
+ },
13
+ "include": [
14
+ "builders/**/*.ts",
15
+ "schematics/**/*.ts"
16
+ ],
17
+ "exclude": [
18
+ "**/*.spec.ts",
19
+ "builders/**/templates/**",
20
+ "schematics/**/templates/**"
21
+ ]
22
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.lib",
3
+ "include": [
4
+ ".eslintrc.js",
5
+ "jest.config.js",
6
+ "testing/*"
7
+ ]
8
+ }
@@ -0,0 +1,12 @@
1
+ /* For IDE usage only */
2
+ {
3
+ "extends": "<%= tsconfigBasePath %>",
4
+ "references": [
5
+ {
6
+ "path": "./tsconfig.lib.json"
7
+ },
8
+ {
9
+ "path": "./tsconfig.spec.json"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "<%= tsconfigSpecPath %>",
3
+ "compilerOptions": {
4
+ "composite": true,
5
+ "outDir": "test",
6
+ "rootDir": ".",
7
+ },
8
+ "include": [
9
+ "./src/**/*.spec.ts"
10
+ ],
11
+ "exclude": [],
12
+ "references": [
13
+ {
14
+ "path": "./tsconfig.build.composite.json"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,19 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ /* eslint-disable quote-props */
3
+
4
+ module.exports = {
5
+ 'root': true,
6
+ 'parserOptions': {
7
+ 'tsconfigRootDir': __dirname,
8
+ 'project': [
9
+ 'tsconfig.build.json',
10
+ 'tsconfig.spec.json',
11
+ 'tsconfig.builders.json',
12
+ 'tsconfig.eslint.json'
13
+ ],
14
+ 'sourceType': 'module'
15
+ },
16
+ 'extends': [
17
+ './tsconfig.eslint.json'
18
+ ]
19
+ };
@@ -0,0 +1,2 @@
1
+ /dist
2
+ /build