stackscan 0.1.24 → 0.1.29

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.
Files changed (51) hide show
  1. package/README.md +10 -0
  2. package/dist/add.mjs +3 -2
  3. package/dist/chunk-2ZANNQYS.mjs +162 -0
  4. package/dist/chunk-5AYPCRZA.mjs +21 -0
  5. package/dist/chunk-CFGUYUPP.mjs +42 -0
  6. package/dist/chunk-DF3YGYKJ.mjs +2241 -0
  7. package/dist/chunk-GFZMRHRT.mjs +181 -0
  8. package/dist/chunk-HT4RZGLE.mjs +267 -0
  9. package/dist/chunk-IFB4PCXR.mjs +28 -0
  10. package/dist/chunk-MFJXW5RR.mjs +6 -0
  11. package/dist/chunk-SECL5E42.mjs +23 -0
  12. package/dist/chunk-STCTH5AY.mjs +15619 -0
  13. package/dist/chunk-ZYFKPOWH.mjs +54 -0
  14. package/dist/cli.js +34 -7
  15. package/dist/cli.mjs +11 -7
  16. package/dist/defaults.mjs +3 -2
  17. package/dist/defaults.test.d.mts +2 -0
  18. package/dist/defaults.test.d.ts +2 -0
  19. package/dist/defaults.test.js +17007 -0
  20. package/dist/defaults.test.mjs +30 -0
  21. package/dist/index.js +34 -7
  22. package/dist/index.mjs +18 -12
  23. package/dist/magic-string.es-WH4FGKAB.mjs +1315 -0
  24. package/dist/output.mjs +4 -3
  25. package/dist/output.test.d.mts +2 -0
  26. package/dist/output.test.d.ts +2 -0
  27. package/dist/output.test.js +20687 -0
  28. package/dist/output.test.mjs +160 -0
  29. package/dist/scan.js +34 -7
  30. package/dist/scan.mjs +7 -6
  31. package/dist/scan.test.d.mts +2 -0
  32. package/dist/scan.test.d.ts +2 -0
  33. package/dist/scan.test.js +23184 -0
  34. package/dist/scan.test.mjs +183 -0
  35. package/dist/simple-icons-hex.mjs +1 -0
  36. package/dist/sync.js +1 -2
  37. package/dist/sync.mjs +7 -6
  38. package/dist/techDefinitions.js +1 -2
  39. package/dist/techDefinitions.mjs +3 -2
  40. package/dist/techMap.js +1 -2
  41. package/dist/techMap.mjs +4 -3
  42. package/dist/techMap.test.d.mts +2 -0
  43. package/dist/techMap.test.d.ts +2 -0
  44. package/dist/techMap.test.js +19240 -0
  45. package/dist/techMap.test.mjs +38 -0
  46. package/dist/types.mjs +3 -2
  47. package/package.json +9 -4
  48. package/public/assets/logos/defaults/package.svg +18 -18
  49. package/public/assets/logos/defaults/terminal.svg +16 -16
  50. package/public/assets/logos/defaults/wrench.svg +15 -15
  51. package/public/assets/logos/testing/vitest.svg +1 -1
@@ -0,0 +1,183 @@
1
+ import {
2
+ scan
3
+ } from "./chunk-HT4RZGLE.mjs";
4
+ import "./chunk-SECL5E42.mjs";
5
+ import "./chunk-DF3YGYKJ.mjs";
6
+ import {
7
+ afterEach,
8
+ beforeEach,
9
+ describe,
10
+ globalExpect,
11
+ it,
12
+ vi
13
+ } from "./chunk-STCTH5AY.mjs";
14
+ import "./chunk-GFZMRHRT.mjs";
15
+ import "./chunk-EH2SEQZP.mjs";
16
+ import "./chunk-IFB4PCXR.mjs";
17
+ import {
18
+ init_esm_shims
19
+ } from "./chunk-5AYPCRZA.mjs";
20
+ import "./chunk-CFGUYUPP.mjs";
21
+
22
+ // src/scan.test.ts
23
+ init_esm_shims();
24
+ import fs from "fs";
25
+ import path from "path";
26
+ vi.mock("fs", () => {
27
+ return {
28
+ default: {
29
+ existsSync: vi.fn(),
30
+ readFileSync: vi.fn(),
31
+ readdirSync: vi.fn(),
32
+ mkdirSync: vi.fn(),
33
+ writeFileSync: vi.fn(),
34
+ renameSync: vi.fn(),
35
+ statSync: vi.fn()
36
+ }
37
+ };
38
+ });
39
+ vi.mock("./output", () => ({
40
+ generateMarkdown: vi.fn(() => "mock markdown"),
41
+ copyAssets: vi.fn(() => Promise.resolve(/* @__PURE__ */ new Set()))
42
+ }));
43
+ describe("scan module", () => {
44
+ let mockExit;
45
+ let consoleLogSpy;
46
+ let consoleWarnSpy;
47
+ beforeEach(() => {
48
+ vi.clearAllMocks();
49
+ fs.existsSync.mockReturnValue(true);
50
+ fs.statSync.mockReturnValue({ isFile: () => true });
51
+ mockExit = vi.spyOn(process, "exit").mockImplementation((code) => {
52
+ throw new Error(`process.exit(${code})`);
53
+ });
54
+ consoleLogSpy = vi.spyOn(console, "log").mockImplementation(() => {
55
+ });
56
+ consoleWarnSpy = vi.spyOn(console, "warn").mockImplementation(() => {
57
+ });
58
+ });
59
+ afterEach(() => {
60
+ mockExit.mockRestore();
61
+ consoleLogSpy.mockRestore();
62
+ consoleWarnSpy.mockRestore();
63
+ });
64
+ it("should scan single project and generate output", async () => {
65
+ const pkgJson = JSON.stringify({
66
+ dependencies: {
67
+ "react": "18.0.0",
68
+ "typescript": "5.0.0"
69
+ },
70
+ devDependencies: {
71
+ "vitest": "1.0.0"
72
+ }
73
+ });
74
+ fs.readFileSync.mockImplementation((p) => {
75
+ if (p.endsWith("package.json")) return pkgJson;
76
+ return "";
77
+ });
78
+ await scan("my-project", { out: "out.json" });
79
+ globalExpect(fs.writeFileSync).toHaveBeenCalled();
80
+ const calls = fs.writeFileSync.mock.calls;
81
+ const outCall = calls.find((c) => c[0] === path.resolve("out.json"));
82
+ globalExpect(outCall).toBeDefined();
83
+ const output = JSON.parse(outCall[1]);
84
+ const slugs = output.map((t) => t.slug);
85
+ globalExpect(slugs).toContain("react");
86
+ globalExpect(slugs).toContain("typescript");
87
+ globalExpect(slugs).toContain("vitest");
88
+ });
89
+ it("should skip SKIPPED_TECHS (react-dom)", async () => {
90
+ const pkgJson = JSON.stringify({
91
+ dependencies: {
92
+ "react": "18.0.0",
93
+ "react-dom": "18.0.0"
94
+ }
95
+ });
96
+ fs.readFileSync.mockReturnValue(pkgJson);
97
+ await scan("my-project", { out: "out.json" });
98
+ const calls = fs.writeFileSync.mock.calls;
99
+ const outCall = calls.find((c) => c[0] === path.resolve("out.json"));
100
+ const output = JSON.parse(outCall[1]);
101
+ const slugs = output.map((t) => t.slug);
102
+ globalExpect(slugs).toContain("react");
103
+ globalExpect(slugs).not.toContain("react-dom");
104
+ });
105
+ it("should fail gracefully if package.json is missing", async () => {
106
+ fs.existsSync.mockReturnValue(false);
107
+ await globalExpect(scan("test-path")).rejects.toThrow("process.exit(1)");
108
+ });
109
+ describe("workspace mode", () => {
110
+ beforeEach(() => {
111
+ fs.existsSync.mockImplementation((p) => {
112
+ if (p.endsWith("stackscan")) return true;
113
+ if (p.endsWith("package.json")) return true;
114
+ if (p.endsWith("README.md")) return true;
115
+ return true;
116
+ });
117
+ fs.readdirSync.mockImplementation((p) => {
118
+ return [
119
+ { name: "project-a", isDirectory: () => true },
120
+ { name: "project-b", isDirectory: () => true },
121
+ { name: "input", isDirectory: () => true }
122
+ // Should be ignored
123
+ ];
124
+ });
125
+ fs.statSync.mockReturnValue({ isFile: () => true });
126
+ fs.readFileSync.mockReturnValue("{}");
127
+ });
128
+ it("should scan all projects in workspace", async () => {
129
+ await scan();
130
+ globalExpect(fs.writeFileSync).toHaveBeenCalled();
131
+ const calls = fs.writeFileSync.mock.calls;
132
+ const projectACall = calls.find((c) => c[0].includes("project-a") && c[0].endsWith("stack.json"));
133
+ const projectBCall = calls.find((c) => c[0].includes("project-b") && c[0].endsWith("stack.json"));
134
+ globalExpect(projectACall).toBeDefined();
135
+ globalExpect(projectBCall).toBeDefined();
136
+ });
137
+ it("should update root README if enabled", async () => {
138
+ fs.readFileSync.mockImplementation((p) => {
139
+ if (typeof p === "string" && p.endsWith("README.md")) {
140
+ return "# My README\n<!-- STACKSCAN_START -->OLD CONTENT<!-- STACKSCAN_END -->";
141
+ }
142
+ if (typeof p === "string" && p.endsWith("package.json")) {
143
+ return JSON.stringify({ name: "sub-project", dependencies: {} });
144
+ }
145
+ return "{}";
146
+ });
147
+ await scan({ readme: true });
148
+ const calls = fs.writeFileSync.mock.calls;
149
+ const readmeCall = calls.find((c) => c[0].endsWith("README.md"));
150
+ globalExpect(readmeCall).toBeDefined();
151
+ globalExpect(readmeCall[1]).toContain("<!-- STACKSCAN_START -->");
152
+ globalExpect(readmeCall[1]).toContain("<!-- STACKSCAN_END -->");
153
+ });
154
+ it("should create stackscan directory if it does not exist", async () => {
155
+ fs.existsSync.mockImplementation((p) => {
156
+ if (p.endsWith("stackscan")) return false;
157
+ return true;
158
+ });
159
+ await globalExpect(scan()).rejects.toThrow("process.exit(0)");
160
+ globalExpect(fs.mkdirSync).toHaveBeenCalledWith(globalExpect.stringContaining("stackscan"), globalExpect.anything());
161
+ });
162
+ it("should warn if no projects found", async () => {
163
+ fs.readdirSync.mockReturnValue([]);
164
+ await scan();
165
+ globalExpect(consoleLogSpy).toHaveBeenCalledWith(globalExpect.stringContaining("No project directories found"));
166
+ });
167
+ });
168
+ describe("argument handling", () => {
169
+ it("should handle options object as first argument", async () => {
170
+ fs.readdirSync.mockReturnValue([
171
+ { name: "project-a", isDirectory: () => true }
172
+ ]);
173
+ fs.existsSync.mockReturnValue(true);
174
+ fs.readFileSync.mockImplementation((p) => {
175
+ if (p.endsWith("package.json")) return "{}";
176
+ return "";
177
+ });
178
+ const options = { readme: false };
179
+ await scan(options);
180
+ globalExpect(consoleLogSpy).toHaveBeenCalledWith(globalExpect.stringContaining("Skipping README update"));
181
+ });
182
+ });
183
+ });
@@ -3366,6 +3366,7 @@ import {
3366
3366
  zulip,
3367
3367
  zyte
3368
3368
  } from "./chunk-EH2SEQZP.mjs";
3369
+ import "./chunk-CFGUYUPP.mjs";
3369
3370
  export {
3370
3371
  abb,
3371
3372
  abbott,
package/dist/sync.js CHANGED
@@ -581,7 +581,7 @@ var techDefinitions = [
581
581
  "id": "rtkquery",
582
582
  "name": "RTK Query",
583
583
  "aliases": [
584
- "@reduxjs/toolkit"
584
+ "@rtk-query/graphql-request-base-query"
585
585
  ],
586
586
  "category": "state",
587
587
  "logo": "state/redux.svg",
@@ -1625,7 +1625,6 @@ var techDefinitions = [
1625
1625
  "aliases": [
1626
1626
  "aws-sdk",
1627
1627
  "@aws-sdk/client-s3",
1628
- "@aws-sdk/client-dynamodb",
1629
1628
  "@aws-sdk/client-lambda"
1630
1629
  ],
1631
1630
  "category": "cloud",
package/dist/sync.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  sync
3
- } from "./chunk-XNTLNSF6.mjs";
4
- import "./chunk-HKCVFKM4.mjs";
5
- import "./chunk-E75XPZ2U.mjs";
6
- import "./chunk-UJM3S22V.mjs";
7
- import "./chunk-NGEKE4DQ.mjs";
8
- import "./chunk-EOKQCSHI.mjs";
3
+ } from "./chunk-2ZANNQYS.mjs";
4
+ import "./chunk-SECL5E42.mjs";
5
+ import "./chunk-DF3YGYKJ.mjs";
6
+ import "./chunk-GFZMRHRT.mjs";
9
7
  import "./chunk-EH2SEQZP.mjs";
8
+ import "./chunk-IFB4PCXR.mjs";
9
+ import "./chunk-5AYPCRZA.mjs";
10
+ import "./chunk-CFGUYUPP.mjs";
10
11
  export {
11
12
  sync
12
13
  };
@@ -561,7 +561,7 @@ var techDefinitions = [
561
561
  "id": "rtkquery",
562
562
  "name": "RTK Query",
563
563
  "aliases": [
564
- "@reduxjs/toolkit"
564
+ "@rtk-query/graphql-request-base-query"
565
565
  ],
566
566
  "category": "state",
567
567
  "logo": "state/redux.svg",
@@ -1605,7 +1605,6 @@ var techDefinitions = [
1605
1605
  "aliases": [
1606
1606
  "aws-sdk",
1607
1607
  "@aws-sdk/client-s3",
1608
- "@aws-sdk/client-dynamodb",
1609
1608
  "@aws-sdk/client-lambda"
1610
1609
  ],
1611
1610
  "category": "cloud",
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  techDefinitions
3
- } from "./chunk-E75XPZ2U.mjs";
4
- import "./chunk-EOKQCSHI.mjs";
3
+ } from "./chunk-DF3YGYKJ.mjs";
4
+ import "./chunk-5AYPCRZA.mjs";
5
+ import "./chunk-CFGUYUPP.mjs";
5
6
  export {
6
7
  techDefinitions
7
8
  };
package/dist/techMap.js CHANGED
@@ -563,7 +563,7 @@ var techDefinitions = [
563
563
  "id": "rtkquery",
564
564
  "name": "RTK Query",
565
565
  "aliases": [
566
- "@reduxjs/toolkit"
566
+ "@rtk-query/graphql-request-base-query"
567
567
  ],
568
568
  "category": "state",
569
569
  "logo": "state/redux.svg",
@@ -1607,7 +1607,6 @@ var techDefinitions = [
1607
1607
  "aliases": [
1608
1608
  "aws-sdk",
1609
1609
  "@aws-sdk/client-s3",
1610
- "@aws-sdk/client-dynamodb",
1611
1610
  "@aws-sdk/client-lambda"
1612
1611
  ],
1613
1612
  "category": "cloud",
package/dist/techMap.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  techMap
3
- } from "./chunk-HKCVFKM4.mjs";
4
- import "./chunk-E75XPZ2U.mjs";
5
- import "./chunk-EOKQCSHI.mjs";
3
+ } from "./chunk-SECL5E42.mjs";
4
+ import "./chunk-DF3YGYKJ.mjs";
5
+ import "./chunk-5AYPCRZA.mjs";
6
+ import "./chunk-CFGUYUPP.mjs";
6
7
  export {
7
8
  techMap
8
9
  };
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }