Skip to content

Commit

Permalink
Merge pull request #45 from tomekwi/set-recommended-fields--#10
Browse files Browse the repository at this point in the history
Set recommended package.json fields
  • Loading branch information
shama committed Feb 9, 2015
2 parents 45a474a + 1faba89 commit 1214c39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/pkg.js
Expand Up @@ -136,7 +136,9 @@ NapaPkg.prototype.writePackageJson = function(done) {
pkg = {
name: this.name,
version: '0.0.0',
description: ''
description: '-',
repository: {type: 'git', url: '-'},
readme: '-'
}
} else {
pkg = require(filepath)
Expand Down
8 changes: 6 additions & 2 deletions test.js
Expand Up @@ -120,13 +120,17 @@ test('pkg install different version', function(t) {
})

test('pkg install with ref', function(t) {
t.plan(1)
t.plan(4)
var result = null
var pkg = new Pkg('https://github.com/twbs/bootstrap', 'bootstrap', {ref: 'v3.3.0'})
var pkg = new Pkg('https://github.com/gdsmith/jquery.easing', 'jquery.easing', {ref: '1.3.1'})

clean([pkg.cacheTo, pkg.installTo], function() {
pkg.install(function(err) {
var packagePath, package;
t.notOk(err, 'no error should occur')
t.ok(fs.existsSync(packagePath = path.resolve(pkg.installTo, 'package.json')), 'package.json has been generated')
t.ok((package = require(packagePath)) && package.name && package.version, 'package.json has required fields')
t.ok(package && package.description && package.readme && package.repository && package.repository.type, 'package.json has recommended fields')
})
})
})

0 comments on commit 1214c39

Please sign in to comment.