fixturify-project
Advanced tools
Comparing version 1.2.0 to 1.3.0
28
index.js
@@ -181,14 +181,18 @@ 'use strict'; | ||
toJSON() { | ||
return { | ||
[this.name]: Object.assign({ | ||
'node_modules': depsAsObject([ | ||
...this.devDependencies(), | ||
...this.dependencies() | ||
]), | ||
'package.json': JSON.stringify(Object.assign(this.pkg, { | ||
dependencies: depsToObject(this.dependencies()), | ||
devDependencies: depsToObject(this.devDependencies()), | ||
}), null, 2), | ||
}, this.files), | ||
}; | ||
if (arguments.length > 0) { | ||
return this.toJSON()[this.name][arguments[0]]; | ||
} else { | ||
return { | ||
[this.name]: Object.assign({ | ||
'node_modules': depsAsObject([ | ||
...this.devDependencies(), | ||
...this.dependencies() | ||
]), | ||
'package.json': JSON.stringify(Object.assign(this.pkg, { | ||
dependencies: depsToObject(this.dependencies()), | ||
devDependencies: depsToObject(this.devDependencies()), | ||
}), null, 2), | ||
}, this.files), | ||
}; | ||
} | ||
} | ||
@@ -195,0 +199,0 @@ |
{ | ||
"name": "fixturify-project", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:stefanpenner/node-fixturify-project", |
@@ -52,3 +52,3 @@ # node-fixturify-project | ||
### Adanced | ||
### Advanced | ||
@@ -55,0 +55,0 @@ Obviously nested dependencies are common, and are not only supported but somewhat ergonomics: |
20
test.js
@@ -239,3 +239,21 @@ 'use strict'; | ||
expect(project.pkg.version, '1'); | ||
}) | ||
}); | ||
it('to JSON with 1 arg, is an alias for toJSON()[project.name][arg]', function() { | ||
let project = new Project('foo', '123'); | ||
project.addDependency('rsvp', '1.2.3'); | ||
project.addDevDependency('q', '1.2.4'); | ||
expect(JSON.parse(project.toJSON('package.json'))).to.deep.eql({ | ||
name: 'foo', | ||
version: '123', | ||
keywords: [], | ||
dependencies: { | ||
rsvp: '1.2.3' | ||
}, | ||
devDependencies: { | ||
q: '1.2.4' | ||
}, | ||
}); | ||
}); | ||
}); |
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
25323
388