@clubedge/create-clubedge-app 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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to `create-clubedge-app` are documented here.
4
4
 
5
+ ## 0.1.2
6
+
7
+ - Customize the landing page, sidebar, dashboard, sign-in page, and metadata with the generated project name.
8
+ - Add automated tests for project naming and generated-file customization.
9
+
10
+ ## 0.1.1
11
+
12
+ - Keep CLI spinners out of Git and pnpm subprocess output so terminal progress remains readable.
13
+
5
14
  ## 0.1.0
6
15
 
7
16
  - Initial CLI release: scaffold the Clubedge Starter reference repository into a new project directory.
package/README.md CHANGED
@@ -33,7 +33,7 @@ cd my-app
33
33
  pnpm dev
34
34
  ```
35
35
 
36
- The generated project includes `.env.local`; fill in `DATABASE_URL` to start the app and configure Supabase Auth or other providers as needed. See its `SETUP.md` for database, Redis, storage, and Docker setup.
36
+ The generated project includes `.env.local`; fill in `DATABASE_URL` to start the app and configure Supabase Auth or other providers as needed. The root route is a project-named landing page, and the reference dashboard is available at `/dashboard`. See its `SETUP.md` for database, Redis, storage, and Docker setup.
37
37
 
38
38
  When no destination is provided, the CLI asks where to create the project:
39
39
 
package/bin/create.mjs CHANGED
@@ -6,6 +6,7 @@ import { cp, mkdir, readdir, readFile, writeFile } from "node:fs/promises";
6
6
  import { spawn } from "node:child_process";
7
7
  import { basename, dirname, join, resolve } from "node:path";
8
8
  import process from "node:process";
9
+ import { pathToFileURL } from "node:url";
9
10
 
10
11
  const starterRepository = "yassine-ahmed/clubedge-starter";
11
12
  const defaultRef = "main";
@@ -160,9 +161,36 @@ async function customizeProject(directory, packageName) {
160
161
  const layout = await readFile(layoutPath, "utf8");
161
162
  const customizedLayout = layout
162
163
  .replaceAll('"Clubedge Starter"', JSON.stringify(displayName))
163
- .replace("A production-minded foundation for Clubedge applications.", `A web application built with Clubedge Starter.`);
164
+ .replace(`%s \u00b7 Clubedge Starter`, `%s \u00b7 ${displayName}`)
165
+ .replace(
166
+ "A production-minded foundation for Clubedge applications.",
167
+ `${displayName} application foundation.`,
168
+ );
164
169
  await writeFile(layoutPath, customizedLayout);
165
170
 
171
+ const appFiles = [
172
+ join(directory, "apps", "web", "src", "app", "page.tsx"),
173
+ join(directory, "apps", "web", "src", "app", "app-sidebar.tsx"),
174
+ join(directory, "apps", "web", "src", "app", "dashboard", "page.tsx"),
175
+ join(directory, "apps", "web", "src", "app", "login", "page.tsx"),
176
+ ];
177
+ for (const appFile of appFiles) {
178
+ let source;
179
+ try {
180
+ source = await readFile(appFile, "utf8");
181
+ } catch (error) {
182
+ if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
183
+ continue;
184
+ }
185
+ throw error;
186
+ }
187
+ const customizedSource = source
188
+ .replaceAll("Clubedge Starter", displayName)
189
+ .replaceAll('>Clubedge<', `>${displayName}<`)
190
+ .replaceAll("Starter workspace", "Application workspace");
191
+ await writeFile(appFile, customizedSource);
192
+ }
193
+
166
194
  const exampleEnvironment = join(directory, ".env.example");
167
195
  const localEnvironment = join(directory, "apps", "web", ".env.local");
168
196
  await cp(exampleEnvironment, localEnvironment, { errorOnExist: true });
@@ -212,20 +240,18 @@ async function createProject(options) {
212
240
  }
213
241
 
214
242
  if (options.git) {
215
- const gitSpinner = spinner();
216
- gitSpinner.start("Initializing Git");
243
+ console.log("\nInitializing Git...");
217
244
  await initializeGit(projectDirectory);
218
- gitSpinner.stop("Git repository initialized on main");
245
+ console.log("Git repository initialized on main");
219
246
  }
220
247
 
221
248
  if (options.install) {
222
- const installSpinner = spinner();
223
- installSpinner.start("Installing dependencies with pnpm");
249
+ console.log("\nInstalling dependencies with pnpm...\n");
224
250
  try {
225
251
  await run("pnpm", ["install"], projectDirectory);
226
- installSpinner.stop("Dependencies installed");
252
+ console.log("\nDependencies installed");
227
253
  } catch (error) {
228
- installSpinner.stop("Project created; dependency installation did not complete");
254
+ console.error("\nProject created; dependency installation did not complete.");
229
255
  console.error(error instanceof Error ? error.message : error);
230
256
  console.error("Install pnpm with Corepack, then run `pnpm install` in the new project.");
231
257
  }
@@ -257,4 +283,8 @@ async function main() {
257
283
  }
258
284
  }
259
285
 
260
- await main();
286
+ export { customizeProject, displayNameFromPackageName, packageNameFromDirectory };
287
+
288
+ if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
289
+ await main();
290
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clubedge/create-clubedge-app",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Create a Next.js application from the Clubedge Starter reference implementation.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.9.0",
@@ -35,7 +35,8 @@
35
35
  ],
36
36
  "scripts": {
37
37
  "start": "node ./bin/create.mjs",
38
- "check": "node --check ./bin/create.mjs"
38
+ "check": "node --check ./bin/create.mjs",
39
+ "test": "node --test"
39
40
  },
40
41
  "dependencies": {
41
42
  "@clack/prompts": "^1.8.1",