Skip to content

Commit 27c5d2a

Browse files
authored
default to npm (#974)
1 parent 505afec commit 27c5d2a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/create.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export async function create(options = {}, effects: CreateEffects = defaultEffec
8080
{value: "yarn", label: "Yes, via yarn", hint: "recommended"},
8181
{value: null, label: "No"}
8282
],
83-
initialValue: inferPackageManager()
83+
initialValue: inferPackageManager("npm")
8484
}),
8585
initializeGit: () =>
8686
clack.confirm({
@@ -205,12 +205,12 @@ async function recursiveCopyTemplate(
205205
}
206206
}
207207

208-
function inferPackageManager(): string | null {
208+
function inferPackageManager(defaultValue: string | null): string | null {
209209
const userAgent = process.env["npm_config_user_agent"];
210-
if (!userAgent) return null;
210+
if (!userAgent) return defaultValue;
211211
const pkgSpec = userAgent.split(" ")[0]!; // userAgent is non-empty, so this is always defined
212-
if (!pkgSpec) return null;
212+
if (!pkgSpec) return defaultValue;
213213
const [name, version] = pkgSpec.split("/");
214-
if (!name || !version) return null;
214+
if (!name || !version) return defaultValue;
215215
return name;
216216
}

0 commit comments

Comments
 (0)