ng-lint-staged
Advanced tools
Comparing version 0.1.6 to 7.0.0
@@ -5,3 +5,3 @@ #!/usr/bin/env node | ||
const {spawn} = require('child_process'); | ||
const { spawn } = require('child_process'); | ||
const path = require('path'); | ||
@@ -15,54 +15,39 @@ | ||
let filesSwitch = false; | ||
for (let i = 3, iz = process.argv.length; i < iz; i++) { | ||
const arg = process.argv[i]; | ||
for (const arg of process.argv) { | ||
if (arg === '--') { | ||
filesSwitch = true; | ||
continue; | ||
} | ||
if (arg === '--') { | ||
filesSwitch = true; | ||
continue; | ||
} | ||
if (filesSwitch) { | ||
fileArgs.push(arg); | ||
} else { | ||
scriptArgs.push(arg); | ||
} | ||
if (filesSwitch) { | ||
fileArgs.push(arg); | ||
} else { | ||
scriptArgs.push(arg); | ||
} | ||
} | ||
const files = fileArgs | ||
.map((file) => { | ||
// ng lint's --files argument only works with relative paths | ||
// strip cwd and leading path delimiter | ||
return `--files="${path.relative(process.cwd(), file)}"`; | ||
}) | ||
; | ||
const files = fileArgs.map(file => { | ||
// ng lint's --files argument only works with relative paths | ||
// strip cwd and leading path delimiter | ||
return `--files="${path.relative(process.cwd(), file)}"`; | ||
}); | ||
const npm = spawn('npm', ['run', script, '--', ...scriptArgs, ...files], { | ||
cwd: process.cwd(), | ||
env: process.env, | ||
shell: true, | ||
}); | ||
const npm = spawn( | ||
'npm', | ||
[ | ||
'run', | ||
script, | ||
'--', | ||
...scriptArgs, | ||
...files, | ||
], | ||
{ | ||
cwd: process.cwd(), | ||
env: process.env, | ||
shell: true, | ||
} | ||
); | ||
npm.stdout.on('data', (data) => { | ||
console.log(data.toString()); | ||
npm.stdout.on('data', data => { | ||
console.log(data.toString()); | ||
}); | ||
npm.stderr.on('data', (data) => { | ||
console.error(data.toString()); | ||
npm.stderr.on('data', data => { | ||
console.error(data.toString()); | ||
}); | ||
npm.on('close', (code) => { | ||
if (code) { | ||
console.error(`Child process existed with code ${code}`); | ||
process.exit(1); | ||
} | ||
npm.on('close', code => { | ||
if (code) { | ||
console.error(`Child process existed with code ${code}`); | ||
process.exit(1); | ||
} | ||
}); |
{ | ||
"name": "ng-lint-staged", | ||
"version": "0.1.6", | ||
"version": "7.0.0", | ||
"description": "Shim to run lint-staged with ng-lint", | ||
@@ -5,0 +5,0 @@ "bin": { |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
4486
41