@idomatic/core 1.1.4 → 1.1.6
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/README.md +2 -1
- package/bin/index.js +4 -6
- package/lib/core.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,7 +74,8 @@ Write Mode: Processes each file, adding id attributes where needed.
|
|
|
74
74
|
Parsing:
|
|
75
75
|
Depending on the file type, idomatic imports the appropriate parser (@idomatic/parser-js for JavaScript/JSX/TSX or @idomatic/parser-html for HTML-based files) to modify your code using an Abstract Syntax Tree (AST).
|
|
76
76
|
|
|
77
|
-
Example
|
|
77
|
+
## Example
|
|
78
|
+
|
|
78
79
|
Imagine you have a React component without an id attribute:
|
|
79
80
|
|
|
80
81
|
```js
|
package/bin/index.js
CHANGED
|
@@ -3,13 +3,11 @@ import runInitScan from "../lib/scan.js";
|
|
|
3
3
|
import runInitScanDry from "../lib/scanDry.js";
|
|
4
4
|
|
|
5
5
|
const args = process.argv.slice(2);
|
|
6
|
-
const isScan = args.includes("scan");
|
|
7
|
-
const isInitScanDry = args.includes("scan --dry");
|
|
8
6
|
|
|
9
|
-
if (
|
|
10
|
-
await runInitScan();
|
|
11
|
-
} else if (isInitScanDry) {
|
|
7
|
+
if (args[0] === "scan" && args[1] === "--dry") {
|
|
12
8
|
await runInitScanDry();
|
|
9
|
+
} else if (args[0] === "scan") {
|
|
10
|
+
await runInitScan();
|
|
13
11
|
} else {
|
|
14
|
-
console.log("
|
|
12
|
+
console.log("Unsupported command. Please use 'scan' or 'scan --dry'.");
|
|
15
13
|
}
|
package/lib/core.js
CHANGED
|
@@ -29,7 +29,7 @@ export async function processFile(filePath, config) {
|
|
|
29
29
|
console.log(`✅ Updated: ${filePath}`);
|
|
30
30
|
} catch (err) {
|
|
31
31
|
console.error(
|
|
32
|
-
`❌ Failed to load parser "${parserPackage}" for ${filePath}`
|
|
32
|
+
`❌ Failed to load parser "${parserPackage}" for ${filePath} ${err}`
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
}
|