vercel-vm-factory 0.17.8 → 0.18.8
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/config.mjs +11 -0
- package/deploy-vm.mjs +22 -2
- package/package.json +1 -1
package/config.mjs
CHANGED
|
@@ -14,6 +14,17 @@ export const toolChoices = {
|
|
|
14
14
|
"claude-code": "Claude Code",
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
export const projectNameSuffixes = [
|
|
18
|
+
"juddy",
|
|
19
|
+
"nova",
|
|
20
|
+
"orbit",
|
|
21
|
+
"pixel",
|
|
22
|
+
"spark",
|
|
23
|
+
"ripple",
|
|
24
|
+
"atlas",
|
|
25
|
+
"echo",
|
|
26
|
+
];
|
|
27
|
+
|
|
17
28
|
export const codeDefaults = {
|
|
18
29
|
"vm-image": "alpine",
|
|
19
30
|
from: defaultWsShellImage,
|
package/deploy-vm.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import * as p from "@clack/prompts";
|
|
|
9
9
|
import {
|
|
10
10
|
codeDefaults,
|
|
11
11
|
defaultWsShellImage,
|
|
12
|
+
projectNameSuffixes,
|
|
12
13
|
shells,
|
|
13
14
|
toolChoices,
|
|
14
15
|
vmImages,
|
|
@@ -79,7 +80,7 @@ async function main() {
|
|
|
79
80
|
const project = await value(
|
|
80
81
|
"project",
|
|
81
82
|
"Vercel project name",
|
|
82
|
-
defaults.project
|
|
83
|
+
defaultProjectName(vmImageName, defaults.project),
|
|
83
84
|
);
|
|
84
85
|
const wsShellImage =
|
|
85
86
|
args.from ??
|
|
@@ -528,6 +529,23 @@ function usesGitHubAuth(mode) {
|
|
|
528
529
|
return mode === "github" || mode === "both";
|
|
529
530
|
}
|
|
530
531
|
|
|
532
|
+
function defaultProjectName(vmImageName, savedProject) {
|
|
533
|
+
if (savedProject && !["undefined", "null"].includes(String(savedProject)))
|
|
534
|
+
return savedProject;
|
|
535
|
+
const suffix =
|
|
536
|
+
projectNameSuffixes[
|
|
537
|
+
Math.abs(hashText(vmImageName)) % projectNameSuffixes.length
|
|
538
|
+
];
|
|
539
|
+
return `${vmImageName}-${suffix}`;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
function hashText(text) {
|
|
543
|
+
return [...String(text)].reduce(
|
|
544
|
+
(hash, char) => (hash * 31 + char.charCodeAt(0)) | 0,
|
|
545
|
+
0,
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
|
|
531
549
|
async function chooseVmImage(fallback) {
|
|
532
550
|
if (args["vm-image"]) return args["vm-image"];
|
|
533
551
|
if (args.base) return args.base;
|
|
@@ -716,7 +734,9 @@ function cleanDefaults(data) {
|
|
|
716
734
|
delete migrated["custom-base"];
|
|
717
735
|
|
|
718
736
|
const clean = Object.fromEntries(
|
|
719
|
-
Object.entries(migrated).filter(
|
|
737
|
+
Object.entries(migrated).filter(
|
|
738
|
+
([, value]) => value && !["undefined", "null"].includes(String(value)),
|
|
739
|
+
),
|
|
720
740
|
);
|
|
721
741
|
return Object.fromEntries(
|
|
722
742
|
Object.entries(clean).sort(([a], [b]) => a.localeCompare(b)),
|