@bobfrankston/importgen 0.1.18 → 0.1.19
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 +4 -1
- package/index.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ npm install -g @bobfrankston/importgen
|
|
|
25
25
|
Run from your project directory (containing `package.json` and your HTML file):
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
importgen [htmlfile] [--watch|-w]
|
|
28
|
+
importgen [htmlfile] [--watch|-w] [--version|-v]
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
```bash
|
|
@@ -39,6 +39,9 @@ importgen app.html
|
|
|
39
39
|
# Watch mode: regenerate whenever package.json changes
|
|
40
40
|
importgen --watch
|
|
41
41
|
importgen default.htm --watch
|
|
42
|
+
|
|
43
|
+
# Show version
|
|
44
|
+
importgen -v
|
|
42
45
|
```
|
|
43
46
|
|
|
44
47
|
`importgen` reads dependencies from `package.json` in the current directory and injects the import map into the HTML file.
|
package/index.js
CHANGED
|
@@ -177,8 +177,12 @@ function generateImportMap(packageJsonPath, htmlFilePath) {
|
|
|
177
177
|
}
|
|
178
178
|
// Parse CLI arguments
|
|
179
179
|
const args = process.argv.slice(2);
|
|
180
|
+
if (args.includes('-v') || args.includes('--version')) {
|
|
181
|
+
console.log(`importgen ${packageJson.version}`);
|
|
182
|
+
process.exit(0);
|
|
183
|
+
}
|
|
180
184
|
const watchMode = args.includes('-w') || args.includes('--watch');
|
|
181
|
-
const htmlArg = args.find(a => a
|
|
185
|
+
const htmlArg = args.find(a => !a.startsWith('-'));
|
|
182
186
|
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
183
187
|
// Resolve HTML file: explicit argument, or search for common names
|
|
184
188
|
const possibleHtmlFiles = ['index.html', 'default.html', 'default.htm'];
|