comment-variables 1.2.3 → 1.2.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.
- package/README.md +14 -0
- package/generate.template.js +1 -1
- package/library/index.js +8 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# comment-variables
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
<!-- <picture>
|
|
6
|
+
<source media="(prefers-color-scheme: dark)" srcset="./assets/README/name-dark-default.png">
|
|
7
|
+
<source media="(prefers-color-scheme: light)" srcset="./assets/README/name-light.png">
|
|
8
|
+
<img alt="Logo and name for the Comment Variables ecosystem." src="./assets/README/name-dark-default.png">
|
|
9
|
+
</picture> -->
|
|
10
|
+
|
|
3
11
|
A CLI tool for configuring, managing and maintaining JavaScript comments as JavaScript variables, via a `comments.config.js` file at the root of your project.
|
|
4
12
|
|
|
5
13
|

|
|
@@ -127,6 +135,8 @@ const data = {
|
|
|
127
135
|
"The flattened config data, with `$COMMENT` placeholders as keys and actual comments as values." /* $COMMENT#JSDOC#PARAMS#FLATTENEDCONFIGDATA */,
|
|
128
136
|
reversedFlattenedConfigData:
|
|
129
137
|
"The reversed flattened config data, with actual comments as keys and `$COMMENT` placeholders as values." /* $COMMENT#JSDOC#PARAMS#REVERSEDFLATTENEDCONFIGDATA */,
|
|
138
|
+
composedVariablesExclusives:
|
|
139
|
+
"The array of comment variables keys (implying their aliases as well) exclusively used to craft composed variables, that should be ignored by both the `resolve` and the `compress` commands." /* $COMMENT#JSDOC#PARAMS#COMPOSEDVARIABLESEXCLUSIVES */,
|
|
130
140
|
aliases_flattenedKeys:
|
|
131
141
|
"The dictionary that connects aliases to their original flattened keys in case an encountered placeholder is actually an alias." /* $COMMENT#JSDOC#PARAMS#ALIASES_FLATTENEDKEYS */,
|
|
132
142
|
ruleName:
|
|
@@ -145,6 +155,8 @@ const data = {
|
|
|
145
155
|
'The array of paths linked to the config file, (named "ignores" given it is ignored by the "compress" and "resolve" commands).' /* $COMMENT#JSDOC#PARAMS#CONFIGPATHIGNORES */,
|
|
146
156
|
originalFlattenedConfigData:
|
|
147
157
|
"The original flattened config data, before changes to aliases variables and composed variables are applied." /* $COMMENT#JSDOC#PARAMS#ORIGINALFLATTENEDCONFIGDATA */,
|
|
158
|
+
relativeMjsPath:
|
|
159
|
+
'The relative path of the generated `.mjs` file to be ignored in the "placeholders" process.' /* $COMMENT#JSDOC#PARAMS#RELATIVEMJSPATH */,
|
|
148
160
|
}),
|
|
149
161
|
returns: Object.freeze({
|
|
150
162
|
exitDueToFailure:
|
|
@@ -157,6 +169,8 @@ const data = {
|
|
|
157
169
|
constants: Object.freeze({
|
|
158
170
|
sortedReversedFlattenedConfigData:
|
|
159
171
|
"The whole `reversedFlattenedConfigData` turned from an object to an array of key-value arrays sorted by the descending length of each key to prevent partial replacements." /* $COMMENT#JSDOC#CONSTANTS#SORTEDREVERSEDFLATTENEDCONFIGDATA */,
|
|
172
|
+
composedVariablesExclusivesSet:
|
|
173
|
+
"A local Set out of composed variables exclusives for speed." /* $COMMENT#JSDOC#CONSTANTS#COMPOSEDVARIABLESEXCLUSIVESSET */,
|
|
160
174
|
}),
|
|
161
175
|
}),
|
|
162
176
|
};
|
package/generate.template.js
CHANGED
|
@@ -32,4 +32,4 @@ const config = {
|
|
|
32
32
|
|
|
33
33
|
export default config;
|
|
34
34
|
|
|
35
|
-
// Once you've grasped these concepts, simply rename this file and its
|
|
35
|
+
// Once you've grasped these concepts, simply rename this file, its JSON counterpart and its `.mjs` counterpart to `comments.config.js`, `comments.config.json` and `comments.config.mjs` respectively and you're good to go. (If you're using the extension, make sure to run VS Code's "Developer: Reload Window" command for the extension to operate based on your new `comments.config.js` file.)
|
package/library/index.js
CHANGED
|
@@ -16,6 +16,10 @@ import resolveConfig, {
|
|
|
16
16
|
cwd,
|
|
17
17
|
knownIgnores,
|
|
18
18
|
makeResolvedConfigData,
|
|
19
|
+
makeJsonData,
|
|
20
|
+
makeMjsData,
|
|
21
|
+
makeJsonPathLog,
|
|
22
|
+
makeMjsPathLog,
|
|
19
23
|
} from "comment-variables-resolve-config";
|
|
20
24
|
|
|
21
25
|
import { hasPackageJson, hasGitFolder } from "./_commons/constants/bases.js";
|
|
@@ -187,23 +191,17 @@ if (!makeResolvedConfigDataResults.success) {
|
|
|
187
191
|
|
|
188
192
|
const resolvedConfigData = makeResolvedConfigDataResults.resolvedConfigData;
|
|
189
193
|
|
|
190
|
-
const jsonData =
|
|
194
|
+
const jsonData = makeJsonData(resolvedConfigData);
|
|
191
195
|
fs.writeFileSync(jsonPath, jsonData, "utf8");
|
|
192
196
|
|
|
193
|
-
console.log(
|
|
197
|
+
console.log(makeJsonPathLog(jsonPath));
|
|
194
198
|
|
|
195
199
|
// NEW!! comments.config.mjs to directly access resolvedConfigData.
|
|
196
200
|
|
|
197
|
-
const mjsData =
|
|
198
|
-
resolvedConfigData
|
|
199
|
-
)}} ResolvedConfigData */\n\n/** @type {ResolvedConfigData} */\nexport const resolvedConfigData = ${JSON.stringify(
|
|
200
|
-
resolvedConfigData,
|
|
201
|
-
null,
|
|
202
|
-
2
|
|
203
|
-
)}`;
|
|
201
|
+
const mjsData = makeMjsData(resolvedConfigData);
|
|
204
202
|
fs.writeFileSync(mjsPath, mjsData, "utf8");
|
|
205
203
|
|
|
206
|
-
console.log(
|
|
204
|
+
console.log(makeMjsPathLog(mjsPath));
|
|
207
205
|
|
|
208
206
|
// ADDRESSES THE CORE COMMANDS "resolve", "compress", AND "placeholders".
|
|
209
207
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comment-variables",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
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.9",
|
|
34
34
|
"eslint": "^9.29.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|