comment-variables 2.2.1 → 2.3.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/generate.variations.js +27 -11
- package/package.json +2 -2
package/generate.variations.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// The Comment Variables config template generated in case no config file has been found.
|
|
2
2
|
|
|
3
|
-
// Just flip the `variations` object's `variant` key back and forth between `EN` and `FR` and see what happens on the accompanying `comments.example.js` file that has also been generated.
|
|
4
|
-
|
|
5
3
|
/* variants */
|
|
6
4
|
|
|
7
5
|
const EN = "en";
|
|
8
6
|
const ENGLISH = "English";
|
|
7
|
+
|
|
9
8
|
const FR = "fr";
|
|
10
9
|
const FRANÇAIS = "français";
|
|
11
10
|
|
|
@@ -14,9 +13,9 @@ const FRANÇAIS = "français";
|
|
|
14
13
|
const enData = Object.freeze({
|
|
15
14
|
comment: "This is a comment.",
|
|
16
15
|
alias: "EN#COMMENT",
|
|
17
|
-
composed: "$COMMENT#EN#COMMENT $COMMENT#EN#COMMENTS#YES $COMMENT#EN#ALIAS",
|
|
16
|
+
composed: "$COMMENT#EN#COMMENT $COMMENT#EN#COMMENTS#YES. $COMMENT#EN#ALIAS",
|
|
18
17
|
comments: Object.freeze({
|
|
19
|
-
yes: "Yes
|
|
18
|
+
yes: "Yes",
|
|
20
19
|
no: "No.",
|
|
21
20
|
}),
|
|
22
21
|
});
|
|
@@ -24,9 +23,9 @@ const enData = Object.freeze({
|
|
|
24
23
|
const frData = Object.freeze({
|
|
25
24
|
comment: "Ceci est un commentaire.",
|
|
26
25
|
alias: "FR#COMMENT",
|
|
27
|
-
composed: "$COMMENT#FR#COMMENT $COMMENT#FR#COMMENTS#YES $COMMENT#FR#ALIAS",
|
|
26
|
+
composed: "$COMMENT#FR#COMMENT $COMMENT#FR#COMMENTS#YES. $COMMENT#FR#ALIAS",
|
|
28
27
|
comments: Object.freeze({
|
|
29
|
-
yes: "Oui
|
|
28
|
+
yes: "Oui",
|
|
30
29
|
no: "Non.",
|
|
31
30
|
}),
|
|
32
31
|
});
|
|
@@ -57,7 +56,7 @@ const frComposedVariablesExclusives = ["FR#COMMENTS#YES"];
|
|
|
57
56
|
const composedVariablesExclusives = [
|
|
58
57
|
...enComposedVariablesExclusives,
|
|
59
58
|
...frComposedVariablesExclusives,
|
|
60
|
-
]; //
|
|
59
|
+
]; // composed variables allowed, Comment Variables that include `#COMPOSEDVARIABLESEXCLUSIVES#` are implicitly added
|
|
61
60
|
|
|
62
61
|
/* variations */
|
|
63
62
|
|
|
@@ -73,9 +72,19 @@ const variations = Object.freeze({
|
|
|
73
72
|
referenceData: enData,
|
|
74
73
|
// Defines the variant of the reference variation.
|
|
75
74
|
referenceVariant: EN,
|
|
76
|
-
// Defines the behavior of the error handling in case of variations that do not match one-to-one with the reference variation. If `true`, allows incomplete variations data to remain. If `false`, errors and guides the fixing of missing variations data.
|
|
75
|
+
// Defines the behavior of the error handling in case of variations that do not match one-to-one with the reference variation. If `true`, allows incomplete variations data to remain. If `false`, errors and guides the fixing of missing variations data (while ignoring composed variables exclusives).
|
|
77
76
|
allowIncompleteVariations: true,
|
|
78
|
-
|
|
77
|
+
// Defines which variants' `#PUBLIC#` Comment Variables should be publicly available, by default through `comments.public.mjs` and `comments.public.json`.
|
|
78
|
+
// public: [EN, FR] // v3
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// /* libraries */
|
|
82
|
+
|
|
83
|
+
// import { commentVariablesData as libraryCommentVariablesData } from "library"
|
|
84
|
+
|
|
85
|
+
// const libraries = {
|
|
86
|
+
// "library": libraryCommentVariablesData.variantKey
|
|
87
|
+
// } // v3
|
|
79
88
|
|
|
80
89
|
const config = {
|
|
81
90
|
data,
|
|
@@ -84,10 +93,17 @@ const config = {
|
|
|
84
93
|
myIgnoresOnly,
|
|
85
94
|
composedVariablesExclusives,
|
|
86
95
|
variations,
|
|
96
|
+
// libraries // v3
|
|
87
97
|
};
|
|
88
98
|
|
|
89
99
|
export default config;
|
|
90
100
|
|
|
91
|
-
//
|
|
101
|
+
// Just flip the `variations` object's `variant` key back and forth between `EN` and `FR` and see what happens when running commands and hovering on the accompanying `comments.example.js` file that has also been generated.
|
|
102
|
+
|
|
103
|
+
// The `comment-variables resolve` command resolves Comment Variables into comments.
|
|
104
|
+
// The `comment-variables compress` command compresses comments into Comment Variables.
|
|
105
|
+
// And the `comment-variables placeholders` command generates Comment Variables placeholders right next to where their values are defined.
|
|
92
106
|
|
|
93
|
-
//
|
|
107
|
+
// For hover resolutions, you'll need the dedicated VS Code extension for Comment Variables.
|
|
108
|
+
|
|
109
|
+
// 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comment-variables",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"type": "module",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@eslint/markdown": "^6.5.0",
|
|
35
|
-
"comment-variables-resolve-config": "^2.
|
|
35
|
+
"comment-variables-resolve-config": "^2.3.1",
|
|
36
36
|
"eslint": "^9.29.0",
|
|
37
37
|
"prompts": "^2.4.2"
|
|
38
38
|
},
|