@nuniapp/cli 0.1.2 → 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 +7 -7
- package/dist/index.mjs +11 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Sets up [Nuni](https://nuni.praveenjuge.com) in any project.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
npx @nuniapp/cli init # new project ID + install steps for your framework
|
|
7
|
-
npx @nuniapp/cli init --json # the same, machine-readable (for agents)
|
|
8
|
-
npx @nuniapp/cli prompt # the ready-made prompt for your coding agent
|
|
9
|
-
npx @nuniapp/cli id # just a new project ID
|
|
6
|
+
npx @nuniapp/cli@latest init # new project ID + install steps for your framework
|
|
7
|
+
npx @nuniapp/cli@latest init --json # the same, machine-readable (for agents)
|
|
8
|
+
npx @nuniapp/cli@latest prompt # the ready-made prompt for your coding agent
|
|
9
|
+
npx @nuniapp/cli@latest id # just a new project ID
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
`init` does not edit your files. It detects your framework (Next.js, React, Vue, Nuxt, SvelteKit, Astro, Angular, plain HTML and more) and package manager, and prints exactly what to add and where.
|
|
@@ -23,13 +23,13 @@ Get a project ID by running: npx @nuniapp/cli@latest init (it prints the ID and
|
|
|
23
23
|
Steps:
|
|
24
24
|
1. Detect the framework and package manager.
|
|
25
25
|
2. If the app uses React (Next.js, Vite, Remix, React Router, TanStack Start, etc.):
|
|
26
|
-
- Install @nuniapp/react.
|
|
26
|
+
- Install @nuniapp/react@latest.
|
|
27
27
|
- Render <Nuni project="PROJECT_ID" /> once, globally, in the root layout or app entry (for Next.js App Router: app/layout.tsx, inside <body>). It is already a client component.
|
|
28
28
|
3. Otherwise, if there is a bundler (Vue, Svelte, Astro, Angular, etc.):
|
|
29
|
-
- Install @nuniapp/widget.
|
|
29
|
+
- Install @nuniapp/widget@latest.
|
|
30
30
|
- Call init({ project: "PROJECT_ID" }) once on the client, in the app entry or root layout. import { init } from "@nuniapp/widget".
|
|
31
31
|
4. If there is no bundler (plain HTML, WordPress, Webflow): add this before </body> on every page:
|
|
32
|
-
<script src="https://cdn.jsdelivr.net/npm/@nuniapp/widget@
|
|
32
|
+
<script src="https://cdn.jsdelivr.net/npm/@nuniapp/widget@latest/dist/nuni.global.js" data-project="PROJECT_ID" defer></script>
|
|
33
33
|
5. Commit the project ID directly in the code. It is public, not a secret. Do not put it in an env var.
|
|
34
34
|
6. Do not add Nuni to server-only code, and do not load it more than once.
|
|
35
35
|
7. If the site sends a Content-Security-Policy, allow connect-src https://*.convex.cloud wss://*.convex.cloud https://*.convex.site (and script-src cdn.jsdelivr.net for the script tag).
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { join, resolve } from "node:path";
|
|
|
3
3
|
import { parseArgs } from "node:util";
|
|
4
4
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
5
5
|
//#region package.json
|
|
6
|
-
var version = "0.1.
|
|
6
|
+
var version = "0.1.3";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region ../shared/src/id.ts
|
|
9
9
|
const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
@@ -40,7 +40,7 @@ const PACKAGES = {
|
|
|
40
40
|
react: "@nuniapp/react",
|
|
41
41
|
cli: "@nuniapp/cli"
|
|
42
42
|
};
|
|
43
|
-
const CDN_URL = "https://cdn.jsdelivr.net/npm/@nuniapp/widget@
|
|
43
|
+
const CDN_URL = "https://cdn.jsdelivr.net/npm/@nuniapp/widget@latest/dist/nuni.global.js";
|
|
44
44
|
const DOCS_URL = "https://nuni.praveenjuge.com";
|
|
45
45
|
/**
|
|
46
46
|
* The prompt a developer pastes into Codex, Claude Code, Cursor, etc.
|
|
@@ -54,10 +54,10 @@ ${options.projectId ? `Use this Nuni project ID: ${options.projectId}` : `Get a
|
|
|
54
54
|
Steps:
|
|
55
55
|
1. Detect the framework and package manager.
|
|
56
56
|
2. If the app uses React (Next.js, Vite, Remix, React Router, TanStack Start, etc.):
|
|
57
|
-
- Install ${PACKAGES.react}.
|
|
57
|
+
- Install ${PACKAGES.react}@latest.
|
|
58
58
|
- Render <Nuni project="PROJECT_ID" /> once, globally, in the root layout or app entry (for Next.js App Router: app/layout.tsx, inside <body>). It is already a client component.
|
|
59
59
|
3. Otherwise, if there is a bundler (Vue, Svelte, Astro, Angular, etc.):
|
|
60
|
-
- Install ${PACKAGES.widget}.
|
|
60
|
+
- Install ${PACKAGES.widget}@latest.
|
|
61
61
|
- Call init({ project: "PROJECT_ID" }) once on the client, in the app entry or root layout. import { init } from "${PACKAGES.widget}".
|
|
62
62
|
4. If there is no bundler (plain HTML, WordPress, Webflow): add this before </body> on every page:
|
|
63
63
|
<script src="${CDN_URL}" data-project="PROJECT_ID" defer><\/script>
|
|
@@ -88,10 +88,10 @@ function detectPackageManager(cwd) {
|
|
|
88
88
|
}
|
|
89
89
|
function installCommand(pm, pkg) {
|
|
90
90
|
switch (pm) {
|
|
91
|
-
case "bun": return `bun add ${pkg}`;
|
|
92
|
-
case "pnpm": return `pnpm add ${pkg}`;
|
|
93
|
-
case "yarn": return `yarn add ${pkg}`;
|
|
94
|
-
default: return `npm install ${pkg}`;
|
|
91
|
+
case "bun": return `bun add ${pkg}@latest`;
|
|
92
|
+
case "pnpm": return `pnpm add ${pkg}@latest`;
|
|
93
|
+
case "yarn": return `yarn add ${pkg}@latest`;
|
|
94
|
+
default: return `npm install ${pkg}@latest`;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
function detectFramework(cwd) {
|
|
@@ -289,9 +289,9 @@ const VERSION = version;
|
|
|
289
289
|
const HELP = `nuni ${VERSION}: pinned comments on your live site
|
|
290
290
|
|
|
291
291
|
Usage
|
|
292
|
-
npx @nuniapp/cli init [--id <project-id>] [--cwd <dir>] [--json]
|
|
293
|
-
npx @nuniapp/cli prompt [--id <project-id>]
|
|
294
|
-
npx @nuniapp/cli id
|
|
292
|
+
npx @nuniapp/cli@latest init [--id <project-id>] [--cwd <dir>] [--json]
|
|
293
|
+
npx @nuniapp/cli@latest prompt [--id <project-id>]
|
|
294
|
+
npx @nuniapp/cli@latest id
|
|
295
295
|
|
|
296
296
|
Commands
|
|
297
297
|
init Generate a project ID and print the install steps for this project
|