@storm-software/workspace-tools 1.264.27 → 1.265.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.
@@ -1,450 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkUF6KFXG5js = require('./chunk-UF6KFXG5.js');
4
-
5
-
6
-
7
-
8
-
9
- var _chunk7YRW5HNXjs = require('./chunk-7YRW5HNX.js');
10
-
11
-
12
- var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
13
-
14
- // src/plugins/typescript/project-config.ts
15
- var _fs = require('fs');
16
- var _path = require('path');
17
- var _nxjsonjs = require('nx/src/config/nx-json.js');
18
- var _fileutils = require('nx/src/utils/fileutils');
19
- var _packagejson = require('nx/src/utils/package-json');
20
- var _pkgtypes = require('pkg-types');
21
- var name = "storm-software/typescript";
22
- var createNodes = [
23
- "{project.json,**/project.json}",
24
- async (file, opts = {
25
- includeApps: true
26
- }, ctx) => {
27
- const packageJson = createPackageJson(file, ctx.workspaceRoot);
28
- if (!packageJson) {
29
- return {};
30
- }
31
- const tsconfig = await createTsconfig(file, ctx.workspaceRoot);
32
- if (!tsconfig) {
33
- return {};
34
- }
35
- const project = createProjectFromPackageJsonNextToProjectJson(file, packageJson);
36
- if (_optionalChain([opts, 'optionalAccess', _ => _.includeApps]) === false && project.projectType === "application") {
37
- return {};
38
- }
39
- const enableMarkdownlint = _optionalChain([opts, 'optionalAccess', _2 => _2.enableMarkdownlint]) !== false;
40
- const enableEslint = _optionalChain([opts, 'optionalAccess', _3 => _3.enableEslint]) !== false;
41
- const nxJson = _nxjsonjs.readNxJson.call(void 0, ctx.workspaceRoot);
42
- const targets = _packagejson.readTargetsFromPackageJson.call(void 0, packageJson, nxJson);
43
- if (_path.join.call(void 0, ctx.workspaceRoot, project.root).startsWith(_path.join.call(void 0, ctx.workspaceRoot, "tools")) && _optionalChain([opts, 'optionalAccess', _4 => _4.lintInternalTools]) !== true) {
44
- targets.lint = {
45
- dependsOn: [
46
- "^lint"
47
- ],
48
- executor: "nx:run-commands",
49
- options: {
50
- command: "echo 'Skipping linting of internal tools package \"{projectName}\". This can be changed by setting `lintInternalTools` to `true` in the Storm TypeScript plugin options.' "
51
- }
52
- };
53
- } else {
54
- if (!targets["lint-ls"]) {
55
- targets["lint-ls"] = {
56
- cache: true,
57
- inputs: [
58
- "linting",
59
- "typescript",
60
- "^production"
61
- ],
62
- dependsOn: [
63
- "^lint-ls"
64
- ],
65
- executor: "nx:run-commands",
66
- options: {
67
- command: 'pnpm exec ls-lint --config="node_modules/@storm-software/linting-tools/ls-lint/.ls-lint.yml" '
68
- }
69
- };
70
- }
71
- if (!targets["lint-markdown"] && enableMarkdownlint) {
72
- targets["lint-markdown"] = {
73
- cache: true,
74
- outputs: [
75
- "{projectRoot}/**/*.md",
76
- "{projectRoot}/**/*.mdx"
77
- ],
78
- inputs: [
79
- "linting",
80
- "{projectRoot}/**/*.md",
81
- "{projectRoot}/**/*.mdx"
82
- ],
83
- dependsOn: [
84
- "^lint-markdown"
85
- ],
86
- executor: "nx:run-commands",
87
- options: {
88
- command: 'pnpm exec markdownlint-cli2 "{projectRoot}/*.{md,mdx}" "{projectRoot}/**/*.{md,mdx}" --config "node_modules/@storm-software/markdownlint/config/base.markdownlint-cli2.jsonc" --fix'
89
- }
90
- };
91
- }
92
- if (!targets.lint && enableEslint) {
93
- let eslintConfig = checkEslintConfigAtPath(project.root);
94
- if (!eslintConfig) {
95
- eslintConfig = checkEslintConfigAtPath(ctx.workspaceRoot);
96
- }
97
- if (eslintConfig) {
98
- targets.lint = {
99
- cache: true,
100
- inputs: [
101
- "linting",
102
- "typescript",
103
- "^production"
104
- ],
105
- outputs: [
106
- "{projectRoot}/**/*.{ts,tsx,js,jsx,json,md,mdx,yaml,yml,html,css,scss,sass,less,graphql,gql}"
107
- ],
108
- dependsOn: [
109
- "lint-markdown",
110
- "lint-knip",
111
- "^lint"
112
- ],
113
- executor: "@nx/eslint:lint",
114
- options: {
115
- format: "stylish",
116
- fix: true,
117
- errorOnUnmatchedPattern: false,
118
- cache: true,
119
- cacheLocation: "{workspaceRoot}/node_modules/.cache/eslint/{projectRoot}",
120
- eslintConfig
121
- }
122
- };
123
- }
124
- }
125
- }
126
- if (!targets["format-toml"]) {
127
- targets["format-toml"] = {
128
- inputs: [
129
- "linting",
130
- "{projectRoot}/**/*.toml"
131
- ],
132
- outputs: [
133
- "{projectRoot}/**/*.toml"
134
- ],
135
- dependsOn: [
136
- "^format-toml"
137
- ],
138
- executor: "nx:run-commands",
139
- options: {
140
- command: 'pnpm exec taplo format --config="node_modules/@storm-software/linting-tools/taplo/config.toml" --cache-path="node_modules/.cache/taplo/{projectRoot}" --colors="always" "{projectRoot}/*.toml" "{projectRoot}/**/*.toml" '
141
- }
142
- };
143
- }
144
- if (!targets["format-readme"]) {
145
- targets["format-readme"] = {
146
- inputs: [
147
- "linting",
148
- "documentation",
149
- "{projectRoot}/{README.md,package.json,Cargo.toml,executors.json,generators.json}"
150
- ],
151
- outputs: [
152
- "{projectRoot}/README.md"
153
- ],
154
- dependsOn: [
155
- "^format-readme"
156
- ],
157
- executor: "nx:run-commands",
158
- options: {
159
- command: 'pnpm exec storm-git readme --templates="tools/readme-templates" --project="{projectName}"'
160
- }
161
- };
162
- }
163
- if (!targets["format-prettier"]) {
164
- targets["format-prettier"] = {
165
- inputs: [
166
- "linting",
167
- "typescript",
168
- "^production"
169
- ],
170
- outputs: [
171
- "{projectRoot}/**/*"
172
- ],
173
- dependsOn: [
174
- "^format-prettier"
175
- ],
176
- executor: "nx:run-commands",
177
- options: {
178
- command: 'pnpm exec prettier "{projectRoot}/**/*" --write --ignore-unknown --no-error-on-unmatched-pattern --config="node_modules/@storm-software/prettier/config.json" --ignore-path="node_modules/@storm-software/prettier/.prettierignore" --cache --cache-location="node_modules/.cache/prettier/{projectRoot}" '
179
- }
180
- };
181
- }
182
- if (!targets.format) {
183
- targets.format = {
184
- dependsOn: [
185
- "format-readme",
186
- "format-toml",
187
- "format-prettier",
188
- "^format"
189
- ],
190
- executor: "nx:run-commands",
191
- options: {
192
- command: `echo 'Formatting the project files in "{projectRoot}"' `
193
- }
194
- };
195
- }
196
- if (!targets.clean) {
197
- targets.clean = {
198
- cache: true,
199
- executor: "nx:run-commands",
200
- inputs: [
201
- "typescript",
202
- "^production"
203
- ],
204
- outputs: [
205
- "{workspaceRoot}/dist/{projectRoot}"
206
- ],
207
- options: {
208
- command: "pnpm exec rimraf dist/{projectRoot}",
209
- color: true,
210
- cwd: "{workspaceRoot}"
211
- }
212
- };
213
- }
214
- if (!targets.rebuild) {
215
- targets.rebuild = {
216
- cache: false,
217
- executor: "nx:run-commands",
218
- dependsOn: [
219
- "clean",
220
- "^build"
221
- ],
222
- inputs: [
223
- "typescript",
224
- "default",
225
- "^production"
226
- ],
227
- outputs: [
228
- "{workspaceRoot}/dist/{projectRoot}"
229
- ],
230
- options: {
231
- command: `pnpm exec nx run ${project.name}:build`
232
- }
233
- };
234
- }
235
- if (!targets.test && checkJestConfigAtPath(project.root)) {
236
- targets.test = {
237
- cache: true,
238
- executor: "@nx/jest:jest",
239
- inputs: [
240
- "testing",
241
- "typescript",
242
- "^production"
243
- ],
244
- outputs: [
245
- "{workspaceRoot}/coverage/{projectRoot}"
246
- ],
247
- defaultConfiguration: "development",
248
- options: {
249
- jestConfig: "{projectRoot}/jest.config.ts",
250
- passWithNoTests: true
251
- },
252
- configurations: {
253
- development: {
254
- ci: false,
255
- codeCoverage: true
256
- },
257
- production: {
258
- ci: true,
259
- codeCoverage: true
260
- }
261
- }
262
- };
263
- }
264
- targets["size-limit"] = {
265
- dependsOn: [
266
- "build",
267
- "^size-limit"
268
- ],
269
- options: {}
270
- };
271
- const isPrivate = _nullishCoalesce(packageJson.private, () => ( false));
272
- if (!isPrivate) {
273
- _chunk7YRW5HNXjs.addProjectTag.call(void 0, project, _chunk7YRW5HNXjs.ProjectTagConstants.Registry.TAG_ID, _chunk7YRW5HNXjs.ProjectTagConstants.Registry.NPM, {
274
- overwrite: true
275
- });
276
- targets["nx-release-publish"] = {
277
- dependsOn: [
278
- "build",
279
- "size-limit",
280
- "^nx-release-publish"
281
- ],
282
- executor: "@storm-software/workspace-tools:npm-publish",
283
- options: {}
284
- };
285
- if (project.projectType === "application" || _chunk7YRW5HNXjs.isEqualProjectTag.call(void 0, project, _chunk7YRW5HNXjs.ProjectTagConstants.ProjectType.TAG_ID, _chunk7YRW5HNXjs.ProjectTagConstants.ProjectType.APPLICATION) || _chunk7YRW5HNXjs.isEqualProjectTag.call(void 0, project, _chunk7YRW5HNXjs.ProjectTagConstants.DistStyle.TAG_ID, _chunk7YRW5HNXjs.ProjectTagConstants.DistStyle.CLEAN)) {
286
- targets["clean-package"] = {
287
- cache: true,
288
- dependsOn: [
289
- "build"
290
- ],
291
- inputs: [
292
- "linting",
293
- "testing",
294
- "documentation",
295
- "default",
296
- "^production"
297
- ],
298
- outputs: [
299
- "{workspaceRoot}/dist/{projectRoot}"
300
- ],
301
- executor: "@storm-software/workspace-tools:clean-package",
302
- options: {
303
- cleanReadMe: true,
304
- cleanComments: true
305
- }
306
- };
307
- _optionalChain([targets, 'access', _5 => _5["nx-release-publish"], 'access', _6 => _6.dependsOn, 'optionalAccess', _7 => _7.push, 'call', _8 => _8("clean-package")]);
308
- _optionalChain([targets, 'access', _9 => _9["size-limit"], 'access', _10 => _10.dependsOn, 'optionalAccess', _11 => _11.push, 'call', _12 => _12("clean-package")]);
309
- }
310
- }
311
- _chunk7YRW5HNXjs.addProjectTag.call(void 0, project, _chunk7YRW5HNXjs.ProjectTagConstants.Language.TAG_ID, _chunk7YRW5HNXjs.ProjectTagConstants.Language.TYPESCRIPT, {
312
- overwrite: true
313
- });
314
- const platform = _chunkUF6KFXG5js.getProjectPlatform.call(void 0, project);
315
- switch (platform) {
316
- case "worker":
317
- _chunk7YRW5HNXjs.addProjectTag.call(void 0, project, _chunk7YRW5HNXjs.ProjectTagConstants.Platform.TAG_ID, _chunk7YRW5HNXjs.ProjectTagConstants.Platform.WORKER, {
318
- overwrite: true
319
- });
320
- break;
321
- case "node":
322
- _chunk7YRW5HNXjs.addProjectTag.call(void 0, project, _chunk7YRW5HNXjs.ProjectTagConstants.Platform.TAG_ID, _chunk7YRW5HNXjs.ProjectTagConstants.Platform.NODE, {
323
- overwrite: true
324
- });
325
- break;
326
- case "browser":
327
- _chunk7YRW5HNXjs.addProjectTag.call(void 0, project, _chunk7YRW5HNXjs.ProjectTagConstants.Platform.TAG_ID, _chunk7YRW5HNXjs.ProjectTagConstants.Platform.BROWSER, {
328
- overwrite: true
329
- });
330
- break;
331
- default:
332
- _chunk7YRW5HNXjs.addProjectTag.call(void 0, project, _chunk7YRW5HNXjs.ProjectTagConstants.Platform.TAG_ID, _chunk7YRW5HNXjs.ProjectTagConstants.Platform.NEUTRAL, {
333
- overwrite: true
334
- });
335
- break;
336
- }
337
- _chunk7YRW5HNXjs.setDefaultProjectTags.call(void 0, project, name);
338
- return _optionalChain([project, 'optionalAccess', _13 => _13.name]) ? {
339
- projects: {
340
- [project.name]: {
341
- ...project,
342
- targets,
343
- release: {
344
- ..._optionalChain([project, 'optionalAccess', _14 => _14.release]),
345
- version: {
346
- ..._optionalChain([project, 'optionalAccess', _15 => _15.release, 'optionalAccess', _16 => _16.version]),
347
- generator: "@storm-software/workspace-tools:release-version"
348
- }
349
- }
350
- }
351
- }
352
- } : {};
353
- }
354
- ];
355
- function createProjectFromPackageJsonNextToProjectJson(projectJsonPath, packageJson) {
356
- const { nx, name: name2 } = packageJson;
357
- const root = _path.dirname.call(void 0, projectJsonPath);
358
- return {
359
- ...nx,
360
- name: name2,
361
- root,
362
- targets: {}
363
- };
364
- }
365
- _chunk3GQAWCBQjs.__name.call(void 0, createProjectFromPackageJsonNextToProjectJson, "createProjectFromPackageJsonNextToProjectJson");
366
- function createPackageJson(projectJsonPath, workspaceRoot) {
367
- try {
368
- const root = _path.dirname.call(void 0, projectJsonPath);
369
- const packageJsonPath = _path.join.call(void 0, workspaceRoot, root, "package.json");
370
- if (!_fs.existsSync.call(void 0, packageJsonPath)) {
371
- return null;
372
- }
373
- return _fileutils.readJsonFile.call(void 0, packageJsonPath);
374
- } catch (e) {
375
- console.log(e);
376
- return null;
377
- }
378
- }
379
- _chunk3GQAWCBQjs.__name.call(void 0, createPackageJson, "createPackageJson");
380
- async function createTsconfig(projectJsonPath, workspaceRoot) {
381
- try {
382
- const root = _path.dirname.call(void 0, projectJsonPath);
383
- const tsconfigJsonPath = _path.join.call(void 0, workspaceRoot, root, "tsconfig.json");
384
- if (!_fs.existsSync.call(void 0, tsconfigJsonPath)) {
385
- return null;
386
- }
387
- return _pkgtypes.readTSConfig.call(void 0, tsconfigJsonPath);
388
- } catch (e) {
389
- console.log(e);
390
- return null;
391
- }
392
- }
393
- _chunk3GQAWCBQjs.__name.call(void 0, createTsconfig, "createTsconfig");
394
- function checkEslintConfigAtPath(directory) {
395
- const hasEslintConfigFile = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (fileName) => {
396
- return _fs.existsSync.call(void 0, _path.join.call(void 0, directory, fileName));
397
- }, "hasEslintConfigFile");
398
- if (hasEslintConfigFile(".eslintrc.js")) {
399
- return ".eslintrc.js";
400
- } else if (hasEslintConfigFile(".eslintrc.cjs")) {
401
- return ".eslintrc.cjs";
402
- } else if (hasEslintConfigFile(".eslintrc.yaml")) {
403
- return ".eslintrc.yaml";
404
- } else if (hasEslintConfigFile(".eslintrc.yml")) {
405
- return ".eslintrc.yml";
406
- } else if (hasEslintConfigFile(".eslintrc.json")) {
407
- return ".eslintrc.json";
408
- } else if (hasEslintConfigFile(".eslintrc")) {
409
- return ".eslintrc";
410
- } else if (hasEslintConfigFile("eslint.config.js")) {
411
- return "eslint.config.js";
412
- } else if (hasEslintConfigFile("eslint.config.cjs")) {
413
- return "eslint.config.cjs";
414
- } else if (hasEslintConfigFile("eslint.config.mjs")) {
415
- return "eslint.config.mjs";
416
- } else if (hasEslintConfigFile("eslint.config.ts")) {
417
- return "eslint.config.ts";
418
- } else if (hasEslintConfigFile("eslint.config.cts")) {
419
- return "eslint.config.cts";
420
- } else if (hasEslintConfigFile("eslint.config.mts")) {
421
- return "eslint.config.mts";
422
- }
423
- return null;
424
- }
425
- _chunk3GQAWCBQjs.__name.call(void 0, checkEslintConfigAtPath, "checkEslintConfigAtPath");
426
- function checkJestConfigAtPath(directory) {
427
- const hasJestConfigFile = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (fileName) => {
428
- return _fs.existsSync.call(void 0, _path.join.call(void 0, directory, fileName));
429
- }, "hasJestConfigFile");
430
- if (hasJestConfigFile("eslint.config.js")) {
431
- return "jest.config.js";
432
- } else if (hasJestConfigFile("eslint.config.cjs")) {
433
- return "jest.config.cjs";
434
- } else if (hasJestConfigFile("eslint.config.mjs")) {
435
- return "jest.config.mjs";
436
- } else if (hasJestConfigFile("eslint.config.ts")) {
437
- return "jest.config.ts";
438
- } else if (hasJestConfigFile("jest.config.cts")) {
439
- return "jest.config.cts";
440
- } else if (hasJestConfigFile("jest.config.mts")) {
441
- return "jest.config.mts";
442
- }
443
- return null;
444
- }
445
- _chunk3GQAWCBQjs.__name.call(void 0, checkJestConfigAtPath, "checkJestConfigAtPath");
446
-
447
-
448
-
449
-
450
- exports.name = name; exports.createNodes = createNodes;