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 CHANGED
@@ -1,3 +1,8 @@
1
+ 2023.12.21, v3.4.0
2
+
3
+ feature:
4
+ - 1e3d44a extract: add
5
+
1
6
  2023.12.21, v3.3.0
2
7
 
3
8
  feature:
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  >
14
14
  > **(c) The Book of Kon, PoKon and ZaKon**
15
15
 
16
- ![image](https://github.com/putoutjs/redlint/assets/1573141/09bed270-cbf5-484f-bdd6-dd031ae38703)
16
+ ![image](https://github.com/putoutjs/redlint/assets/1573141/3f239180-a378-48b7-9e68-9cc66e762e2b)
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
- ![image](https://github.com/putoutjs/redlint/assets/1573141/c5d3a231-6caf-4dcb-9410-1d4dda48d9e0)
34
+ ![image](https://github.com/putoutjs/redlint/assets/1573141/32a8e9f0-f073-43e7-a592-3bbc7bf056a4)
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);
@@ -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 = (from, filesystem, {
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
- console.log(`Commands:
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redlint",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Lint Filesystem with 🐊Putout",