@vexblocks/cli 1.1.0 → 1.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 +2 -3
- package/dist/index.js +7 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -168,11 +168,10 @@ If you already have a Convex project with a `schema.ts`:
|
|
|
168
168
|
|
|
169
169
|
1. Run `npx @vexblocks/cli add backend`
|
|
170
170
|
2. The CLI will:
|
|
171
|
-
- Create a backup of your schema
|
|
172
171
|
- Add `schema.cms.ts` with CMS tables
|
|
173
|
-
-
|
|
172
|
+
- Automatically merge CMS tables into your schema
|
|
174
173
|
|
|
175
|
-
3.
|
|
174
|
+
3. Your `schema.ts` will be updated to include:
|
|
176
175
|
|
|
177
176
|
```typescript
|
|
178
177
|
import { defineSchema } from "convex/server"
|
package/dist/index.js
CHANGED
|
@@ -30,10 +30,14 @@ var PACKAGE_NAMES = {
|
|
|
30
30
|
};
|
|
31
31
|
var MANAGED_PACKAGES = ["cms", "shared", "types"];
|
|
32
32
|
var PROTECTED_FILES = [
|
|
33
|
-
"packages/backend/vexblocks.config.ts",
|
|
33
|
+
"packages/backend/convex/cms/vexblocks.config.ts",
|
|
34
34
|
"packages/backend/.env",
|
|
35
35
|
"packages/backend/.env.local",
|
|
36
|
-
"packages/cms-shared/src/types/generated.ts"
|
|
36
|
+
"packages/cms-shared/src/types/generated.ts",
|
|
37
|
+
"packages/backend/emails/change-email-template.ts",
|
|
38
|
+
"packages/backend/emails/otp-email-template.ts",
|
|
39
|
+
"packages/backend/emails/delete-account-template.ts",
|
|
40
|
+
"packages/backend/emails/invite-email-template.ts"
|
|
37
41
|
];
|
|
38
42
|
var PACKAGE_DEPENDENCIES = {
|
|
39
43
|
cms: ["backend", "shared"],
|
|
@@ -88,14 +92,6 @@ async function getPackageManager(cwd) {
|
|
|
88
92
|
}
|
|
89
93
|
return "npm";
|
|
90
94
|
}
|
|
91
|
-
async function createBackup(filePath) {
|
|
92
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
93
|
-
const backupPath = `${filePath}.backup-${timestamp}`;
|
|
94
|
-
if (await fs.pathExists(filePath)) {
|
|
95
|
-
await fs.copy(filePath, backupPath);
|
|
96
|
-
}
|
|
97
|
-
return backupPath;
|
|
98
|
-
}
|
|
99
95
|
|
|
100
96
|
// src/utils/github.ts
|
|
101
97
|
import path2 from "path";
|
|
@@ -482,17 +478,13 @@ async function installBackendPackage(targetPath, sourcePath, spinner) {
|
|
|
482
478
|
const hasSchema = await fs4.pathExists(existingSchemaPath);
|
|
483
479
|
if (hasSchema) {
|
|
484
480
|
spinner.text = "Detected existing Convex schema, merging CMS tables...";
|
|
485
|
-
const backupPath = `${existingSchemaPath}.backup-${Date.now()}`;
|
|
486
|
-
await fs4.copy(existingSchemaPath, backupPath);
|
|
487
|
-
logger.info(`Backed up existing schema to ${path4.basename(backupPath)}`);
|
|
488
481
|
const cmsFiles = [
|
|
489
482
|
"convex/cms",
|
|
490
483
|
"convex/auth.ts",
|
|
491
484
|
"convex/auth.config.ts",
|
|
492
485
|
"convex/http.ts",
|
|
493
486
|
"better-auth",
|
|
494
|
-
"emails"
|
|
495
|
-
"vexblocks.config.ts"
|
|
487
|
+
"emails"
|
|
496
488
|
];
|
|
497
489
|
for (const file of cmsFiles) {
|
|
498
490
|
const fullSourcePath = `${sourcePath}/${file}`;
|
|
@@ -1152,8 +1144,6 @@ async function upgradePackage(cwd, pkg, version, manifest, options) {
|
|
|
1152
1144
|
}
|
|
1153
1145
|
const isManaged = MANAGED_PACKAGES.includes(pkg);
|
|
1154
1146
|
if (isManaged || options.force) {
|
|
1155
|
-
const backupPath = await createBackup(targetPath);
|
|
1156
|
-
spinner.text = `Created backup at ${path7.basename(backupPath)}`;
|
|
1157
1147
|
await fs7.remove(targetPath);
|
|
1158
1148
|
const sourcePath = getSourcePath2(pkg);
|
|
1159
1149
|
await downloadAndExtractPackage(sourcePath, targetPath, (file) => {
|
|
@@ -1165,9 +1155,6 @@ async function upgradePackage(cwd, pkg, version, manifest, options) {
|
|
|
1165
1155
|
for (const file of cmsFiles) {
|
|
1166
1156
|
const targetFilePath = path7.join(targetPath, file);
|
|
1167
1157
|
const sourceFilePath = `packages/backend/${file}`;
|
|
1168
|
-
if (await fs7.pathExists(targetFilePath)) {
|
|
1169
|
-
await createBackup(targetFilePath);
|
|
1170
|
-
}
|
|
1171
1158
|
try {
|
|
1172
1159
|
await fs7.remove(targetFilePath);
|
|
1173
1160
|
await downloadAndExtractPackage(sourceFilePath, targetFilePath);
|