Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git-dirty.js « scripts - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5730ed900668102825bdeb6853a058ab4a03c8ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env node
const { spawnSync } = require('child_process')
const changes = spawnSync('git', ['status', '--porcelain', '-uall'])
const stdout = changes.stdout.toString('utf8')
const stderr = changes.stderr.toString('utf8')
const { status, signal } = changes
console.log(stdout)
console.error(stderr)
if (status || signal) {
  console.error({ status, signal })
  process.exitCode = status || 1
}
if (stdout.trim() !== '') {
  throw new Error('git dirty')
} else {
  console.log('git clean')
}