Account for gitignores when running git add

This commit is contained in:
Renée Kooi 2019-05-27 13:58:43 +02:00
parent bc6da2a637
commit 999253f034
No known key found for this signature in database
GPG key ID: 8CDD5F0BC448F040

View file

@ -46,12 +46,13 @@ async function updateVersions (files, packageName) {
async function gitAdd (files) {
const git = spawn('git', ['add', ...files], { stdio: 'inherit' })
const exitCode = await once(git, 'exit')
const [exitCode] = await once(git, 'exit')
if (exitCode !== 0) {
throw new Error(`git add failed with ${exitCode}`)
}
}
// Run the build as a release build (that inlines version numbers etc.)
async function npmRunBuild () {
const npmRun = spawn('npm', ['run', 'build'], {
stdio: 'inherit',
@ -60,7 +61,7 @@ async function npmRunBuild () {
IS_RELEASE_BUILD: true
}
})
const exitCode = await once(npmRun, 'exit')
const [exitCode] = await once(npmRun, 'exit')
if (exitCode !== 0) {
throw new Error(`npm run build failed with ${exitCode}`)
}
@ -93,7 +94,10 @@ async function main () {
await updateVersions(files, '@uppy/robodog')
await updateVersions(files, '@uppy/locales')
await gitAdd(files)
// gitignored files were updated for the npm package, but can't be updated
// on git.
const isIgnored = await globby.gitignore()
await gitAdd(files.filter((filename) => !isIgnored(filename)))
await npmRunBuild()
}