test(create-module): helper to create fresh repo/module
This commit is contained in:
parent
c936e8be4b
commit
d22b98a4ee
@ -7,6 +7,8 @@ cache:
|
|||||||
- node_modules
|
- node_modules
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
before_install:
|
||||||
|
- npm i -g npm@^2.0.0
|
||||||
deploy:
|
deploy:
|
||||||
provider: npm
|
provider: npm
|
||||||
email: stephan@boennemann.me
|
email: stephan@boennemann.me
|
||||||
|
@ -19,9 +19,15 @@
|
|||||||
"semver": "^4.2.0"
|
"semver": "^4.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"lodash.defaults": "^3.0.0",
|
||||||
|
"nano-uid": "^0.2.0",
|
||||||
"standard": "^2.3.1",
|
"standard": "^2.3.1",
|
||||||
"sinopia": "^1.0.0"
|
"sinopia": "^1.0.0"
|
||||||
},
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^0.10.0",
|
||||||
|
"npm": "^2.0.0"
|
||||||
|
},
|
||||||
"homepage": "https://github.com/boennemann/semantic-release",
|
"homepage": "https://github.com/boennemann/semantic-release",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"release",
|
"release",
|
||||||
|
45
tests/lib/create-module.js
Normal file
45
tests/lib/create-module.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
var exec = require('child_process').exec
|
||||||
|
var join = require('path').join
|
||||||
|
|
||||||
|
var efh = require('error-first-handler')
|
||||||
|
var defaults = require('lodash.defaults')
|
||||||
|
var uid = require('nano-uid')()
|
||||||
|
|
||||||
|
module.exports = function (pkg) {
|
||||||
|
var cb = Array.prototype.pop.call(arguments)
|
||||||
|
uid.generate(5, efh(cb)(function (id) {
|
||||||
|
var pkg = defaults((typeof pkg === 'object' ? pkg : {}), {
|
||||||
|
name: id,
|
||||||
|
version: '0.0.0',
|
||||||
|
devDependencies: {
|
||||||
|
'semantic-release': 'file:../../../'
|
||||||
|
},
|
||||||
|
scripts: {
|
||||||
|
prepublish: 'semantic-release pre',
|
||||||
|
postpublish: 'semantic-release post'
|
||||||
|
},
|
||||||
|
publishConfig: {
|
||||||
|
registry: 'http://localhost:4873/'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
id = pkg.name
|
||||||
|
var cwd = join(__dirname, '../../.tmp/modules', id)
|
||||||
|
|
||||||
|
exec(
|
||||||
|
'mkdir ' + cwd + ' && ' +
|
||||||
|
'cd ' + cwd + ' && ' +
|
||||||
|
'git init && ' +
|
||||||
|
'echo \'' + JSON.stringify(pkg, null, 2) + '\' >> package.json && ' +
|
||||||
|
'git add . && ' +
|
||||||
|
'git config user.email "integration@test" && ' +
|
||||||
|
'git config user.name "Integration Test" && ' +
|
||||||
|
'git commit -m "initial" && ' +
|
||||||
|
'npm install'
|
||||||
|
, efh(cb)(function (stdout) {
|
||||||
|
cb(null, id, cwd)
|
||||||
|
}))
|
||||||
|
}))
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user