redlint 6.2.0 → 6.3.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 +20 -0
- package/bin/read-stdin.js +22 -0
- package/bin/redlint.js +2 -1
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -111,6 +111,26 @@ To add new rule `create-file` located in plugin `custom` for **RedLint** write a
|
|
|
111
111
|
When you writing a rule for **RedLint** you can run tests with `redlint test`.
|
|
112
112
|
Here is how it looks like: <img width="393" height="290" alt="image" src="https://github.com/user-attachments/assets/17f3bbb2-98aa-415e-b8e3-2065fef87261" />
|
|
113
113
|
|
|
114
|
+
## Pack
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
redlint pack
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Will produce file `filesystem.red` with content of current directory
|
|
121
|
+
|
|
122
|
+
## Extract
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
redlint extract
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Will extract `filesystem.red` to current directory. Also works from stdin:
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
cat ../../filesystem.red | redlint extract
|
|
132
|
+
```
|
|
133
|
+
|
|
114
134
|
## License
|
|
115
135
|
|
|
116
136
|
MIT
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {promisify} from 'node:util';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
|
|
4
|
+
export const readStdin = promisify((overrides, fn) => {
|
|
5
|
+
const {stdin} = fn ? overrides : process;
|
|
6
|
+
fn = fn || overrides;
|
|
7
|
+
|
|
8
|
+
stdin.setEncoding('utf8');
|
|
9
|
+
|
|
10
|
+
if (stdin.isTTY)
|
|
11
|
+
return fn(null, '');
|
|
12
|
+
|
|
13
|
+
const data = [];
|
|
14
|
+
|
|
15
|
+
stdin.on('data', (chunk) => {
|
|
16
|
+
data.push(chunk);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
stdin.on('end', () => {
|
|
20
|
+
fn(null, data.join(''));
|
|
21
|
+
});
|
|
22
|
+
});
|
package/bin/redlint.js
CHANGED
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
TEST,
|
|
62
62
|
isTest,
|
|
63
63
|
} from '../lib/menu.js';
|
|
64
|
+
import {readStdin} from './read-stdin.js';
|
|
64
65
|
|
|
65
66
|
const {log} = console;
|
|
66
67
|
const {exit} = process;
|
|
@@ -247,7 +248,7 @@ async function uiLoop(arg) {
|
|
|
247
248
|
}
|
|
248
249
|
|
|
249
250
|
if (isExtract(arg)) {
|
|
250
|
-
const filesystem = await readFile(join(CWD, 'filesystem.red'), 'utf8');
|
|
251
|
+
const filesystem = await readStdin() || await readFile(join(CWD, 'filesystem.red'), 'utf8');
|
|
251
252
|
await masterExtract(CWD, filesystem);
|
|
252
253
|
const spinner = ora(`extract 'filesystem.red'`).start();
|
|
253
254
|
|