Skip to content

Commit 34e7bbd

Browse files
committed
bugfix: askProjectType needs to create an NPM cache correctly
1 parent b73e862 commit 34e7bbd

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pkgs/create-neon/src/index.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,21 @@ async function askProjectType(options: ProjectOptions) {
6161
? await dialog.ask({
6262
prompt: "cache org",
6363
parse: (v: string): string => v,
64-
default: NPM.inferOrg(options.name),
64+
default: `@${options.org ?? options.name}`,
6565
})
6666
: null;
6767

68+
const prefix =
69+
cache === "npm" && org === `@${options.name}`
70+
? ""
71+
: cache === "npm"
72+
? await dialog.ask({
73+
prompt: "cache prefix",
74+
parse: (v: string): string => v,
75+
default: `${options.name}-`,
76+
})
77+
: null;
78+
6879
const ci = await dialog.ask({
6980
prompt: "ci provider",
7081
parse: oneOf({ npm: "github" as const, none: undefined }),
@@ -76,7 +87,7 @@ async function askProjectType(options: ProjectOptions) {
7687
options.library = {
7788
lang: Lang.TS,
7889
module: ModuleType.ESM,
79-
cache: cache === "npm" ? new NPM(options.name, org!) : undefined,
90+
cache: cache === "npm" ? new NPM(org!, prefix!) : undefined,
8091
ci: ci === "github" ? new GitHub() : undefined,
8192
platforms: platforms.length === 1 ? platforms[0] : platforms,
8293
};

0 commit comments

Comments
 (0)