@putout/plugin-package-json 7.0.0 β 7.2.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/README.md +2 -1
- package/lib/find-file/index.js +16 -48
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,7 +100,8 @@ Check out in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/eb12c902c
|
|
|
100
100
|
|
|
101
101
|
## find-file
|
|
102
102
|
|
|
103
|
-
Find `package.json` inside of `.filesystem.json` and applies all other `package-json` rules
|
|
103
|
+
Find `package.json` inside of `.filesystem.json` and applies all other `package-json` rules.
|
|
104
|
+
Checkout in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/325233d19fde0acacadbcf1f42dd3bb2/124a50fe0e92c6c3cab24f8b87c33b202dc3e540).
|
|
104
105
|
|
|
105
106
|
```diff
|
|
106
107
|
{
|
package/lib/find-file/index.js
CHANGED
|
@@ -1,54 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
operator,
|
|
3
|
-
parse,
|
|
4
|
-
print,
|
|
5
|
-
transform,
|
|
6
|
-
} from 'putout';
|
|
1
|
+
import {operator} from 'putout';
|
|
7
2
|
import rules from '../package-json.js';
|
|
8
3
|
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
writeFileContent,
|
|
13
|
-
toJS,
|
|
14
|
-
fromJS,
|
|
15
|
-
} = operator;
|
|
16
|
-
|
|
17
|
-
const plugins = Object.entries(rules);
|
|
4
|
+
const plugin = {
|
|
5
|
+
rules,
|
|
6
|
+
};
|
|
18
7
|
|
|
19
|
-
|
|
8
|
+
const {matchFiles} = operator;
|
|
20
9
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
10
|
+
const {
|
|
11
|
+
scan,
|
|
12
|
+
report,
|
|
13
|
+
fix,
|
|
14
|
+
} = matchFiles({
|
|
15
|
+
'package.json': plugin,
|
|
16
|
+
});
|
|
28
17
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
for (const [i, file] of files.entries()) {
|
|
34
|
-
const content = toJS(readFileContent(file));
|
|
35
|
-
const ast = parse(content);
|
|
36
|
-
const places = transform(ast, content, {
|
|
37
|
-
fix: false,
|
|
38
|
-
plugins,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if (!places.length)
|
|
42
|
-
continue;
|
|
43
|
-
|
|
44
|
-
push(file, {
|
|
45
|
-
content,
|
|
46
|
-
ast,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
progress({
|
|
50
|
-
i,
|
|
51
|
-
n,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
18
|
+
export {
|
|
19
|
+
scan,
|
|
20
|
+
report,
|
|
21
|
+
fix,
|
|
54
22
|
};
|
package/package.json
CHANGED