@stormycms/cli 0.0.25 → 0.0.27
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/boilerplate.zip +0 -0
- package/dist/cli.js +12 -1
- package/dist/index.js +12 -1
- package/dist/index.mjs +12 -1
- package/package.json +1 -1
package/boilerplate.zip
CHANGED
|
Binary file
|
package/dist/cli.js
CHANGED
|
@@ -376,6 +376,16 @@ function isDefaultUrl(value) {
|
|
|
376
376
|
function groupMissingKeys(values) {
|
|
377
377
|
return Object.entries(values).filter(([_key, value]) => !isDefaultUrl(value) && isPlaceholder(value)).map(([key]) => key);
|
|
378
378
|
}
|
|
379
|
+
function validateEnvValue(key, value) {
|
|
380
|
+
if (value === "") return true;
|
|
381
|
+
if (key === "STORMY_CMS_CLIENT_SECRET" && !/^sk_[A-Za-z0-9]+$/.test(value)) {
|
|
382
|
+
return "A client secret is sk_ followed by letters and digits only. Copy it again from the Keys page.";
|
|
383
|
+
}
|
|
384
|
+
if (key === "STORMY_CMS_CLIENT_ID" && !/^[A-Za-z0-9_]+$/.test(value)) {
|
|
385
|
+
return "A client ID has letters, digits and underscores only. Copy it again from the Keys page.";
|
|
386
|
+
}
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
379
389
|
async function promptEnvValues(targetDir, skipEnv) {
|
|
380
390
|
const answers = {};
|
|
381
391
|
if (skipEnv) {
|
|
@@ -403,7 +413,8 @@ async function promptEnvValues(targetDir, skipEnv) {
|
|
|
403
413
|
const response = await (0, import_prompts.default)({
|
|
404
414
|
type: key.includes("SECRET") ? "password" : "text",
|
|
405
415
|
name: "value",
|
|
406
|
-
message: `${key} (${relativePaths.join(", ")})
|
|
416
|
+
message: `${key} (${relativePaths.join(", ")})`,
|
|
417
|
+
validate: (value) => validateEnvValue(key, value)
|
|
407
418
|
});
|
|
408
419
|
if (!response.value) continue;
|
|
409
420
|
for (const relativePath of relativePaths) {
|
package/dist/index.js
CHANGED
|
@@ -312,6 +312,16 @@ function isDefaultUrl(value) {
|
|
|
312
312
|
function groupMissingKeys(values) {
|
|
313
313
|
return Object.entries(values).filter(([_key, value]) => !isDefaultUrl(value) && isPlaceholder(value)).map(([key]) => key);
|
|
314
314
|
}
|
|
315
|
+
function validateEnvValue(key, value) {
|
|
316
|
+
if (value === "") return true;
|
|
317
|
+
if (key === "STORMY_CMS_CLIENT_SECRET" && !/^sk_[A-Za-z0-9]+$/.test(value)) {
|
|
318
|
+
return "A client secret is sk_ followed by letters and digits only. Copy it again from the Keys page.";
|
|
319
|
+
}
|
|
320
|
+
if (key === "STORMY_CMS_CLIENT_ID" && !/^[A-Za-z0-9_]+$/.test(value)) {
|
|
321
|
+
return "A client ID has letters, digits and underscores only. Copy it again from the Keys page.";
|
|
322
|
+
}
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
315
325
|
async function promptEnvValues(targetDir, skipEnv) {
|
|
316
326
|
const answers = {};
|
|
317
327
|
if (skipEnv) {
|
|
@@ -339,7 +349,8 @@ async function promptEnvValues(targetDir, skipEnv) {
|
|
|
339
349
|
const response = await (0, import_prompts.default)({
|
|
340
350
|
type: key.includes("SECRET") ? "password" : "text",
|
|
341
351
|
name: "value",
|
|
342
|
-
message: `${key} (${relativePaths.join(", ")})
|
|
352
|
+
message: `${key} (${relativePaths.join(", ")})`,
|
|
353
|
+
validate: (value) => validateEnvValue(key, value)
|
|
343
354
|
});
|
|
344
355
|
if (!response.value) continue;
|
|
345
356
|
for (const relativePath of relativePaths) {
|
package/dist/index.mjs
CHANGED
|
@@ -269,6 +269,16 @@ function isDefaultUrl(value) {
|
|
|
269
269
|
function groupMissingKeys(values) {
|
|
270
270
|
return Object.entries(values).filter(([_key, value]) => !isDefaultUrl(value) && isPlaceholder(value)).map(([key]) => key);
|
|
271
271
|
}
|
|
272
|
+
function validateEnvValue(key, value) {
|
|
273
|
+
if (value === "") return true;
|
|
274
|
+
if (key === "STORMY_CMS_CLIENT_SECRET" && !/^sk_[A-Za-z0-9]+$/.test(value)) {
|
|
275
|
+
return "A client secret is sk_ followed by letters and digits only. Copy it again from the Keys page.";
|
|
276
|
+
}
|
|
277
|
+
if (key === "STORMY_CMS_CLIENT_ID" && !/^[A-Za-z0-9_]+$/.test(value)) {
|
|
278
|
+
return "A client ID has letters, digits and underscores only. Copy it again from the Keys page.";
|
|
279
|
+
}
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
272
282
|
async function promptEnvValues(targetDir, skipEnv) {
|
|
273
283
|
const answers = {};
|
|
274
284
|
if (skipEnv) {
|
|
@@ -296,7 +306,8 @@ async function promptEnvValues(targetDir, skipEnv) {
|
|
|
296
306
|
const response = await prompts({
|
|
297
307
|
type: key.includes("SECRET") ? "password" : "text",
|
|
298
308
|
name: "value",
|
|
299
|
-
message: `${key} (${relativePaths.join(", ")})
|
|
309
|
+
message: `${key} (${relativePaths.join(", ")})`,
|
|
310
|
+
validate: (value) => validateEnvValue(key, value)
|
|
300
311
|
});
|
|
301
312
|
if (!response.value) continue;
|
|
302
313
|
for (const relativePath of relativePaths) {
|