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
package/README.md CHANGED
@@ -81,6 +81,16 @@ npx stackscan scan --color brand
81
81
 
82
82
  ---
83
83
 
84
+ ## Dependabot & Security
85
+
86
+ When hosting `package.json` files for analysis, security tools like Dependabot may incorrectly flag them as vulnerable dependencies of your project.
87
+
88
+ To prevent this, StackScan will **automatically rename** any `package.json` found in `public/stackscan/` to `_package.json`.
89
+ - Dependabot ignores `_package.json`.
90
+ - StackScan prioritizes reading `_package.json` on future runs.
91
+
92
+ ---
93
+
84
94
  ## Output
85
95
 
86
96
  For each project in `public/stackscan/`, a `stack.json` is generated in the same folder.
package/dist/add.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  add
3
- } from "./chunk-ACCTMJVS.mjs";
4
- import "./chunk-EOKQCSHI.mjs";
3
+ } from "./chunk-ZYFKPOWH.mjs";
4
+ import "./chunk-5AYPCRZA.mjs";
5
+ import "./chunk-CFGUYUPP.mjs";
5
6
  export {
6
7
  add
7
8
  };
@@ -0,0 +1,162 @@
1
+ import {
2
+ techMap
3
+ } from "./chunk-SECL5E42.mjs";
4
+ import {
5
+ copyAssets,
6
+ generateMarkdown
7
+ } from "./chunk-GFZMRHRT.mjs";
8
+ import {
9
+ simple_icons_hex_default
10
+ } from "./chunk-EH2SEQZP.mjs";
11
+ import {
12
+ init_esm_shims
13
+ } from "./chunk-5AYPCRZA.mjs";
14
+
15
+ // src/sync.ts
16
+ init_esm_shims();
17
+ import fs from "fs";
18
+ import path from "path";
19
+ var BASE_DIR = path.join(process.cwd(), "public", "stackscan");
20
+ var SKIPPED_TECHS = [
21
+ "react-dom"
22
+ ];
23
+ async function sync(options = {}) {
24
+ console.log("\u{1F680} Starting Sync...");
25
+ if (options.color) {
26
+ console.log(`\u{1F3A8} Color mode: ${options.color}`);
27
+ }
28
+ if (!fs.existsSync(BASE_DIR)) {
29
+ console.log(`Creating stackscan directory at: ${BASE_DIR}`);
30
+ fs.mkdirSync(BASE_DIR, { recursive: true });
31
+ console.log('Please place your project folders inside "public/stackscan/" and run this command again.');
32
+ process.exit(0);
33
+ }
34
+ const entries = fs.readdirSync(BASE_DIR, { withFileTypes: true });
35
+ const projectDirs = entries.filter((dirent) => dirent.isDirectory() && dirent.name !== "input" && dirent.name !== "output");
36
+ if (projectDirs.length === 0) {
37
+ console.log('\u26A0\uFE0F No project directories found in "public/stackscan/".');
38
+ return;
39
+ }
40
+ console.log(`Found ${projectDirs.length} projects to process.
41
+ `);
42
+ const allProjects = [];
43
+ const allTechs = [];
44
+ for (const dir of projectDirs) {
45
+ const projectPath = path.join(BASE_DIR, dir.name);
46
+ const packageJsonPath = path.join(projectPath, "package.json");
47
+ if (fs.existsSync(packageJsonPath)) {
48
+ try {
49
+ const content = fs.readFileSync(packageJsonPath, "utf-8");
50
+ const pkg = JSON.parse(content);
51
+ const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
52
+ const detectedTechs = [];
53
+ Object.keys(allDeps).forEach((dep) => {
54
+ if (SKIPPED_TECHS.includes(dep)) return;
55
+ if (techMap[dep]) {
56
+ const tech = techMap[dep];
57
+ let color = null;
58
+ if (options.color === "white") color = "#FFFFFF";
59
+ else if (options.color === "black") color = "#000000";
60
+ else if (options.color && options.color.startsWith("#")) color = options.color;
61
+ else {
62
+ const depSlug = dep.toLowerCase();
63
+ const nameSlug = tech.name.toLowerCase();
64
+ const nameSlugNoSpaces = tech.name.toLowerCase().replace(/\s+/g, "");
65
+ const hex = simple_icons_hex_default[depSlug] || simple_icons_hex_default[nameSlug] || simple_icons_hex_default[nameSlugNoSpaces];
66
+ if (hex) color = `#${hex}`;
67
+ }
68
+ detectedTechs.push({
69
+ name: tech.name,
70
+ slug: dep,
71
+ logo: tech.logo,
72
+ // Raw path for resolution
73
+ color
74
+ });
75
+ }
76
+ });
77
+ let uniqueTechs = Array.from(new Set(detectedTechs.map((t) => t.slug))).map((slug) => detectedTechs.find((t) => t.slug === slug));
78
+ const seenLogos = /* @__PURE__ */ new Set();
79
+ uniqueTechs = uniqueTechs.filter((t) => {
80
+ if (seenLogos.has(t.logo)) {
81
+ return false;
82
+ }
83
+ seenLogos.add(t.logo);
84
+ return true;
85
+ });
86
+ const assetsDir = path.join(process.cwd(), "public", "assets", "logos");
87
+ if (options.copyAssets !== false) {
88
+ await copyAssets(uniqueTechs, assetsDir, { colorMode: options.color });
89
+ }
90
+ const techsWithUrls = uniqueTechs.map((t) => ({
91
+ ...t,
92
+ logo: `https://raw.githubusercontent.com/benjamindotdev/stackscan/main/public/assets/logos/${t.logo}`,
93
+ relativePath: `./public/assets/logos/${t.logo}`
94
+ }));
95
+ allTechs.push(...techsWithUrls);
96
+ fs.writeFileSync(
97
+ path.join(projectPath, "stack.json"),
98
+ JSON.stringify(techsWithUrls, null, 2)
99
+ );
100
+ const mdContent = generateMarkdown(techsWithUrls);
101
+ fs.writeFileSync(path.join(projectPath, "stack.md"), mdContent);
102
+ allProjects.push({
103
+ name: dir.name,
104
+ techs: techsWithUrls
105
+ });
106
+ console.log(`\u2705 ${dir.name.padEnd(20)} -> stack.json (${uniqueTechs.length} techs)`);
107
+ } catch (err) {
108
+ console.error(`\u274C Error processing ${dir.name}:`, err.message);
109
+ }
110
+ } else {
111
+ console.warn(`\u26A0\uFE0F Skipping "${dir.name}": No package.json found.`);
112
+ }
113
+ }
114
+ if (allProjects.length > 0) {
115
+ updateRootReadme(allProjects);
116
+ }
117
+ console.log("\n\u2728 Sync complete.");
118
+ }
119
+ function updateRootReadme(projects) {
120
+ const readmePath = path.join(process.cwd(), "README.md");
121
+ if (!fs.existsSync(readmePath)) {
122
+ console.log("\u26A0\uFE0F No root README.md found to update.");
123
+ return;
124
+ }
125
+ let readmeContent = fs.readFileSync(readmePath, "utf-8");
126
+ const startMarker = "<!-- STACKSCAN_START -->";
127
+ const endMarker = "<!-- STACKSCAN_END -->";
128
+ let newSection = `${startMarker}
129
+ ## My Projects
130
+
131
+ `;
132
+ for (const p of projects) {
133
+ newSection += `### ${p.name}
134
+ `;
135
+ newSection += `<p>
136
+ `;
137
+ for (const t of p.techs) {
138
+ const src = t.relativePath || t.logo;
139
+ newSection += ` <img src="${src}" alt="${t.name}" height="25" style="margin-right: 10px;" />
140
+ `;
141
+ }
142
+ newSection += `</p>
143
+
144
+ `;
145
+ }
146
+ newSection += `${endMarker}`;
147
+ if (readmeContent.includes(startMarker) && readmeContent.includes(endMarker)) {
148
+ const regex = new RegExp(`${startMarker}[\\s\\S]*?${endMarker}`);
149
+ readmeContent = readmeContent.replace(regex, newSection);
150
+ console.log(`\u{1F4DD} Updated root README.md with ${projects.length} projects.`);
151
+ } else {
152
+ readmeContent += `
153
+
154
+ ${newSection}`;
155
+ console.log(`\u{1F4DD} Appended projects to root README.md.`);
156
+ }
157
+ fs.writeFileSync(readmePath, readmeContent);
158
+ }
159
+
160
+ export {
161
+ sync
162
+ };
@@ -0,0 +1,21 @@
1
+ import {
2
+ __esm
3
+ } from "./chunk-CFGUYUPP.mjs";
4
+
5
+ // node_modules/tsup/assets/esm_shims.js
6
+ import path from "path";
7
+ import { fileURLToPath } from "url";
8
+ var getFilename, getDirname, __dirname;
9
+ var init_esm_shims = __esm({
10
+ "node_modules/tsup/assets/esm_shims.js"() {
11
+ "use strict";
12
+ getFilename = () => fileURLToPath(import.meta.url);
13
+ getDirname = () => path.dirname(getFilename());
14
+ __dirname = /* @__PURE__ */ getDirname();
15
+ }
16
+ });
17
+
18
+ export {
19
+ __dirname,
20
+ init_esm_shims
21
+ };
@@ -0,0 +1,42 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
11
+ var __commonJS = (cb, mod) => function __require() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
+ };
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
+ mod
33
+ ));
34
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
35
+
36
+ export {
37
+ __esm,
38
+ __commonJS,
39
+ __export,
40
+ __toESM,
41
+ __publicField
42
+ };