ignore-sync
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -5,2 +5,12 @@ # Changelog | ||
## [3.1.0](https://github.com/foray1010/ignore-sync/compare/v3.0.1...v3.1.0) (2021-02-05) | ||
### Features | ||
- support glob in local and relative source tag ([2a4519a](https://github.com/foray1010/ignore-sync/commit/2a4519a1d0f5b40ad650bba50451115d84b94f24)) | ||
### Bug Fixes | ||
- **deps:** update dependency axios to v0.21.1 ([1ef8865](https://github.com/foray1010/ignore-sync/commit/1ef886543d43b4ae3c7950227e1c4f7f2cc7df6a)) | ||
### [3.0.1](https://github.com/foray1010/ignore-sync/compare/v3.0.0...v3.0.1) (2020-11-16) | ||
@@ -7,0 +17,0 @@ |
{ | ||
"$schema": "https://json.schemastore.org/package", | ||
"name": "ignore-sync", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "a CLI tool to build and sync *ignore files across files and repositories", | ||
@@ -31,3 +32,4 @@ "keywords": [ | ||
"dependencies": { | ||
"axios": "0.21.0", | ||
"axios": "0.21.1", | ||
"fast-glob": "3.2.5", | ||
"ignore": "5.1.8", | ||
@@ -39,13 +41,13 @@ "ramda": "0.27.1" | ||
"@commitlint/config-conventional": "11.0.0", | ||
"@foray1010/eslint-config": "4.1.1", | ||
"@foray1010/prettier-config": "4.1.1", | ||
"@foray1010/remark-preset": "3.4.0", | ||
"cross-env": "7.0.2", | ||
"eslint": "7.13.0", | ||
"@foray1010/eslint-config": "4.4.1", | ||
"@foray1010/prettier-config": "4.1.2", | ||
"@foray1010/remark-preset": "3.4.1", | ||
"cross-env": "7.0.3", | ||
"eslint": "7.19.0", | ||
"glob-exec": "0.1.1", | ||
"husky": "4.3.0", | ||
"husky": "4.3.8", | ||
"jest": "26.6.3", | ||
"lint-staged": "10.5.1", | ||
"lint-staged": "10.5.3", | ||
"mermaid.cli": "0.5.1", | ||
"prettier": "2.1.2", | ||
"prettier": "2.2.1", | ||
"remark-cli": "9.0.0" | ||
@@ -52,0 +54,0 @@ }, |
@@ -60,5 +60,7 @@ # ignore-sync | ||
- the content of these local files will be copied directly to generated ignore file | ||
- support glob pattern, e.g. `packages/**/.gitignore` | ||
- `[relative]` | ||
- the content of these local files will be copied with **relative path prefix** to generated ignore file | ||
- support glob pattern, e.g. `packages/**/.gitignore` | ||
- example | ||
@@ -65,0 +67,0 @@ |
'use strict' | ||
const R = require('ramda') | ||
const fg = require('fast-glob') | ||
const path = require('path') | ||
@@ -8,28 +9,46 @@ const cleanupIgnoreSyncFile = require('./cleanupIgnoreSyncFile') | ||
const appendToLastData = (blocks, datum) => [ | ||
...R.init(blocks), | ||
R.compose(R.over(R.lensProp('data'), R.append(datum)), R.last)(blocks), | ||
] | ||
const decodeIgnoreSyncFile = (ignoreSyncFile) => { | ||
const normalizedIgnoreSyncFile = cleanupIgnoreSyncFile(ignoreSyncFile) | ||
const decodeIgnoreSyncFile = (ignoreSyncFile) => | ||
R.compose( | ||
R.reduce((acc, line) => { | ||
if (/^\[(.*)\]$/.test(line)) { | ||
return [ | ||
...acc, | ||
{ | ||
source: RegExp.$1, | ||
data: [], | ||
}, | ||
] | ||
} | ||
return normalizedIgnoreSyncFile.split(LINE_BREAK).reduce((blocks, line) => { | ||
if (/^\[(.*)\]$/.test(line)) { | ||
return [ | ||
...blocks, | ||
{ | ||
source: RegExp.$1, | ||
data: [], | ||
}, | ||
] | ||
} | ||
if (!acc.length) | ||
throw new Error('source `[]` not found before ignore pattern is found') | ||
const lastBlock = blocks[blocks.length - 1] | ||
if (!lastBlock) { | ||
throw new Error('source `[]` not found before ignore pattern is found') | ||
} | ||
return appendToLastData(acc, line) | ||
}, []), | ||
R.split(LINE_BREAK), | ||
cleanupIgnoreSyncFile, | ||
)(ignoreSyncFile) | ||
if (['local', 'relative'].includes(lastBlock.source)) { | ||
const pattern = path.join('.', line) | ||
const files = fg.sync([pattern], { | ||
absolute: false, | ||
dot: true, | ||
onlyFiles: true, | ||
}) | ||
return [ | ||
...blocks.slice(0, -1), | ||
{ | ||
...lastBlock, | ||
data: [...lastBlock.data, ...files], | ||
}, | ||
] | ||
} | ||
return [ | ||
...blocks.slice(0, -1), | ||
{ | ||
...lastBlock, | ||
data: [...lastBlock.data, line], | ||
}, | ||
] | ||
}, []) | ||
} | ||
module.exports = decodeIgnoreSyncFile |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21388
26
385
88
4
+ Addedfast-glob@3.2.5
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Addedaxios@0.21.1(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedfast-glob@3.2.5(transitive)
+ Addedfastq@1.17.1(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)
- Removedaxios@0.21.0(transitive)
Updatedaxios@0.21.1