@putout/plugin-gitignore 5.0.0 β 7.0.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 -2
- package/lib/gitignore.js +15 -61
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @putout/plugin-gitignore [![NPM version][NPMIMGURL]][NPMURL]
|
|
2
2
|
|
|
3
3
|
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-gitignore.svg?style=flat&longCache=true
|
|
4
|
-
[NPMURL]: https://npmjs.org/package/@putout/plugin-gitignore"npm"
|
|
4
|
+
[NPMURL]: https://npmjs.org/package/@putout/plugin-gitignore "npm"
|
|
5
5
|
|
|
6
6
|
π[**Putout**](https://github.com/coderaiser/putout) plugin helps with π[**Putout**](https://github.com/coderaiser/putout) plugins development.
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ npm i @putout/plugin-gitignore -D
|
|
|
13
13
|
|
|
14
14
|
## Rules
|
|
15
15
|
|
|
16
|
-
By default, all files
|
|
16
|
+
By default, all files enabled, if you want disable some of them use `dismiss` property:
|
|
17
17
|
|
|
18
18
|
```json
|
|
19
19
|
{
|
package/lib/gitignore.js
CHANGED
|
@@ -1,63 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {operator} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
const {StringLiteral} = types;
|
|
5
|
-
const getValue = ({value}) => value;
|
|
3
|
+
const {ignore} = operator;
|
|
6
4
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
[__ignore]: ({__array}) => {
|
|
22
|
-
const list = __array.elements.map(getValue);
|
|
23
|
-
|
|
24
|
-
for (const name of newNames) {
|
|
25
|
-
if (!list.includes(name))
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return false;
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const replace = ({options}) => {
|
|
35
|
-
const {dismiss = []} = options;
|
|
36
|
-
const newNames = filterNames(names, dismiss);
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
[__ignore]: ({__array}, path) => {
|
|
40
|
-
const list = __array.elements.map(getValue);
|
|
41
|
-
|
|
42
|
-
for (const name of newNames) {
|
|
43
|
-
if (!list.includes(name))
|
|
44
|
-
__array.elements.push(StringLiteral(name));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return path;
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
function filterNames(names, dismiss) {
|
|
53
|
-
const newNames = [];
|
|
54
|
-
|
|
55
|
-
for (const name of names) {
|
|
56
|
-
if (dismiss.includes(name))
|
|
57
|
-
continue;
|
|
58
|
-
|
|
59
|
-
newNames.push(name);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return newNames;
|
|
63
|
-
}
|
|
5
|
+
export const {
|
|
6
|
+
match,
|
|
7
|
+
replace,
|
|
8
|
+
report,
|
|
9
|
+
} = ignore({
|
|
10
|
+
name: '.gitignore',
|
|
11
|
+
list: [
|
|
12
|
+
'.idea',
|
|
13
|
+
'*.swp',
|
|
14
|
+
'yarn-error.log',
|
|
15
|
+
'coverage',
|
|
16
|
+
],
|
|
17
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-gitignore",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "πPutout plugin helps with .gitignore",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"changelog": false,
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git://github.com/coderaiser/putout.git"
|
|
14
|
+
"url": "git+https://github.com/coderaiser/putout.git"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"test": "madrun test",
|
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
"gitignore"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@putout/
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"eslint
|
|
38
|
-
"eslint-plugin-
|
|
39
|
-
"
|
|
40
|
-
"madrun": "^
|
|
34
|
+
"@putout/eslint-flat": "^4.0.0",
|
|
35
|
+
"@putout/test": "^15.0.0",
|
|
36
|
+
"c8": "^10.0.0",
|
|
37
|
+
"eslint": "^10.0.0",
|
|
38
|
+
"eslint-plugin-n": "^17.0.0",
|
|
39
|
+
"eslint-plugin-putout": "^30.0.0",
|
|
40
|
+
"madrun": "^12.0.0",
|
|
41
41
|
"nodemon": "^3.0.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"putout": ">=
|
|
44
|
+
"putout": ">=41"
|
|
45
45
|
},
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"engines": {
|
|
48
|
-
"node": ">=
|
|
48
|
+
"node": ">=22"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|