@idomatic/core 1.0.7 → 1.0.9
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/bin/index.js +5 -7
- package/lib/core.js +0 -1
- package/lib/scanDry.js +27 -0
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
2
|
import runInitScan from "../lib/scan.js";
|
|
6
3
|
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
-
|
|
9
4
|
const args = process.argv.slice(2);
|
|
10
|
-
const
|
|
5
|
+
const isScan = args.includes("scan");
|
|
6
|
+
const isInitScanDry = args.includes("scan --dry");
|
|
11
7
|
|
|
12
|
-
if (
|
|
8
|
+
if (isScan) {
|
|
13
9
|
await runInitScan();
|
|
10
|
+
} else if (isInitScanDry) {
|
|
11
|
+
await runInitScanDry();
|
|
14
12
|
} else {
|
|
15
13
|
console.log("Only --init-scan is supported in MVP for now.");
|
|
16
14
|
}
|
package/lib/core.js
CHANGED
package/lib/scanDry.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { globby } from "globby";
|
|
2
|
+
import { processFile } from "./core.js";
|
|
3
|
+
import getUserConfig from "./readConfig.js";
|
|
4
|
+
|
|
5
|
+
async function runInitScan() {
|
|
6
|
+
const config = getUserConfig();
|
|
7
|
+
|
|
8
|
+
const patterns = config.includeExtensions.map((ext) => `**/*.${ext}`);
|
|
9
|
+
const files = await globby(patterns, {
|
|
10
|
+
gitignore: true,
|
|
11
|
+
ignore: config.excludeFiles.map((dir) => `${dir}/**`),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
console.log(`📂 Found ${files.length} files. Scanning...`);
|
|
15
|
+
|
|
16
|
+
for (const file of files) {
|
|
17
|
+
try {
|
|
18
|
+
console.log(`[Dry Run] Would process: ${file}`);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.warn(`❌ Error in: ${file}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
console.log("🎉 Init scan complete!");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default runInitScan;
|