@noarka/cli 0.1.0 → 0.1.4
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 +19 -19
- package/dist/cli.js +22 -5
- package/package.json +37 -36
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
# @noarka/cli
|
|
2
|
-
|
|
3
|
-
Scaffold Noarka UI primitives into your project
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npx @noarka/cli init
|
|
7
|
-
npx @noarka/cli add button
|
|
8
|
-
npx @noarka/cli list
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
- `init` writes `utils/cn.ts` once per project.
|
|
12
|
-
- `add <component>` copies the primitive to `components/ui/` (lowercase
|
|
13
|
-
basenames, same-dir imports rewritten) and writes `utils/cn.ts` if missing.
|
|
14
|
-
Components that use another primitive print a follow-up `add` command.
|
|
15
|
-
- Templates ship inside `@noarka/ui` itself, so scaffolded code always
|
|
16
|
-
matches the installed library version.
|
|
17
|
-
|
|
18
|
-
Options: `--dir <path>` scaffolds into another project root, `--overwrite`
|
|
19
|
-
replaces existing files.
|
|
1
|
+
# @noarka/cli
|
|
2
|
+
|
|
3
|
+
Scaffold Noarka UI primitives into your project.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx @noarka/cli init
|
|
7
|
+
npx @noarka/cli add button
|
|
8
|
+
npx @noarka/cli list
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
- `init` writes `utils/cn.ts` once per project.
|
|
12
|
+
- `add <component>` copies the primitive to `components/ui/` (lowercase
|
|
13
|
+
basenames, same-dir imports rewritten) and writes `utils/cn.ts` if missing.
|
|
14
|
+
Components that use another primitive print a follow-up `add` command.
|
|
15
|
+
- Templates ship inside `@noarka/ui` itself, so scaffolded code always
|
|
16
|
+
matches the installed library version.
|
|
17
|
+
|
|
18
|
+
Options: `--dir <path>` scaffolds into another project root, `--overwrite`
|
|
19
|
+
replaces existing files.
|
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,14 @@ import fs from "fs";
|
|
|
5
5
|
import path from "path";
|
|
6
6
|
import { createRequire } from "module";
|
|
7
7
|
var require2 = createRequire(import.meta.url);
|
|
8
|
+
function cliVersion() {
|
|
9
|
+
try {
|
|
10
|
+
const pkg = require2("../package.json");
|
|
11
|
+
return typeof pkg.version === "string" ? pkg.version : "0.0.0";
|
|
12
|
+
} catch {
|
|
13
|
+
return "0.0.0";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
8
16
|
function uiRoot() {
|
|
9
17
|
try {
|
|
10
18
|
return path.dirname(require2.resolve("@noarka/ui/package.json"));
|
|
@@ -77,10 +85,19 @@ function peerDeps(dir) {
|
|
|
77
85
|
function cmdInit(projectDir, overwrite) {
|
|
78
86
|
const { target, status } = ensureCn(projectDir, overwrite);
|
|
79
87
|
console.log(`${status}: ${path.relative(process.cwd(), target)}`);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
const cssTarget = path.join(projectDir, "styles", "globals.css");
|
|
89
|
+
const cssContent = `@import "@noarka/ui/styles/tokens.css";
|
|
90
|
+
@import "@noarka/ui/styles/base.css";
|
|
91
|
+
|
|
92
|
+
/* Required: node_modules is skipped by Tailwind v4's automatic content detection. */
|
|
93
|
+
@source "../node_modules/@noarka/ui/dist/**/*.js";
|
|
94
|
+
`;
|
|
95
|
+
const cssStatus = writeFile(cssTarget, cssContent, overwrite);
|
|
96
|
+
console.log(`${cssStatus}: ${path.relative(process.cwd(), cssTarget)}`);
|
|
97
|
+
console.log("\nNext: import the scaffolded stylesheet once in your app entry:");
|
|
98
|
+
console.log(' import "./styles/globals.css";');
|
|
99
|
+
console.log("\nDesign tokens (incl. --surface) are now available as utilities:");
|
|
100
|
+
console.log(" bg-surface, text-foreground, bg-muted, ...");
|
|
84
101
|
}
|
|
85
102
|
function cmdAdd(name, projectDir, overwrite) {
|
|
86
103
|
const dir = findDir(name);
|
|
@@ -138,7 +155,7 @@ function parseArgs(argv) {
|
|
|
138
155
|
help();
|
|
139
156
|
process.exit(0);
|
|
140
157
|
} else if (arg === "-v" || arg === "--version") {
|
|
141
|
-
console.log(
|
|
158
|
+
console.log(cliVersion());
|
|
142
159
|
process.exit(0);
|
|
143
160
|
} else if (arg.startsWith("-")) {
|
|
144
161
|
console.error(`Unknown option "${arg}". See: noarka --help`);
|
package/package.json
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@noarka/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Scaffold Noarka UI primitives into your project
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"noarka": "./dist/cli.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist",
|
|
12
|
-
"README.md",
|
|
13
|
-
"LICENSE"
|
|
14
|
-
],
|
|
15
|
-
"keywords": [
|
|
16
|
-
"noarka",
|
|
17
|
-
"ui",
|
|
18
|
-
"cli",
|
|
19
|
-
"scaffold",
|
|
20
|
-
"components"
|
|
21
|
-
],
|
|
22
|
-
"publishConfig": {
|
|
23
|
-
"access": "public"
|
|
24
|
-
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@noarka/cli",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Scaffold Noarka UI primitives into your project.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"noarka": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"noarka",
|
|
17
|
+
"ui",
|
|
18
|
+
"cli",
|
|
19
|
+
"scaffold",
|
|
20
|
+
"components"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup src/cli.ts --format esm --clean",
|
|
27
|
+
"typecheck": "tsc --noEmit"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@noarka/ui": "workspace:^0.1.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^20.19.43",
|
|
34
|
+
"tsup": "^8.3.5",
|
|
35
|
+
"typescript": "^5"
|
|
36
|
+
}
|
|
37
|
+
}
|