feat: add git sha to package json

This commit is contained in:
Mikeal Rogers 2019-05-23 18:13:42 +00:00
parent d61abceefc
commit 53a92ca2d1
3 changed files with 12 additions and 3 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules
package-lock.json
.nyc_output

View File

@ -1,6 +1,4 @@
#!/usr/bin/env node #!/usr/bin/env node
console.log(process.argv)
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const { execSync } = require('child_process') const { execSync } = require('child_process')
@ -17,6 +15,11 @@ if (messages.map(message => message.includes('BREAKING CHANGE')).includes(true))
} }
let pkg = require(path.join(process.cwd(), 'package.json')) let pkg = require(path.join(process.cwd(), 'package.json'))
pkg.gitsha = process.env.GITHUB_SHA
fs.writeFileSync(path.join(process.cwd(), 'package.json'), Buffer.from(JSON.stringify(pkg)))
let current = execSync(`npm view ${pkg.name} version`).toString() let current = execSync(`npm view ${pkg.name} version`).toString()
process.stdout.write(execSync(`npm version --allow-same-version=true --git-tag-version=false ${current} `)) process.stdout.write(execSync(`npm version --allow-same-version=true --git-tag-version=false ${current} `))
let newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString() let newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString()

View File

@ -21,5 +21,8 @@
"homepage": "https://github.com/mikeal/auto-release#readme", "homepage": "https://github.com/mikeal/auto-release#readme",
"dependencies": { "dependencies": {
"yargs": "^12.0.5" "yargs": "^12.0.5"
},
"devDependencies": {
"standard": "^12.0.1"
} }
} }