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.9.0 to 1.10.0

3

package.json
{
"name": "spec-change",
"version": "1.9.0",
"version": "1.10.0",
"description": "Computes specs to re-run when files change",

@@ -35,2 +35,3 @@ "main": "src/index.js",

"debug": "^4.3.4",
"deep-equal": "^2.2.3",
"dependency-tree": "^10.0.9",

@@ -37,0 +38,0 @@ "globby": "^11.1.0",

@@ -39,2 +39,3 @@ # spec-change

{
"generatedAt": "2024-01-20T03:38:50.803Z",
"folder": "relative path to folder",

@@ -49,2 +50,4 @@ "fileMask": "**/*.ts",

**Note:** the file will NOT be written if the folder, file mask, and the dependencies tree is the same.
You can check how long finding files and dependencies takes by adding `--time` boolean flag. Note: the info is printed to `STDERR` stream

@@ -51,0 +54,0 @@

@@ -8,2 +8,3 @@ // https://github.com/dependents/node-dependency-tree

const fs = require('fs')
const deepEqual = require('deep-equal')

@@ -154,3 +155,4 @@ function isOutside(relativePath) {

debug('options %o', options)
const { folder, saveDepsFilename, allowJs } = options
const { folder, allowJs } = options
let { saveDepsFilename } = options
const fileMask = options.fileMask || '**/*.{js,jsx,ts,tsx}'

@@ -173,15 +175,33 @@

if (saveDepsFilename) {
debug('saving json file with dependencies %s', saveDepsFilename)
// use relative folder
const relativeFolder = path.relative(process.cwd(), folder)
const fullInfo = {
warning:
'This is a machine-generated file, do not modify it manually. Use https://github.com/bahmutov/spec-change',
generatedAt: new Date().toISOString(),
folder: relativeFolder,
fileMask,
deps,
if (fs.existsSync(saveDepsFilename)) {
const oldDeps = JSON.parse(fs.readFileSync(saveDepsFilename, 'utf8'))
const sameFolder = oldDeps.folder === relativeFolder
const sameMask = oldDeps.fileMask === fileMask
const sameDependencies = deepEqual(oldDeps.deps, deps)
debug({ sameFolder, sameMask, sameDependencies })
if (sameFolder && sameMask && sameDependencies) {
saveDepsFilename = false
}
}
const s = JSON.stringify(fullInfo, null, 2) + '\n\n'
fs.writeFileSync(saveDepsFilename, s, 'utf8')
if (saveDepsFilename) {
debug('saving json file with dependencies %s', saveDepsFilename)
const fullInfo = {
warning:
'This is a machine-generated file, do not modify it manually. Use https://github.com/bahmutov/spec-change',
generatedAt: new Date().toISOString(),
folder: relativeFolder,
fileMask,
deps,
}
const s = JSON.stringify(fullInfo, null, 2) + '\n\n'
fs.writeFileSync(saveDepsFilename, s, 'utf8')
console.log('saved dependencies file %s', saveDepsFilename)
} else {
console.log('skipping saving dependencies file')
}
}

@@ -188,0 +208,0 @@ const finished = +new Date()

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