create-primitiv-ui 0.1.1 → 0.1.3
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 +22 -7
- package/create-logic.mjs +7 -0
- package/create.mjs +4 -16
- package/package.json +21 -5
package/README.md
CHANGED
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
# create-primitiv-ui
|
|
2
2
|
|
|
3
|
-
Set up **Primitiv UI** in
|
|
3
|
+
Set up **Primitiv UI** in an existing Vite or Next.js project with a
|
|
4
4
|
single command.
|
|
5
5
|
|
|
6
6
|
## Usage
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
+
# pnpm
|
|
10
|
+
pnpm create primitiv-ui
|
|
11
|
+
|
|
12
|
+
# npm
|
|
9
13
|
npm create primitiv-ui@latest
|
|
10
|
-
|
|
14
|
+
|
|
15
|
+
# yarn / bun
|
|
16
|
+
yarn create primitiv-ui
|
|
17
|
+
bun create primitiv-ui
|
|
11
18
|
```
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
This runs `primitiv init` via `npx primitiv-ui@latest init` — no local
|
|
21
|
+
install needed. It walks you through choosing a stylesheet format, brand
|
|
22
|
+
colour, and styles path, then writes `primitiv.json` and generates the
|
|
23
|
+
shared token layer.
|
|
24
|
+
|
|
25
|
+
Any arguments you pass are forwarded to `primitiv init`:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pnpm create primitiv-ui --yes # accept all defaults
|
|
29
|
+
pnpm create primitiv-ui --format scss # choose SCSS up front
|
|
30
|
+
```
|
|
17
31
|
|
|
18
32
|
Once set up, add components with:
|
|
19
33
|
|
|
20
34
|
```sh
|
|
21
|
-
|
|
35
|
+
pnpm dlx primitiv-ui@latest add button
|
|
36
|
+
# or: npx primitiv-ui@latest add button
|
|
22
37
|
```
|
|
23
38
|
|
|
24
39
|
> **Needs a real Node environment.** The CLI runs a native binary, so this
|
package/create-logic.mjs
ADDED
package/create.mjs
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { execSync, spawnSync } from 'child_process';
|
|
5
|
-
import { existsSync } from 'fs';
|
|
2
|
+
import { spawnSync } from 'child_process';
|
|
3
|
+
import { spawnCommand } from './create-logic.mjs';
|
|
6
4
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
: existsSync('bun.lockb') ? 'bun'
|
|
10
|
-
: 'npm';
|
|
11
|
-
|
|
12
|
-
const addCmd = pm === 'npm' ? 'install --save-dev' : 'add -D';
|
|
13
|
-
|
|
14
|
-
process.stdout.write(`\nInstalling primitiv-ui via ${pm}…\n`);
|
|
15
|
-
execSync(`${pm} ${addCmd} primitiv-ui`, { stdio: 'inherit' });
|
|
16
|
-
|
|
17
|
-
const args = process.argv.slice(2);
|
|
18
|
-
const result = spawnSync('primitiv', ['init', ...args], { stdio: 'inherit' });
|
|
5
|
+
const { cmd, args, options } = spawnCommand(process.argv.slice(2));
|
|
6
|
+
const result = spawnSync(cmd, args, options);
|
|
19
7
|
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-primitiv-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Set up Primitiv UI in an existing Vite or Next.js project. Use with: pnpm create primitiv-ui",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"primitiv",
|
|
7
|
+
"design-system",
|
|
8
|
+
"cli",
|
|
9
|
+
"create",
|
|
10
|
+
"react"
|
|
11
|
+
],
|
|
6
12
|
"bin": {
|
|
7
13
|
"create-primitiv-ui": "./create.mjs"
|
|
8
14
|
},
|
|
9
|
-
"files": [
|
|
10
|
-
|
|
15
|
+
"files": [
|
|
16
|
+
"create.mjs",
|
|
17
|
+
"create-logic.mjs"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "node --test create.test.mjs"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18"
|
|
24
|
+
},
|
|
11
25
|
"repository": {
|
|
12
26
|
"type": "git",
|
|
13
27
|
"url": "https://github.com/primitiv-ui/primitiv.git",
|
|
14
28
|
"directory": "npm/create-primitiv-ui"
|
|
15
29
|
},
|
|
16
30
|
"license": "MIT",
|
|
17
|
-
"publishConfig": {
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
}
|
|
18
34
|
}
|