create-bcp-app 0.1.27 → 0.1.28
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 +1 -1
- package/src/storage-options.mjs +29 -1
package/package.json
CHANGED
package/src/storage-options.mjs
CHANGED
|
@@ -8,14 +8,23 @@ export const STORAGE_CHOICES = [
|
|
|
8
8
|
"cloudflare-r2",
|
|
9
9
|
];
|
|
10
10
|
|
|
11
|
+
const LOCAL_STORAGE_README = `# Local storage\n\nBCP writes local storage objects into this directory at runtime.\n\nApplication code should import the configured adapter from \`lib/storage.ts\` instead of reading or writing files here directly. BCP may also create an internal \`.bcp-storage-meta\` directory for object metadata.\n\nRuntime objects are ignored by Git. Keep this README and \`.gitkeep\` file so a newly generated project has an explicit local-storage directory before the first upload.\n`;
|
|
12
|
+
|
|
11
13
|
const STORAGE_PRESETS = {
|
|
12
14
|
local: {
|
|
13
15
|
env: [
|
|
14
16
|
"STORAGE_LOCAL_DIRECTORY=./storage",
|
|
15
17
|
],
|
|
16
18
|
gitIgnore: [
|
|
17
|
-
"storage
|
|
19
|
+
"storage/*",
|
|
20
|
+
"!storage/.gitkeep",
|
|
21
|
+
"!storage/README.md",
|
|
18
22
|
],
|
|
23
|
+
files: {
|
|
24
|
+
"storage/.gitkeep": "",
|
|
25
|
+
"storage/README.md":
|
|
26
|
+
LOCAL_STORAGE_README,
|
|
27
|
+
},
|
|
19
28
|
source: `import "bcp/server-only";
|
|
20
29
|
|
|
21
30
|
import {
|
|
@@ -40,6 +49,7 @@ export const storage =
|
|
|
40
49
|
"AWS_S3_PREFIX=",
|
|
41
50
|
],
|
|
42
51
|
gitIgnore: [],
|
|
52
|
+
files: {},
|
|
43
53
|
source: `import "bcp/server-only";
|
|
44
54
|
|
|
45
55
|
import {
|
|
@@ -111,6 +121,7 @@ function optionalEnvironmentVariable(
|
|
|
111
121
|
"R2_PREFIX=",
|
|
112
122
|
],
|
|
113
123
|
gitIgnore: [],
|
|
124
|
+
files: {},
|
|
114
125
|
source: `import "bcp/server-only";
|
|
115
126
|
|
|
116
127
|
import {
|
|
@@ -224,6 +235,23 @@ export function applyStorageOption({
|
|
|
224
235
|
"lib/storage.ts",
|
|
225
236
|
preset.source
|
|
226
237
|
);
|
|
238
|
+
|
|
239
|
+
for (
|
|
240
|
+
const [
|
|
241
|
+
relativePath,
|
|
242
|
+
content,
|
|
243
|
+
]
|
|
244
|
+
of Object.entries(
|
|
245
|
+
preset.files
|
|
246
|
+
)
|
|
247
|
+
) {
|
|
248
|
+
writeFile(
|
|
249
|
+
targetDirectory,
|
|
250
|
+
relativePath,
|
|
251
|
+
content
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
227
255
|
appendEnvExample(
|
|
228
256
|
targetDirectory,
|
|
229
257
|
preset.env,
|