spec-change
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "spec-change", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Computes specs to re-run when files change", | ||
@@ -8,4 +8,12 @@ "main": "src/index.js", | ||
"test": "ava", | ||
"semantic-release": "semantic-release" | ||
"semantic-release": "semantic-release", | ||
"demo1": "DEBUG=spec-change node ./bin/spec-change --folder fixtures/6" | ||
}, | ||
"bin": { | ||
"spec-change": "bin/spec-change.js" | ||
}, | ||
"files": [ | ||
"src", | ||
"bin" | ||
], | ||
"keywords": [], | ||
@@ -21,2 +29,5 @@ "author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>", | ||
"dependencies": { | ||
"arg": "^5.0.2", | ||
"debug": "^4.3.4", | ||
"globby": "^11.1.0", | ||
"lazy-ass": "^2.0.3" | ||
@@ -23,0 +34,0 @@ }, |
@@ -5,2 +5,21 @@ # spec-change | ||
## Use | ||
### CLI | ||
``` | ||
$ npx spec-change --folder "path to folder with specs" | ||
``` | ||
Prints a JSON object with the list of JavaScript files. For each file prints the list of dependent files. For example, if `spec.js` imports or requires `utils.js` file, then it will print something like: | ||
```json | ||
{ | ||
"spec.js": ["spec.js"], | ||
"utils.js": ["spec.js"] | ||
} | ||
``` | ||
### NPM module | ||
Based on the `import` and `require` directives. | ||
@@ -10,2 +29,3 @@ | ||
const { getDependentFiles } = require('spec-change') | ||
// the input paths should be absolute | ||
const deps = getDependentFiles([ | ||
@@ -25,8 +45,13 @@ 'path/to/spec1.js', | ||
'path/to/spec2.js': ['path/to/spec2.js'], | ||
// the spec2 imports something from utils | ||
'path/to/utils.js': ['path/to/spec2.js'], | ||
... | ||
// the specs spec2 and spec3 imports something from utils | ||
'path/to/utils.js': ['path/to/spec2.js', 'path/to/spec3.js'], | ||
... | ||
} | ||
``` | ||
## Debugging | ||
Run this code with environment variable `DEBUG=spec-change` | ||
## Small print | ||
@@ -33,0 +58,0 @@ |
@@ -80,2 +80,5 @@ const dependencyTree = require('dependency-tree') | ||
* is a relative filename. The value is a list of _other_ files that depend on it | ||
* @param {string[]} filenames The absolute filenames to the source files | ||
* @param {string} directory The absolute path to the common directory | ||
* @see https://github.com/bahmutov/spec-change | ||
*/ | ||
@@ -82,0 +85,0 @@ function getDependentFiles(filenames, directory) { |
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
71
0
8336
4
5
133
+ Addedarg@^5.0.2
+ Addeddebug@^4.3.4
+ Addedglobby@^11.1.0
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Addedarg@5.0.2(transitive)
+ Addedarray-union@2.1.0(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addeddir-glob@3.0.1(transitive)
+ Addedfast-glob@3.3.3(transitive)
+ Addedfastq@1.18.0(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedglobby@11.1.0(transitive)
+ Addedignore@5.3.2(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedms@2.1.3(transitive)
+ Addedpath-type@4.0.0(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedslash@3.0.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)