@storm-software/workspace-tools 1.66.21 → 1.66.23

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 CHANGED
@@ -1,3 +1,29 @@
1
+ ## 1.66.23 (2024-03-29)
2
+
3
+
4
+ ### 🩹 Fixes
5
+
6
+ - **workspace-tools:** Resolved issues with declaring local Storm nx-plugins ([a5eed1f0](https://github.com/storm-software/storm-ops/commit/a5eed1f0))
7
+
8
+ - **workspace-tools:** Resolved issue with generating local Nx plugins prior to build ([68ef2815](https://github.com/storm-software/storm-ops/commit/68ef2815))
9
+
10
+
11
+ ### ❤️ Thank You
12
+
13
+ - Patrick Sullivan
14
+
15
+ ## 1.66.22 (2024-03-29)
16
+
17
+
18
+ ### 🩹 Fixes
19
+
20
+ - **workspace-tools:** Further updates to Nx plugin modules ([82b6ab01](https://github.com/storm-software/storm-ops/commit/82b6ab01))
21
+
22
+
23
+ ### ❤️ Thank You
24
+
25
+ - Patrick Sullivan
26
+
1
27
  ## 1.66.21 (2024-03-29)
2
28
 
3
29
 
package/config/nx.json CHANGED
@@ -13,8 +13,7 @@
13
13
  "e2e",
14
14
  "docs"
15
15
  ],
16
- "parallel": 3,
17
- "cacheDirectory": "node_modules/.cache/nx"
16
+ "parallel": 3
18
17
  }
19
18
  }
20
19
  },
@@ -198,6 +197,13 @@
198
197
  "^lint"
199
198
  ]
200
199
  },
200
+ "clean": {
201
+ "cache": false,
202
+ "executor": "nx:run-commands",
203
+ "options": {
204
+ "command": "pnpm exec rimraf dist/{projectRoot}"
205
+ }
206
+ },
201
207
  "build": {
202
208
  "cache": true,
203
209
  "inputs": [
@@ -249,6 +255,19 @@
249
255
  "test",
250
256
  "^e2e"
251
257
  ]
258
+ },
259
+ "nx-release-publish": {
260
+ "cache": false,
261
+ "inputs": [
262
+ "default",
263
+ "^production"
264
+ ],
265
+ "outputs": [
266
+ "{options.outputPath}"
267
+ ],
268
+ "dependsOn": [
269
+ "^nx-release-publish"
270
+ ]
252
271
  }
253
272
  },
254
273
  "release": {
@@ -274,17 +293,7 @@
274
293
  }
275
294
  }
276
295
  },
277
- "plugins": [
278
- "@nx/eslint/plugin",
279
- "@storm-software/workspace-tools/plugins/rust",
280
- "@storm-software/workspace-tools/plugins/typescript"
281
- ],
282
- "pluginsConfig": {
283
- "@nx/js": {
284
- "analyzeSourceFiles": true,
285
- "analyzeLockfile": true,
286
- "analyzePackageJson": true
287
- }
288
- },
296
+ "parallel": 3,
297
+ "cacheDirectory": "tmp/nx-cache",
289
298
  "defaultBase": "main"
290
299
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/workspace-tools",
3
- "version": "1.66.21",
3
+ "version": "1.66.23",
4
4
  "private": false,
5
5
  "description": "⚡ A Nx plugin package that contains various executors and generators used in a Storm workspaces.",
6
6
  "keywords": [
package/project.json CHANGED
@@ -6,7 +6,17 @@
6
6
  "targets": {
7
7
  "build": {
8
8
  "executor": "@nx/esbuild:esbuild",
9
- "outputs": ["{options.outputPath}"],
9
+ "inputs": [
10
+ "default",
11
+ "^production"
12
+ ],
13
+ "dependsOn": [
14
+ "clean",
15
+ "^build"
16
+ ],
17
+ "outputs": [
18
+ "{options.outputPath}"
19
+ ],
10
20
  "options": {
11
21
  "outputPath": "dist/packages/workspace-tools",
12
22
  "tsConfig": "packages/workspace-tools/tsconfig.lib.json",
@@ -39,13 +49,19 @@
39
49
  "skipTypeCheck": false,
40
50
  "metafile": true,
41
51
  "minify": false,
42
- "format": ["cjs"],
52
+ "format": [
53
+ "cjs"
54
+ ],
43
55
  "esbuildOptions": {
44
56
  "outExtension": {
45
57
  ".js": ".js"
46
58
  }
47
59
  },
48
- "external": ["nx", "@storm-software/*"],
60
+ "external": [
61
+ "nx",
62
+ "@nx/devkit",
63
+ "esbuild"
64
+ ],
49
65
  "assets": [
50
66
  {
51
67
  "input": "packages/workspace-tools",
@@ -60,13 +76,19 @@
60
76
  {
61
77
  "input": "packages/workspace-tools",
62
78
  "glob": "**/*.json",
63
- "ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
79
+ "ignore": [
80
+ "**/tsconfig*.json",
81
+ "project.json",
82
+ ".eslintrc.json"
83
+ ],
64
84
  "output": "."
65
85
  },
66
86
  {
67
87
  "input": "packages/workspace-tools",
68
88
  "glob": "**/*.js",
69
- "ignore": ["**/jest.config.js"],
89
+ "ignore": [
90
+ "**/jest.config.js"
91
+ ],
70
92
  "output": "."
71
93
  },
72
94
  {
@@ -97,6 +119,5 @@
97
119
  ]
98
120
  }
99
121
  }
100
- },
101
- "tags": ["type:util", "scope:tools"]
102
- }
122
+ }
123
+ }
@@ -32,9 +32,8 @@ export const createNodes: CreateNodes = [
32
32
  return acc;
33
33
  }, new Map<string, Package>());
34
34
 
35
- for (const pkg of cargoPackages) {
36
- if (!isExternal(pkg, ctx.workspaceRoot)) {
37
- // const root = normalizePath(dirname(relative(ctx.workspaceRoot, pkg.manifest_path)));
35
+ for (const cargoPackage of cargoPackages) {
36
+ if (!isExternal(cargoPackage, ctx.workspaceRoot)) {
38
37
  const root = dirname(cargoFile);
39
38
 
40
39
  const targets: ProjectConfiguration["targets"] = {
@@ -45,7 +44,7 @@ export const createNodes: CreateNodes = [
45
44
  executor: "@monodon/rust:lint",
46
45
  outputs: ["{options.target-dir}"],
47
46
  options: {
48
- "target-dir": `dist/target/${pkg.name}`
47
+ "target-dir": `dist/target/${cargoPackage.name}`
49
48
  }
50
49
  },
51
50
  build: {
@@ -55,7 +54,7 @@ export const createNodes: CreateNodes = [
55
54
  executor: "@monodon/rust:check",
56
55
  outputs: ["{options.target-dir}"],
57
56
  options: {
58
- "target-dir": `dist/target/${pkg.name}`
57
+ "target-dir": `dist/target/${cargoPackage.name}`
59
58
  }
60
59
  },
61
60
  test: {
@@ -65,7 +64,7 @@ export const createNodes: CreateNodes = [
65
64
  executor: "@monodon/rust:test",
66
65
  outputs: ["{options.target-dir}"],
67
66
  options: {
68
- "target-dir": `dist/target/${pkg.name}`
67
+ "target-dir": `dist/target/${cargoPackage.name}`
69
68
  },
70
69
  configurations: {
71
70
  production: {
@@ -75,8 +74,7 @@ export const createNodes: CreateNodes = [
75
74
  }
76
75
  };
77
76
 
78
- // Apply nx-release-publish target for non-private projects
79
- const isPrivate = pkg.publish?.length === 0;
77
+ const isPrivate = cargoPackage.publish?.length === 0;
80
78
  if (!isPrivate) {
81
79
  targets["nx-release-publish"] = {
82
80
  cache: false,
@@ -91,17 +89,17 @@ export const createNodes: CreateNodes = [
91
89
 
92
90
  projects[root] = {
93
91
  root,
94
- name: pkg.name,
92
+ name: cargoPackage.name,
95
93
  targets,
96
94
  release: {
97
95
  version: {
98
96
  generator: "@storm-software/workspace-tools:release-version"
99
97
  }
100
98
  },
101
- tags: ["rust", "cargo"]
99
+ tags: ["lang:rust"]
102
100
  };
103
101
  }
104
- for (const dep of pkg.dependencies) {
102
+ for (const dep of cargoPackage.dependencies) {
105
103
  if (isExternal(dep, ctx.workspaceRoot)) {
106
104
  const externalDepName = `cargo:${dep.name}`;
107
105
  if (!externalNodes?.[externalDepName]) {
@@ -132,7 +130,6 @@ export const createDependencies: CreateDependencies = (_, { projects, externalNo
132
130
  }
133
131
 
134
132
  const { packages: cargoPackages } = metadata;
135
-
136
133
  const dependencies: RawProjectGraphDependency[] = [];
137
134
 
138
135
  for (const pkg of cargoPackages) {
@@ -1,2 +1 @@
1
- // export * from "./package-lock-file";
2
1
  export * from "./project-config";
@@ -5,6 +5,7 @@ import { readJsonFile } from "nx/src/utils/fileutils";
5
5
  import { type PackageJson, readTargetsFromPackageJson } from "nx/src/utils/package-json";
6
6
 
7
7
  export const name = "storm-software/typescript/project-config";
8
+
8
9
  export const createNodes = [
9
10
  "{project.json,**/project.json}",
10
11
  (file, _, ctx) => {
@@ -76,7 +77,7 @@ export const createNodes = [
76
77
  ? {
77
78
  projects: {
78
79
  [project.name]: {
79
- tags: ["typescript", "npm"],
80
+ tags: ["lang:typescript"],
80
81
  ...project,
81
82
  targets,
82
83
  release: {
@@ -1,125 +0,0 @@
1
- import { readFileSync, writeFileSync } from "node:fs";
2
- import { ensureDirSync } from "fs-extra";
3
- import { dirname, join } from "node:path";
4
- import { performance } from "node:perf_hooks";
5
- import { combineGlobPatterns } from "nx/src/utils/globs";
6
- import type { CreateDependenciesContext, NxPluginV2 } from "nx/src/utils/nx-plugin";
7
- import {
8
- getLockFileDependencies,
9
- getLockFileName,
10
- getLockFileNodes,
11
- lockFileExists,
12
- LOCK_FILES
13
- } from "../../utils/lock-file";
14
- import type { RawProjectGraphDependency } from "nx/src/project-graph/project-graph-builder";
15
- import { detectPackageManager } from "nx/src/utils/package-manager";
16
- import { hashArray } from "nx/src/hasher/file-hasher";
17
- import { projectGraphCacheDirectory } from "nx/src/utils/cache-directory";
18
- import type { ProjectGraph } from "nx/src/devkit-exports";
19
- import { buildExplicitDependencies } from "nx/src/plugins/js/project-graph/build-dependencies/build-dependencies";
20
-
21
- interface ParsedLockFile {
22
- externalNodes?: ProjectGraph["externalNodes"];
23
- dependencies?: RawProjectGraphDependency[];
24
- }
25
-
26
- const parsedLockFile: ParsedLockFile = {};
27
-
28
- export const packageLockFilePlugin: NxPluginV2 = {
29
- name: "storm-software/typescript/package-lock-file",
30
- createNodes: [
31
- combineGlobPatterns(LOCK_FILES),
32
- (lockFile, _opts, ctx) => {
33
- const packageManager = detectPackageManager(ctx.workspaceRoot);
34
- // Only process the correct lockfile
35
- if (lockFile !== getLockFileName(packageManager)) {
36
- return {};
37
- }
38
-
39
- const lockFilePath = join(ctx.workspaceRoot, lockFile);
40
- const lockFileContents = readFileSync(lockFilePath).toString();
41
- const lockFileHash = getLockFileHash(lockFileContents);
42
-
43
- if (!lockFileNeedsReprocessing(lockFileHash)) {
44
- const nodes = readCachedParsedLockFile().externalNodes;
45
- parsedLockFile.externalNodes = nodes;
46
- return {
47
- externalNodes: nodes
48
- };
49
- }
50
-
51
- const externalNodes = getLockFileNodes(packageManager, lockFileContents, lockFileHash, ctx);
52
- parsedLockFile.externalNodes = externalNodes;
53
-
54
- return {
55
- externalNodes
56
- };
57
- }
58
- ],
59
- createDependencies: (_, ctx: CreateDependenciesContext) => {
60
- const packageManager = detectPackageManager(ctx.workspaceRoot);
61
-
62
- let lockfileDependencies: RawProjectGraphDependency[] = [];
63
- // lockfile may not exist yet
64
- if (lockFileExists(packageManager) && parsedLockFile) {
65
- const lockFilePath = join(ctx.workspaceRoot, getLockFileName(packageManager));
66
- const lockFileContents = readFileSync(lockFilePath).toString();
67
- const lockFileHash = getLockFileHash(lockFileContents);
68
-
69
- if (!lockFileNeedsReprocessing(lockFileHash)) {
70
- lockfileDependencies = readCachedParsedLockFile().dependencies ?? [];
71
- } else {
72
- lockfileDependencies = getLockFileDependencies(
73
- packageManager,
74
- lockFileContents,
75
- lockFileHash,
76
- ctx
77
- );
78
-
79
- parsedLockFile.dependencies = lockfileDependencies;
80
- writeLastProcessedLockfileHash(lockFileHash, parsedLockFile);
81
- }
82
- }
83
-
84
- performance.mark("build typescript dependencies - start");
85
- const explicitProjectDependencies = buildExplicitDependencies(
86
- {
87
- analyzeSourceFiles: true,
88
- analyzePackageJson: true
89
- },
90
- ctx
91
- );
92
- performance.mark("build typescript dependencies - end");
93
- performance.measure(
94
- "build typescript dependencies",
95
- "build typescript dependencies - start",
96
- "build typescript dependencies - end"
97
- );
98
- return lockfileDependencies.concat(explicitProjectDependencies);
99
- }
100
- };
101
-
102
- function getLockFileHash(lockFileContents: string) {
103
- return hashArray([lockFileContents]);
104
- }
105
-
106
- function lockFileNeedsReprocessing(lockHash: string) {
107
- try {
108
- return readFileSync(lockFileHashFile).toString() !== lockHash;
109
- } catch {
110
- return true;
111
- }
112
- }
113
-
114
- function writeLastProcessedLockfileHash(hash: string, lockFile: ParsedLockFile) {
115
- ensureDirSync(dirname(lockFileHashFile));
116
- writeFileSync(cachedParsedLockFile, JSON.stringify(lockFile, null, 2));
117
- writeFileSync(lockFileHashFile, hash);
118
- }
119
-
120
- function readCachedParsedLockFile(): ParsedLockFile {
121
- return JSON.parse(readFileSync(cachedParsedLockFile).toString());
122
- }
123
-
124
- const lockFileHashFile = join(projectGraphCacheDirectory, "lockfile.hash");
125
- const cachedParsedLockFile = join(projectGraphCacheDirectory, "parsed-lock-file.json");