Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spec-change

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spec-change - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

bin/spec-change.js

15

package.json
{
"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) {

.github/workflows/ci.yml
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc