neuron-tree
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "neuron-tree", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Generates the config.tree of neuron", | ||
@@ -20,3 +20,3 @@ "main": "index.js", | ||
], | ||
"engines": { | ||
"engines": { | ||
"node": ">=0.11.0" | ||
@@ -31,4 +31,7 @@ }, | ||
"mocha": "*", | ||
"chai": "*" | ||
"chai": "*", | ||
"shrinked": "~0.1.3", | ||
"test-fixture": "~1.0.1", | ||
"jsonfile": "~1.1.1" | ||
} | ||
} |
@@ -18,6 +18,16 @@ # neuron-tree [![NPM version](https://badge.fury.io/js/neuron-tree.svg)](http://badge.fury.io/js/neuron-tree) [![Build Status](https://travis-ci.org/cortexjs/neuron-tree.svg?branch=master)](https://travis-ci.org/cortexjs/neuron-tree) [![Dependency Status](https://gemnasium.com/cortexjs/neuron-tree.svg)](https://gemnasium.com/cortexjs/neuron-tree) | ||
### tree.parse(shrinked) | ||
### tree.parse(shrinked, types) | ||
- shrinked `Object` the shrinked object of [shrinked](https://www.npmjs.org/package/shrinked) | ||
- types `Array.<type>` the array of types of dependencies, default to | ||
[ | ||
"dependencies", | ||
"asyncDependencies" | ||
] | ||
you could include other types of dependencies in the array. | ||
- type `String` available types: `'dependencies'`, `'asyncDependencies'`, `'engines'`, `devDependencies` | ||
Parses the shrinked B+ tree, and generates a simpler tree for `config.tree` of neuron. | ||
@@ -24,0 +34,0 @@ |
'use strict'; | ||
var expect = require('chai').expect; | ||
var neuron_tree = require('../'); | ||
var tree = require('../'); | ||
var shrinked = require('shrinked'); | ||
var fixture = require('test-fixture')(); | ||
var jf = require('jsonfile'); | ||
var cases = { | ||
full: { | ||
types: [ | ||
'devDependencies', | ||
'asyncDependencies', | ||
'dependencies', | ||
'engines' | ||
], | ||
e: function (tree, e) { | ||
expect(tree).to.deep.equal(e); | ||
} | ||
}, | ||
pro: { | ||
types: [ | ||
'asyncDependencies', | ||
'dependencies', | ||
'engines' | ||
], | ||
e: function (tree, e) { | ||
expect(tree).to.deep.equal(e); | ||
} | ||
}, | ||
pro_no_engine: { | ||
tree: [ | ||
'asyncDependencies', | ||
'dependencies' | ||
], | ||
e: function (tree, e) { | ||
expect(tree).to.deep.equal(e); | ||
} | ||
} | ||
}; | ||
var shrinkwrap = jf.readFileSync(fixture.resolve('shrink.json')); | ||
var expected = require(fixture.resolve('expected')); | ||
Object.keys(cases).forEach(function (type) { | ||
var c = cases[type]; | ||
describe(type, function(){ | ||
it("tree.parse()", function(){ | ||
var parsed = shrinked.parse(shrinkwrap, { | ||
dependencyKeys: c.types | ||
}); | ||
var t = tree.parse(parsed, c.types); | ||
c.e(t, expected[type]); | ||
}); | ||
}); | ||
}); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
8670
10
252
48
5
1