redlint 3.3.0 → 3.4.0
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/ChangeLog +5 -0
- package/README.md +2 -2
- package/bin/redlint.js +20 -0
- package/lib/extract/extract.js +4 -4
- package/lib/help/help.js +2 -1
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
>
|
|
14
14
|
> **(c) The Book of Kon, PoKon and ZaKon**
|
|
15
15
|
|
|
16
|
-

|
|
17
17
|
|
|
18
18
|
What if **Filesystem** was a simple **JSON** file [`.filesystem.json`](https://github.com/putoutjs/redlint/blob/master/.filesystem.json). What if you can transform **JSON** file with 🐊[**Putout**](https://github.com/coderaiser/putout) code transformer and this changes modify **Filesystem**?
|
|
19
19
|
|
|
@@ -31,7 +31,7 @@ npm i redlint -g
|
|
|
31
31
|
|
|
32
32
|
You can choose interactively when run `redlint`:
|
|
33
33
|
|
|
34
|
-

|
|
35
35
|
|
|
36
36
|
## Scan
|
|
37
37
|
|
package/bin/redlint.js
CHANGED
|
@@ -17,8 +17,10 @@ import {buildTree} from '../lib/redlint.js';
|
|
|
17
17
|
import {convertToSimple} from '../lib/simple.js';
|
|
18
18
|
import {masterLint} from '../lib/lint/master.js';
|
|
19
19
|
import {masterPack} from '../lib/pack/master.js';
|
|
20
|
+
import {masterExtract} from '../lib/extract/master.js';
|
|
20
21
|
import {lint} from '../lib/lint/lint.js';
|
|
21
22
|
import {pack} from '../lib/pack/pack.js';
|
|
23
|
+
import {extract} from '../lib/extract/extract.js';
|
|
22
24
|
import {debug} from '../lib/debug.js';
|
|
23
25
|
|
|
24
26
|
const {stringify, parse} = JSON;
|
|
@@ -112,6 +114,24 @@ async function uiLoop(arg) {
|
|
|
112
114
|
process.exit();
|
|
113
115
|
}
|
|
114
116
|
|
|
117
|
+
if (arg === 'extract') {
|
|
118
|
+
const filesystem = await readFile(join(CWD, 'filesystem.red'), result);
|
|
119
|
+
const result = await masterExtract(CWD, filesystem);
|
|
120
|
+
const spinner = ora(`extract 'filesystem.red'`).start();
|
|
121
|
+
|
|
122
|
+
spinner.succeed();
|
|
123
|
+
process.exit();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (arg === 'extract:debug') {
|
|
127
|
+
const filesystem = await readFile(join(CWD, 'filesystem.red'), result);
|
|
128
|
+
const result = await extract(CWD, filesystem);
|
|
129
|
+
const spinner = ora(`extract 'filesystem.red'`).start();
|
|
130
|
+
|
|
131
|
+
spinner.succeed();
|
|
132
|
+
process.exit();
|
|
133
|
+
}
|
|
134
|
+
|
|
115
135
|
if (arg === 'pack:debug') {
|
|
116
136
|
const result = pack(CWD, filesystem);
|
|
117
137
|
await writeFile(join(CWD, 'filesystem.red'), result);
|
package/lib/extract/extract.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
const [, readAllFiles] = pluginFilesystem.rules['read-all-files'];
|
|
14
14
|
const [, replaceCwd] = pluginFilesystem.rules['replace-cwd'];
|
|
15
15
|
|
|
16
|
-
export const extract = (
|
|
16
|
+
export const extract = (to, filesystem, {
|
|
17
17
|
progress = createProgress(),
|
|
18
18
|
branch = originalBranch,
|
|
19
19
|
merge = originalMerge,
|
|
@@ -27,13 +27,13 @@ export const extract = (from, filesystem, {
|
|
|
27
27
|
progress,
|
|
28
28
|
rules: {
|
|
29
29
|
'replace-cwd': ['on', {
|
|
30
|
-
from,
|
|
31
|
-
to
|
|
30
|
+
from: '/',
|
|
31
|
+
to,
|
|
32
32
|
}],
|
|
33
33
|
},
|
|
34
34
|
plugins: [
|
|
35
|
-
['read-all-files', readAllFiles],
|
|
36
35
|
['replace-cwd', replaceCwd],
|
|
36
|
+
['write-all-files', readAllFiles],
|
|
37
37
|
],
|
|
38
38
|
});
|
|
39
39
|
|
package/lib/help/help.js
CHANGED
|
@@ -10,10 +10,11 @@ export const help = ({header = true}) => {
|
|
|
10
10
|
|
|
11
11
|
console.log(`Usage: redlint [command]`);
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
process.stdout.write(`Commands:
|
|
14
14
|
scan - scan files according to 🐊Putout rules
|
|
15
15
|
fix - fix files according to 🐊Putout rules
|
|
16
16
|
pack - pack 'filesystem.red' with directory contents
|
|
17
|
+
extract - extract directory contents from 'filesystem.red'
|
|
17
18
|
help - show help screen and exit
|
|
18
19
|
generate - generate .filesystem.json file and exit
|
|
19
20
|
generate:simple - generate simple .filesystem.json file and exit
|