@storm-software/workspace-tools 1.66.22 → 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,17 @@
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
+
1
15
  ## 1.66.22 (2024-03-29)
2
16
 
3
17
 
package/config/nx.json CHANGED
@@ -197,6 +197,13 @@
197
197
  "^lint"
198
198
  ]
199
199
  },
200
+ "clean": {
201
+ "cache": false,
202
+ "executor": "nx:run-commands",
203
+ "options": {
204
+ "command": "pnpm exec rimraf dist/{projectRoot}"
205
+ }
206
+ },
200
207
  "build": {
201
208
  "cache": true,
202
209
  "inputs": [
@@ -259,7 +266,6 @@
259
266
  "{options.outputPath}"
260
267
  ],
261
268
  "dependsOn": [
262
- "test",
263
269
  "^nx-release-publish"
264
270
  ]
265
271
  }
@@ -287,17 +293,7 @@
287
293
  }
288
294
  }
289
295
  },
290
- "plugins": [
291
- "@nx/eslint/plugin",
292
- "@storm-software/workspace-tools/plugins/rust",
293
- "@storm-software/workspace-tools/plugins/typescript"
294
- ],
295
- "pluginsConfig": {
296
- "@nx/js": {
297
- "analyzeSourceFiles": true,
298
- "analyzeLockfile": true,
299
- "analyzePackageJson": false
300
- }
301
- },
296
+ "parallel": 3,
297
+ "cacheDirectory": "tmp/nx-cache",
302
298
  "defaultBase": "main"
303
299
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/workspace-tools",
3
- "version": "1.66.22",
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,6 +6,14 @@
6
6
  "targets": {
7
7
  "build": {
8
8
  "executor": "@nx/esbuild:esbuild",
9
+ "inputs": [
10
+ "default",
11
+ "^production"
12
+ ],
13
+ "dependsOn": [
14
+ "clean",
15
+ "^build"
16
+ ],
9
17
  "outputs": [
10
18
  "{options.outputPath}"
11
19
  ],
@@ -1,2 +1 @@
1
- // export * from "./package-lock-file";
2
1
  export * from "./project-config";
@@ -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");