Socket
Socket
Sign inDemoInstall

ignore-sync

Package Overview
Dependencies
22
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.1 to 3.1.0

__fixtures__/test_glob1.txt

10

CHANGELOG.md

@@ -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 @@

22

package.json
{
"$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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc