{"name":"version-guard","version":"1.1.2","description":"Used to ensure modern CLI scripts fail silently on old js versions. Useful for static analysis tools and similar","homepage":"http://github.com/voxpelli/version-guard","repository":{"type":"git","url":"git://github.com/voxpelli/version-guard.git"},"main":"index.js","types":"index.d.ts","scripts":{"build:0":"run-s clean","build:1-declaration":"tsc -p declaration.tsconfig.json","build":"run-s build:*","check:installed-check":"installed-check --ignore-dev","check:lint":"eslint --report-unused-disable-directives .","check:tsc":"tsc","check:type-coverage":"type-coverage --detail --strict --at-least 95","check":"run-s clean && run-p check:*","clean:declarations":"rm -rf $(find . -maxdepth 2 -type f -name '*.d.ts*')","clean":"run-p clean:*","prepare":"husky","prepublishOnly":"run-s build","test-ci":"node test/run.js && node test/bin/run.js","test":"run-s check test-ci"},"keywords":[],"author":{"name":"Pelle Wessman","email":"pelle@kodfabrik.se","url":"http://kodfabrik.se/"},"license":"0BSD","engines":{"node":">=0.10.48"},"devDependencies":{"@types/node":"^14.18.63","@voxpelli/eslint-config":"^19.0.0","@voxpelli/tsconfig":"^11.0.0","eslint":"^8.57.0","eslint-plugin-es-x":"^7.6.0","eslint-plugin-import":"^2.29.1","eslint-plugin-jsdoc":"^46.10.1","eslint-plugin-mocha":"^10.4.1","eslint-plugin-n":"^16.6.2","eslint-plugin-promise":"^6.1.1","eslint-plugin-security":"^1.7.1","eslint-plugin-sort-destructure-keys":"^1.5.0","eslint-plugin-unicorn":"^48.0.1","husky":"^9.0.11","installed-check":"^9.1.1","npm-run-all2":"^6.1.2","type-coverage":"^2.28.1","typescript":"~5.4.4"},"_id":"version-guard@1.1.2","gitHead":"69e3e3782b8b1b67988a2ea67b670aa85ce26a38","bugs":{"url":"https://github.com/voxpelli/version-guard/issues"},"_nodeVersion":"20.12.1","_npmVersion":"10.5.0","dist":{"integrity":"sha512-D8d+YxCUpoqtCnQzDxm6SF7DLU3gr2535T4khAtMq4osBahsQnmSxuwXFdrbAdDGG8Uokzfis/jvyeFPdmlc7w==","shasum":"f87524249db225bf802498d25bc0e5c2b8c584dc","tarball":"http://registry-npm.ywwl.com/version-guard/download/version-guard-1.1.2.tgz","fileCount":9,"unpackedSize":9145,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRZPFUlBQS8Bb+DswoQ3Ipk3xX4fp3IQzJmZrQxT/fGAIgKjagvSKk55mSZmMMphSwKaUzSCdARC7tWVo+CktiCEo="}],"size":4074,"noattachment":false,"key":"/version-guard/-/version-guard-1.1.2.tgz"},"_npmUser":{"name":"voxpelli","email":"pelle@kodfabrik.se"},"directories":{},"maintainers":[{"name":"voxpelli","email":"pelle@kodfabrik.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/version-guard_1.1.2_1712264472688_0.1309626933716994"},"_hasShrinkwrap":false,"readme":"# Version Guard\n\nUsed to ensure modern CLI scripts fail silently on old node.js versions\n\n[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg)](https://github.com/voxpelli/eslint-config)\n[![ES Module Ready Badge](https://img.shields.io/badge/es%20module%20ready-yes-success.svg)](https://esmodules.dev/)\n[![Types in JS](https://img.shields.io/badge/types_in_js-yes-brightgreen)](https://github.com/voxpelli/types-in-js)\n\n## Usage\n\nAdd a top-level file to your project, eg. `cli.js`, containing something like:\n\n```javascript\nrequire('version-guard')('./path/to/file/to/run', 14, 18);\n```\n\n## Syntax\n\n`versionGuard(filePath, minMajor, [minMinor])`\n\n* **filePath** - a path to the modern file that should be run\n* **minMajor** - the lowest major Node.js version that should be allowed to run the file\n* **[minMinor]** - the lowest minor version of `minMajor` that should be allowed to run the file\n\nOn supported versions imports and runs `filePath` using the [dynamic `import()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) (supporting both ESM and CJS modules).\n\nOn non-supported versions, fails silently with an error message.\n\nApart from checking current node version this command also looks up the main project's `package.json` and checks that the `engines.node` in it mentions the same version number as is sent to this command. To ensure that maintainers doesn't forget to update one of the two and thus the two diverging.\n\n## Notes\n\nThis project itself is a CJS project as the entire point is to work on incredibly old node.js versions.\n\n## Used by\n\n* [`dependency-check`](https://www.npmjs.com/package/dependency-check) - _in progress_\n* [`installed-check`](https://www.npmjs.com/package/installed-check) - _in progress_\n","publish_time":1712264472833,"_cnpm_publish_time":1712264472833,"dist-tags":{"latest":"1.1.3"}}