@clubedge/create-clubedge-app 0.1.1 → 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,11 @@
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
+
5
10
  ## 0.1.1
6
11
 
7
12
  - Keep CLI spinners out of Git and pnpm subprocess output so terminal progress remains readable.
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 });
@@ -255,4 +283,8 @@ async function main() {
255
283
  }
256
284
  }
257
285
 
258
- 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.1",
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",