mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
feat(package): release-next script
This commit is contained in:
parent
79ce2ebc5d
commit
c7a0d3d55a
@ -33,3 +33,12 @@ jobs:
|
||||
- run:
|
||||
name: Tests
|
||||
command: yarn test && yarn coverage
|
||||
|
||||
# Release next
|
||||
- run:
|
||||
name: Release Next version
|
||||
command: |
|
||||
if [ "${CIRCLE_BRANCH}" == "dev" ]; then
|
||||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
||||
npm run release-next
|
||||
fi
|
||||
|
31
build/release-next.js
Normal file
31
build/release-next.js
Normal file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env node
|
||||
const { readFileSync, writeFileSync } = require('fs-extra')
|
||||
const { resolve } = require('path')
|
||||
const { spawnSync } = require('child_process')
|
||||
|
||||
// paths
|
||||
const packagePath = resolve(__dirname, '..', 'package.json')
|
||||
|
||||
// Read original contents of package.json
|
||||
const originalPackage = readFileSync(packagePath, 'utf-8')
|
||||
|
||||
// Write to backup file
|
||||
// writeFileSync(packagePath + '.backup', originalPackage)
|
||||
|
||||
// Parse package.json
|
||||
const p = JSON.parse(originalPackage)
|
||||
|
||||
// Change package name
|
||||
p.name = 'nuxt-next'
|
||||
|
||||
// Get latest git commit id
|
||||
const gitCommit = String(spawnSync('git', 'rev-parse --short HEAD'.split(' ')).stdout).trim()
|
||||
|
||||
// Version with git tag
|
||||
p.version = p.version.split('-')[0] + '-gh-' + gitCommit
|
||||
|
||||
// Write package.json
|
||||
writeFileSync(packagePath, JSON.stringify(p, null, 2) + '\r\n')
|
||||
|
||||
// Log
|
||||
console.log(p.name + '@' + p.version) // eslint-disable-line no-console
|
@ -56,8 +56,8 @@
|
||||
"watch": "npm run build:nuxt -- -w",
|
||||
"make-start": "node ./build/start.js",
|
||||
"precommit": "npm run lint",
|
||||
"prepare": "npm run build && npm run make-start",
|
||||
"postinstall": "opencollective postinstall || exit 0"
|
||||
"postinstall": "opencollective postinstall || exit 0",
|
||||
"release-next": "npm run build && node ./build/release-next && npm publish --tag next"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.11",
|
||||
|
Loading…
Reference in New Issue
Block a user