@vexblocks/cli 1.1.0 → 1.1.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/README.md +2 -3
- package/dist/index.js +2 -26
- 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,7 +30,7 @@ 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
36
|
"packages/cms-shared/src/types/generated.ts"
|
|
@@ -88,14 +88,6 @@ async function getPackageManager(cwd) {
|
|
|
88
88
|
}
|
|
89
89
|
return "npm";
|
|
90
90
|
}
|
|
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
91
|
|
|
100
92
|
// src/utils/github.ts
|
|
101
93
|
import path2 from "path";
|
|
@@ -482,18 +474,7 @@ async function installBackendPackage(targetPath, sourcePath, spinner) {
|
|
|
482
474
|
const hasSchema = await fs4.pathExists(existingSchemaPath);
|
|
483
475
|
if (hasSchema) {
|
|
484
476
|
spinner.text = "Detected existing Convex schema, merging CMS tables...";
|
|
485
|
-
const
|
|
486
|
-
await fs4.copy(existingSchemaPath, backupPath);
|
|
487
|
-
logger.info(`Backed up existing schema to ${path4.basename(backupPath)}`);
|
|
488
|
-
const cmsFiles = [
|
|
489
|
-
"convex/cms",
|
|
490
|
-
"convex/auth.ts",
|
|
491
|
-
"convex/auth.config.ts",
|
|
492
|
-
"convex/http.ts",
|
|
493
|
-
"better-auth",
|
|
494
|
-
"emails",
|
|
495
|
-
"vexblocks.config.ts"
|
|
496
|
-
];
|
|
477
|
+
const cmsFiles = ["convex/cms", "convex/auth.ts", "convex/auth.config.ts", "convex/http.ts", "better-auth", "emails"];
|
|
497
478
|
for (const file of cmsFiles) {
|
|
498
479
|
const fullSourcePath = `${sourcePath}/${file}`;
|
|
499
480
|
const fullTargetPath = path4.join(targetPath, file);
|
|
@@ -1152,8 +1133,6 @@ async function upgradePackage(cwd, pkg, version, manifest, options) {
|
|
|
1152
1133
|
}
|
|
1153
1134
|
const isManaged = MANAGED_PACKAGES.includes(pkg);
|
|
1154
1135
|
if (isManaged || options.force) {
|
|
1155
|
-
const backupPath = await createBackup(targetPath);
|
|
1156
|
-
spinner.text = `Created backup at ${path7.basename(backupPath)}`;
|
|
1157
1136
|
await fs7.remove(targetPath);
|
|
1158
1137
|
const sourcePath = getSourcePath2(pkg);
|
|
1159
1138
|
await downloadAndExtractPackage(sourcePath, targetPath, (file) => {
|
|
@@ -1165,9 +1144,6 @@ async function upgradePackage(cwd, pkg, version, manifest, options) {
|
|
|
1165
1144
|
for (const file of cmsFiles) {
|
|
1166
1145
|
const targetFilePath = path7.join(targetPath, file);
|
|
1167
1146
|
const sourceFilePath = `packages/backend/${file}`;
|
|
1168
|
-
if (await fs7.pathExists(targetFilePath)) {
|
|
1169
|
-
await createBackup(targetFilePath);
|
|
1170
|
-
}
|
|
1171
1147
|
try {
|
|
1172
1148
|
await fs7.remove(targetFilePath);
|
|
1173
1149
|
await downloadAndExtractPackage(sourceFilePath, targetFilePath);
|