@putout/plugin-gitignore 3.0.1 β 4.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 +12 -5
- package/lib/gitignore.js +9 -7
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
# @putout/plugin-gitignore [![NPM version][NPMIMGURL]][NPMURL]
|
|
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
4
|
[NPMURL]: https://npmjs.org/package/@putout/plugin-gitignore"npm"
|
|
5
|
-
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/plugin-gitignore
|
|
6
|
-
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-gitignore
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
π[**Putout**](https://github.com/coderaiser/putout) plugin helps with π[**Putout**](https://github.com/coderaiser/putout) plugins development.
|
|
9
7
|
|
|
10
8
|
## Install
|
|
11
9
|
|
|
@@ -15,7 +13,7 @@ npm i @putout/plugin-gitignore -D
|
|
|
15
13
|
|
|
16
14
|
## Rules
|
|
17
15
|
|
|
18
|
-
By default, all files enebled, if you want disable some of them use `
|
|
16
|
+
By default, all files enebled, if you want disable some of them use `dismiss` property:
|
|
19
17
|
|
|
20
18
|
```json
|
|
21
19
|
{
|
|
@@ -48,6 +46,15 @@ Adds `*.swp` into .gitignore.
|
|
|
48
46
|
node_modules
|
|
49
47
|
```
|
|
50
48
|
|
|
49
|
+
## Add `.idea` Files
|
|
50
|
+
|
|
51
|
+
Adds `*.swp` into .gitignore.
|
|
52
|
+
|
|
53
|
+
```diff
|
|
54
|
+
+.idea
|
|
55
|
+
node_modules
|
|
56
|
+
```
|
|
57
|
+
|
|
51
58
|
## License
|
|
52
59
|
|
|
53
60
|
MIT
|
package/lib/gitignore.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {types} = require('putout');
|
|
3
|
+
const {types, operator} = require('putout');
|
|
4
|
+
const {__ignore} = operator;
|
|
4
5
|
const {StringLiteral} = types;
|
|
5
6
|
const getValue = ({value}) => value;
|
|
6
7
|
|
|
7
8
|
const names = [
|
|
9
|
+
'.idea',
|
|
8
10
|
'*.swp',
|
|
9
11
|
'yarn-error.log',
|
|
10
12
|
'coverage',
|
|
@@ -17,8 +19,8 @@ module.exports.match = ({options}) => {
|
|
|
17
19
|
const newNames = filterNames(names, dismiss);
|
|
18
20
|
|
|
19
21
|
return {
|
|
20
|
-
|
|
21
|
-
const list =
|
|
22
|
+
[__ignore]: ({__array}) => {
|
|
23
|
+
const list = __array.elements.map(getValue);
|
|
22
24
|
|
|
23
25
|
for (const name of newNames) {
|
|
24
26
|
if (!list.includes(name))
|
|
@@ -35,13 +37,14 @@ module.exports.replace = ({options}) => {
|
|
|
35
37
|
const newNames = filterNames(names, dismiss);
|
|
36
38
|
|
|
37
39
|
return {
|
|
38
|
-
|
|
39
|
-
const list =
|
|
40
|
+
[__ignore]: ({__array}, path) => {
|
|
41
|
+
const list = __array.elements.map(getValue);
|
|
40
42
|
|
|
41
43
|
for (const name of newNames) {
|
|
42
44
|
if (!list.includes(name))
|
|
43
|
-
|
|
45
|
+
__array.elements.push(StringLiteral(name));
|
|
44
46
|
}
|
|
47
|
+
|
|
45
48
|
return path;
|
|
46
49
|
},
|
|
47
50
|
};
|
|
@@ -59,4 +62,3 @@ function filterNames(names, dismiss) {
|
|
|
59
62
|
|
|
60
63
|
return newNames;
|
|
61
64
|
}
|
|
62
|
-
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-gitignore",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"type": "commonjs",
|
|
4
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
|
-
"description": "
|
|
6
|
-
"homepage": "
|
|
6
|
+
"description": "πPutout plugin helps with .gitignore",
|
|
7
|
+
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-gitignore#readme",
|
|
7
8
|
"main": "lib/gitignore.js",
|
|
8
9
|
"release": false,
|
|
9
10
|
"tag": false,
|
|
@@ -30,21 +31,21 @@
|
|
|
30
31
|
"gitignore"
|
|
31
32
|
],
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@putout/test": "^
|
|
34
|
-
"c8": "^
|
|
35
|
-
"eslint": "^
|
|
36
|
-
"eslint-plugin-
|
|
37
|
-
"eslint-plugin-putout": "^
|
|
38
|
-
"lerna": "^
|
|
39
|
-
"madrun": "^
|
|
40
|
-
"nodemon": "^
|
|
34
|
+
"@putout/test": "^7.0.0",
|
|
35
|
+
"c8": "^8.0.0",
|
|
36
|
+
"eslint": "^8.0.1",
|
|
37
|
+
"eslint-plugin-n": "^16.0.0",
|
|
38
|
+
"eslint-plugin-putout": "^21.0.0",
|
|
39
|
+
"lerna": "^6.0.1",
|
|
40
|
+
"madrun": "^9.0.0",
|
|
41
|
+
"nodemon": "^3.0.1"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
|
-
"putout": ">=
|
|
44
|
+
"putout": ">=33"
|
|
44
45
|
},
|
|
45
46
|
"license": "MIT",
|
|
46
47
|
"engines": {
|
|
47
|
-
"node": ">=
|
|
48
|
+
"node": ">=16"
|
|
48
49
|
},
|
|
49
50
|
"publishConfig": {
|
|
50
51
|
"access": "public"
|