create-bw-app 0.24.0 → 0.24.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-bw-app",
3
3
  "private": false,
4
- "version": "0.24.0",
4
+ "version": "0.24.1",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "create-bw-app": "bin/create-bw-app.mjs",
package/src/constants.mjs CHANGED
@@ -84,6 +84,7 @@ export const MODULE_STARTER_FILES = {
84
84
  "app/api/marketing/analytics/overview/route.ts",
85
85
  "app/api/marketing/analytics/segments/[id]/route.ts",
86
86
  "app/api/marketing/campaigns/[id]/cancel/route.ts",
87
+ "app/api/marketing/campaigns/[id]/recipients/[recipientId]/route.ts",
87
88
  "app/api/marketing/campaigns/[id]/recipients/route.ts",
88
89
  "app/api/marketing/campaigns/[id]/retry/route.ts",
89
90
  "app/api/marketing/campaigns/[id]/route.ts",
@@ -156,6 +157,7 @@ export const PLATFORM_STARTER_FILES = [
156
157
  "app/(shell)/dashboard/dashboard-live-mount.tsx",
157
158
  "app/(shell)/dashboard/page.tsx",
158
159
  "app/api/account/route.ts",
160
+ "app/api/notifications/route.ts",
159
161
  "app/api/cron/keepalive/route.ts",
160
162
  "app/api/invitations/_dependencies.ts",
161
163
  "app/api/invitations/[invitationId]/route.ts",
package/src/update.mjs CHANGED
@@ -55,6 +55,10 @@ const MODULE_SELECTED_PLATFORM_FILES = new Set([
55
55
  path.join("app", "api", "organizations", "[id]", "invitations", "[invitationId]", "route.ts"),
56
56
  ]);
57
57
 
58
+ const REFRESHABLE_PLATFORM_STARTER_FILES = new Set([
59
+ path.join("app", "api", "notifications", "route.ts"),
60
+ ]);
61
+
58
62
  function resolveUpdateTargetDirectory(runtimeOptions, argvOptions) {
59
63
  if (runtimeOptions.targetDir || argvOptions.targetDir) {
60
64
  return path.resolve(runtimeOptions.targetDir || argvOptions.targetDir);
@@ -276,7 +280,7 @@ async function getStarterFileStatus(targetDir, installedModules) {
276
280
  sourcePath,
277
281
  targetPath,
278
282
  status: "missing",
279
- refreshable: false,
283
+ refreshable: REFRESHABLE_PLATFORM_STARTER_FILES.has(relativePath),
280
284
  });
281
285
  continue;
282
286
  }
@@ -307,7 +311,7 @@ async function getStarterFileStatus(targetDir, installedModules) {
307
311
  sourcePath,
308
312
  targetPath,
309
313
  status: sourceContent === targetContent ? "current" : "drifted",
310
- refreshable: false,
314
+ refreshable: REFRESHABLE_PLATFORM_STARTER_FILES.has(relativePath),
311
315
  });
312
316
  }
313
317
 
@@ -586,6 +590,7 @@ export async function buildBrightwebAppUpdatePlan(argvOptions = {}, runtimeOptio
586
590
  for (const entry of starterFiles.filter((candidate) =>
587
591
  candidate.status !== "current" && (candidate.status === "missing" || candidate.refreshable !== false))) {
588
592
  fileWrites.push({
593
+ moduleKey: entry.moduleKey,
589
594
  relativePath: entry.relativePath,
590
595
  targetPath: entry.targetPath,
591
596
  content: await fs.readFile(entry.sourcePath, "utf8"),
package/src/upgrade.mjs CHANGED
@@ -62,11 +62,20 @@ export async function upgradeBrightwebApp(moduleKey, argvOptions = {}, runtimeOp
62
62
  for (const [key, entry] of Object.entries(appManifest.modules)) {
63
63
  if (catalog[key]?.packageRoot) entry.version = catalog[key].version;
64
64
  }
65
- for (const relativePath of plan.starterFilesToRefresh || []) {
65
+ for (const write of plan.fileWrites.filter((entry) => entry.type === "starter")) {
66
+ const relativePath = write.relativePath;
66
67
  const targetPath = resolveSafeRelativePath(targetDir, relativePath, "Manifest scaffold file path");
67
- if (!protectedPaths.has(relativePath) && appManifest.scaffoldFiles[relativePath] && await pathExists(targetPath)) {
68
- appManifest.scaffoldFiles[relativePath].hash = await hashFile(targetPath);
68
+ if (protectedPaths.has(relativePath) || !(await pathExists(targetPath))) continue;
69
+ const hash = await hashFile(targetPath);
70
+ if (appManifest.scaffoldFiles[relativePath]) {
71
+ appManifest.scaffoldFiles[relativePath].hash = hash;
69
72
  appManifest.scaffoldFiles[relativePath].status = "current";
73
+ } else {
74
+ appManifest.scaffoldFiles[relativePath] = {
75
+ module: write.moduleKey || "platform-base",
76
+ hash,
77
+ status: "current",
78
+ };
70
79
  }
71
80
  }
72
81
  await writeAppManifest(targetDir, appManifest);