@nsis/dent-cli 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -22
- package/bin/cli.mjs +2 -2
- package/bin/package-BmxYaczR.mjs +1 -0
- package/package.json +5 -4
- package/bin/package-BRbRBetR.mjs +0 -1
package/README.md
CHANGED
|
@@ -6,37 +6,48 @@
|
|
|
6
6
|
[](https://www.npmjs.org/package/@nsis/dent-cli)
|
|
7
7
|
[](https://github.com/idleberg/node-dent-cli/actions)
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Installation
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Node.js
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Installation
|
|
13
|
+
For single-use, use `npx` to download and run the CLI:
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
```sh
|
|
16
|
+
$ npx -y @nsis/dent-cli --help
|
|
17
|
+
```
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
Or, if you prefer to install the CLI:
|
|
22
20
|
|
|
23
21
|
```sh
|
|
24
22
|
$ npm install --global @nsis/dent-cli
|
|
25
23
|
$ npx dent --help
|
|
26
24
|
```
|
|
27
25
|
|
|
28
|
-
###
|
|
26
|
+
### Scoop
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
The CLI is available to users of the [Scoop](https://scoop.sh/) package manager.
|
|
31
29
|
|
|
32
|
-
```
|
|
33
|
-
|
|
30
|
+
```powershell
|
|
31
|
+
# Add the bucket
|
|
32
|
+
scoop bucket add nsis https://github.com/NSIS-Dev/scoop-nsis
|
|
33
|
+
|
|
34
|
+
# Install dent
|
|
35
|
+
scoop install nsis/dent
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
###
|
|
38
|
+
### Download
|
|
39
|
+
|
|
40
|
+
As a last resort, you can download [pre-compiled binaries](https://github.com/idleberg/node-dent-cli/releases/latest) for Windows.
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
The CLI exposes two sub-commands:
|
|
45
|
+
|
|
46
|
+
- `dent format` — formats NSIS scripts
|
|
47
|
+
- `dent check` — checks if a script needs formatting
|
|
37
48
|
|
|
38
49
|
```
|
|
39
|
-
Usage: dent [options]
|
|
50
|
+
Usage: dent [options] [command]
|
|
40
51
|
|
|
41
52
|
CLI tool to format NSIS scripts
|
|
42
53
|
|
|
@@ -45,14 +56,13 @@ Options:
|
|
|
45
56
|
-D, --debug prints additional debug messages (default: false)
|
|
46
57
|
-h, --help display help for command
|
|
47
58
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-s, --use-spaces indent with spaces instead of tabs (default: false)
|
|
52
|
-
-t, --trim trim empty lines (default: true)
|
|
53
|
-
-w, --write edit files in-place (default: false)
|
|
59
|
+
Commands:
|
|
60
|
+
format [options] [file...] format NSIS scripts
|
|
61
|
+
check [options] [file...] check whether NSIS scripts are formatted (exits non-zero on drift)
|
|
54
62
|
```
|
|
55
63
|
|
|
64
|
+
Run `dent --help` to list sub-commands, or `dent <command> --help` for command-specific options.
|
|
65
|
+
|
|
56
66
|
## Related
|
|
57
67
|
|
|
58
68
|
- [dent](https://www.npmjs.com/package/@nsis/dent)
|
|
@@ -60,4 +70,3 @@ Formatting Options
|
|
|
60
70
|
## License
|
|
61
71
|
|
|
62
72
|
This work is licensed under [The MIT License](LICENSE)
|
|
63
|
-
|
package/bin/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{access as
|
|
2
|
-
CLI parameters:`,{args:
|
|
1
|
+
import{Command as e}from"commander";import{access as t,constants as n,glob as r,readFile as i,writeFile as a}from"node:fs/promises";import{createFormatter as o}from"@nsis/dent";import{blue as s,dim as c}from"kleur/colors";import{createConsola as l}from"consola";import{platform as u}from"node:os";const d=l({level:4}),f=u()===`win32`?`crlf`:`lf`;function p(e){return e.optionsGroup(`Formatting Options`).option(`-e, --eol <"crlf"|"lf">`,`control how line-breaks are represented`,e=>[`crlf`,`lf`].includes(e)?e:(d.warn(`Invalid EOL value provided, defaulting to "${f}".`),f),f).option(`-i, --indent-size <number>`,`number of units per indentation level`,e=>Number.parseInt(e,10),2).option(`-s, --use-spaces`,`indent with spaces instead of tabs`,!1).option(`-t, --trim`,`trim empty lines`,!0)}function m(e){e.indentSize!==2&&e.useSpaces===!1&&d.warn(`The "indent-size" option is ignored when "use-spaces" is not set.`)}async function h(e){try{await t(e,n.F_OK)}catch{return!1}return!0}async function g(){return(await import(`../package.json`,{with:{type:`json`}})).default.version??`development`}function _(e,t){let n=t.optsWithGlobals();return e.length||t.help(),n.debug&&d.debug(`
|
|
2
|
+
CLI parameters:`,{args:e,options:n}),m(n),n}function v(e){return{endOfLines:e.eol,indentSize:e.indentSize,trimEmptyLines:e.trim,useTabs:!e.useSpaces}}async function y(e){return Array.fromAsync(r(e,{cwd:process.cwd()}))}async function b(e){return!e.endsWith(`.nsi`)&&!e.endsWith(`.nsh`)?(d.warn(`${s(e)} is not an NSIS script, skipping.`),null):await h(e)===!1?(d.warn(`${s(e)} does not exist, skipping.`),null):(await i(e)).toString()}function x(){let t=new e(`check`).description(`check if NSIS scripts are formatted correctly`).arguments(`[file...]`).action(async(e,t,n)=>{await S(e,_(e,n))});return p(t),t.option(`-w, --write`,`edit files in-place, if check fails`,!1),t}async function S(e,t){let n=await y(e);n.length===0&&(d.error(`No valid input files provided, exiting.`),process.exit(2));let{check:r}=o(v(t));d.start(`Checking ${e.length} ${e.length===1?`file`:`files`}...`);let i=performance.now(),l=[];for(let e of n){let n=performance.now(),i=await b(e);if(i===null)continue;let o=r(i),u=Math.round(performance.now()-n);if(o===null){d.info(`${s(e)} already formatted ${c(`(${u}ms)`)}`);continue}l.push(e),t.write?(await a(e,o,{encoding:`utf-8`}),d.info(`${s(e)} formatted ${c(`(${u}ms)`)}`)):d.warn(`${s(e)} has issues ${c(`(${u}ms)`)}`)}let u=Math.round(performance.now()-i);d.success(`Completed in ${u}ms.`),l.length>=1&&process.exit(1)}function C(){let t=new e(`format`).description(`format NSIS scripts`).arguments(`[file...]`).action(async(e,t,n)=>{await w(e,_(e,n))});return p(t),t.option(`-w, --write`,`edit files in-place`,!1),t}async function w(e,t){let n=await y(e);n.length===0&&(d.error(`No valid input files provided, exiting.`),process.exit(1));let{check:r}=o(v(t));t.write&&d.start(`Formatting ${e.length} ${e.length===1?`file`:`files`}...`);let i=performance.now();for(let e of n){let n=performance.now(),i=await b(e);if(i===null)continue;let o=r(i),l=Math.round(performance.now()-n);t.write?o===null?d.info(`${s(e)} already formatted ${c(`(${l}ms)`)}`):(await a(e,o,{encoding:`utf-8`}),d.info(`${s(e)} formatted ${c(`(${l}ms)`)}`)):process.stdout.write(o??i)}if(t.write){let e=Math.round(performance.now()-i);d.success(`Completed in ${e}ms.`)}}async function T(){let t=new e(`dent`),n=await g();if(t.version(n).configureOutput({writeOut:e=>d.log(e),writeErr:e=>d.error(e)}).description(`CLI tool to format NSIS scripts`).option(`-D, --debug`,`prints additional debug messages`,!1).addCommand(C()).addCommand(x()),process.argv.length<=2){t.outputHelp();return}await t.parseAsync(process.argv)}await T();export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={name:`@nsis/dent-cli`,version:`0.5.0`,description:`An opinionated code formatter for NSIS scripts`,license:`MIT`,scripts:{build:`tsdown`,dev:`tsdown --watch`,lint:`concurrently --prefix-colors blue,green,magenta npm:lint:*`,"lint:biome":`biome check`,"lint:e18e":`e18e-cli analyze`,prepack:`npm run build`,"publish:jsr":`deno publish`,"publish:npm":`np`,start:`npm run build -- --watch`,test:`vitest run`},files:[`bin/`,`LICENSE`,`README.md`],type:`module`,bin:{dent:`./bin/cli.mjs`},engines:{node:`>=20.0.0`},repository:{type:`git`,url:`git+https://github.com/idleberg/node-dent-cli.git`},keywords:[`nsis`,`formatter`],dependencies:{"@nsis/dent":`^0.7.0`,commander:`^14.0.3`,consola:`^3.4.2`,kleur:`^4.1.5`},devDependencies:{"@commitlint/cli":`^20.5.3`,"@commitlint/config-conventional":`^20.5.3`,"@idleberg/configs":`^0.4.2`,"@types/node":`^24.12.2`,concurrently:`^9.2.1`,np:`^11.2.0`,tsdown:`^0.21.10`,typescript:`^6.0.3`,vitest:`^4.1.5`},pnpm:{onlyBuiltDependencies:[`lefthook`]},packageManager:`pnpm@10.30.3+sha512.c961d1e0a2d8e354ecaa5166b822516668b7f44cb5bd95122d590dd81922f606f5473b6d23ec4a5be05e7fcd18e8488d47d978bbe981872f1145d06e9a740017`};export{e as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nsis/dent-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "An opinionated code formatter for NSIS scripts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"formatter"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@nsis/dent": "^0.
|
|
27
|
+
"@nsis/dent": "^0.7.0",
|
|
28
28
|
"commander": "^14.0.3",
|
|
29
29
|
"consola": "^3.4.2",
|
|
30
30
|
"kleur": "^4.1.5"
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"concurrently": "^9.2.1",
|
|
38
38
|
"np": "^11.2.0",
|
|
39
39
|
"tsdown": "^0.21.10",
|
|
40
|
-
"typescript": "^6.0.3"
|
|
40
|
+
"typescript": "^6.0.3",
|
|
41
|
+
"vitest": "^4.1.5"
|
|
41
42
|
},
|
|
42
43
|
"scripts": {
|
|
43
44
|
"build": "tsdown",
|
|
@@ -48,6 +49,6 @@
|
|
|
48
49
|
"publish:jsr": "deno publish",
|
|
49
50
|
"publish:npm": "np",
|
|
50
51
|
"start": "npm run build -- --watch",
|
|
51
|
-
"test": "
|
|
52
|
+
"test": "vitest run"
|
|
52
53
|
}
|
|
53
54
|
}
|
package/bin/package-BRbRBetR.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={name:`@nsis/dent-cli`,version:`0.4.4`,description:`An opinionated code formatter for NSIS scripts`,license:`MIT`,scripts:{build:`tsdown`,dev:`tsdown --watch`,lint:`concurrently --prefix-colors blue,green,magenta npm:lint:*`,"lint:biome":`biome check`,"lint:e18e":`e18e-cli analyze`,prepack:`npm run build`,"publish:jsr":`deno publish`,"publish:npm":`np`,start:`npm run build -- --watch`,test:`echo "Tests pending" && exit 0`},files:[`bin/`,`LICENSE`,`README.md`],type:`module`,bin:{dent:`./bin/cli.mjs`},engines:{node:`>=20.0.0`},repository:{type:`git`,url:`git+https://github.com/idleberg/node-dent-cli.git`},keywords:[`nsis`,`formatter`],dependencies:{"@nsis/dent":`^0.6.2`,commander:`^14.0.3`,consola:`^3.4.2`,kleur:`^4.1.5`},devDependencies:{"@commitlint/cli":`^20.5.3`,"@commitlint/config-conventional":`^20.5.3`,"@idleberg/configs":`^0.4.2`,"@types/node":`^24.12.2`,concurrently:`^9.2.1`,np:`^11.2.0`,tsdown:`^0.21.10`,typescript:`^6.0.3`},pnpm:{onlyBuiltDependencies:[`lefthook`]},packageManager:`pnpm@10.30.3+sha512.c961d1e0a2d8e354ecaa5166b822516668b7f44cb5bd95122d590dd81922f606f5473b6d23ec4a5be05e7fcd18e8488d47d978bbe981872f1145d06e9a740017`};export{e as default};
|