create-pollar-app-patrickkish 0.1.0 → 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,50 +1,131 @@
1
1
  # create-pollar-app-patrickkish
2
2
 
3
- CLI that scaffolds a ready-to-run **Next.js 16 + Pollar** app. Closes [pollar-backoffice#2](https://github.com/pollar-xyz/pollar-backoffice/issues/2).
3
+ Scaffold a **Next.js 16** app with [**Pollar**](https://docs.pollar.xyz) wallet already wired — login, balance, assets, send, receive, and transaction history via the official SDK.
4
4
 
5
- ## Usage
5
+ Built for [pollar-backoffice#2](https://github.com/pollar-xyz/pollar-backoffice/issues/2).
6
+
7
+ ## Quick start
8
+
9
+ Pick your package manager. Each command below scaffolds a new app, installs dependencies, and initializes git.
10
+
11
+ ### pnpm (recommended)
12
+
13
+ ```bash
14
+ pnpm dlx create-pollar-app-patrickkish@latest my-pollar-app
15
+ cd my-pollar-app
16
+ # edit .env.local — set NEXT_PUBLIC_POLLAR_API_KEY=pub_testnet_...
17
+ pnpm dev
18
+ ```
19
+
20
+ Non-interactive:
21
+
22
+ ```bash
23
+ pnpm dlx create-pollar-app-patrickkish@latest my-pollar-app -- --yes --pm pnpm --network testnet
24
+ ```
25
+
26
+ ### npm
27
+
28
+ ```bash
29
+ npm create create-pollar-app-patrickkish@latest my-pollar-app
30
+ cd my-pollar-app
31
+ # edit .env.local
32
+ npm run dev
33
+ ```
34
+
35
+ Non-interactive:
36
+
37
+ ```bash
38
+ npm create create-pollar-app-patrickkish@latest my-pollar-app -- --yes --pm npm --network testnet
39
+ ```
40
+
41
+ ### yarn
42
+
43
+ ```bash
44
+ yarn create create-pollar-app-patrickkish my-pollar-app
45
+ cd my-pollar-app
46
+ # edit .env.local
47
+ yarn dev
48
+ ```
49
+
50
+ Non-interactive:
51
+
52
+ ```bash
53
+ yarn create create-pollar-app-patrickkish my-pollar-app --yes --pm yarn --network testnet
54
+ ```
55
+
56
+ ### bun
6
57
 
7
58
  ```bash
8
- # Interactive (pnpm recommended)
9
- pnpm dlx create-pollar-app-patrickkish my-app
59
+ bunx create-pollar-app-patrickkish@latest my-pollar-app
60
+ cd my-pollar-app
61
+ # edit .env.local
62
+ bun run dev
63
+ ```
10
64
 
11
- # Non-interactive
12
- npx create-pollar-app-patrickkish my-app --yes --pm pnpm --network testnet
13
- npm create create-pollar-app-patrickkish@latest my-app -- --yes --pm npm
14
- yarn create create-pollar-app-patrickkish my-app --yes --pm yarn
15
- bunx create-pollar-app-patrickkish my-app --yes --pm bun
65
+ Non-interactive:
66
+
67
+ ```bash
68
+ bunx create-pollar-app-patrickkish@latest my-pollar-app --yes --pm bun --network testnet
16
69
  ```
17
70
 
18
- ### Flags
71
+ ## What you get
72
+
73
+ The generated app includes:
74
+
75
+ - **Next.js 16** App Router, **React 19**, TypeScript, **Tailwind 4**
76
+ - `@pollar/core@^0.9.0` and `@pollar/react@^0.9.0`
77
+ - `PollarProvider` in the root layout
78
+ - Login via **`WalletButton`**
79
+ - Home screen actions that open SDK modals: balance, assets, send (USDC example), receive, history
80
+ - `.env.example`, eslint, prettier, and a README with a Deploy to Vercel button
81
+
82
+ No backend and no secret keys — client-side only.
83
+
84
+ ## CLI flags
19
85
 
20
86
  | Flag | Description |
21
87
  |------|-------------|
22
- | `--yes` / `-y` | Skip prompts (defaults: detected package manager, testnet) |
23
- | `--pm <npm\|pnpm\|yarn\|bun>` | Package manager for install |
24
- | `--network <testnet\|mainnet>` | Stellar network written to `.env.local` |
88
+ | `--yes` / `-y` | Skip prompts (uses detected package manager + testnet) |
89
+ | `--pm <npm\|pnpm\|yarn\|bun>` | Package manager for installing the new app |
90
+ | `--network <testnet\|mainnet>` | Written to `.env.local` as `NEXT_PUBLIC_POLLAR_NETWORK` |
91
+
92
+ When you skip `--pm`, the CLI picks the manager that invoked it (`pnpm dlx` → pnpm, `npm create` → npm, etc.).
25
93
 
26
- When you run via `pnpm dlx`, the default package manager is **pnpm**. Same for `npm create`, `yarn create`, and `bunx`.
94
+ ## Environment variables
27
95
 
28
- ## Generated app
96
+ | Variable | Required | Description |
97
+ |----------|----------|-------------|
98
+ | `NEXT_PUBLIC_POLLAR_API_KEY` | Yes | Publishable key from [dashboard.pollar.xyz](https://dashboard.pollar.xyz) (`pub_testnet_...`) |
99
+ | `NEXT_PUBLIC_POLLAR_NETWORK` | No | `testnet` (default) or `mainnet` |
29
100
 
30
- - `PollarProvider` + `NEXT_PUBLIC_POLLAR_API_KEY`
31
- - Login with **WalletButton**
32
- - Home screen opens SDK modals: balance, assets, send (USDC example), receive, history
33
- - eslint + prettier, README with Deploy to Vercel button
101
+ Get a testnet key at **dashboard.pollar.xyz → Configuration → API Keys**.
34
102
 
35
- ## Develop this CLI
103
+ ## Requirements
104
+
105
+ - Node.js **20+**
106
+ - A Pollar publishable API key (free, self-serve)
107
+
108
+ ## Develop this package locally
36
109
 
37
110
  ```bash
111
+ git clone https://github.com/PatrickKish1/create-pollar-app-patrickkish.git
112
+ cd create-pollar-app-patrickkish
38
113
  pnpm install
39
114
  node bin/index.js my-test-app --yes --pm pnpm
40
115
  ```
41
116
 
42
- ## Publish
117
+ ## Publish to npm
118
+
119
+ This package must be **public** so reviewers and users can run `npx` / `pnpm dlx` without npm login:
43
120
 
44
121
  ```bash
45
122
  npm publish --access public
46
123
  ```
47
124
 
125
+ Do **not** use `--access private` for this deliverable — a private package cannot be installed by maintainers testing issue #2.
126
+
127
+ A `prepublishOnly` script blocks publishing if `node_modules` exists inside `template/`.
128
+
48
129
  ## License
49
130
 
50
131
  MIT
package/lib/create.js CHANGED
@@ -5,6 +5,7 @@ import { fileURLToPath } from "node:url";
5
5
  import prompts from "prompts";
6
6
  import { detectPackageManager, installCommand, runCommand } from "./package-manager.js";
7
7
  import { copyTemplate } from "./copy-template.js";
8
+ import { printNextSteps } from "./print-next-steps.js";
8
9
 
9
10
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
11
  const TEMPLATE_DIR = path.join(__dirname, "..", "template");
@@ -99,42 +100,17 @@ export async function createApp(options) {
99
100
  network,
100
101
  });
101
102
 
102
- console.log(`Installing dependencies with ${packageManager}…`);
103
- await runCommand(installCommand(packageManager), targetDir);
104
-
105
103
  console.log("Initializing git repository…");
106
104
  await runCommand("git init", targetDir);
107
105
  await runCommand("git branch -M main", targetDir).catch(() => undefined);
108
- await runCommand("git add .", targetDir);
106
+
107
+ console.log(`Installing dependencies with ${packageManager}…`);
108
+ await runCommand(installCommand(packageManager), targetDir);
109
+
110
+ await runCommand("git add -A", targetDir);
109
111
  await runCommand('git commit -m "Initial commit from create-pollar-app-patrickkish"', targetDir).catch(
110
112
  () => undefined,
111
113
  );
112
114
 
113
- console.log(`
114
- Success! Created ${projectName}
115
-
116
- Next steps:
117
- cd ${projectName}
118
- Set your Pollar API key in .env.local:
119
- NEXT_PUBLIC_POLLAR_API_KEY=pub_testnet_...
120
- Get a key at https://dashboard.pollar.xyz
121
-
122
- ${devCommand(packageManager)}
123
-
124
- Open http://localhost:3000 — log in with WalletButton and try Send USDC from the home screen.
125
- `);
126
- }
127
-
128
- /** @param {string} pm */
129
- function devCommand(pm) {
130
- switch (pm) {
131
- case "pnpm":
132
- return "pnpm dev";
133
- case "yarn":
134
- return "yarn dev";
135
- case "bun":
136
- return "bun run dev";
137
- default:
138
- return "npm run dev";
139
- }
115
+ printNextSteps(projectName, packageManager, network);
140
116
  }
@@ -0,0 +1,62 @@
1
+ /** @param {string} projectName @param {string} packageManager @param {string} network */
2
+ export function printNextSteps(projectName, packageManager, network) {
3
+ const keyVar = "NEXT_PUBLIC_POLLAR_API_KEY";
4
+ const networkVar = "NEXT_PUBLIC_POLLAR_NETWORK";
5
+
6
+ const blocks = {
7
+ pnpm: {
8
+ create: "pnpm dlx create-pollar-app-patrickkish@latest <name>",
9
+ install: "pnpm install",
10
+ dev: "pnpm dev",
11
+ build: "pnpm build",
12
+ },
13
+ npm: {
14
+ create: "npm create create-pollar-app-patrickkish@latest <name>",
15
+ install: "npm install",
16
+ dev: "npm run dev",
17
+ build: "npm run build",
18
+ },
19
+ yarn: {
20
+ create: "yarn create create-pollar-app-patrickkish <name>",
21
+ install: "yarn install",
22
+ dev: "yarn dev",
23
+ build: "yarn build",
24
+ },
25
+ bun: {
26
+ create: "bunx create-pollar-app-patrickkish@latest <name>",
27
+ install: "bun install",
28
+ dev: "bun run dev",
29
+ build: "bun run build",
30
+ },
31
+ };
32
+
33
+ const pm = blocks[packageManager] ?? blocks.npm;
34
+
35
+ console.log(`
36
+ Success! Created ${projectName}
37
+
38
+ Next steps:
39
+
40
+ 1. Go to the project
41
+ cd ${projectName}
42
+
43
+ 2. Add your Pollar API key (testnet: https://dashboard.pollar.xyz)
44
+ Edit .env.local:
45
+ ${keyVar}=pub_testnet_...
46
+ ${networkVar}=${network}
47
+
48
+ 3. Start the dev server
49
+ ${pm.dev}
50
+
51
+ 4. Open http://localhost:3000
52
+ - Log in with WalletButton
53
+ - Use "Send USDC" on the home screen to try a testnet transfer
54
+
55
+ Package manager notes (${packageManager}):
56
+ install: ${pm.install}
57
+ build: ${pm.build}
58
+
59
+ To scaffold another app with ${packageManager}:
60
+ ${pm.create.replace("<name>", "my-pollar-app")} -- --yes --pm ${packageManager}
61
+ `);
62
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pollar-app-patrickkish",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Scaffold a Next.js app with Pollar wallet pre-wired",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,6 +17,7 @@
17
17
  "template"
18
18
  ],
19
19
  "scripts": {
20
+ "prepublishOnly": "node scripts/prepublish-check.js",
20
21
  "test:cli": "node bin/index.js test-app --yes --pm pnpm --network testnet"
21
22
  },
22
23
  "dependencies": {
@@ -1,38 +1,71 @@
1
1
  # Pollar App
2
2
 
3
- A Next.js app scaffolded with [create-pollar-app-patrickkish](https://github.com/PatrickKish1/create-pollar-app-patrickkish). Pollar wallet login, send, receive, balance, assets, and history are provided by the official SDK.
3
+ Next.js starter with [Pollar](https://docs.pollar.xyz) embedded wallet — scaffolded by [create-pollar-app-patrickkish](https://github.com/PatrickKish1/create-pollar-app-patrickkish).
4
4
 
5
5
  ## Get started in 3 steps
6
6
 
7
- 1. **Set your API key** — copy `.env.local` and paste your testnet key from [dashboard.pollar.xyz](https://dashboard.pollar.xyz):
7
+ ### 1. Set your API key
8
8
 
9
- ```bash
10
- NEXT_PUBLIC_POLLAR_API_KEY=pub_testnet_...
11
- ```
9
+ Open `.env.local` and paste your publishable key from [dashboard.pollar.xyz](https://dashboard.pollar.xyz):
12
10
 
13
- 2. **Install and run:**
11
+ ```bash
12
+ NEXT_PUBLIC_POLLAR_API_KEY=pub_testnet_xxxxxxxxxxxxxxxxxxxx
13
+ NEXT_PUBLIC_POLLAR_NETWORK=testnet
14
+ ```
14
15
 
15
- ```bash
16
- pnpm install # or npm / yarn / bun
17
- pnpm dev
18
- ```
16
+ ### 2. Install and run
19
17
 
20
- 3. **Open** [http://localhost:3000](http://localhost:3000) log in with **WalletButton**, then use **Send USDC** on the home screen.
18
+ Use the same package manager you chose when scaffolding:
19
+
20
+ **pnpm**
21
+
22
+ ```bash
23
+ pnpm install # skip if you just scaffolded — deps are already installed
24
+ pnpm dev
25
+ ```
26
+
27
+ **npm**
28
+
29
+ ```bash
30
+ npm install
31
+ npm run dev
32
+ ```
33
+
34
+ **yarn**
35
+
36
+ ```bash
37
+ yarn install
38
+ yarn dev
39
+ ```
40
+
41
+ **bun**
42
+
43
+ ```bash
44
+ bun install
45
+ bun run dev
46
+ ```
47
+
48
+ ### 3. Try it
49
+
50
+ Open [http://localhost:3000](http://localhost:3000):
51
+
52
+ 1. Log in with **WalletButton** (providers come from your Pollar dashboard)
53
+ 2. Click **Send USDC** on the home screen
54
+ 3. Complete a testnet send
55
+
56
+ ## What's included
57
+
58
+ - `PollarProvider` configured from `NEXT_PUBLIC_POLLAR_API_KEY`
59
+ - SDK modals for balance, assets, send, receive, and history
60
+ - eslint + prettier
21
61
 
22
62
  ## Deploy to Vercel
23
63
 
24
- [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new?env=NEXT_PUBLIC_POLLAR_API_KEY,NEXT_PUBLIC_POLLAR_NETWORK&envDescription=Pollar%20publishable%20key%20and%20Stellar%20network&project-name=pollar-app)
64
+ [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?env=NEXT_PUBLIC_POLLAR_API_KEY,NEXT_PUBLIC_POLLAR_NETWORK&envDescription=Pollar%20publishable%20key%20and%20Stellar%20network&project-name=pollar-app)
25
65
 
26
- After deploy, set `NEXT_PUBLIC_POLLAR_API_KEY` in Vercel project settings.
66
+ Add `NEXT_PUBLIC_POLLAR_API_KEY` in your Vercel project settings after deploy.
27
67
 
28
68
  ## Stack
29
69
 
30
- - Next.js 16 (App Router), React 19, TypeScript, Tailwind 4
70
+ - Next.js 16, React 19, TypeScript 5, Tailwind 4
31
71
  - `@pollar/core@^0.9.0`, `@pollar/react@^0.9.0`
32
-
33
- ## Environment
34
-
35
- | Variable | Required | Description |
36
- |----------|----------|-------------|
37
- | `NEXT_PUBLIC_POLLAR_API_KEY` | Yes | Pollar publishable key (`pub_testnet_...`) |
38
- | `NEXT_PUBLIC_POLLAR_NETWORK` | No | `testnet` (default) or `mainnet` |