@nightshadeui/cli 2.9.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/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +39 -0
- package/dist/cli.js.map +1 -0
- package/package.json +24 -0
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { generatePaletteCss } from '@nightshadeui/palette-generator';
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
const pkgPath = fileURLToPath(new URL('../package.json', import.meta.url));
|
|
7
|
+
const { version } = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
8
|
+
const program = new Command();
|
|
9
|
+
program
|
|
10
|
+
.name('nightshade')
|
|
11
|
+
.description('Nightshade UI tools')
|
|
12
|
+
.version(version);
|
|
13
|
+
program
|
|
14
|
+
.command('palette')
|
|
15
|
+
.description('Emit OKLCH palette as CSS custom properties')
|
|
16
|
+
.option('-f, --file <path>', 'read JSON palette spec from file (stdin if "-")')
|
|
17
|
+
.option('-o, --output <path>', 'write to file instead of stdout')
|
|
18
|
+
.option('--raw', 'emit property lines only (no :root wrapper)')
|
|
19
|
+
.action((opts) => {
|
|
20
|
+
let palette = {};
|
|
21
|
+
if (opts.file) {
|
|
22
|
+
const raw = opts.file === '-' ?
|
|
23
|
+
readFileSync(0, 'utf8') :
|
|
24
|
+
readFileSync(opts.file, 'utf8');
|
|
25
|
+
palette = JSON.parse(raw);
|
|
26
|
+
}
|
|
27
|
+
const css = generatePaletteCss({
|
|
28
|
+
...palette,
|
|
29
|
+
cssSelector: opts.raw ? false : ':root',
|
|
30
|
+
});
|
|
31
|
+
if (opts.output) {
|
|
32
|
+
writeFileSync(opts.output, css, 'utf8');
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
process.stdout.write(`${css}\n`);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
program.parse();
|
|
39
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAe,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3E,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAwB,CAAC;AAErF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACF,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,qBAAqB,CAAC;KAClC,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,OAAO;KACF,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,6CAA6C,CAAC;KAC1D,MAAM,CAAC,mBAAmB,EAAE,iDAAiD,CAAC;KAC9E,MAAM,CAAC,qBAAqB,EAAE,iCAAiC,CAAC;KAChE,MAAM,CAAC,OAAO,EAAE,6CAA6C,CAAC;KAC9D,MAAM,CAAC,CAAC,IAAuD,EAAE,EAAE;IAChE,IAAI,OAAO,GAAgB,EAAE,CAAC;IAC9B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,MAAM,GAAG,GACL,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;YACf,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;YACzB,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAgB,CAAC;IAC7C,CAAC;IACD,MAAM,GAAG,GAAG,kBAAkB,CAAC;QAC3B,GAAG,OAAO;QACV,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO;KAC1C,CAAC,CAAC;IACH,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IACrC,CAAC;AACL,CAAC,CAAC,CAAC;AAEP,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nightshadeui/cli",
|
|
3
|
+
"version": "2.9.0",
|
|
4
|
+
"description": "Nightshade UI command-line tools",
|
|
5
|
+
"author": "Boris Okunskiy",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"nightshade": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@nightshadeui/palette-generator": "2.9.0",
|
|
19
|
+
"commander": "^13.1.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
|
+
}
|
|
24
|
+
}
|