@nsis/dent-cli 0.5.1 → 0.6.1
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/bin/cli.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
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(`-
|
|
2
|
+
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, --no-trim`,`do not trim empty lines`)}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(`
|
|
3
3
|
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{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={name:`@nsis/dent-cli`,version:`0.
|
|
1
|
+
var e={name:`@nsis/dent-cli`,version:`0.6.1`,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.2`,commander:`^14.0.3`,consola:`^3.4.2`,kleur:`^4.1.5`},devDependencies:{"@commitlint/cli":`^21.0.1`,"@commitlint/config-conventional":`^21.0.1`,"@idleberg/configs":`^0.4.2`,"@types/node":`^24.12.4`,concurrently:`^9.2.1`,np:`^11.2.1`,tsdown:`^0.22.0`,typescript:`^6.0.3`,vitest:`^4.1.6`},packageManager:`pnpm@11.1.2+sha512.415a1cc25974731e75455c1468371be74c5aa5fb7621b50d4056d222451609f11412f23fd602e6169f1e060466641f798597e1be961a10688836a67b16569499`};export{e as default};
|
package/package.json
CHANGED
|
@@ -1,54 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
2
|
+
"name": "@nsis/dent-cli",
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "An opinionated code formatter for NSIS scripts",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsdown",
|
|
8
|
+
"dev": "tsdown --watch",
|
|
9
|
+
"lint": "concurrently --prefix-colors blue,green,magenta npm:lint:*",
|
|
10
|
+
"lint:biome": "biome check",
|
|
11
|
+
"lint:e18e": "e18e-cli analyze",
|
|
12
|
+
"prepack": "npm run build",
|
|
13
|
+
"publish:jsr": "deno publish",
|
|
14
|
+
"publish:npm": "np",
|
|
15
|
+
"start": "npm run build -- --watch",
|
|
16
|
+
"test": "vitest run"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"bin/",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"bin": {
|
|
25
|
+
"dent": "./bin/cli.mjs"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20.0.0"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/idleberg/node-dent-cli.git"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"nsis",
|
|
36
|
+
"formatter"
|
|
37
|
+
],
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@nsis/dent": "^0.7.2",
|
|
40
|
+
"commander": "^14.0.3",
|
|
41
|
+
"consola": "^3.4.2",
|
|
42
|
+
"kleur": "^4.1.5"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@commitlint/cli": "^21.0.1",
|
|
46
|
+
"@commitlint/config-conventional": "^21.0.1",
|
|
47
|
+
"@idleberg/configs": "^0.4.2",
|
|
48
|
+
"@types/node": "^24.12.4",
|
|
49
|
+
"concurrently": "^9.2.1",
|
|
50
|
+
"np": "^11.2.1",
|
|
51
|
+
"tsdown": "^0.22.0",
|
|
52
|
+
"typescript": "^6.0.3",
|
|
53
|
+
"vitest": "^4.1.6"
|
|
54
|
+
},
|
|
55
|
+
"packageManager": "pnpm@11.1.2+sha512.415a1cc25974731e75455c1468371be74c5aa5fb7621b50d4056d222451609f11412f23fd602e6169f1e060466641f798597e1be961a10688836a67b16569499"
|
|
56
|
+
}
|