+14
-0
@@ -8,2 +8,16 @@ # Changelog | ||
| ## [v1.1.0](https://github.com/nvm-sh/nvmrc/compare/v1.0.0...v1.1.0) - 2024-06-20 | ||
| ### Commits | ||
| - [New] add `--help`, `--version`; accept a path to another directory; nicer error messages [`69371ff`](https://github.com/nvm-sh/nvmrc/commit/69371ff3ed16cbd5f3328a9923a245f98dfb1612) | ||
| - [Tests] add more assertions [`41a8ad6`](https://github.com/nvm-sh/nvmrc/commit/41a8ad6df407230e6895342b79618a0297d98008) | ||
| - [Tests] reorganize tests [`9e280e5`](https://github.com/nvm-sh/nvmrc/commit/9e280e5d0e5e982c97eaef8e8358c5c855bccc7e) | ||
| - [Tests] `import.meta.dirname` is not always available [`43dbe63`](https://github.com/nvm-sh/nvmrc/commit/43dbe630edef4d76338a7b4b9bc4e485a9c9d0a1) | ||
| - [Tests] add more coverage [`0d325aa`](https://github.com/nvm-sh/nvmrc/commit/0d325aa903893072cb07daf43ae04b491e104d6c) | ||
| - [Dev Deps] update `c8`, `tape` [`5c481c1`](https://github.com/nvm-sh/nvmrc/commit/5c481c15a357392734daa70243947d98a8100da5) | ||
| - [patch] remove extra newline [`3a92b47`](https://github.com/nvm-sh/nvmrc/commit/3a92b479dd665f3bd1f575beb5cab2d10a0d34b4) | ||
| - [Deps] update `c8` [`1c01438`](https://github.com/nvm-sh/nvmrc/commit/1c01438772943fef0bc7979298194644b291ddca) | ||
| - [Dev Deps] pin eslint [`54f028c`](https://github.com/nvm-sh/nvmrc/commit/54f028c887748a08f46b7da60f4cb1b94908c277) | ||
| ## v1.0.0 - 2024-06-05 | ||
@@ -10,0 +24,0 @@ |
+49
-4
| #! /usr/bin/env node | ||
| import { readFile } from 'fs/promises'; | ||
| import { join } from 'path'; | ||
| import { existsSync } from 'fs'; | ||
| import { join, sep } from 'path'; | ||
| import { parseArgs } from 'util'; | ||
| const contentsP = readFile(join(process.cwd(), '.nvmrc')); | ||
| const { | ||
| values: { | ||
| help, | ||
| version, | ||
| }, | ||
| positionals, | ||
| } = parseArgs({ | ||
| allowPositionals: true, | ||
| options: { | ||
| help: { type: 'boolean' }, | ||
| version: { type: 'boolean' }, | ||
| }, | ||
| }); | ||
| const cwd = process.cwd(); | ||
| if (help) { | ||
| console.log(`nvmrc | ||
| command-line tool to validate a \`.nvmrc\` file | ||
| Positionals: | ||
| <dir> a relative path to a directory containing a \`.nvmrc\` file [default: \`${cwd}\`] | ||
| Options: | ||
| --version Show version number [boolean] | ||
| --help Show help [boolean]`); | ||
| process.exit(0); | ||
| } else if (version) { | ||
| console.log(`v${(await import('module')).createRequire(import.meta.url)('./package.json').version}`); | ||
| process.exit(0); | ||
| } else if (positionals.length > 1) { | ||
| console.error(`expected exactly zero or one positional arguments; got ${positionals.length}`); | ||
| } | ||
| const [dir = cwd] = positionals; | ||
| const file = join(dir, '.nvmrc'); | ||
| if (!existsSync(file)) { | ||
| console.error(`\`.nvmrc\` file not found in \`${dir.replace(sep === '/' ? /\/?$/ : /\\?$/, sep)}\``); | ||
| process.exit(1); | ||
| } | ||
| const contentsP = readFile(file); | ||
| const contentsStr = `${await contentsP}`; | ||
@@ -34,4 +80,3 @@ | ||
| non-commented content parsed: | ||
| ${rawOptions.join('\n')} | ||
| `); | ||
| ${rawOptions.join('\n')}`); | ||
@@ -38,0 +83,0 @@ process.exit(1); |
+4
-4
| { | ||
| "name": "nvmrc", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "description": "command-line tool to validate a `.nvmrc` file", | ||
@@ -44,4 +44,4 @@ "bin": "./nvmrc.mjs", | ||
| "auto-changelog": "^2.4.0", | ||
| "c8": "^9.1.0", | ||
| "eslint": "^8.8.0", | ||
| "c8": "^10.1.2", | ||
| "eslint": "=8.8.0", | ||
| "in-publish": "^2.0.1", | ||
@@ -51,3 +51,3 @@ "npmignore": "^0.3.1", | ||
| "strip-color": "^0.1.0", | ||
| "tape": "^5.7.5" | ||
| "tape": "^5.8.1" | ||
| }, | ||
@@ -54,0 +54,0 @@ "testling": { |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
9591
33.49%66
120%2
100%