create-primitiv-ui 0.0.1 → 0.1.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/README.md CHANGED
@@ -1,9 +1,27 @@
1
- # create-primitiv-ui (placeholder)
1
+ # create-primitiv-ui
2
2
 
3
- Reserves the unscoped npm name **`create-primitiv-ui`** the package behind
4
- `npm create primitiv-ui` / `pnpm create primitiv-ui`, which will run
5
- `primitiv init`. See
6
- [`docs/rfcs/0005-primitiv-cli.md`](../../docs/rfcs/0005-primitiv-cli.md).
3
+ Set up **Primitiv UI** in a new or existing Vite / Next.js project with a
4
+ single command.
7
5
 
8
- This is a placeholder that prints a "coming soon" notice. Publishing
9
- instructions live in [`../README.md`](../README.md).
6
+ ## Usage
7
+
8
+ ```sh
9
+ npm create primitiv-ui@latest
10
+ # or: pnpm create primitiv-ui
11
+ ```
12
+
13
+ It detects your package manager, installs
14
+ [`primitiv-ui`](https://www.npmjs.com/package/primitiv-ui) as a dev
15
+ dependency, then runs `primitiv init` to scaffold configuration. Any
16
+ arguments you pass are forwarded to `primitiv init`.
17
+
18
+ Once set up, add components with:
19
+
20
+ ```sh
21
+ npx primitiv add button
22
+ ```
23
+
24
+ > **Needs a real Node environment.** The CLI runs a native binary, so this
25
+ > won't work in StackBlitz / WebContainer. Use local, a Codespace, or Docker.
26
+
27
+ Part of the [Primitiv](https://github.com/primitiv-ui/primitiv) design system.
package/create.mjs ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ // Entry point for `pnpm create primitiv-ui` / `npm create primitiv-ui`.
3
+ // Installs primitiv-ui as a dev dependency, then delegates to `primitiv init`.
4
+ import { execSync, spawnSync } from 'child_process';
5
+ import { existsSync } from 'fs';
6
+
7
+ const pm = existsSync('pnpm-lock.yaml') ? 'pnpm'
8
+ : existsSync('yarn.lock') ? 'yarn'
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' });
19
+ process.exit(result.status ?? 1);
package/package.json CHANGED
@@ -1,21 +1,18 @@
1
1
  {
2
2
  "name": "create-primitiv-ui",
3
- "version": "0.0.1",
4
- "description": "Scaffold a project with the Primitiv design system (placeholder; in development).",
3
+ "version": "0.1.1",
4
+ "description": "Set up Primitiv UI in an existing Vite or Next.js project. Use with: pnpm create primitiv-ui",
5
+ "keywords": ["primitiv", "design-system", "cli", "create", "react"],
5
6
  "bin": {
6
- "create-primitiv-ui": "bin/create-primitiv-ui.js"
7
+ "create-primitiv-ui": "./create.mjs"
7
8
  },
8
- "files": [
9
- "bin"
10
- ],
11
- "keywords": [
12
- "primitiv",
13
- "primitiv-ui",
14
- "design-system",
15
- "create",
16
- "cli"
17
- ],
18
- "publishConfig": {
19
- "access": "public"
20
- }
9
+ "files": ["create.mjs"],
10
+ "engines": { "node": ">=18" },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/primitiv-ui/primitiv.git",
14
+ "directory": "npm/create-primitiv-ui"
15
+ },
16
+ "license": "MIT",
17
+ "publishConfig": { "access": "public" }
21
18
  }
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- // Placeholder for the Primitiv scaffold (`npm create primitiv-ui`).
3
- // The real scaffold is in development — see docs/rfcs/0005-primitiv-cli.md.
4
- console.log(
5
- [
6
- "create-primitiv-ui — coming soon.",
7
- "The Primitiv project scaffold is in development.",
8
- "It will run `primitiv init` to set up tokens, styles, and configuration.",
9
- ].join("\n")
10
- );