@rxap/plugin-library 16.0.0-dev.9 → 16.0.1-dev.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/CHANGELOG.md +277 -0
- package/LICENSE.md +621 -0
- package/README.md +71 -1
- package/generators.json +52 -0
- package/package.json +68 -50
- package/src/executors/check-version/executor.js +7 -2
- package/src/executors/check-version/executor.js.map +1 -1
- package/src/executors/readme/executor.js +124 -66
- package/src/executors/readme/executor.js.map +1 -1
- package/src/executors/run-generator/executor.d.ts +1 -1
- package/src/executors/run-generator/executor.js +69 -9
- package/src/executors/run-generator/executor.js.map +1 -1
- package/src/executors/run-generator/schema.d.ts +1 -0
- package/src/executors/run-generator/schema.json +4 -0
- package/src/generators/expose-as-schematic/generator.d.ts +4 -0
- package/src/generators/expose-as-schematic/generator.js +44 -0
- package/src/generators/expose-as-schematic/generator.js.map +1 -0
- package/src/generators/expose-as-schematic/index.d.ts +2 -0
- package/src/generators/expose-as-schematic/index.js +8 -0
- package/src/generators/expose-as-schematic/index.js.map +1 -0
- package/src/generators/expose-as-schematic/schema.d.ts +3 -0
- package/src/generators/expose-as-schematic/schema.json +16 -0
- package/src/generators/fix-dependencies/generator.js +39 -103
- package/src/generators/fix-dependencies/generator.js.map +1 -1
- package/src/generators/fix-dependencies/index.d.ts +2 -0
- package/src/generators/fix-dependencies/index.js +8 -0
- package/src/generators/fix-dependencies/index.js.map +1 -0
- package/src/generators/index-export/generator.js +13 -4
- package/src/generators/index-export/generator.js.map +1 -1
- package/src/generators/index-export/index.d.ts +2 -0
- package/src/generators/index-export/index.js +8 -0
- package/src/generators/index-export/index.js.map +1 -0
- package/src/generators/init/generator.js +52 -116
- package/src/generators/init/generator.js.map +1 -1
- package/src/generators/init/index.d.ts +2 -0
- package/src/generators/init/index.js +8 -0
- package/src/generators/init/index.js.map +1 -0
- package/src/generators/init/schema.d.ts +2 -0
- package/src/generators/init/schema.json +10 -0
- package/src/generators/init-buildable/generator.d.ts +4 -0
- package/src/generators/init-buildable/generator.js +45 -0
- package/src/generators/init-buildable/generator.js.map +1 -0
- package/src/generators/init-buildable/index.d.ts +2 -0
- package/src/generators/init-buildable/index.js +8 -0
- package/src/generators/init-buildable/index.js.map +1 -0
- package/src/generators/init-buildable/schema.d.ts +5 -0
- package/src/generators/init-buildable/schema.json +26 -0
- package/src/generators/init-plugin/generator.js +36 -20
- package/src/generators/init-plugin/generator.js.map +1 -1
- package/src/generators/init-plugin/index.d.ts +2 -0
- package/src/generators/init-plugin/index.js +8 -0
- package/src/generators/init-plugin/index.js.map +1 -0
- package/src/generators/init-plugin/schema.d.ts +2 -0
- package/src/generators/init-plugin/schema.json +10 -0
- package/src/generators/init-publishable/generator.d.ts +4 -0
- package/src/generators/init-publishable/generator.js +126 -0
- package/src/generators/init-publishable/generator.js.map +1 -0
- package/src/generators/init-publishable/index.d.ts +2 -0
- package/src/generators/init-publishable/index.js +8 -0
- package/src/generators/init-publishable/index.js.map +1 -0
- package/src/generators/init-publishable/schema.d.ts +5 -0
- package/src/generators/init-publishable/schema.json +26 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +3 -1
- package/src/index.js.map +1 -1
- /package/src/generators/{init → init-publishable}/files/README.md.handlebars +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const generator_1 = tslib_1.__importDefault(require("./generator"));
|
|
6
|
+
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
7
|
+
exports.default = schematic;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/library/src/generators/index-export/index.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAChD,oEAAoC;AAEpC,MAAM,SAAS,GAAG,IAAA,2BAAkB,EAAC,mBAAS,CAAC,CAAC;AAChD,kBAAe,SAAS,CAAC"}
|
|
@@ -6,105 +6,13 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const generator_utilities_1 = require("@rxap/generator-utilities");
|
|
7
7
|
const plugin_angular_1 = require("@rxap/plugin-angular");
|
|
8
8
|
const plugin_nestjs_1 = require("@rxap/plugin-nestjs");
|
|
9
|
-
const
|
|
10
|
-
const generator_1 = tslib_1.__importDefault(require("../init-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _d, _e;
|
|
14
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
15
|
-
(_a = nxJson.targetDefaults) !== null && _a !== void 0 ? _a : (nxJson.targetDefaults = {});
|
|
16
|
-
// region build
|
|
17
|
-
(_b = (_d = nxJson.targetDefaults)['build']) !== null && _b !== void 0 ? _b : (_d['build'] = { dependsOn: ['^build'] });
|
|
18
|
-
if (!nxJson.targetDefaults['build']
|
|
19
|
-
.dependsOn
|
|
20
|
-
.find(dependsOn => typeof dependsOn === 'object' && dependsOn.target === 'readme')) {
|
|
21
|
-
nxJson.targetDefaults['build']
|
|
22
|
-
.dependsOn
|
|
23
|
-
.push({
|
|
24
|
-
target: 'readme',
|
|
25
|
-
projects: 'self',
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
// endregion
|
|
29
|
-
// region readme
|
|
30
|
-
(_c = (_e = nxJson.targetDefaults)['readme']) !== null && _c !== void 0 ? _c : (_e['readme'] = {});
|
|
31
|
-
nxJson.targetDefaults['readme'].inputs = [
|
|
32
|
-
'{projectRoot}/README.md.handlebars',
|
|
33
|
-
'{projectRoot}/GETSTARTED.md',
|
|
34
|
-
'{projectRoot}/GUIDES.md',
|
|
35
|
-
'{projectRoot}/package.json',
|
|
36
|
-
'{projectRoot}/collection.json',
|
|
37
|
-
'{projectRoot}/generators.json',
|
|
38
|
-
'{projectRoot}/executors.json',
|
|
39
|
-
'{projectRoot}/builders.json',
|
|
40
|
-
];
|
|
41
|
-
nxJson.targetDefaults['readme'].outputs = ['{projectRoot}/README.md'];
|
|
42
|
-
// endregion
|
|
43
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
44
|
-
}
|
|
45
|
-
function updateProjectPackageJson(tree, project, projectName, rootPackageJson) {
|
|
46
|
-
var _a, _b, _c, _d, _e;
|
|
47
|
-
const packageJson = (0, devkit_1.readJson)(tree, (0, path_1.join)(project.root, 'package.json'));
|
|
48
|
-
(_a = packageJson.scripts) !== null && _a !== void 0 ? _a : (packageJson.scripts = {});
|
|
49
|
-
if (packageJson.scripts.prepublishOnly) {
|
|
50
|
-
delete packageJson.scripts.prepublishOnly;
|
|
51
|
-
}
|
|
52
|
-
if (packageJson.scripts.preversion) {
|
|
53
|
-
delete packageJson.scripts.preversion;
|
|
54
|
-
}
|
|
55
|
-
if (packageJson.scripts.version) {
|
|
56
|
-
delete packageJson.scripts.version;
|
|
57
|
-
}
|
|
58
|
-
if (Object.keys(packageJson.scripts).length === 0) {
|
|
59
|
-
delete packageJson.scripts;
|
|
60
|
-
}
|
|
61
|
-
(_b = packageJson.publishConfig) !== null && _b !== void 0 ? _b : (packageJson.publishConfig = {});
|
|
62
|
-
packageJson.publishConfig.access = 'public';
|
|
63
|
-
const output = (0, generator_utilities_1.GetBuildOutputForProject)(project);
|
|
64
|
-
packageJson.publishConfig.directory = (0, path_1.relative)(project.root, output);
|
|
65
|
-
// add common properties
|
|
66
|
-
packageJson.keywords = [
|
|
67
|
-
...new Set([
|
|
68
|
-
...((_c = packageJson.keywords) !== null && _c !== void 0 ? _c : []),
|
|
69
|
-
...((_d = rootPackageJson.keywords) !== null && _d !== void 0 ? _d : []),
|
|
70
|
-
...((_e = project.tags) !== null && _e !== void 0 ? _e : []),
|
|
71
|
-
]),
|
|
72
|
-
];
|
|
73
|
-
packageJson.homepage = (0, path_1.join)(rootPackageJson.homepage, project.root);
|
|
74
|
-
packageJson.bugs = rootPackageJson.bugs;
|
|
75
|
-
packageJson.license = rootPackageJson.license;
|
|
76
|
-
packageJson.contributors = rootPackageJson.contributors;
|
|
77
|
-
packageJson.funding = rootPackageJson.funding;
|
|
78
|
-
packageJson.repository = rootPackageJson.repository;
|
|
79
|
-
if (packageJson.repository && typeof packageJson.repository === 'object') {
|
|
80
|
-
packageJson.repository.directory = project.root;
|
|
81
|
-
}
|
|
82
|
-
packageJson.author = rootPackageJson.author;
|
|
83
|
-
(0, devkit_1.writeJson)(tree, (0, path_1.join)(project.root, 'package.json'), packageJson);
|
|
84
|
-
}
|
|
85
|
-
function updateProjectTargets(project) {
|
|
86
|
-
var _a, _b, _c, _d, _e;
|
|
87
|
-
var _f, _g, _h, _j;
|
|
88
|
-
(_a = project.targets) !== null && _a !== void 0 ? _a : (project.targets = {});
|
|
89
|
-
(_b = (_f = project.targets)['update-dependencies']) !== null && _b !== void 0 ? _b : (_f['update-dependencies'] = { executor: '@rxap/plugin-library:update-dependencies' });
|
|
90
|
-
(_c = (_g = project.targets)['update-package-group']) !== null && _c !== void 0 ? _c : (_g['update-package-group'] = { executor: '@rxap/plugin-library:update-package-group' });
|
|
91
|
-
(_d = (_h = project.targets)['readme']) !== null && _d !== void 0 ? _d : (_h['readme'] = { executor: '@rxap/plugin-library:readme' });
|
|
92
|
-
(_e = (_j = project.targets)['fix-dependencies']) !== null && _e !== void 0 ? _e : (_j['fix-dependencies'] = {
|
|
93
|
-
executor: '@rxap/plugin-library:run-generator',
|
|
94
|
-
outputs: [
|
|
95
|
-
'{workspaceRoot}/{projectRoot}/package.json',
|
|
96
|
-
],
|
|
97
|
-
options: {
|
|
98
|
-
generator: '@rxap/plugin-library:fix-dependencies',
|
|
99
|
-
options: {
|
|
100
|
-
strict: true,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
}
|
|
9
|
+
const workspace_utilities_1 = require("@rxap/workspace-utilities");
|
|
10
|
+
const generator_1 = tslib_1.__importDefault(require("../init-buildable/generator"));
|
|
11
|
+
const generator_2 = tslib_1.__importDefault(require("../init-plugin/generator"));
|
|
12
|
+
const generator_3 = tslib_1.__importDefault(require("../init-publishable/generator"));
|
|
105
13
|
function updateProjectTags(project) {
|
|
106
14
|
const tags = project.root.split('/').filter(Boolean);
|
|
107
|
-
tags.
|
|
15
|
+
const projectName = tags.pop(); // remove the last element this is the project name
|
|
108
16
|
if (tags[0] === 'angular') {
|
|
109
17
|
tags.push('ngx');
|
|
110
18
|
}
|
|
@@ -112,6 +20,34 @@ function updateProjectTags(project) {
|
|
|
112
20
|
tags.push('nestjs');
|
|
113
21
|
}
|
|
114
22
|
(0, generator_utilities_1.CoerceProjectTags)(project, tags);
|
|
23
|
+
// if the tag list does not include the project name
|
|
24
|
+
if (!tags.includes(projectName)) {
|
|
25
|
+
// then remove the project name from the tags if it is included
|
|
26
|
+
project.tags = project.tags.filter(tag => tag !== projectName);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function updateProjectTargets(project) {
|
|
30
|
+
if (!(0, workspace_utilities_1.IsPluginProject)(project) && !(0, workspace_utilities_1.IsGeneratorProject)(project) && !(0, workspace_utilities_1.IsSchematicProject)(project)) {
|
|
31
|
+
(0, workspace_utilities_1.CoerceTarget)(project, 'index-export', {});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function updateDefaultProjectTargets(tree) {
|
|
35
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
36
|
+
(0, workspace_utilities_1.CoerceTarget)(nxJson, 'index-export', {
|
|
37
|
+
'executor': '@rxap/plugin-library:run-generator',
|
|
38
|
+
'outputs': [
|
|
39
|
+
'{workspaceRoot}/{projectRoot}/src/index.ts',
|
|
40
|
+
],
|
|
41
|
+
'options': {
|
|
42
|
+
'generator': '@rxap/plugin-library:index-export',
|
|
43
|
+
},
|
|
44
|
+
'inputs': [
|
|
45
|
+
'production',
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
(0, workspace_utilities_1.CoerceNxJsonCacheableOperation)(nxJson, 'index-export');
|
|
49
|
+
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', '^index-export');
|
|
50
|
+
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', 'index-export');
|
|
115
51
|
}
|
|
116
52
|
function skipProject(tree, options, project, projectName) {
|
|
117
53
|
if ((0, generator_utilities_1.SkipNonLibraryProject)(tree, options, project, projectName)) {
|
|
@@ -120,33 +56,33 @@ function skipProject(tree, options, project, projectName) {
|
|
|
120
56
|
return false;
|
|
121
57
|
}
|
|
122
58
|
function initGenerator(tree, options) {
|
|
123
|
-
var _a, _b, _c;
|
|
124
59
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
125
60
|
console.log('library init generator:', options);
|
|
126
|
-
|
|
127
|
-
setGeneralTargetDefaults(tree);
|
|
61
|
+
updateDefaultProjectTargets(tree);
|
|
128
62
|
for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
|
|
129
63
|
if (skipProject(tree, options, project, projectName)) {
|
|
130
64
|
continue;
|
|
131
65
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
(0,
|
|
142
|
-
|
|
143
|
-
|
|
66
|
+
if (!options.skipProjects) {
|
|
67
|
+
console.log(`init project: ${projectName}`);
|
|
68
|
+
updateProjectTags(project);
|
|
69
|
+
updateProjectTargets(project);
|
|
70
|
+
(0, devkit_1.updateProjectConfiguration)(tree, project.name, project);
|
|
71
|
+
}
|
|
72
|
+
if ((0, generator_utilities_1.IsBuildable)(project)) {
|
|
73
|
+
yield (0, generator_1.default)(tree, options);
|
|
74
|
+
}
|
|
75
|
+
if ((0, generator_utilities_1.IsPublishable)(tree, project)) {
|
|
76
|
+
yield (0, generator_3.default)(tree, options);
|
|
77
|
+
}
|
|
78
|
+
if ((0, workspace_utilities_1.IsAngularProject)(project)) {
|
|
79
|
+
yield (0, plugin_angular_1.AngularInitGenerator)(tree, Object.assign(Object.assign({}, options), { projects: [projectName], skipProjects: options.skipProjects }));
|
|
144
80
|
}
|
|
145
|
-
if ((
|
|
146
|
-
yield (0,
|
|
81
|
+
if ((0, workspace_utilities_1.IsPluginProject)(project)) {
|
|
82
|
+
yield (0, generator_2.default)(tree, Object.assign(Object.assign({}, options), { projects: [projectName], skipProjects: options.skipProjects }));
|
|
147
83
|
}
|
|
148
|
-
if ((
|
|
149
|
-
yield (0, plugin_nestjs_1.nestJsInitGenerator)(tree, Object.assign(Object.assign({}, options), { projects: [projectName] }));
|
|
84
|
+
if ((0, workspace_utilities_1.IsNestJsProject)(project)) {
|
|
85
|
+
yield (0, plugin_nestjs_1.nestJsInitGenerator)(tree, Object.assign(Object.assign({}, options), { projects: [projectName], skipProjects: options.skipProjects }));
|
|
150
86
|
}
|
|
151
87
|
}
|
|
152
88
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/library/src/generators/init/generator.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/library/src/generators/init/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAMoB;AACpB,mEAKmC;AACnC,yDAA4D;AAC5D,uDAA0D;AAC1D,mEASmC;AACnC,oFAAiE;AACjE,iFAA2D;AAC3D,sFAAqE;AAIrE,SAAS,iBAAiB,CAAC,OAA6B;IACtD,MAAM,IAAI,GAAa,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,mDAAmD;IACnF,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;QACzB,IAAI,CAAC,I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AAE,OAAO,CAAC,YAAY,IAErC,CAAC;aACH;YAED,IAAI,IAAA,qCAAe,EAAC,OAAO,CAAC,EAAE;gBAC5B,MAAM,IAAA,mBAAmB,EACvB,IAAI,kCAEC,OAAO,KACV,QAAQ,EAAE,CAAE,WAAW,CAAE,EACzB,YAAY,EAAE,OAAO,CAAC,YAAY,IAErC,CAAC;aACH;YAED,IAAI,IAAA,qCAAe,EAAC,OAAO,CAAC,EAAE;gBAC5B,MAAM,IAAA,mCAAmB,EACvB,IAAI,kCAEC,OAAO,KACV,QAAQ,EAAE,CAAE,WAAW,CAAE,EACzB,YAAY,EAAE,OAAO,CAAC,YAAY,IAErC,CAAC;aACH;SAEF;IAEH,CAAC;CAAA;AA/DD,sCA+DC;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const generator_1 = tslib_1.__importDefault(require("./generator"));
|
|
6
|
+
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
7
|
+
exports.default = schematic;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/library/src/generators/init/index.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAChD,oEAAoC;AAEpC,MAAM,SAAS,GAAG,IAAA,2BAAkB,EAAC,mBAAS,CAAC,CAAC;AAChD,kBAAe,SAAS,CAAC"}
|
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
"items": {
|
|
11
11
|
"type": "string"
|
|
12
12
|
}
|
|
13
|
+
},
|
|
14
|
+
"overwrite": {
|
|
15
|
+
"type": "boolean",
|
|
16
|
+
"default": false,
|
|
17
|
+
"description": "Whether to overwrite existing files"
|
|
18
|
+
},
|
|
19
|
+
"skipProjects": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"default": false,
|
|
22
|
+
"description": "Whether to skip executing project specific initialization"
|
|
13
23
|
}
|
|
14
24
|
},
|
|
15
25
|
"required": []
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initBuildableGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const generator_utilities_1 = require("@rxap/generator-utilities");
|
|
7
|
+
const workspace_utilities_1 = require("@rxap/workspace-utilities");
|
|
8
|
+
function setGeneralTargetDefaults(tree) {
|
|
9
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
10
|
+
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', '^build');
|
|
11
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
12
|
+
}
|
|
13
|
+
function updateProjectTargets(project) {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
if ((_c = (_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a['build']) === null || _b === void 0 ? void 0 : _b.configurations) === null || _c === void 0 ? void 0 : _c['production']) {
|
|
16
|
+
(0, workspace_utilities_1.CoerceTarget)(project, 'build', {
|
|
17
|
+
defaultConfiguration: 'production',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function skipProject(tree, options, project, projectName) {
|
|
22
|
+
if ((0, generator_utilities_1.SkipNonBuildableProject)(tree, options, project, projectName)) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
function initBuildableGenerator(tree, options) {
|
|
28
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
console.log('buildable library init generator:', options);
|
|
30
|
+
setGeneralTargetDefaults(tree);
|
|
31
|
+
if (!options.skipProjects) {
|
|
32
|
+
for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
|
|
33
|
+
if (skipProject(tree, options, project, projectName)) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
console.log(`init project: ${projectName}`);
|
|
37
|
+
updateProjectTargets(project);
|
|
38
|
+
(0, devkit_1.updateProjectConfiguration)(tree, project.name, project);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.initBuildableGenerator = initBuildableGenerator;
|
|
44
|
+
exports.default = initBuildableGenerator;
|
|
45
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/library/src/generators/init-buildable/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,mEAAoE;AACpE,mEAGmC;AAInC,SAAS,wBAAwB,CAAC,IAAU;IAC1C,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;IAEhC,IAAA,oDAA8B,EAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAE1D,IAAA,qBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAE7B,CAAC;AAED,SAAS,oBAAoB,CAAC,OAA6B;;IACzD,IAAI,MAAA,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAG,OAAO,CAAC,0CAAE,cAAc,0CAAG,YAAY,CAAC,EAAE;QAC9D,IAAA,kCAAY,EAAC,OAAO,EAAE,OAAO,EAAE;YAC7B,oBAAoB,EAAE,YAAY;SACnC,CAAC,CAAC;KACJ;AACH,CAAC;AAED,SAAS,WAAW,CAClB,IAAU,EACV,OAA4B,EAC5B,OAA6B,EAC7B,WAAmB;IAGnB,IAAI,IAAA,6CAAuB,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QAChE,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AAEf,CAAC;AAED,SAAsB,sBAAsB,CAC1C,IAAU,EACV,OAAqC;;QAErC,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;QAE1D,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAE/B,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;YACzB,KAAK,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,IAAI,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;gBAElE,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;oBACpD,SAAS;iBACV;gBAED,OAAO,CAAC,GAAG,CAAC,iBAAkB,WAAY,EAAE,CAAC,CAAC;gBAC9C,oBAAoB,CAAC,OAAO,CAAC,CAAC;gBAE9B,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;aAEzD;SACF;IACH,CAAC;CAAA;AAtBD,wDAsBC;AAED,kBAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const generator_1 = tslib_1.__importDefault(require("./generator"));
|
|
6
|
+
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
7
|
+
exports.default = schematic;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/library/src/generators/init-buildable/index.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAChD,oEAAoC;AAEpC,MAAM,SAAS,GAAG,IAAA,2BAAkB,EAAC,mBAAS,CAAC,CAAC;AAChD,kBAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "InitBuildable",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"projects": {
|
|
8
|
+
"alias": "project",
|
|
9
|
+
"type": "array",
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"overwrite": {
|
|
15
|
+
"type": "boolean",
|
|
16
|
+
"default": false,
|
|
17
|
+
"description": "Whether to overwrite existing files"
|
|
18
|
+
},
|
|
19
|
+
"skipProjects": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"default": false,
|
|
22
|
+
"description": "Whether to skip executing project specific initialization"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": []
|
|
26
|
+
}
|
|
@@ -4,48 +4,64 @@ exports.initPluginGenerator = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const generator_utilities_1 = require("@rxap/generator-utilities");
|
|
7
|
+
const plugin_utilities_1 = require("@rxap/plugin-utilities");
|
|
8
|
+
const workspace_utilities_1 = require("@rxap/workspace-utilities");
|
|
7
9
|
function skipProject(tree, options, project, projectName) {
|
|
8
|
-
var _a;
|
|
9
10
|
if ((0, generator_utilities_1.SkipNonLibraryProject)(tree, options, project, projectName)) {
|
|
10
11
|
return true;
|
|
11
12
|
}
|
|
12
|
-
if (!(
|
|
13
|
+
if (!(0, workspace_utilities_1.IsPluginProject)(project)) {
|
|
13
14
|
return true;
|
|
14
15
|
}
|
|
15
16
|
return false;
|
|
16
17
|
}
|
|
17
|
-
function updateProjectTargets(project) {
|
|
18
|
-
|
|
19
|
-
(_a = project.targets) !== null && _a !== void 0 ? _a : (project.targets = {});
|
|
20
|
-
project.targets['check-version'] = {
|
|
18
|
+
function updateProjectTargets(tree, project) {
|
|
19
|
+
(0, workspace_utilities_1.CoerceTarget)(project, 'check-version', {
|
|
21
20
|
executor: '@rxap/plugin-library:check-version',
|
|
22
21
|
options: {
|
|
23
22
|
packageName: 'nx',
|
|
24
23
|
},
|
|
25
|
-
};
|
|
24
|
+
});
|
|
25
|
+
if ((0, plugin_utilities_1.HasGenerators)(tree, project)) {
|
|
26
|
+
(0, workspace_utilities_1.CoerceTarget)(project, 'expose-as-schematic', {
|
|
27
|
+
executor: '@rxap/plugin-library:run-generator',
|
|
28
|
+
options: {
|
|
29
|
+
generator: '@rxap/plugin-library:expose-as-schematic',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
26
33
|
}
|
|
27
34
|
function setGeneralTargetDefaults(tree) {
|
|
28
|
-
var _a, _b, _c, _d;
|
|
29
|
-
var _e;
|
|
30
35
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
31
|
-
(
|
|
32
|
-
(
|
|
33
|
-
if (!((_d = (_c = nxJson.targetDefaults['build']) === null || _c === void 0 ? void 0 : _c.dependsOn) === null || _d === void 0 ? void 0 : _d.includes('check-version'))) {
|
|
34
|
-
nxJson.targetDefaults['build'].dependsOn.push('check-version');
|
|
35
|
-
}
|
|
36
|
+
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', 'check-version', 'expose-as-schematic');
|
|
37
|
+
(0, workspace_utilities_1.CoerceNxJsonCacheableOperation)(nxJson, 'check-version', 'expose-as-schematic');
|
|
36
38
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
37
39
|
}
|
|
40
|
+
function updatePackageJson(tree, project) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
yield (0, workspace_utilities_1.UpdateProjectPackageJson)(tree, packageJson => {
|
|
43
|
+
if (packageJson.version === '0.0.1') {
|
|
44
|
+
const nxVersion = (0, workspace_utilities_1.GetNxVersion)(tree);
|
|
45
|
+
const major = nxVersion.split('.')[0];
|
|
46
|
+
packageJson.version = `${major}.0.0`;
|
|
47
|
+
}
|
|
48
|
+
}, { projectName: project.name });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
38
51
|
function initPluginGenerator(tree, options) {
|
|
39
52
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
53
|
console.log('plugin library init generator:', options);
|
|
41
54
|
setGeneralTargetDefaults(tree);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
if (!options.skipProjects) {
|
|
56
|
+
for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
|
|
57
|
+
if (skipProject(tree, options, project, projectName)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
console.log(`init project: ${projectName}`);
|
|
61
|
+
updateProjectTargets(tree, project);
|
|
62
|
+
(0, devkit_1.updateProjectConfiguration)(tree, project.name, project);
|
|
63
|
+
yield updatePackageJson(tree, project);
|
|
45
64
|
}
|
|
46
|
-
console.log(`init project: ${projectName}`);
|
|
47
|
-
updateProjectTargets(project);
|
|
48
|
-
(0, devkit_1.updateProjectConfiguration)(tree, project.name, project);
|
|
49
65
|
}
|
|
50
66
|
});
|
|
51
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/library/src/generators/init-plugin/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/library/src/generators/init-plugin/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,mEAImC;AACnC,6DAAuD;AACvD,mEASmC;AAGnC,SAAS,WAAW,CAClB,IAAU,EACV,OAAkC,EAClC,OAA6B,EAC7B,WAAmB;IAGnB,IAAI,IAAA,2CAAqB,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,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GAAG,GAAI,KAAM,MAAM,CAAC;aACxC;QAEH,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACpC,CAAC;CAAA;AAED,SAAsB,mBAAmB,CACvC,IAAU,EACV,OAAkC;;QAElC,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;QAEvD,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAE/B,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;YAEzB,KAAK,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,IAAI,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;gBAElE,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;oBACpD,SAAS;iBACV;gBAED,OAAO,CAAC,GAAG,CAAC,iBAAkB,WAAY,EAAE,CAAC,CAAC;gBAE9C,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAEpC,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAExD,MAAM,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;aAExC;SAEF;IAEH,CAAC;CAAA;AA5BD,kDA4BC;AAED,kBAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const generator_1 = tslib_1.__importDefault(require("./generator"));
|
|
6
|
+
const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
7
|
+
exports.default = schematic;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/library/src/generators/init-plugin/index.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAChD,oEAAoC;AAEpC,MAAM,SAAS,GAAG,IAAA,2BAAkB,EAAC,mBAAS,CAAC,CAAC;AAChD,kBAAe,SAAS,CAAC"}
|
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
"items": {
|
|
11
11
|
"type": "string"
|
|
12
12
|
}
|
|
13
|
+
},
|
|
14
|
+
"overwrite": {
|
|
15
|
+
"type": "boolean",
|
|
16
|
+
"default": false,
|
|
17
|
+
"description": "Whether to overwrite existing files"
|
|
18
|
+
},
|
|
19
|
+
"skipProjects": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"default": false,
|
|
22
|
+
"description": "Whether to skip executing project specific initialization"
|
|
13
23
|
}
|
|
14
24
|
},
|
|
15
25
|
"required": []
|