vercel-vm-factory 0.17.8 → 0.19.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/README.md +1 -1
- package/config.mjs +11 -0
- package/deploy-vm.mjs +24 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ Choosing bash or zsh adds the matching package to the generated Dockerfile when
|
|
|
78
78
|
|
|
79
79
|
Generated shell setup examples:
|
|
80
80
|
|
|
81
|
-
- Alpine + `/bin/zsh`: installs `zsh curl git`, clones oh-my-zsh into `/root/.oh-my-zsh`, and writes `/root/.zshrc`.
|
|
81
|
+
- Alpine + `/bin/zsh`: installs `zsh curl git ca-certificates`, clones oh-my-zsh into `/root/.oh-my-zsh`, and writes `/root/.zshrc`.
|
|
82
82
|
- Ubuntu/Debian + `/bin/bash`: installs `bash` with `apt-get`.
|
|
83
83
|
- `/bin/sh`: no extra shell package is installed.
|
|
84
84
|
|
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 ??
|
|
@@ -434,7 +435,8 @@ function makeToolInstall({ tools, vmImageName }) {
|
|
|
434
435
|
function makeShellInstall({ shell, vmImageName }) {
|
|
435
436
|
const packageName = path.basename(shell);
|
|
436
437
|
if (packageName === "sh") return "";
|
|
437
|
-
const packages =
|
|
438
|
+
const packages =
|
|
439
|
+
packageName === "zsh" ? "zsh curl git ca-certificates" : packageName;
|
|
438
440
|
|
|
439
441
|
if (vmImageName === "alpine")
|
|
440
442
|
return `RUN apk add --no-cache ${packages}`;
|
|
@@ -528,6 +530,23 @@ function usesGitHubAuth(mode) {
|
|
|
528
530
|
return mode === "github" || mode === "both";
|
|
529
531
|
}
|
|
530
532
|
|
|
533
|
+
function defaultProjectName(vmImageName, savedProject) {
|
|
534
|
+
if (savedProject && !["undefined", "null"].includes(String(savedProject)))
|
|
535
|
+
return savedProject;
|
|
536
|
+
const suffix =
|
|
537
|
+
projectNameSuffixes[
|
|
538
|
+
Math.abs(hashText(vmImageName)) % projectNameSuffixes.length
|
|
539
|
+
];
|
|
540
|
+
return `${vmImageName}-${suffix}`;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function hashText(text) {
|
|
544
|
+
return [...String(text)].reduce(
|
|
545
|
+
(hash, char) => (hash * 31 + char.charCodeAt(0)) | 0,
|
|
546
|
+
0,
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
|
|
531
550
|
async function chooseVmImage(fallback) {
|
|
532
551
|
if (args["vm-image"]) return args["vm-image"];
|
|
533
552
|
if (args.base) return args.base;
|
|
@@ -716,7 +735,9 @@ function cleanDefaults(data) {
|
|
|
716
735
|
delete migrated["custom-base"];
|
|
717
736
|
|
|
718
737
|
const clean = Object.fromEntries(
|
|
719
|
-
Object.entries(migrated).filter(
|
|
738
|
+
Object.entries(migrated).filter(
|
|
739
|
+
([, value]) => value && !["undefined", "null"].includes(String(value)),
|
|
740
|
+
),
|
|
720
741
|
);
|
|
721
742
|
return Object.fromEntries(
|
|
722
743
|
Object.entries(clean).sort(([a], [b]) => a.localeCompare(b)),
|