Skip to content

Commit

Permalink
Add --skip to dots node recurse.
Browse files Browse the repository at this point in the history
See #76.
  • Loading branch information
flatheadmill committed Oct 22, 2019
1 parent df23fcd commit 510ee9d
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions bin/dots-node-recurse
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
options:
-s, --skip <string>
Skip specified package. `.top` will skip the current package.
-t, --tag <string>
The release note tag to update.
Expand All @@ -28,6 +31,11 @@ require('arguable')(module, async arguable => {
const _module = require('module')

const seen = {}
const skip = {}

for (const skipping of arguable.arrayed.skip) {
skip[skipping] = true
}

async function exists (path) {
try {
Expand Down Expand Up @@ -86,16 +94,19 @@ require('arguable')(module, async arguable => {
return 0
}
seen[current.name] = true
console.log(`--- ${current.name} ---`)
const child = processes.spawn(arguable.argv[0], arguable.argv.slice(1), {
cwd: directory,
stdio: 'inherit'
})
const [ code, signal ] = await once(child, 'exit').promise
if (code != 0) {
console.log(`failed in ${directory}`)
return code || 1
if (!(skip[current.name] || skip['.top'])) {
console.log(`--- ${current.name} ---`)
const child = processes.spawn(arguable.argv[0], arguable.argv.slice(1), {
cwd: directory,
stdio: 'inherit'
})
const [ code, signal ] = await once(child, 'exit').promise
if (code != 0) {
console.log(`failed in ${directory}`)
return code || 1
}
}
skip['.top'] = false
for (const property of [ 'dependencies', 'devDependencies' ]) {
for (const name in current[property]) {
const pkg = _require(`${name}/package.json`)
Expand Down

0 comments on commit 510ee9d

Please sign in to comment.