@vexblocks/cli 1.0.4 → 1.0.5

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -29,6 +29,11 @@ var PACKAGE_NAMES = {
29
29
  types: "Type Generator"
30
30
  };
31
31
  var MANAGED_PACKAGES = ["cms", "shared", "types"];
32
+ var PROTECTED_FILES = [
33
+ "packages/backend/vexblocks.config.ts",
34
+ "packages/backend/.env",
35
+ "packages/backend/.env.local"
36
+ ];
32
37
  var PACKAGE_DEPENDENCIES = {
33
38
  cms: ["backend", "shared"],
34
39
  backend: [],
@@ -110,7 +115,10 @@ async function fetchFile(filePath) {
110
115
  }
111
116
  return response.text();
112
117
  }
113
- async function downloadFile(remotePath, localPath) {
118
+ async function downloadFile(remotePath, localPath, options) {
119
+ if (options?.skipIfExists && await fs2.pathExists(localPath)) {
120
+ return;
121
+ }
114
122
  const url = `${GITHUB_RAW_URL}/${remotePath}`;
115
123
  const response = await fetch(url);
116
124
  if (!response.ok) {
@@ -138,8 +146,13 @@ async function downloadAndExtractPackage(packagePath, targetDir, onProgress) {
138
146
  for (const file of files) {
139
147
  const relativePath = file.path.slice(packagePath.length + 1);
140
148
  const localPath = path2.join(targetDir, relativePath);
149
+ const isProtectedFile = PROTECTED_FILES.some(
150
+ (protectedPath) => file.path.endsWith(protectedPath)
151
+ );
141
152
  onProgress?.(relativePath);
142
- await downloadFile(file.path, localPath);
153
+ await downloadFile(file.path, localPath, {
154
+ skipIfExists: isProtectedFile
155
+ });
143
156
  }
144
157
  }
145
158
  async function getPackageFiles(packagePath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vexblocks/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "CLI for adding VexBlocks Headless CMS to your Turborepo project",
5
5
  "keywords": [
6
6
  "cms",