@putout/cli-process-file 2.0.1 → 2.1.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/lib/printer/printer.mjs +19 -6
- package/lib/process-file.js +1 -1
- package/package.json +1 -1
package/lib/printer/printer.mjs
CHANGED
|
@@ -18,23 +18,36 @@ const JSON = {
|
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
const PACKAGE = {
|
|
22
|
+
...JSON,
|
|
23
|
+
format: {
|
|
24
|
+
...JSON.format,
|
|
25
|
+
indent: ' ',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
21
29
|
export const configurePrinter = (name, printerOptions) => {
|
|
22
30
|
const [printer = 'putout', options = {}] = maybeArray(printerOptions);
|
|
23
|
-
const ext = name
|
|
24
|
-
.split('.')
|
|
25
|
-
.pop();
|
|
26
31
|
|
|
27
32
|
if (printer !== 'putout')
|
|
28
33
|
return printerOptions;
|
|
29
34
|
|
|
30
|
-
const mergedOptions = deepMerge(parseOptions(
|
|
35
|
+
const mergedOptions = deepMerge(parseOptions(name), options);
|
|
31
36
|
|
|
32
37
|
return [printer, mergedOptions];
|
|
33
38
|
};
|
|
34
39
|
|
|
35
|
-
function parseOptions(
|
|
36
|
-
|
|
40
|
+
function parseOptions(name) {
|
|
41
|
+
const ext = name
|
|
42
|
+
.split('.')
|
|
43
|
+
.pop();
|
|
44
|
+
|
|
45
|
+
if (ext === 'json') {
|
|
46
|
+
if (name.endsWith('package.json'))
|
|
47
|
+
return PACKAGE;
|
|
48
|
+
|
|
37
49
|
return JSON;
|
|
50
|
+
}
|
|
38
51
|
|
|
39
52
|
if (ext === 'yml{json}')
|
|
40
53
|
return JSON;
|
package/lib/process-file.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/cli-process-file",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "Run all 🐊Putout linters",
|
|
6
6
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/cli-process-file#readme",
|