@storm-software/workspace-tools 1.202.0 → 1.203.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 +15 -0
- package/declarations.d.ts +18 -2
- package/index.js +96 -175
- package/meta.json +73 -118
- package/package.json +1 -1
- package/src/base/index.js +67 -94
- package/src/base/typescript-library-generator.d.ts +1 -3
- package/src/base/typescript-library-generator.js +67 -94
- package/src/executors/unbuild/schema.json +7 -1
- package/src/generators/browser-library/generator.js +72 -97
- package/src/generators/neutral-library/generator.js +68 -93
- package/src/generators/node-library/generator.js +68 -93
- package/src/plugins/rust/index.js +7 -0
- package/src/plugins/typescript/index.js +7 -0
- package/src/utils/index.js +7 -0
- package/src/utils/project-tags.d.ts +8 -1
- package/src/utils/project-tags.js +7 -0
|
@@ -29,7 +29,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// packages/workspace-tools/src/base/typescript-library-generator.ts
|
|
30
30
|
var typescript_library_generator_exports = {};
|
|
31
31
|
__export(typescript_library_generator_exports, {
|
|
32
|
-
addLint: () => addLint,
|
|
33
32
|
createProjectTsConfigJson: () => createProjectTsConfigJson,
|
|
34
33
|
getOutputPath: () => getOutputPath,
|
|
35
34
|
normalizeOptions: () => normalizeOptions,
|
|
@@ -42,6 +41,63 @@ var import_js = require("@nx/js");
|
|
|
42
41
|
var import_init = __toESM(require("@nx/js/src/generators/init/init"));
|
|
43
42
|
var import_generator = __toESM(require("@nx/js/src/generators/setup-verdaccio/generator"));
|
|
44
43
|
|
|
44
|
+
// packages/workspace-tools/src/utils/project-tags.ts
|
|
45
|
+
var ProjectTagConstants = {
|
|
46
|
+
Language: {
|
|
47
|
+
TAG_ID: "language",
|
|
48
|
+
TYPESCRIPT: "typescript",
|
|
49
|
+
RUST: "rust"
|
|
50
|
+
},
|
|
51
|
+
ProjectType: {
|
|
52
|
+
TAG_ID: "type",
|
|
53
|
+
LIBRARY: "library",
|
|
54
|
+
APPLICATION: "application"
|
|
55
|
+
},
|
|
56
|
+
DistStyle: {
|
|
57
|
+
TAG_ID: "dist-style",
|
|
58
|
+
NORMAL: "normal",
|
|
59
|
+
CLEAN: "clean"
|
|
60
|
+
},
|
|
61
|
+
Provider: {
|
|
62
|
+
TAG_ID: "provider"
|
|
63
|
+
},
|
|
64
|
+
Platform: {
|
|
65
|
+
TAG_ID: "platform",
|
|
66
|
+
NODE: "node",
|
|
67
|
+
BROWSER: "browser",
|
|
68
|
+
NEUTRAL: "neutral",
|
|
69
|
+
WORKER: "worker"
|
|
70
|
+
},
|
|
71
|
+
Registry: {
|
|
72
|
+
TAG_ID: "registry",
|
|
73
|
+
CARGO: "cargo",
|
|
74
|
+
NPM: "npm",
|
|
75
|
+
CONTAINER: "container",
|
|
76
|
+
CYCLONE: "cyclone"
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var formatProjectTag = (variant, value) => {
|
|
80
|
+
return `${variant}:${value}`;
|
|
81
|
+
};
|
|
82
|
+
var hasProjectTag = (project, variant) => {
|
|
83
|
+
project.tags = project.tags ?? [];
|
|
84
|
+
const prefix = formatProjectTag(variant, "");
|
|
85
|
+
return project.tags.some(
|
|
86
|
+
(tag) => tag.startsWith(prefix) && tag.length > prefix.length
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
var addProjectTag = (project, variant, value, options = {
|
|
90
|
+
overwrite: false
|
|
91
|
+
}) => {
|
|
92
|
+
project.tags = project.tags ?? [];
|
|
93
|
+
if (options.overwrite || !hasProjectTag(project, variant)) {
|
|
94
|
+
project.tags = project.tags.filter(
|
|
95
|
+
(tag) => !tag.startsWith(formatProjectTag(variant, ""))
|
|
96
|
+
);
|
|
97
|
+
project.tags.push(formatProjectTag(variant, value));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
45
101
|
// packages/workspace-tools/src/utils/versions.ts
|
|
46
102
|
var nxVersion = "^18.0.4";
|
|
47
103
|
|
|
@@ -83,6 +139,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
83
139
|
tsConfig: (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"),
|
|
84
140
|
project: (0, import_devkit.joinPathFragments)(options.projectRoot, "package.json"),
|
|
85
141
|
defaultConfiguration: "production",
|
|
142
|
+
platform: "neutral",
|
|
86
143
|
assets: [
|
|
87
144
|
{
|
|
88
145
|
input: options.projectRoot,
|
|
@@ -106,21 +163,25 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
106
163
|
verbose: true
|
|
107
164
|
}
|
|
108
165
|
}
|
|
109
|
-
}
|
|
110
|
-
lint: {},
|
|
111
|
-
test: {}
|
|
166
|
+
}
|
|
112
167
|
}
|
|
113
168
|
};
|
|
114
|
-
if (schema.platform
|
|
169
|
+
if (schema.platform) {
|
|
115
170
|
projectConfig.targets.build.options.platform = schema.platform;
|
|
116
171
|
}
|
|
172
|
+
addProjectTag(
|
|
173
|
+
projectConfig,
|
|
174
|
+
ProjectTagConstants.Platform.TAG_ID,
|
|
175
|
+
projectConfig.targets.build.options.platform === "node" ? ProjectTagConstants.Platform.NODE : projectConfig.targets.build.options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : projectConfig.targets.build.options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
|
|
176
|
+
{ overwrite: true }
|
|
177
|
+
);
|
|
117
178
|
createProjectTsConfigJson(tree, options);
|
|
118
179
|
(0, import_devkit.addProjectConfiguration)(tree, options.name, projectConfig);
|
|
119
180
|
let repository = {
|
|
120
181
|
type: "github",
|
|
121
182
|
url: "https://github.com/storm-software/storm-stack.git"
|
|
122
183
|
};
|
|
123
|
-
let description = schema.description ?? "
|
|
184
|
+
let description = schema.description ?? "A package developed by Storm Software used to create modern, scalable web applications.";
|
|
124
185
|
if (tree.exists("package.json")) {
|
|
125
186
|
const packageJson = (0, import_devkit.readJson)(tree, "package.json");
|
|
126
187
|
if (packageJson?.repository) {
|
|
@@ -229,96 +290,9 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
229
290
|
exclude: ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
|
230
291
|
});
|
|
231
292
|
}
|
|
232
|
-
const lintCallback = await addLint(tree, options);
|
|
233
|
-
tasks.push(lintCallback);
|
|
234
293
|
await (0, import_devkit.formatFiles)(tree);
|
|
235
294
|
return null;
|
|
236
295
|
}
|
|
237
|
-
async function addLint(tree, options) {
|
|
238
|
-
const { lintProjectGenerator } = (0, import_devkit.ensurePackage)("@nx/eslint", nxVersion);
|
|
239
|
-
const { mapLintPattern } = (
|
|
240
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
241
|
-
require("@nx/eslint/src/generators/lint-project/lint-project")
|
|
242
|
-
);
|
|
243
|
-
const projectConfiguration = (0, import_devkit.readProjectConfiguration)(tree, options.name);
|
|
244
|
-
const task = lintProjectGenerator(tree, {
|
|
245
|
-
project: options.name,
|
|
246
|
-
linter: options.linter,
|
|
247
|
-
skipFormat: true,
|
|
248
|
-
tsConfigPaths: [(0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json")],
|
|
249
|
-
unitTestRunner: options.unitTestRunner,
|
|
250
|
-
eslintFilePatterns: [
|
|
251
|
-
mapLintPattern(
|
|
252
|
-
options.projectRoot,
|
|
253
|
-
options.js ? "js" : "ts",
|
|
254
|
-
options.rootProject
|
|
255
|
-
)
|
|
256
|
-
],
|
|
257
|
-
setParserOptionsProject: options.setParserOptionsProject,
|
|
258
|
-
rootProject: options.rootProject
|
|
259
|
-
});
|
|
260
|
-
const {
|
|
261
|
-
addOverrideToLintConfig,
|
|
262
|
-
lintConfigHasOverride,
|
|
263
|
-
isEslintConfigSupported,
|
|
264
|
-
updateOverrideInLintConfig
|
|
265
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
266
|
-
} = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
267
|
-
if (!isEslintConfigSupported(tree)) {
|
|
268
|
-
return task;
|
|
269
|
-
}
|
|
270
|
-
addOverrideToLintConfig(tree, "", {
|
|
271
|
-
files: ["*.json"],
|
|
272
|
-
parser: "jsonc-eslint-parser",
|
|
273
|
-
rules: {
|
|
274
|
-
"@nx/dependency-checks": [
|
|
275
|
-
"error",
|
|
276
|
-
{
|
|
277
|
-
"buildTargets": ["build"],
|
|
278
|
-
"ignoredFiles": [
|
|
279
|
-
"{projectRoot}/esbuild.config.{js,ts,mjs,mts}",
|
|
280
|
-
"{projectRoot}/jest.config.ts"
|
|
281
|
-
],
|
|
282
|
-
"checkMissingDependencies": true,
|
|
283
|
-
"checkObsoleteDependencies": true,
|
|
284
|
-
"checkVersionMismatches": false
|
|
285
|
-
}
|
|
286
|
-
]
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
if (lintConfigHasOverride(
|
|
290
|
-
tree,
|
|
291
|
-
projectConfiguration.root,
|
|
292
|
-
(o) => Array.isArray(o.files) ? o.files.some((f) => f.match(/\.json$/)) : !!o.files?.match(/\.json$/),
|
|
293
|
-
true
|
|
294
|
-
)) {
|
|
295
|
-
updateOverrideInLintConfig(
|
|
296
|
-
tree,
|
|
297
|
-
projectConfiguration.root,
|
|
298
|
-
(o) => o.rules?.["@nx/dependency-checks"],
|
|
299
|
-
(o) => {
|
|
300
|
-
const value = o.rules["@nx/dependency-checks"];
|
|
301
|
-
let ruleSeverity;
|
|
302
|
-
let ruleOptions;
|
|
303
|
-
if (Array.isArray(value)) {
|
|
304
|
-
ruleSeverity = value[0];
|
|
305
|
-
ruleOptions = value[1];
|
|
306
|
-
} else {
|
|
307
|
-
ruleSeverity = value ?? "error";
|
|
308
|
-
ruleOptions = {};
|
|
309
|
-
}
|
|
310
|
-
if (options.bundler === "esbuild") {
|
|
311
|
-
ruleOptions.ignoredFiles = [
|
|
312
|
-
"{projectRoot}/esbuild.config.{js,ts,mjs,mts}"
|
|
313
|
-
];
|
|
314
|
-
o.rules["@nx/dependency-checks"] = [ruleSeverity, ruleOptions];
|
|
315
|
-
}
|
|
316
|
-
return o;
|
|
317
|
-
}
|
|
318
|
-
);
|
|
319
|
-
}
|
|
320
|
-
return task;
|
|
321
|
-
}
|
|
322
296
|
function getOutputPath(options) {
|
|
323
297
|
const parts = ["dist"];
|
|
324
298
|
if (options.projectRoot === ".") {
|
|
@@ -414,7 +388,6 @@ async function normalizeOptions(tree, options) {
|
|
|
414
388
|
}
|
|
415
389
|
// Annotate the CommonJS export names for ESM import in node:
|
|
416
390
|
0 && (module.exports = {
|
|
417
|
-
addLint,
|
|
418
391
|
createProjectTsConfigJson,
|
|
419
392
|
getOutputPath,
|
|
420
393
|
normalizeOptions,
|
|
@@ -27,6 +27,12 @@
|
|
|
27
27
|
"x-priority": "important",
|
|
28
28
|
"default": "{projectRoot}/tsconfig.json"
|
|
29
29
|
},
|
|
30
|
+
"platform": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "Platform target for outputs.",
|
|
33
|
+
"enum": ["neutral", "browser", "node", "worker"],
|
|
34
|
+
"default": "neutral"
|
|
35
|
+
},
|
|
30
36
|
"additionalEntryPoints": {
|
|
31
37
|
"type": "array",
|
|
32
38
|
"description": "List of additional entry points.",
|
|
@@ -96,7 +102,7 @@
|
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
},
|
|
99
|
-
"required": ["tsConfig"],
|
|
105
|
+
"required": ["tsConfig", "platform"],
|
|
100
106
|
"definitions": {
|
|
101
107
|
"assetPattern": {
|
|
102
108
|
"oneOf": [
|
|
@@ -67720,6 +67720,63 @@ var import_js = require("@nx/js");
|
|
|
67720
67720
|
var import_init = __toESM(require("@nx/js/src/generators/init/init"));
|
|
67721
67721
|
var import_generator = __toESM(require("@nx/js/src/generators/setup-verdaccio/generator"));
|
|
67722
67722
|
|
|
67723
|
+
// packages/workspace-tools/src/utils/project-tags.ts
|
|
67724
|
+
var ProjectTagConstants = {
|
|
67725
|
+
Language: {
|
|
67726
|
+
TAG_ID: "language",
|
|
67727
|
+
TYPESCRIPT: "typescript",
|
|
67728
|
+
RUST: "rust"
|
|
67729
|
+
},
|
|
67730
|
+
ProjectType: {
|
|
67731
|
+
TAG_ID: "type",
|
|
67732
|
+
LIBRARY: "library",
|
|
67733
|
+
APPLICATION: "application"
|
|
67734
|
+
},
|
|
67735
|
+
DistStyle: {
|
|
67736
|
+
TAG_ID: "dist-style",
|
|
67737
|
+
NORMAL: "normal",
|
|
67738
|
+
CLEAN: "clean"
|
|
67739
|
+
},
|
|
67740
|
+
Provider: {
|
|
67741
|
+
TAG_ID: "provider"
|
|
67742
|
+
},
|
|
67743
|
+
Platform: {
|
|
67744
|
+
TAG_ID: "platform",
|
|
67745
|
+
NODE: "node",
|
|
67746
|
+
BROWSER: "browser",
|
|
67747
|
+
NEUTRAL: "neutral",
|
|
67748
|
+
WORKER: "worker"
|
|
67749
|
+
},
|
|
67750
|
+
Registry: {
|
|
67751
|
+
TAG_ID: "registry",
|
|
67752
|
+
CARGO: "cargo",
|
|
67753
|
+
NPM: "npm",
|
|
67754
|
+
CONTAINER: "container",
|
|
67755
|
+
CYCLONE: "cyclone"
|
|
67756
|
+
}
|
|
67757
|
+
};
|
|
67758
|
+
var formatProjectTag = (variant, value2) => {
|
|
67759
|
+
return `${variant}:${value2}`;
|
|
67760
|
+
};
|
|
67761
|
+
var hasProjectTag = (project, variant) => {
|
|
67762
|
+
project.tags = project.tags ?? [];
|
|
67763
|
+
const prefix = formatProjectTag(variant, "");
|
|
67764
|
+
return project.tags.some(
|
|
67765
|
+
(tag) => tag.startsWith(prefix) && tag.length > prefix.length
|
|
67766
|
+
);
|
|
67767
|
+
};
|
|
67768
|
+
var addProjectTag = (project, variant, value2, options = {
|
|
67769
|
+
overwrite: false
|
|
67770
|
+
}) => {
|
|
67771
|
+
project.tags = project.tags ?? [];
|
|
67772
|
+
if (options.overwrite || !hasProjectTag(project, variant)) {
|
|
67773
|
+
project.tags = project.tags.filter(
|
|
67774
|
+
(tag) => !tag.startsWith(formatProjectTag(variant, ""))
|
|
67775
|
+
);
|
|
67776
|
+
project.tags.push(formatProjectTag(variant, value2));
|
|
67777
|
+
}
|
|
67778
|
+
};
|
|
67779
|
+
|
|
67723
67780
|
// packages/workspace-tools/src/utils/versions.ts
|
|
67724
67781
|
var nxVersion = "^18.0.4";
|
|
67725
67782
|
|
|
@@ -67761,6 +67818,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67761
67818
|
tsConfig: (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"),
|
|
67762
67819
|
project: (0, import_devkit.joinPathFragments)(options.projectRoot, "package.json"),
|
|
67763
67820
|
defaultConfiguration: "production",
|
|
67821
|
+
platform: "neutral",
|
|
67764
67822
|
assets: [
|
|
67765
67823
|
{
|
|
67766
67824
|
input: options.projectRoot,
|
|
@@ -67784,21 +67842,25 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67784
67842
|
verbose: true
|
|
67785
67843
|
}
|
|
67786
67844
|
}
|
|
67787
|
-
}
|
|
67788
|
-
lint: {},
|
|
67789
|
-
test: {}
|
|
67845
|
+
}
|
|
67790
67846
|
}
|
|
67791
67847
|
};
|
|
67792
|
-
if (schema.platform
|
|
67848
|
+
if (schema.platform) {
|
|
67793
67849
|
projectConfig.targets.build.options.platform = schema.platform;
|
|
67794
67850
|
}
|
|
67851
|
+
addProjectTag(
|
|
67852
|
+
projectConfig,
|
|
67853
|
+
ProjectTagConstants.Platform.TAG_ID,
|
|
67854
|
+
projectConfig.targets.build.options.platform === "node" ? ProjectTagConstants.Platform.NODE : projectConfig.targets.build.options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : projectConfig.targets.build.options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
|
|
67855
|
+
{ overwrite: true }
|
|
67856
|
+
);
|
|
67795
67857
|
createProjectTsConfigJson(tree, options);
|
|
67796
67858
|
(0, import_devkit.addProjectConfiguration)(tree, options.name, projectConfig);
|
|
67797
67859
|
let repository = {
|
|
67798
67860
|
type: "github",
|
|
67799
67861
|
url: "https://github.com/storm-software/storm-stack.git"
|
|
67800
67862
|
};
|
|
67801
|
-
let description = schema.description ?? "
|
|
67863
|
+
let description = schema.description ?? "A package developed by Storm Software used to create modern, scalable web applications.";
|
|
67802
67864
|
if (tree.exists("package.json")) {
|
|
67803
67865
|
const packageJson = (0, import_devkit.readJson)(tree, "package.json");
|
|
67804
67866
|
if (packageJson?.repository) {
|
|
@@ -67907,96 +67969,9 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67907
67969
|
exclude: ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
|
67908
67970
|
});
|
|
67909
67971
|
}
|
|
67910
|
-
const lintCallback = await addLint(tree, options);
|
|
67911
|
-
tasks.push(lintCallback);
|
|
67912
67972
|
await (0, import_devkit.formatFiles)(tree);
|
|
67913
67973
|
return null;
|
|
67914
67974
|
}
|
|
67915
|
-
async function addLint(tree, options) {
|
|
67916
|
-
const { lintProjectGenerator } = (0, import_devkit.ensurePackage)("@nx/eslint", nxVersion);
|
|
67917
|
-
const { mapLintPattern } = (
|
|
67918
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
67919
|
-
require("@nx/eslint/src/generators/lint-project/lint-project")
|
|
67920
|
-
);
|
|
67921
|
-
const projectConfiguration = (0, import_devkit.readProjectConfiguration)(tree, options.name);
|
|
67922
|
-
const task = lintProjectGenerator(tree, {
|
|
67923
|
-
project: options.name,
|
|
67924
|
-
linter: options.linter,
|
|
67925
|
-
skipFormat: true,
|
|
67926
|
-
tsConfigPaths: [(0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json")],
|
|
67927
|
-
unitTestRunner: options.unitTestRunner,
|
|
67928
|
-
eslintFilePatterns: [
|
|
67929
|
-
mapLintPattern(
|
|
67930
|
-
options.projectRoot,
|
|
67931
|
-
options.js ? "js" : "ts",
|
|
67932
|
-
options.rootProject
|
|
67933
|
-
)
|
|
67934
|
-
],
|
|
67935
|
-
setParserOptionsProject: options.setParserOptionsProject,
|
|
67936
|
-
rootProject: options.rootProject
|
|
67937
|
-
});
|
|
67938
|
-
const {
|
|
67939
|
-
addOverrideToLintConfig,
|
|
67940
|
-
lintConfigHasOverride,
|
|
67941
|
-
isEslintConfigSupported,
|
|
67942
|
-
updateOverrideInLintConfig
|
|
67943
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
67944
|
-
} = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
67945
|
-
if (!isEslintConfigSupported(tree)) {
|
|
67946
|
-
return task;
|
|
67947
|
-
}
|
|
67948
|
-
addOverrideToLintConfig(tree, "", {
|
|
67949
|
-
files: ["*.json"],
|
|
67950
|
-
parser: "jsonc-eslint-parser",
|
|
67951
|
-
rules: {
|
|
67952
|
-
"@nx/dependency-checks": [
|
|
67953
|
-
"error",
|
|
67954
|
-
{
|
|
67955
|
-
"buildTargets": ["build"],
|
|
67956
|
-
"ignoredFiles": [
|
|
67957
|
-
"{projectRoot}/esbuild.config.{js,ts,mjs,mts}",
|
|
67958
|
-
"{projectRoot}/jest.config.ts"
|
|
67959
|
-
],
|
|
67960
|
-
"checkMissingDependencies": true,
|
|
67961
|
-
"checkObsoleteDependencies": true,
|
|
67962
|
-
"checkVersionMismatches": false
|
|
67963
|
-
}
|
|
67964
|
-
]
|
|
67965
|
-
}
|
|
67966
|
-
});
|
|
67967
|
-
if (lintConfigHasOverride(
|
|
67968
|
-
tree,
|
|
67969
|
-
projectConfiguration.root,
|
|
67970
|
-
(o) => Array.isArray(o.files) ? o.files.some((f2) => f2.match(/\.json$/)) : !!o.files?.match(/\.json$/),
|
|
67971
|
-
true
|
|
67972
|
-
)) {
|
|
67973
|
-
updateOverrideInLintConfig(
|
|
67974
|
-
tree,
|
|
67975
|
-
projectConfiguration.root,
|
|
67976
|
-
(o) => o.rules?.["@nx/dependency-checks"],
|
|
67977
|
-
(o) => {
|
|
67978
|
-
const value2 = o.rules["@nx/dependency-checks"];
|
|
67979
|
-
let ruleSeverity;
|
|
67980
|
-
let ruleOptions;
|
|
67981
|
-
if (Array.isArray(value2)) {
|
|
67982
|
-
ruleSeverity = value2[0];
|
|
67983
|
-
ruleOptions = value2[1];
|
|
67984
|
-
} else {
|
|
67985
|
-
ruleSeverity = value2 ?? "error";
|
|
67986
|
-
ruleOptions = {};
|
|
67987
|
-
}
|
|
67988
|
-
if (options.bundler === "esbuild") {
|
|
67989
|
-
ruleOptions.ignoredFiles = [
|
|
67990
|
-
"{projectRoot}/esbuild.config.{js,ts,mjs,mts}"
|
|
67991
|
-
];
|
|
67992
|
-
o.rules["@nx/dependency-checks"] = [ruleSeverity, ruleOptions];
|
|
67993
|
-
}
|
|
67994
|
-
return o;
|
|
67995
|
-
}
|
|
67996
|
-
);
|
|
67997
|
-
}
|
|
67998
|
-
return task;
|
|
67999
|
-
}
|
|
68000
67975
|
function getOutputPath(options) {
|
|
68001
67976
|
const parts = ["dist"];
|
|
68002
67977
|
if (options.projectRoot === ".") {
|
|
@@ -68098,12 +68073,12 @@ async function browserLibraryGeneratorFn(tree, schema) {
|
|
|
68098
68073
|
...schema,
|
|
68099
68074
|
platform: "browser",
|
|
68100
68075
|
devDependencies: {
|
|
68101
|
-
"@types/react": "^18.
|
|
68102
|
-
"@types/react-dom": "^18.
|
|
68076
|
+
"@types/react": "^18.3.6",
|
|
68077
|
+
"@types/react-dom": "^18.3.0"
|
|
68103
68078
|
},
|
|
68104
68079
|
peerDependencies: {
|
|
68105
|
-
react: "^18.
|
|
68106
|
-
"react-dom": "^18.
|
|
68080
|
+
react: "^18.3.0",
|
|
68081
|
+
"react-dom": "^18.3.0",
|
|
68107
68082
|
"react-native": "*"
|
|
68108
68083
|
},
|
|
68109
68084
|
peerDependenciesMeta: {
|
|
@@ -68114,7 +68089,7 @@ async function browserLibraryGeneratorFn(tree, schema) {
|
|
|
68114
68089
|
optional: true
|
|
68115
68090
|
}
|
|
68116
68091
|
},
|
|
68117
|
-
buildExecutor: "@storm-software/workspace-tools:
|
|
68092
|
+
buildExecutor: "@storm-software/workspace-tools:unbuild"
|
|
68118
68093
|
};
|
|
68119
68094
|
const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
|
|
68120
68095
|
const { className, name, propertyName } = (0, import_devkit2.names)(
|
|
@@ -67720,6 +67720,63 @@ var import_js = require("@nx/js");
|
|
|
67720
67720
|
var import_init = __toESM(require("@nx/js/src/generators/init/init"));
|
|
67721
67721
|
var import_generator = __toESM(require("@nx/js/src/generators/setup-verdaccio/generator"));
|
|
67722
67722
|
|
|
67723
|
+
// packages/workspace-tools/src/utils/project-tags.ts
|
|
67724
|
+
var ProjectTagConstants = {
|
|
67725
|
+
Language: {
|
|
67726
|
+
TAG_ID: "language",
|
|
67727
|
+
TYPESCRIPT: "typescript",
|
|
67728
|
+
RUST: "rust"
|
|
67729
|
+
},
|
|
67730
|
+
ProjectType: {
|
|
67731
|
+
TAG_ID: "type",
|
|
67732
|
+
LIBRARY: "library",
|
|
67733
|
+
APPLICATION: "application"
|
|
67734
|
+
},
|
|
67735
|
+
DistStyle: {
|
|
67736
|
+
TAG_ID: "dist-style",
|
|
67737
|
+
NORMAL: "normal",
|
|
67738
|
+
CLEAN: "clean"
|
|
67739
|
+
},
|
|
67740
|
+
Provider: {
|
|
67741
|
+
TAG_ID: "provider"
|
|
67742
|
+
},
|
|
67743
|
+
Platform: {
|
|
67744
|
+
TAG_ID: "platform",
|
|
67745
|
+
NODE: "node",
|
|
67746
|
+
BROWSER: "browser",
|
|
67747
|
+
NEUTRAL: "neutral",
|
|
67748
|
+
WORKER: "worker"
|
|
67749
|
+
},
|
|
67750
|
+
Registry: {
|
|
67751
|
+
TAG_ID: "registry",
|
|
67752
|
+
CARGO: "cargo",
|
|
67753
|
+
NPM: "npm",
|
|
67754
|
+
CONTAINER: "container",
|
|
67755
|
+
CYCLONE: "cyclone"
|
|
67756
|
+
}
|
|
67757
|
+
};
|
|
67758
|
+
var formatProjectTag = (variant, value2) => {
|
|
67759
|
+
return `${variant}:${value2}`;
|
|
67760
|
+
};
|
|
67761
|
+
var hasProjectTag = (project, variant) => {
|
|
67762
|
+
project.tags = project.tags ?? [];
|
|
67763
|
+
const prefix = formatProjectTag(variant, "");
|
|
67764
|
+
return project.tags.some(
|
|
67765
|
+
(tag) => tag.startsWith(prefix) && tag.length > prefix.length
|
|
67766
|
+
);
|
|
67767
|
+
};
|
|
67768
|
+
var addProjectTag = (project, variant, value2, options = {
|
|
67769
|
+
overwrite: false
|
|
67770
|
+
}) => {
|
|
67771
|
+
project.tags = project.tags ?? [];
|
|
67772
|
+
if (options.overwrite || !hasProjectTag(project, variant)) {
|
|
67773
|
+
project.tags = project.tags.filter(
|
|
67774
|
+
(tag) => !tag.startsWith(formatProjectTag(variant, ""))
|
|
67775
|
+
);
|
|
67776
|
+
project.tags.push(formatProjectTag(variant, value2));
|
|
67777
|
+
}
|
|
67778
|
+
};
|
|
67779
|
+
|
|
67723
67780
|
// packages/workspace-tools/src/utils/versions.ts
|
|
67724
67781
|
var nxVersion = "^18.0.4";
|
|
67725
67782
|
|
|
@@ -67761,6 +67818,7 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67761
67818
|
tsConfig: (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"),
|
|
67762
67819
|
project: (0, import_devkit.joinPathFragments)(options.projectRoot, "package.json"),
|
|
67763
67820
|
defaultConfiguration: "production",
|
|
67821
|
+
platform: "neutral",
|
|
67764
67822
|
assets: [
|
|
67765
67823
|
{
|
|
67766
67824
|
input: options.projectRoot,
|
|
@@ -67784,21 +67842,25 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67784
67842
|
verbose: true
|
|
67785
67843
|
}
|
|
67786
67844
|
}
|
|
67787
|
-
}
|
|
67788
|
-
lint: {},
|
|
67789
|
-
test: {}
|
|
67845
|
+
}
|
|
67790
67846
|
}
|
|
67791
67847
|
};
|
|
67792
|
-
if (schema.platform
|
|
67848
|
+
if (schema.platform) {
|
|
67793
67849
|
projectConfig.targets.build.options.platform = schema.platform;
|
|
67794
67850
|
}
|
|
67851
|
+
addProjectTag(
|
|
67852
|
+
projectConfig,
|
|
67853
|
+
ProjectTagConstants.Platform.TAG_ID,
|
|
67854
|
+
projectConfig.targets.build.options.platform === "node" ? ProjectTagConstants.Platform.NODE : projectConfig.targets.build.options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : projectConfig.targets.build.options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
|
|
67855
|
+
{ overwrite: true }
|
|
67856
|
+
);
|
|
67795
67857
|
createProjectTsConfigJson(tree, options);
|
|
67796
67858
|
(0, import_devkit.addProjectConfiguration)(tree, options.name, projectConfig);
|
|
67797
67859
|
let repository = {
|
|
67798
67860
|
type: "github",
|
|
67799
67861
|
url: "https://github.com/storm-software/storm-stack.git"
|
|
67800
67862
|
};
|
|
67801
|
-
let description = schema.description ?? "
|
|
67863
|
+
let description = schema.description ?? "A package developed by Storm Software used to create modern, scalable web applications.";
|
|
67802
67864
|
if (tree.exists("package.json")) {
|
|
67803
67865
|
const packageJson = (0, import_devkit.readJson)(tree, "package.json");
|
|
67804
67866
|
if (packageJson?.repository) {
|
|
@@ -67907,96 +67969,9 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
|
|
|
67907
67969
|
exclude: ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
|
67908
67970
|
});
|
|
67909
67971
|
}
|
|
67910
|
-
const lintCallback = await addLint(tree, options);
|
|
67911
|
-
tasks.push(lintCallback);
|
|
67912
67972
|
await (0, import_devkit.formatFiles)(tree);
|
|
67913
67973
|
return null;
|
|
67914
67974
|
}
|
|
67915
|
-
async function addLint(tree, options) {
|
|
67916
|
-
const { lintProjectGenerator } = (0, import_devkit.ensurePackage)("@nx/eslint", nxVersion);
|
|
67917
|
-
const { mapLintPattern } = (
|
|
67918
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
67919
|
-
require("@nx/eslint/src/generators/lint-project/lint-project")
|
|
67920
|
-
);
|
|
67921
|
-
const projectConfiguration = (0, import_devkit.readProjectConfiguration)(tree, options.name);
|
|
67922
|
-
const task = lintProjectGenerator(tree, {
|
|
67923
|
-
project: options.name,
|
|
67924
|
-
linter: options.linter,
|
|
67925
|
-
skipFormat: true,
|
|
67926
|
-
tsConfigPaths: [(0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json")],
|
|
67927
|
-
unitTestRunner: options.unitTestRunner,
|
|
67928
|
-
eslintFilePatterns: [
|
|
67929
|
-
mapLintPattern(
|
|
67930
|
-
options.projectRoot,
|
|
67931
|
-
options.js ? "js" : "ts",
|
|
67932
|
-
options.rootProject
|
|
67933
|
-
)
|
|
67934
|
-
],
|
|
67935
|
-
setParserOptionsProject: options.setParserOptionsProject,
|
|
67936
|
-
rootProject: options.rootProject
|
|
67937
|
-
});
|
|
67938
|
-
const {
|
|
67939
|
-
addOverrideToLintConfig,
|
|
67940
|
-
lintConfigHasOverride,
|
|
67941
|
-
isEslintConfigSupported,
|
|
67942
|
-
updateOverrideInLintConfig
|
|
67943
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
67944
|
-
} = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
67945
|
-
if (!isEslintConfigSupported(tree)) {
|
|
67946
|
-
return task;
|
|
67947
|
-
}
|
|
67948
|
-
addOverrideToLintConfig(tree, "", {
|
|
67949
|
-
files: ["*.json"],
|
|
67950
|
-
parser: "jsonc-eslint-parser",
|
|
67951
|
-
rules: {
|
|
67952
|
-
"@nx/dependency-checks": [
|
|
67953
|
-
"error",
|
|
67954
|
-
{
|
|
67955
|
-
"buildTargets": ["build"],
|
|
67956
|
-
"ignoredFiles": [
|
|
67957
|
-
"{projectRoot}/esbuild.config.{js,ts,mjs,mts}",
|
|
67958
|
-
"{projectRoot}/jest.config.ts"
|
|
67959
|
-
],
|
|
67960
|
-
"checkMissingDependencies": true,
|
|
67961
|
-
"checkObsoleteDependencies": true,
|
|
67962
|
-
"checkVersionMismatches": false
|
|
67963
|
-
}
|
|
67964
|
-
]
|
|
67965
|
-
}
|
|
67966
|
-
});
|
|
67967
|
-
if (lintConfigHasOverride(
|
|
67968
|
-
tree,
|
|
67969
|
-
projectConfiguration.root,
|
|
67970
|
-
(o) => Array.isArray(o.files) ? o.files.some((f2) => f2.match(/\.json$/)) : !!o.files?.match(/\.json$/),
|
|
67971
|
-
true
|
|
67972
|
-
)) {
|
|
67973
|
-
updateOverrideInLintConfig(
|
|
67974
|
-
tree,
|
|
67975
|
-
projectConfiguration.root,
|
|
67976
|
-
(o) => o.rules?.["@nx/dependency-checks"],
|
|
67977
|
-
(o) => {
|
|
67978
|
-
const value2 = o.rules["@nx/dependency-checks"];
|
|
67979
|
-
let ruleSeverity;
|
|
67980
|
-
let ruleOptions;
|
|
67981
|
-
if (Array.isArray(value2)) {
|
|
67982
|
-
ruleSeverity = value2[0];
|
|
67983
|
-
ruleOptions = value2[1];
|
|
67984
|
-
} else {
|
|
67985
|
-
ruleSeverity = value2 ?? "error";
|
|
67986
|
-
ruleOptions = {};
|
|
67987
|
-
}
|
|
67988
|
-
if (options.bundler === "esbuild") {
|
|
67989
|
-
ruleOptions.ignoredFiles = [
|
|
67990
|
-
"{projectRoot}/esbuild.config.{js,ts,mjs,mts}"
|
|
67991
|
-
];
|
|
67992
|
-
o.rules["@nx/dependency-checks"] = [ruleSeverity, ruleOptions];
|
|
67993
|
-
}
|
|
67994
|
-
return o;
|
|
67995
|
-
}
|
|
67996
|
-
);
|
|
67997
|
-
}
|
|
67998
|
-
return task;
|
|
67999
|
-
}
|
|
68000
67975
|
function getOutputPath(options) {
|
|
68001
67976
|
const parts = ["dist"];
|
|
68002
67977
|
if (options.projectRoot === ".") {
|
|
@@ -68098,7 +68073,7 @@ async function neutralLibraryGeneratorFn(tree, schema) {
|
|
|
68098
68073
|
...schema,
|
|
68099
68074
|
platform: "neutral",
|
|
68100
68075
|
devDependencies: {},
|
|
68101
|
-
buildExecutor: "@storm-software/workspace-tools:
|
|
68076
|
+
buildExecutor: "@storm-software/workspace-tools:unbuild"
|
|
68102
68077
|
};
|
|
68103
68078
|
const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
|
|
68104
68079
|
const { className, name, propertyName } = (0, import_devkit2.names)(
|