@putout/operator-match-files 3.0.0 → 3.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/match-files.js +8 -5
- package/package.json +4 -4
package/lib/match-files.js
CHANGED
|
@@ -13,6 +13,7 @@ const {
|
|
|
13
13
|
writeFileContent,
|
|
14
14
|
getFilename,
|
|
15
15
|
createFile,
|
|
16
|
+
removeFile,
|
|
16
17
|
getParentDirectory,
|
|
17
18
|
} = require('@putout/operator-filesystem');
|
|
18
19
|
|
|
@@ -31,7 +32,7 @@ module.exports.matchFiles = (files) => {
|
|
|
31
32
|
};
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
function fix(path, {outputFilename, matchedJS, matchedAST, plugins}) {
|
|
35
|
+
function fix(path, {inputFile, outputFilename, matchedJS, matchedAST, plugins}) {
|
|
35
36
|
transform(matchedAST, matchedJS, {
|
|
36
37
|
plugins,
|
|
37
38
|
});
|
|
@@ -39,6 +40,9 @@ function fix(path, {outputFilename, matchedJS, matchedAST, plugins}) {
|
|
|
39
40
|
const matchedJSON = magicPrint(outputFilename, matchedAST);
|
|
40
41
|
|
|
41
42
|
writeFileContent(path, matchedJSON);
|
|
43
|
+
|
|
44
|
+
if (path !== inputFile)
|
|
45
|
+
removeFile(inputFile);
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
const createScan = (files) => (path, {push, progress, options}) => {
|
|
@@ -83,11 +87,9 @@ const createScan = (files) => (path, {push, progress, options}) => {
|
|
|
83
87
|
const fileContent = readFileContent(inputFile) || '{}';
|
|
84
88
|
const [matchedJS, matchedAST] = magicParse(inputFilename, fileContent);
|
|
85
89
|
|
|
90
|
+
const name = `match-file: ${inputFilename}`;
|
|
86
91
|
const plugins = [
|
|
87
|
-
[
|
|
88
|
-
`match-file/${inputFilename}`,
|
|
89
|
-
plugin,
|
|
90
|
-
],
|
|
92
|
+
[name, plugin],
|
|
91
93
|
];
|
|
92
94
|
|
|
93
95
|
const places = findPlaces(matchedAST, matchedJS, {
|
|
@@ -100,6 +102,7 @@ const createScan = (files) => (path, {push, progress, options}) => {
|
|
|
100
102
|
const {message} = places[0];
|
|
101
103
|
|
|
102
104
|
push(outputFile, {
|
|
105
|
+
inputFile,
|
|
103
106
|
outputFilename,
|
|
104
107
|
message,
|
|
105
108
|
plugins,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/operator-match-files",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout operator adds ability to match files to plugins",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@putout/plugin-nodejs": "*",
|
|
40
|
-
"@putout/test": "^
|
|
40
|
+
"@putout/test": "^9.0.0",
|
|
41
41
|
"c8": "^9.0.0",
|
|
42
|
-
"eslint": "^9.0.0
|
|
43
|
-
"eslint-plugin-n": "^17.0.0
|
|
42
|
+
"eslint": "^9.0.0",
|
|
43
|
+
"eslint-plugin-n": "^17.0.0",
|
|
44
44
|
"eslint-plugin-putout": "^22.0.0",
|
|
45
45
|
"lerna": "^6.0.1",
|
|
46
46
|
"madrun": "^10.0.0",
|