comment-variables 1.1.2 → 1.2.1
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 -2
- package/comments.config.js +9 -0
- package/library/index.js +18 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ npm install -g comment-variables
|
|
|
18
18
|
comment-variables
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Interacts with your root `comments.config.js` file's default exported object to print all the parameters you need to be aware of before running `compress` or `resolve`. Also acts as a dry run validation check. If no error is printed, it means you can run `compress` or `resolve` safely, as long as the printed parameters correspond to what you've expected from your defined config. (Additionally creates a resolved version of your config data as a JSON file. If no configuration file is found, a tutorial mode is triggered, generating a template config file for you.)
|
|
21
|
+
Interacts with your root `comments.config.js` file's default exported object to print all the parameters you need to be aware of before running `compress` or `resolve`. Also acts as a dry run validation check. If no error is printed, it means you can run `compress` or `resolve` safely, as long as the printed parameters correspond to what you've expected from your defined config. (Additionally creates a resolved version of your config data as a JSON file, and as a .mjs file exporting both the typedef `ResolvedConfigData` and the object `resolvedConfigData`. If no configuration file is found, a tutorial mode is triggered, generating a template config file for you.)
|
|
22
22
|
|
|
23
23
|
```
|
|
24
24
|
comment-variables placeholders
|
|
@@ -183,4 +183,4 @@ And yes, even comments within JavaScript and TypeScript blocks in Markdown files
|
|
|
183
183
|
|
|
184
184
|
_Leverage the power of JavaScript to programmatically design your JavaScript comments._
|
|
185
185
|
|
|
186
|
-
**The Comment Variables VS Code extension is available [here](https://comvar.lemonsqueezy.com/buy/
|
|
186
|
+
**The Comment Variables VS Code extension is available [here](https://comvar.lemonsqueezy.com/buy/723b0220-ea5d-4b0a-835a-f0843e431639?logo=0&discount=0).**
|
package/comments.config.js
CHANGED
|
@@ -47,6 +47,15 @@ const data = {
|
|
|
47
47
|
// value: "value not allowed", // errors, "key", "value" and "placeholder" not allowed
|
|
48
48
|
// placeholder: "placeholder not allowed", // errors, "key", "value" and "placeholder" not allowed
|
|
49
49
|
// noConcat: "no" + "concat", // errors, unrecognized value
|
|
50
|
+
|
|
51
|
+
// already error via regex, but now enhanced:
|
|
52
|
+
// "//": "key comment error 1",
|
|
53
|
+
// "/*": "key comment error 2",
|
|
54
|
+
// "*/": "key comment error 3",
|
|
55
|
+
// error directly in resolveConfig:
|
|
56
|
+
// "key comment error 1": "//",
|
|
57
|
+
// "key comment error 2": "/*",
|
|
58
|
+
// "key comment error 3": "*/",
|
|
50
59
|
},
|
|
51
60
|
},
|
|
52
61
|
// for deving
|
package/library/index.js
CHANGED
|
@@ -149,9 +149,13 @@ skipDetails ||
|
|
|
149
149
|
|
|
150
150
|
// ADDRESSES THE --lint-config-imports FLAG (lintConfigImports, no longer a flag), GIVEN THAT THE FILES IMPORTED BY THE CONFIG ARE IGNORED BY DEFAULT.
|
|
151
151
|
|
|
152
|
+
// instantiate the JSON and .mjs path proactively
|
|
153
|
+
const jsonPath = configPath.replace(/\.js$/, () => ".json");
|
|
154
|
+
const mjsPath = configPath.replace(/\.js$/, () => ".mjs");
|
|
155
|
+
|
|
152
156
|
const rawConfigPathIgnores = lintConfigImports
|
|
153
|
-
? [configPath]
|
|
154
|
-
: rawConfigAndImportPaths;
|
|
157
|
+
? [configPath, mjsPath]
|
|
158
|
+
: [...rawConfigAndImportPaths, mjsPath];
|
|
155
159
|
|
|
156
160
|
// the ignore paths must be relative
|
|
157
161
|
const configPathIgnores = rawConfigPathIgnores.map((e) =>
|
|
@@ -181,15 +185,23 @@ if (!makeResolvedConfigDataResults.success) {
|
|
|
181
185
|
}
|
|
182
186
|
|
|
183
187
|
const resolvedConfigData = makeResolvedConfigDataResults.resolvedConfigData;
|
|
184
|
-
|
|
185
|
-
/\.js$/,
|
|
186
|
-
() => ".json"
|
|
187
|
-
);
|
|
188
|
+
|
|
188
189
|
const jsonData = JSON.stringify(resolvedConfigData, null, 2);
|
|
189
190
|
fs.writeFileSync(jsonPath, jsonData, "utf8");
|
|
190
191
|
|
|
191
192
|
console.log(`JSON resolved config data written to: \n${jsonPath}`);
|
|
192
193
|
|
|
194
|
+
// NEW!! comments.config.mjs to directly access resolvedConfigData.
|
|
195
|
+
|
|
196
|
+
const mjsData = `/** @typedef {${JSON.stringify(
|
|
197
|
+
resolvedConfigData
|
|
198
|
+
)}} ResolvedConfigData */\n\n/** @type {ResolvedConfigData} */\nexport const resolvedConfigData = ${JSON.stringify(
|
|
199
|
+
resolvedConfigData,
|
|
200
|
+
null,
|
|
201
|
+
2
|
|
202
|
+
)}`;
|
|
203
|
+
fs.writeFileSync(mjsPath, mjsData, "utf8");
|
|
204
|
+
|
|
193
205
|
// ADDRESSES THE CORE COMMANDS "resolve", "compress", AND "placeholders".
|
|
194
206
|
|
|
195
207
|
switch (coreCommand) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comment-variables",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A CLI tool for configuring, managing and maintaining JavaScript comments as JavaScript variables.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"comment-variables": "./library/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"type": "module",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@eslint/markdown": "^6.5.0",
|
|
33
|
-
"comment-variables-resolve-config": "^1.14.
|
|
33
|
+
"comment-variables-resolve-config": "^1.14.4",
|
|
34
34
|
"eslint": "^9.29.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|