@idomatic/core 1.1.3 → 1.1.5

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 (3) hide show
  1. package/README.md +13 -35
  2. package/bin/index.js +4 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,9 +1,10 @@
1
- idomatic
1
+ IDomatic
2
2
  idomatic is a CLI tool that automatically adds id attributes to your HTML/JSX/TSX components. It helps improve your testing and QA processes by ensuring that key elements always have unique, predictable identifiers.
3
3
 
4
4
  Note: idomatic is optimized for React and HTML-based projects (including Vue and Angular). You can choose your framework during setup, and the tool will create a default configuration accordingly.
5
5
 
6
- Features
6
+ ## Features
7
+
7
8
  Automatic ID Injection: Scans your project files and injects id attributes into components that are missing them.
8
9
 
9
10
  Configurable Behavior: Customize the prefix, specify file extensions, exclude certain tags, and more.
@@ -14,39 +15,18 @@ Framework Specific Defaults: Pre-populated configurations for React (JS/TSX) or
14
15
 
15
16
  Easy Integration: Use with your existing build or CI/CD processes.
16
17
 
17
- Installation
18
- You can install idomatic using your favorite package manager. For example:
19
-
20
- bash
21
- Copy
22
-
23
- # Using npm
24
-
25
- ```shell
26
- npm install --save-dev @idomatic/core`
27
- ```
18
+ ## Installation
28
19
 
29
- # Using yarn
20
+ To install idomatic, simply run the initializer command:
30
21
 
31
22
  ```shell
32
- yarn add --dev @idomatic/core
23
+ npm init @idomatic
33
24
  ```
34
25
 
35
- # Using bun
26
+ This command will guide you through selecting your framework and automatically install the necessary configuration file and parser for your project. The default configuration file (e.g., .idomatic.config.json) will be created in your project's root.
36
27
 
37
- ```shell
38
- bun add --dev @idomatic/core
39
- ```
28
+ ## Usage
40
29
 
41
- Additionally, if you haven't set up the configuration for idomatic, you can run the initializer:
42
-
43
- ```shell
44
- npx idomatic --init
45
- ```
46
-
47
- This command will guide you through selecting your framework and create a default configuration file (.idomatic.config.json) in your project's root.
48
-
49
- Usage
50
30
  CLI Commands
51
31
  After installation and configuration, you can run idomatic using the following commands:
52
32
 
@@ -79,9 +59,10 @@ The configuration file .idomatic.config.json is created during the setup process
79
59
 
80
60
  You can customize these values to better suit your project’s needs. For HTML/Vue/Angular projects, the includeExtensions field will be set to ["html", "vue", "ng.html"].
81
61
 
82
- How It Works
62
+ ## How It Works
63
+
83
64
  Setup:
84
- Run the setup command (npx idomatic --init) to choose your framework and create a configuration file.
65
+ Run the setup command (e.g npm init @idomatic) to choose your framework and create a configuration file.
85
66
 
86
67
  Scanning:
87
68
  The tool uses your configuration to search for files matching the specified extensions.
@@ -93,7 +74,8 @@ Write Mode: Processes each file, adding id attributes where needed.
93
74
  Parsing:
94
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).
95
76
 
96
- Example
77
+ ## Example
78
+
97
79
  Imagine you have a React component without an id attribute:
98
80
 
99
81
  ```js
@@ -116,7 +98,3 @@ The generated id includes a prefix (from the configuration) and a unique identif
116
98
 
117
99
  Contributing
118
100
  Contributions are welcome! Feel free to open issues or pull requests on GitHub.
119
-
120
- ```
121
-
122
- ```
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 (isScan) {
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("Only --init-scan is supported in MVP for now.");
12
+ console.log("Unsupported command. Please use 'scan' or 'scan --dry'.");
15
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idomatic/core",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "idomatic": "./bin/index.js"