Hello community,
here is the log from the commit of package nodejs-init-package-json for
openSUSE:Factory checked in at 2015-07-20 11:21:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nodejs-init-package-json (Old)
and /work/SRC/openSUSE:Factory/.nodejs-init-package-json.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nodejs-init-package-json"
Changes:
--------
---
/work/SRC/openSUSE:Factory/nodejs-init-package-json/nodejs-init-package-json.changes
2015-04-27 13:01:30.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.nodejs-init-package-json.new/nodejs-init-package-json.changes
2015-07-20 11:21:59.000000000 +0200
@@ -1,0 +2,10 @@
+Sat Jun 6 11:38:00 UTC 2015 - [email protected]
+
+- update version 1.6.0
+
+-------------------------------------------------------------------
+Fri Apr 24 12:15:46 UTC 2015 - [email protected]
+
+- Update to version 1.4.2
+
+-------------------------------------------------------------------
Old:
----
init-package-json-1.1.0.tgz
New:
----
init-package-json-1.6.0.tgz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ nodejs-init-package-json.spec ++++++
--- /var/tmp/diff_new_pack.pPx7Sm/_old 2015-07-20 11:22:01.000000000 +0200
+++ /var/tmp/diff_new_pack.pPx7Sm/_new 2015-07-20 11:22:01.000000000 +0200
@@ -19,7 +19,7 @@
%define base_name init-package-json
Name: nodejs-init-package-json
-Version: 1.1.0
+Version: 1.6.0
Release: 0
Summary: Node.js init package.json
License: ISC
++++++ init-package-json-1.1.0.tgz -> init-package-json-1.6.0.tgz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/.npmignore new/package/.npmignore
--- old/package/.npmignore 1970-01-01 01:00:00.000000000 +0100
+++ new/package/.npmignore 2015-05-21 23:05:13.000000000 +0200
@@ -0,0 +1,2 @@
+node_modules/
+.eslintrc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/.travis.yml new/package/.travis.yml
--- old/package/.travis.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/package/.travis.yml 2015-05-21 23:05:13.000000000 +0200
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - "0.10"
+ - "0.11"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/README.md new/package/README.md
--- old/package/README.md 2014-07-19 07:30:45.000000000 +0200
+++ new/package/README.md 2015-05-21 23:05:13.000000000 +0200
@@ -2,6 +2,8 @@
A node module to get your node module started.
+[](http://travis-ci.org/npm/init-package-json)
+
## Usage
```javascript
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/default-input.js new/package/default-input.js
--- old/package/default-input.js 2014-09-19 08:05:04.000000000 +0200
+++ new/package/default-input.js 2015-05-21 23:10:36.000000000 +0200
@@ -1,6 +1,10 @@
var fs = require('fs')
-var path = require('path')
var glob = require('glob')
+var path = require('path')
+var validateLicense = require('validate-npm-package-license')
+var validateName = require('validate-npm-package-name')
+var npa = require('npm-package-arg')
+var semver = require('semver')
// more popular packages should go here, maybe?
function isTestPkg (p) {
@@ -28,7 +32,7 @@
try { p = JSON.parse(p) }
catch (e) { return next() }
if (!p.version) return next()
- deps[d] = config.get('save-prefix') + p.version
+ deps[d] = config.get('save-exact') ? p.version :
config.get('save-prefix') + p.version
return next()
})
})
@@ -39,10 +43,38 @@
}}
var name = package.name || basename
-exports.name = yes ? name : prompt('name', name)
-
-var version = package.version || config.get('init.version') || '1.0.0'
-exports.version = yes ? version : prompt('version', version)
+var spec = npa(name)
+var scope = config.get('scope')
+if (scope) {
+ if (scope.charAt(0) !== '@') scope = '@' + scope
+ if (spec.scope) {
+ name = scope + '/' + spec.name.split('/')[1]
+ } else {
+ name = scope + '/' + name
+ }
+}
+exports.name = yes ? name : prompt('name', name, function (data) {
+ var its = validateName(data)
+ if (its.validForNewPackages) return data
+ var errors = (its.errors || []).concat(its.warnings || [])
+ var er = new Error('Sorry, ' + errors.join(' and ') + '.')
+ er.notValid = true
+ return er
+})
+
+var version = package.version ||
+ config.get('init.version') ||
+ config.get('init-version') ||
+ '1.0.0'
+exports.version = yes ?
+ version :
+ prompt('version', version, function (version) {
+ if (semver.valid(version)) return version
+ var er = new Error('Invalid version: "' + version + '"')
+ er.notValid = true
+ er.again = true
+ return er
+ })
if (!package.description) {
exports.description = yes ? '' : prompt('description')
@@ -177,14 +209,28 @@
}
if (!package.author) {
- exports.author = config.get('init.author.name')
+ exports.author = config.get('init.author.name') ||
+ config.get('init-author-name')
? {
- "name" : config.get('init.author.name'),
- "email" : config.get('init.author.email'),
- "url" : config.get('init.author.url')
+ "name" : config.get('init.author.name') ||
+ config.get('init-author-name'),
+ "email" : config.get('init.author.email') ||
+ config.get('init-author-email'),
+ "url" : config.get('init.author.url') ||
+ config.get('init-author-url')
}
- : prompt('author')
+ : yes ? '' : prompt('author')
}
-var license = package.license || config.get('init.license') || 'ISC'
-exports.license = yes ? license : prompt('license', license)
+var license = package.license ||
+ config.get('init.license') ||
+ config.get('init-license') ||
+ 'ISC'
+exports.license = yes ? license : prompt('license', license, function (data) {
+ var its = validateLicense(data)
+ if (its.validForNewPackages) return data
+ var errors = (its.errors || []).concat(its.warnings || [])
+ var er = new Error('Sorry, ' + errors.join(' and ') + '.')
+ er.notValid = true
+ return er
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/example/example-basic.js
new/package/example/example-basic.js
--- old/package/example/example-basic.js 2014-07-19 07:30:45.000000000
+0200
+++ new/package/example/example-basic.js 2015-05-21 23:05:13.000000000
+0200
@@ -1,5 +1,4 @@
var init = require('../init-package-json.js')
-var path = require('path')
var dir = process.cwd()
var initFile = require.resolve('./init/basic-init.js')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/example/example-default.js
new/package/example/example-default.js
--- old/package/example/example-default.js 2014-07-19 07:30:45.000000000
+0200
+++ new/package/example/example-default.js 2015-05-21 23:05:13.000000000
+0200
@@ -1,5 +1,4 @@
var init = require('../init-package-json.js')
-var path = require('path')
var dir = process.cwd()
init(dir, 'file that does not exist', function (err, data) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/example/example-npm.js
new/package/example/example-npm.js
--- old/package/example/example-npm.js 2014-07-19 07:30:45.000000000 +0200
+++ new/package/example/example-npm.js 2015-05-21 23:05:13.000000000 +0200
@@ -1,5 +1,4 @@
var init = require('../init-package-json.js')
-var path = require('path')
var dir = process.cwd()
var npm = require('npm')
@@ -10,4 +9,3 @@
console.log('written successfully')
})
})
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/init-package-json.js
new/package/init-package-json.js
--- old/package/init-package-json.js 2014-09-19 08:05:04.000000000 +0200
+++ new/package/init-package-json.js 2015-05-21 23:05:13.000000000 +0200
@@ -98,6 +98,11 @@
if (!pkg.repository)
delete pkg.repository
+ // readJson filters out empty descriptions, but init-package-json
+ // traditionally leaves them alone
+ if (!pkg.description)
+ pkg.description = data.description
+
var d = JSON.stringify(pkg, null, 2) + '\n'
function write (yes) {
fs.writeFile(package, d, 'utf8', function (er) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/package.json new/package/package.json
--- old/package/package.json 2014-09-19 08:06:16.000000000 +0200
+++ new/package/package.json 2015-05-21 23:12:06.000000000 +0200
@@ -1,6 +1,6 @@
{
"name": "init-package-json",
- "version": "1.1.0",
+ "version": "1.6.0",
"main": "init-package-json.js",
"scripts": {
"test": "tap test/*.js"
@@ -13,15 +13,19 @@
"license": "ISC",
"description": "A node module to get your node module started",
"dependencies": {
- "glob": "^4.0.2",
- "promzard": "~0.2.0",
+ "glob": "^5.0.3",
+ "npm-package-arg": "^4.0.0",
+ "promzard": "^0.3.0",
"read": "~1.0.1",
- "read-package-json": "1",
- "semver": "2.x || 3.x || 4"
+ "read-package-json": "1 || 2",
+ "semver": "2.x || 3.x || 4",
+ "validate-npm-package-license": "1.0.0-prerelease-2",
+ "validate-npm-package-name": "^2.0.1"
},
"devDependencies": {
- "tap": "~0.2.5",
- "rimraf": "~2.0.2"
+ "npm": "^2",
+ "rimraf": "^2.1.4",
+ "tap": "^0.7.1"
},
"keywords": [
"init",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/basic.input new/package/test/basic.input
--- old/package/test/basic.input 2014-07-19 07:30:45.000000000 +0200
+++ new/package/test/basic.input 2015-05-21 23:05:13.000000000 +0200
@@ -3,7 +3,7 @@
exports.name = prompt('name', package.name || basename)
exports.version = '1.2.5'
exports.description = prompt('description', package.description)
-exports.author = 'me <[email protected]> (http://url)'
+exports.author = 'npmbot <[email protected]> (http://npm.im)'
exports.scripts = package.scripts || {}
exports.scripts.test = 'make test'
exports.main = package.main || 'main.js'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/basic.js new/package/test/basic.js
--- old/package/test/basic.js 2014-07-19 07:30:45.000000000 +0200
+++ new/package/test/basic.js 2015-05-21 23:05:13.000000000 +0200
@@ -1,35 +1,33 @@
-var tap = require('tap')
+var common = require('./lib/common')
var init = require('../')
+var path = require('path')
var rimraf = require('rimraf')
+var test = require('tap').test
-tap.test('the basics', function (t) {
- var i = __dirname + '/basic.input'
- var dir = __dirname
- init(dir, i, {foo:'bar'}, function (er, data) {
+test('the basics', function (t) {
+ var i = path.join(__dirname, 'basic.input')
+ init(__dirname, i, { foo: 'bar' }, function (er, data) {
if (er) throw er
- var expect =
- { name: 'the-name',
- version: '1.2.5',
- description: 'description',
- author: 'me <[email protected]> (http://url)',
- scripts: { test: 'make test' },
- main: 'main.js',
- config: { foo: 'bar' },
- package: {} }
+ var expect = {
+ name: 'the-name',
+ version: '1.2.5',
+ description: 'description',
+ author: 'npmbot <[email protected]> (http://npm.im)',
+ scripts: { test: 'make test' },
+ main: 'main.js',
+ config: { foo: 'bar' },
+ package: {}
+ }
t.same(data, expect)
t.end()
})
- setTimeout(function () {
- process.stdin.emit('data', 'the-name\n')
- }, 50)
- setTimeout(function () {
- process.stdin.emit('data', 'description\n')
- }, 100)
- setTimeout(function () {
- process.stdin.emit('data', 'yes\n')
- }, 150)
+ common.drive([
+ 'the-name\n',
+ 'description\n',
+ 'yes\n'
+ ])
})
-tap.test('teardown', function (t) {
+test('teardown', function (t) {
rimraf(__dirname + '/package.json', t.end.bind(t))
})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/lib/common.js
new/package/test/lib/common.js
--- old/package/test/lib/common.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/lib/common.js 2015-05-21 23:05:13.000000000 +0200
@@ -0,0 +1,24 @@
+module.exports.drive = drive
+
+var semver = require('semver')
+
+function drive (input) {
+ var stdin = process.stdin
+ function emit (chunk, ms) {
+ setTimeout(function () {
+ stdin.emit('data', chunk)
+ }, ms)
+ }
+ if (semver.gte(process.versions.node, '0.11.0')) {
+ input.forEach(function (chunk) {
+ stdin.push(chunk)
+ })
+ } else {
+ stdin.once('readable', function () {
+ var ms = 0
+ input.forEach(function (chunk) {
+ emit(chunk, ms += 50)
+ })
+ })
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/license.js new/package/test/license.js
--- old/package/test/license.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/license.js 2015-05-21 23:05:13.000000000 +0200
@@ -0,0 +1,38 @@
+var test = require('tap').test
+var init = require('../')
+var rimraf = require('rimraf')
+var common = require('./lib/common')
+
+test('license', function (t) {
+ init(__dirname, '', {}, function (er, data) {
+ t.ok(!er, 'should not error')
+ var wanted = {
+ name: 'the-name',
+ version: '1.0.0',
+ description: '',
+ scripts: { test: 'echo "Error: no test specified" && exit 1' },
+ license: 'Apache-2.0',
+ author: '',
+ main: 'basic.js'
+ }
+ t.same(data, wanted)
+ t.end()
+ })
+ common.drive([
+ 'the-name\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ 'Apache\n',
+ 'Apache-2.0\n',
+ 'yes\n'
+ ])
+})
+
+test('teardown', function (t) {
+ rimraf(__dirname + '/package.json', t.end.bind(t))
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/name-spaces.js
new/package/test/name-spaces.js
--- old/package/test/name-spaces.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/name-spaces.js 2015-05-21 23:05:13.000000000 +0200
@@ -0,0 +1,38 @@
+var test = require('tap').test
+var init = require('../')
+var rimraf = require('rimraf')
+var common = require('./lib/common')
+
+test('spaces', function (t) {
+ init(__dirname, '', {}, function (er, data) {
+ t.ok(!er, 'should not error')
+ var wanted = {
+ name: 'the-name',
+ version: '1.0.0',
+ description: '',
+ scripts: { test: 'echo "Error: no test specified" && exit 1' },
+ license: 'ISC',
+ author: '',
+ main: 'basic.js'
+ }
+ t.same(data, wanted)
+ t.end()
+ })
+ common.drive([
+ 'the name\n',
+ 'the-name\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ 'yes\n'
+ ])
+})
+
+test('teardown', function (t) {
+ rimraf(__dirname + '/package.json', t.end.bind(t))
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/name-uppercase.js
new/package/test/name-uppercase.js
--- old/package/test/name-uppercase.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/name-uppercase.js 2015-05-21 23:05:13.000000000 +0200
@@ -0,0 +1,38 @@
+var test = require('tap').test
+var init = require('../')
+var rimraf = require('rimraf')
+var common = require('./lib/common')
+
+test('uppercase', function (t) {
+ init(__dirname, '', {}, function (er, data) {
+ t.ok(!er, 'should not error')
+ var wanted = {
+ name: 'the-name',
+ version: '1.0.0',
+ description: '',
+ scripts: { test: 'echo "Error: no test specified" && exit 1' },
+ license: 'ISC',
+ author: '',
+ main: 'basic.js'
+ }
+ t.same(data, wanted)
+ t.end()
+ })
+ common.drive([
+ 'THE-NAME\n',
+ 'the-name\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ '\n',
+ 'yes\n'
+ ])
+})
+
+test('teardown', function (t) {
+ rimraf(__dirname + '/package.json', t.end.bind(t))
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/npm-defaults.js
new/package/test/npm-defaults.js
--- old/package/test/npm-defaults.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/npm-defaults.js 2015-05-21 23:05:13.000000000 +0200
@@ -0,0 +1,109 @@
+var test = require('tap').test
+var rimraf = require('rimraf')
+var resolve = require('path').resolve
+
+var npm = require('npm')
+var init = require('../')
+
+var EXPECTED = {
+ name: 'test',
+ version: '3.1.4',
+ description: '',
+ main: 'basic.js',
+ scripts: {
+ test: 'echo "Error: no test specified" && exit 1'
+ },
+ keywords: [],
+ author: 'npmbot <[email protected]> (http://npm.im/)',
+ license: 'WTFPL'
+}
+
+test('npm configuration values pulled from environment', function (t) {
+ /*eslint camelcase:0 */
+ process.env.npm_config_yes = 'yes'
+
+ process.env.npm_config_init_author_name = 'npmbot'
+ process.env.npm_config_init_author_email = '[email protected]'
+ process.env.npm_config_init_author_url = 'http://npm.im'
+
+ process.env.npm_config_init_license = EXPECTED.license
+ process.env.npm_config_init_version = EXPECTED.version
+
+ npm.load({}, function (err) {
+ t.ifError(err, 'npm loaded successfully')
+
+ // clear out dotted names from test environment
+ npm.config.del('init.author.name')
+ npm.config.del('init.author.email')
+ npm.config.del('init.author.url')
+ // the following have npm defaults, and need to be explicitly overridden
+ npm.config.set('init.license', '')
+ npm.config.set('init.version', '')
+
+ process.chdir(resolve(__dirname))
+ init(__dirname, __dirname, npm.config, function (er, data) {
+ t.ifError(err, 'init ran successfully')
+
+ t.same(data, EXPECTED, 'got the package data from the environment')
+ t.end()
+ })
+ })
+})
+
+test('npm configuration values pulled from dotted config', function (t) {
+ /*eslint camelcase:0 */
+ var config = {
+ yes: 'yes',
+
+ 'init.author.name': 'npmbot',
+ 'init.author.email': '[email protected]',
+ 'init.author.url': 'http://npm.im',
+
+ 'init.license': EXPECTED.license,
+ 'init.version': EXPECTED.version
+ }
+
+ npm.load(config, function (err) {
+ t.ifError(err, 'npm loaded successfully')
+
+ process.chdir(resolve(__dirname))
+ init(__dirname, __dirname, npm.config, function (er, data) {
+ t.ifError(err, 'init ran successfully')
+
+ t.same(data, EXPECTED, 'got the package data from the config')
+ t.end()
+ })
+ })
+})
+
+test('npm configuration values pulled from dashed config', function (t) {
+ /*eslint camelcase:0 */
+ var config = {
+ yes: 'yes',
+
+ 'init-author-name': 'npmbot',
+ 'init-author-email': '[email protected]',
+ 'init-author-url': 'http://npm.im',
+
+ 'init-license': EXPECTED.license,
+ 'init-version': EXPECTED.version
+ }
+
+ npm.load(config, function (err) {
+ t.ifError(err, 'npm loaded successfully')
+
+ process.chdir(resolve(__dirname))
+ init(__dirname, __dirname, npm.config, function (er, data) {
+ t.ifError(err, 'init ran successfully')
+
+ t.same(data, EXPECTED, 'got the package data from the config')
+ t.end()
+ })
+ })
+})
+
+test('cleanup', function (t) {
+ rimraf.sync(resolve(__dirname, 'package.json'))
+ t.pass('cleaned up')
+ t.end()
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/scope-in-config.js
new/package/test/scope-in-config.js
--- old/package/test/scope-in-config.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/scope-in-config.js 2015-05-21 23:05:13.000000000 +0200
@@ -0,0 +1,47 @@
+var fs = require('fs')
+var path = require('path')
+
+var rimraf = require('rimraf')
+var tap = require('tap')
+
+var init = require('../')
+
+var EXPECT = {
+ name: '@scoped/test',
+ version: '1.0.0',
+ description: '',
+ author: '',
+ scripts: { test: 'echo \"Error: no test specified\" && exit 1' },
+ main: 'basic.js',
+ keywords: [],
+ license: 'ISC'
+}
+
+tap.test('--yes with scope', function (t) {
+ init(__dirname, __dirname, { yes: 'yes', scope: '@scoped' }, function (er,
data) {
+ if (er) throw er
+
+ t.same(EXPECT, data)
+ t.end()
+ })
+})
+
+var json = {
+ name: '@already/scoped',
+ version: '1.0.0'
+}
+
+tap.test('with existing package.json', function (t) {
+ fs.writeFileSync(path.join(__dirname, 'package.json'), JSON.stringify(json,
null, 2))
+ init(__dirname, __dirname, { yes: 'yes', scope: '@still' }, function (er,
data) {
+ if (er) throw er
+
+ t.equal(data.name, '@still/scoped', 'new scope is added, basic name is
kept')
+ t.end()
+ })
+})
+
+tap.test('teardown', function (t) {
+ rimraf.sync(path.join(__dirname, 'package.json'))
+ t.end()
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/scope.js new/package/test/scope.js
--- old/package/test/scope.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/scope.js 2015-05-21 23:05:13.000000000 +0200
@@ -0,0 +1,38 @@
+var tap = require('tap')
+var init = require('../')
+var rimraf = require('rimraf')
+
+var EXPECT = {
+ name: '@foo/test',
+ version: '1.2.5',
+ description: 'description',
+ author: 'npmbot <[email protected]> (http://npm.im)',
+ scripts: { test: 'make test' },
+ main: 'main.js',
+ config: { scope: '@foo' },
+ package: {}
+}
+
+tap.test('the scope', function (t) {
+ var i = __dirname + '/basic.input'
+ var dir = __dirname
+ init(dir, i, {scope: '@foo'}, function (er, data) {
+ if (er) throw er
+
+ t.same(EXPECT, data)
+ t.end()
+ })
+ setTimeout(function () {
+ process.stdin.emit('data', '@foo/test\n')
+ }, 50)
+ setTimeout(function () {
+ process.stdin.emit('data', 'description\n')
+ }, 100)
+ setTimeout(function () {
+ process.stdin.emit('data', 'yes\n')
+ }, 150)
+})
+
+tap.test('teardown', function (t) {
+ rimraf(__dirname + '/package.json', t.end.bind(t))
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/yes-defaults.js
new/package/test/yes-defaults.js
--- old/package/test/yes-defaults.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/yes-defaults.js 2015-05-21 23:05:13.000000000 +0200
@@ -0,0 +1,27 @@
+var tap = require('tap')
+var init = require('../')
+var rimraf = require('rimraf')
+
+var EXPECT = {
+ name: 'test',
+ version: '1.0.0',
+ description: '',
+ author: '',
+ scripts: { test: 'echo "Error: no test specified" && exit 1' },
+ main: 'basic.js',
+ keywords: [],
+ license: 'ISC'
+}
+
+tap.test('--yes defaults', function (t) {
+ init(__dirname, __dirname, {yes: 'yes'}, function (er, data) {
+ if (er) throw er
+
+ t.same(EXPECT, data, 'used the default data')
+ t.end()
+ })
+})
+
+tap.test('teardown', function (t) {
+ rimraf(__dirname + '/package.json', t.end.bind(t))
+})