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,44 @@
1
- # primitiv-ui (placeholder)
1
+ # primitiv-ui
2
2
 
3
- Reserves the unscoped npm name **`primitiv-ui`** the package that will ship the
4
- Primitiv design system CLI (command: `primitiv`). See
5
- [`docs/rfcs/0005-primitiv-cli.md`](../../docs/rfcs/0005-primitiv-cli.md).
3
+ The **Primitiv UI** design-system CLI. Add headless, accessible,
4
+ fully-styled components — and their design tokens to any Vite or
5
+ Next.js project from the command line.
6
6
 
7
- This is a placeholder that prints a "coming soon" notice. It will be replaced by
8
- the real CLI build at a higher version. Publishing instructions live in
9
- [`../README.md`](../README.md).
7
+ ## Install
8
+
9
+ ```sh
10
+ npm i -D primitiv-ui
11
+ # or: pnpm add -D primitiv-ui
12
+ ```
13
+
14
+ This provides the `primitiv` command. The CLI is a small native binary
15
+ (written in Rust); `primitiv-ui` is a thin launcher that pulls in the
16
+ matching per-platform package via `optionalDependencies` and runs it — so
17
+ you only download the one binary your machine needs.
18
+
19
+ ## Usage
20
+
21
+ ```sh
22
+ primitiv init # scaffold primitiv.json and wire up tokens/theme
23
+ primitiv add button # add a component: styled surface + headless React + contract
24
+ primitiv tokens # emit design tokens (CSS / SCSS / Tailwind)
25
+ primitiv theme # emit the theme overrides layer
26
+ primitiv list # list available components and what's installed
27
+ ```
28
+
29
+ Pass `--help` to any command for its flags (e.g. `primitiv add --help`).
30
+
31
+ ## Supported platforms
32
+
33
+ macOS (arm64, x64), Linux (x64, arm64 — glibc), and Windows (x64). On any
34
+ other target, install the binary from source:
35
+
36
+ ```sh
37
+ cargo install primitiv-cli
38
+ ```
39
+
40
+ > **Native binary.** This won't run inside StackBlitz / WebContainer — their
41
+ > in-browser WASM Node can't execute native binaries. Use a local, Codespace,
42
+ > or Docker Node environment.
43
+
44
+ Part of the [Primitiv](https://github.com/primitiv-ui/primitiv) design system.
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'child_process';
3
+ import { createRequire } from 'module';
4
+ import { dirname, join } from 'path';
5
+ import { existsSync } from 'fs';
6
+
7
+ const require = createRequire(import.meta.url);
8
+
9
+ const PLATFORM_PACKAGES = {
10
+ 'darwin:arm64': '@primitiv-ui/cli-darwin-arm64',
11
+ 'darwin:x64': '@primitiv-ui/cli-darwin-x64',
12
+ 'linux:x64': '@primitiv-ui/cli-linux-x64-gnu',
13
+ 'linux:arm64': '@primitiv-ui/cli-linux-arm64-gnu',
14
+ 'win32:x64': '@primitiv-ui/cli-win32-x64',
15
+ };
16
+
17
+ const key = `${process.platform}:${process.arch}`;
18
+ const pkg = PLATFORM_PACKAGES[key];
19
+
20
+ if (!pkg) {
21
+ process.stderr.write(
22
+ `primitiv: unsupported platform (${process.platform}/${process.arch}).\n` +
23
+ `Install from source: cargo install primitiv-cli\n`
24
+ );
25
+ process.exit(1);
26
+ }
27
+
28
+ let binaryPath;
29
+ try {
30
+ const pkgDir = dirname(require.resolve(`${pkg}/package.json`));
31
+ const binary = process.platform === 'win32' ? 'primitiv.exe' : 'primitiv';
32
+ binaryPath = join(pkgDir, binary);
33
+ } catch {
34
+ process.stderr.write(
35
+ `primitiv: the ${pkg} platform package could not be found.\n` +
36
+ `Try reinstalling: pnpm add -D primitiv-ui\n` +
37
+ `Or install from source: cargo install primitiv-cli\n`
38
+ );
39
+ process.exit(1);
40
+ }
41
+
42
+ if (!existsSync(binaryPath)) {
43
+ process.stderr.write(
44
+ `primitiv: binary not found at ${binaryPath}.\n` +
45
+ `Try: cargo install primitiv-cli\n`
46
+ );
47
+ process.exit(1);
48
+ }
49
+
50
+ const { status } = spawnSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
51
+ process.exit(status ?? 1);
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "primitiv-ui",
3
- "version": "0.0.1",
4
- "description": "Primitiv design system CLI (placeholder; in development). Headless components ship as @primitiv-ui/react, /icons, /tokens.",
3
+ "version": "0.1.1",
4
+ "description": "Primitiv UI — the design system CLI. Run `primitiv add button` in any Vite or Next.js project.",
5
+ "keywords": ["primitiv", "design-system", "cli", "react", "tailwind"],
5
6
  "bin": {
6
- "primitiv": "bin/primitiv.js"
7
+ "primitiv": "./bin/primitiv.mjs"
7
8
  },
8
- "files": [
9
- "bin"
10
- ],
11
- "keywords": [
12
- "primitiv",
13
- "primitiv-ui",
14
- "design-system",
15
- "cli"
16
- ],
17
- "publishConfig": {
18
- "access": "public"
19
- }
9
+ "files": ["bin"],
10
+ "engines": { "node": ">=18" },
11
+ "optionalDependencies": {
12
+ "@primitiv-ui/cli-darwin-arm64": "0.1.1",
13
+ "@primitiv-ui/cli-darwin-x64": "0.1.1",
14
+ "@primitiv-ui/cli-linux-x64-gnu": "0.1.1",
15
+ "@primitiv-ui/cli-linux-arm64-gnu": "0.1.1",
16
+ "@primitiv-ui/cli-win32-x64": "0.1.1"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/primitiv-ui/primitiv.git",
21
+ "directory": "npm/cli-wrapper"
22
+ },
23
+ "license": "MIT",
24
+ "publishConfig": { "access": "public" }
20
25
  }
package/bin/primitiv.js DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- // Placeholder for the Primitiv design system CLI (command: `primitiv`).
3
- // The real CLI is in development — see docs/rfcs/0005-primitiv-cli.md.
4
- console.log(
5
- [
6
- "primitiv-ui — coming soon.",
7
- "The Primitiv design system CLI is in development.",
8
- "Headless components are published as @primitiv-ui/react (and /icons, /tokens).",
9
- ].join("\n")
10
- );