Comparing version 0.2.1 to 1.0.0
@@ -40,4 +40,6 @@ #!/usr/bin/env node | ||
} | ||
if (typeof(pkg.files) === "string") { | ||
pkg.files = stringToArray(pkg.files); | ||
} | ||
Object.keys(pkg).forEach(function(property){ | ||
@@ -51,4 +53,4 @@ if (pkg[property] === "true") { | ||
} | ||
}) | ||
}); | ||
fs.writeFileSync(args.package, JSON.stringify(pkg, null, 2)); |
{ | ||
"name": "npe", | ||
"version": "0.2.1", | ||
"version": "1.0.0", | ||
"description": "Node Package Editor: a CLI for one-off inspection and editing of properties in package.json files.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,4 +31,4 @@ # npe [![Build Status](https://travis-ci.org/zeke/npe.png?branch=master)](https://travis-ci.org/zeke/npe) | ||
# If commas are present, they'll be the delimiter. Otherwise spaces. | ||
npm keywords "foo, bar, cheese whiz" | ||
npm keywords "foo bar baz" | ||
npe keywords "foo, bar, cheese whiz" | ||
npe keywords "foo bar baz" | ||
@@ -35,0 +35,0 @@ # The current working directory's package.json is used by default, |
@@ -6,3 +6,4 @@ 'use strict'; | ||
var util = require('util'); | ||
var path = require('path'); | ||
var fixturePath = path.join(__dirname, "fixtures/normal/package.json"); | ||
describe("npe", function() { | ||
@@ -50,3 +51,3 @@ | ||
nixt() | ||
.run('./index.js name --package test/fixtures/normal/package.json') | ||
.run('./index.js name --package ' + fixturePath) | ||
.stdout("normal") | ||
@@ -58,3 +59,3 @@ .end(done); | ||
nixt() | ||
.run('./index.js scripts --package test/fixtures/normal/package.json') | ||
.run('./index.js scripts --package ' + fixturePath) | ||
.stdout(/tape/) | ||
@@ -66,3 +67,3 @@ .end(done); | ||
nixt() | ||
.run('./index.js scripts.test --package test/fixtures/normal/package.json') | ||
.run('./index.js scripts.test --package ' + fixturePath) | ||
.stdout("tape") | ||
@@ -81,3 +82,3 @@ .end(done); | ||
nixt() | ||
.run("cp test/fixtures/normal/package.json " + tmpFile) | ||
.run("cp " + fixturePath +" " + tmpFile) | ||
.end(done); | ||
@@ -172,2 +173,57 @@ }); | ||
it("sets files array from a comma-delimited string", function(done) { | ||
nixt() | ||
.expect(function(result){ | ||
pkg = require(tmpFile); | ||
if (!util.isArray(pkg.files)) { | ||
console.log(pkg.files); | ||
return new Error('files should be an array'); | ||
} | ||
if (pkg.files.length !== 2) { | ||
console.log(pkg.files); | ||
return new Error('files should have two elements'); | ||
} | ||
if (pkg.files[0] !== "bin/") { | ||
console.log(pkg.files); | ||
return new Error('first keyword should be bin/'); | ||
} | ||
}) | ||
.run("./index.js files \"bin/, lib/\" --package="+tmpFile) | ||
.end(done); | ||
}); | ||
it("sets files array from a space-delimited string", function(done) { | ||
nixt() | ||
.expect(function(result){ | ||
pkg = require(tmpFile); | ||
if (!util.isArray(pkg.files)) { | ||
console.log(pkg.files); | ||
return new Error('files should be an array'); | ||
} | ||
if (pkg.files.length !== 2) { | ||
console.log(pkg.files); | ||
return new Error('files should have two elements'); | ||
} | ||
if (pkg.files[0] !== "bin/") { | ||
console.log(pkg.files); | ||
return new Error('first keyword should be bin/'); | ||
} | ||
if (pkg.files[1] !== "lib/") { | ||
console.log(pkg.files); | ||
return new Error('last keyword should be lib/'); | ||
} | ||
}) | ||
.run("./index.js files \"bin/ lib/\" --package="+tmpFile) | ||
.end(done); | ||
}); | ||
it("sets 'false' string to a boolean false", function(done) { | ||
@@ -174,0 +230,0 @@ nixt() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
12086
252
0
11