create-pollar-app-patrickkish 0.1.0 → 0.1.2

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,150 @@
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
+ The issue acceptance path is **`npx`** — it works for everyone regardless of which package manager you use in the generated app.
10
+
11
+ ### npx (primary — issue #2 flow)
12
+
13
+ ```bash
14
+ npx 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
+ npm run dev
18
+ ```
19
+
20
+ Non-interactive:
21
+
22
+ ```bash
23
+ npx create-pollar-app-patrickkish@latest my-pollar-app --yes --pm pnpm --network testnet
24
+ ```
25
+
26
+ Use `--pm` to pick the package manager for the **new app** (defaults to npm when invoked via npx).
27
+
28
+ ### pnpm (team preference)
29
+
30
+ ```bash
31
+ pnpm dlx create-pollar-app-patrickkish@latest my-pollar-app
32
+ cd my-pollar-app
33
+ # edit .env.local — set NEXT_PUBLIC_POLLAR_API_KEY=pub_testnet_...
34
+ pnpm dev
35
+ ```
36
+
37
+ Non-interactive:
38
+
39
+ ```bash
40
+ pnpm dlx create-pollar-app-patrickkish@latest my-pollar-app -- --yes --pm pnpm --network testnet
41
+ ```
42
+
43
+ ### npm
44
+
45
+ Equivalent to npx (no `npx` prefix needed):
46
+
47
+ ```bash
48
+ npm create create-pollar-app-patrickkish@latest my-pollar-app
49
+ cd my-pollar-app
50
+ # edit .env.local
51
+ npm run dev
52
+ ```
53
+
54
+ Non-interactive:
6
55
 
7
56
  ```bash
8
- # Interactive (pnpm recommended)
9
- pnpm dlx create-pollar-app-patrickkish my-app
57
+ npm create create-pollar-app-patrickkish@latest my-pollar-app -- --yes --pm npm --network testnet
58
+ ```
59
+
60
+ ### yarn
10
61
 
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
62
+ ```bash
63
+ yarn create create-pollar-app-patrickkish my-pollar-app
64
+ cd my-pollar-app
65
+ # edit .env.local
66
+ yarn dev
67
+ ```
68
+
69
+ Non-interactive:
70
+
71
+ ```bash
72
+ yarn create create-pollar-app-patrickkish my-pollar-app --yes --pm yarn --network testnet
16
73
  ```
17
74
 
18
- ### Flags
75
+ ### bun
76
+
77
+ ```bash
78
+ bunx create-pollar-app-patrickkish@latest my-pollar-app
79
+ cd my-pollar-app
80
+ # edit .env.local
81
+ bun run dev
82
+ ```
83
+
84
+ Non-interactive:
85
+
86
+ ```bash
87
+ bunx create-pollar-app-patrickkish@latest my-pollar-app --yes --pm bun --network testnet
88
+ ```
89
+
90
+ ## What you get
91
+
92
+ The generated app includes:
93
+
94
+ - **Next.js 16** App Router, **React 19**, TypeScript, **Tailwind 4**
95
+ - `@pollar/core@^0.9.0` and `@pollar/react@^0.9.0`
96
+ - `PollarProvider` in the root layout
97
+ - Login via **`WalletButton`**
98
+ - Home screen actions that open SDK modals: balance, assets, send (USDC example), receive, history
99
+ - `.env.example`, eslint, prettier, and a README with a Deploy to Vercel button
100
+
101
+ No backend and no secret keys — client-side only.
102
+
103
+ ## CLI flags
19
104
 
20
105
  | Flag | Description |
21
106
  |------|-------------|
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` |
107
+ | `--yes` / `-y` | Skip prompts (uses detected package manager + testnet) |
108
+ | `--pm <npm\|pnpm\|yarn\|bun>` | Package manager for installing the new app |
109
+ | `--network <testnet\|mainnet>` | Written to `.env.local` as `NEXT_PUBLIC_POLLAR_NETWORK` |
25
110
 
26
- When you run via `pnpm dlx`, the default package manager is **pnpm**. Same for `npm create`, `yarn create`, and `bunx`.
111
+ When you skip `--pm`, the CLI picks the manager that invoked it (`pnpm dlx` pnpm, `npm create` npm, etc.).
27
112
 
28
- ## Generated app
113
+ ## Environment variables
29
114
 
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
115
+ | Variable | Required | Description |
116
+ |----------|----------|-------------|
117
+ | `NEXT_PUBLIC_POLLAR_API_KEY` | Yes | Publishable key from [dashboard.pollar.xyz](https://dashboard.pollar.xyz) (`pub_testnet_...`) |
118
+ | `NEXT_PUBLIC_POLLAR_NETWORK` | No | `testnet` (default) or `mainnet` |
34
119
 
35
- ## Develop this CLI
120
+ Get a testnet key at **dashboard.pollar.xyz → Configuration → API Keys**.
121
+
122
+ ## Requirements
123
+
124
+ - Node.js **20+**
125
+ - A Pollar publishable API key (free, self-serve)
126
+
127
+ ## Develop this package locally
36
128
 
37
129
  ```bash
130
+ git clone https://github.com/PatrickKish1/create-pollar-app-patrickkish.git
131
+ cd create-pollar-app-patrickkish
38
132
  pnpm install
39
133
  node bin/index.js my-test-app --yes --pm pnpm
40
134
  ```
41
135
 
42
- ## Publish
136
+ ## Publish to npm
137
+
138
+ This package must be **public** so reviewers and users can run `npx` / `pnpm dlx` without npm login:
43
139
 
44
140
  ```bash
45
141
  npm publish --access public
46
142
  ```
47
143
 
144
+ Do **not** use `--access private` for this deliverable — a private package cannot be installed by maintainers testing issue #2.
145
+
146
+ A `prepublishOnly` script blocks publishing if `node_modules` exists inside `template/`.
147
+
48
148
  ## License
49
149
 
50
150
  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,64 @@
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: "npx 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
+ const rescaffoldFlags = `--yes --pm ${packageManager}`;
35
+ const rescaffoldSep = packageManager === "pnpm" ? " -- " : " ";
36
+
37
+ console.log(`
38
+ Success! Created ${projectName}
39
+
40
+ Next steps:
41
+
42
+ 1. Go to the project
43
+ cd ${projectName}
44
+
45
+ 2. Add your Pollar API key (testnet: https://dashboard.pollar.xyz)
46
+ Edit .env.local:
47
+ ${keyVar}=pub_testnet_...
48
+ ${networkVar}=${network}
49
+
50
+ 3. Start the dev server
51
+ ${pm.dev}
52
+
53
+ 4. Open http://localhost:3000
54
+ - Log in with WalletButton
55
+ - Use "Send USDC" on the home screen to try a testnet transfer
56
+
57
+ Package manager notes (${packageManager}):
58
+ install: ${pm.install}
59
+ build: ${pm.build}
60
+
61
+ To scaffold another app with ${packageManager}:
62
+ ${pm.create.replace("<name>", "my-pollar-app")}${rescaffoldSep}${rescaffoldFlags}
63
+ `);
64
+ }
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.2",
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` |