comment-variables 1.1.0 → 1.1.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 +44 -17
- package/comments.config.js +0 -1
- package/generate.template.js +0 -1
- package/library/index.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npm install -g comment-variables
|
|
|
12
12
|
|
|
13
13
|
## Commands
|
|
14
14
|
|
|
15
|
-
**`comment-variables` (aliases `jscomments`/`comvar`) comes with
|
|
15
|
+
**`comment-variables` (aliases `jscomments`/`comvar`) comes with four commands in this initial release:**
|
|
16
16
|
|
|
17
17
|
```
|
|
18
18
|
comment-variables
|
|
@@ -20,6 +20,12 @@ comment-variables
|
|
|
20
20
|
|
|
21
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.)
|
|
22
22
|
|
|
23
|
+
```
|
|
24
|
+
comment-variables placeholders
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Creates Comment Variables placeholders right next to the single sources of truth where Comment Variables are defined. (See in config example below.)
|
|
28
|
+
|
|
23
29
|
```
|
|
24
30
|
comment-variables compress
|
|
25
31
|
```
|
|
@@ -34,45 +40,63 @@ Scans your line and block comments for `$COMMENT#*` placeholders (like `$COMMENT
|
|
|
34
40
|
|
|
35
41
|
_The `compress` and `resolve` commands make each other entirely reversible._
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
## Flags
|
|
44
|
+
|
|
45
|
+
**The CLI tool comes with a single flag:**
|
|
38
46
|
|
|
39
47
|
```
|
|
40
|
-
comment-variables
|
|
48
|
+
comment-variables --config <your-config.js>
|
|
41
49
|
```
|
|
42
50
|
|
|
43
|
-
|
|
51
|
+
Passes a different file as your config file instead of the default root `comments.config.js` file (like `comment-variables --config your-config.js`), through a path relative to the root of your project.
|
|
44
52
|
|
|
45
|
-
|
|
53
|
+
_The --config flag can be composed with any of the commands:_
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
comment-variables --config your-config.js
|
|
57
|
+
comment-variables compress --config your-config.js
|
|
58
|
+
comment-variables resolve --config your-config.js
|
|
59
|
+
comment-variables placeholders --config your-config.js
|
|
60
|
+
```
|
|
46
61
|
|
|
47
|
-
|
|
62
|
+
## Settings
|
|
63
|
+
|
|
64
|
+
**The config object requires the following settings:**
|
|
48
65
|
|
|
49
66
|
```
|
|
50
|
-
|
|
67
|
+
data:
|
|
51
68
|
```
|
|
52
69
|
|
|
53
|
-
|
|
70
|
+
Your dedicated object defining your Comment Variables through nested key-value pairs of string literals.
|
|
54
71
|
|
|
55
72
|
```
|
|
56
|
-
|
|
73
|
+
ignores:
|
|
57
74
|
```
|
|
58
75
|
|
|
59
|
-
|
|
76
|
+
Your dedicated array defining your files and folders to be ignored by the `compress` and `resolve` commands through strings of paths relative to the root of your project.
|
|
77
|
+
|
|
78
|
+
## Options
|
|
79
|
+
|
|
80
|
+
**The config object supports the following options:**
|
|
60
81
|
|
|
61
82
|
```
|
|
62
|
-
|
|
83
|
+
lintConfigImports:
|
|
63
84
|
```
|
|
64
85
|
|
|
65
|
-
By default, `comment-variables`
|
|
86
|
+
By default, `comment-variables` excludes your config file and all the (JavaScript/TypeScript) files it recursively imports. Passing `true` to this config option cancels this mechanism, linting config imports. (The config file however still remains excluded from linting.)
|
|
66
87
|
|
|
67
|
-
|
|
88
|
+
```
|
|
89
|
+
myIgnoresOnly:
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
By default, `comment-variables` includes a preset list of ignored folders (`"node_modules"`, `".next"`, `".react-router"`...). Passing `true` to this config option cancels this mechanism so that you can have full control over your ignored files and folders.
|
|
68
93
|
|
|
69
94
|
```
|
|
70
|
-
|
|
71
|
-
comment-variables compress --config your-config.js
|
|
72
|
-
comment-variables resolve --config your-config.js
|
|
73
|
-
comment-variables placeholders --config your-config.js
|
|
95
|
+
composedVariablesExclusives:
|
|
74
96
|
```
|
|
75
97
|
|
|
98
|
+
In due time, you may end up creating Comment Variables that are exclusively meant to be used to create other Comment Variables – the latter classified as composed variables. Passing an array to this config option, comprised of the keys of these original comment variables (for example, if a Comment Variable placeholder is `$COMMENT#COMMENT` its related key is `COMMENT`), prevents these original comment variables from being affected by the `compress` and `resolve` commands.
|
|
99
|
+
|
|
76
100
|
## **`comments.config.js`**
|
|
77
101
|
|
|
78
102
|
A root `comments.config.js` file looks like this. (This is the config file I'm using to manage my JavaScript comments in this library.)
|
|
@@ -142,11 +166,14 @@ const ignores = ["README.md", "generate.template.js", "generate.example.js"];
|
|
|
142
166
|
const lintConfigImports = false; // can be omitted
|
|
143
167
|
const myIgnoresOnly = false; // can be omitted
|
|
144
168
|
|
|
169
|
+
const composedVariablesExclusives = []; // can be omitted
|
|
170
|
+
|
|
145
171
|
const config = {
|
|
146
172
|
data,
|
|
147
173
|
ignores,
|
|
148
174
|
lintConfigImports,
|
|
149
175
|
myIgnoresOnly,
|
|
176
|
+
composedVariablesExclusives,
|
|
150
177
|
};
|
|
151
178
|
|
|
152
179
|
export default config;
|
package/comments.config.js
CHANGED
|
@@ -115,7 +115,6 @@ const ignores = ["README.md", "generate.template.js", "generate.example.js"];
|
|
|
115
115
|
const lintConfigImports = false; // can be omitted
|
|
116
116
|
const myIgnoresOnly = false; // can be omitted
|
|
117
117
|
|
|
118
|
-
// NEW
|
|
119
118
|
const composedVariablesExclusives = []; // can be omitted
|
|
120
119
|
|
|
121
120
|
const config = {
|
package/generate.template.js
CHANGED
package/library/index.js
CHANGED
|
@@ -142,7 +142,10 @@ skipDetails || console.log("lintConfigImports is:", lintConfigImports);
|
|
|
142
142
|
skipDetails || console.log("myIgnoresOnly are:", myIgnoresOnly);
|
|
143
143
|
// NEW
|
|
144
144
|
skipDetails ||
|
|
145
|
-
console.log(
|
|
145
|
+
console.log(
|
|
146
|
+
"Composed variables exclusives are:",
|
|
147
|
+
composedVariablesExclusives
|
|
148
|
+
);
|
|
146
149
|
|
|
147
150
|
// ADDRESSES THE --lint-config-imports FLAG (lintConfigImports, no longer a flag), GIVEN THAT THE FILES IMPORTED BY THE CONFIG ARE IGNORED BY DEFAULT.
|
|
148
151
|
|
package/package.json
CHANGED