create-skybridge 0.16.0 → 0.16.1
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/dist/index.js +18 -18
- package/package.json +1 -1
- package/template/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import path from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import * as prompts from "@clack/prompts";
|
|
6
6
|
import mri from "mri";
|
|
7
|
-
const minimumPnpmVersion = 10;
|
|
8
7
|
const defaultProjectName = "skybridge-project";
|
|
9
8
|
// prettier-ignore
|
|
10
9
|
const helpMessage = `\
|
|
@@ -125,12 +124,14 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
125
124
|
console.error(error);
|
|
126
125
|
process.exit(1);
|
|
127
126
|
}
|
|
127
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
128
|
+
const pkgManager = userAgent?.split(" ")[0]?.split("/")[0] || "npm";
|
|
128
129
|
// 4. Ask about immediate installation
|
|
129
130
|
let immediate = argImmediate;
|
|
130
131
|
if (immediate === undefined) {
|
|
131
132
|
if (interactive) {
|
|
132
133
|
const immediateResult = await prompts.confirm({
|
|
133
|
-
message: `Install with
|
|
134
|
+
message: `Install with ${pkgManager} and start now?`,
|
|
134
135
|
});
|
|
135
136
|
if (prompts.isCancel(immediateResult)) {
|
|
136
137
|
return cancel();
|
|
@@ -141,8 +142,20 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
141
142
|
immediate = false;
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
|
-
const installCmd = [
|
|
145
|
-
const runCmd = [
|
|
145
|
+
const installCmd = [pkgManager, "install"];
|
|
146
|
+
const runCmd = [pkgManager];
|
|
147
|
+
switch (pkgManager) {
|
|
148
|
+
case "yarn":
|
|
149
|
+
case "pnpm":
|
|
150
|
+
case "bun":
|
|
151
|
+
break;
|
|
152
|
+
case "deno":
|
|
153
|
+
runCmd.push("task");
|
|
154
|
+
break;
|
|
155
|
+
default:
|
|
156
|
+
runCmd.push("run");
|
|
157
|
+
}
|
|
158
|
+
runCmd.push("dev");
|
|
146
159
|
if (!immediate) {
|
|
147
160
|
prompts.outro(`Done! Next steps:
|
|
148
161
|
cd ${targetDir}
|
|
@@ -151,20 +164,7 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
151
164
|
`);
|
|
152
165
|
return;
|
|
153
166
|
}
|
|
154
|
-
|
|
155
|
-
const result = spawnSync("pnpm", ["--version"], { encoding: "utf-8" });
|
|
156
|
-
if (result.error || result.status !== 0) {
|
|
157
|
-
console.error("Error: pnpm is not installed. Please install pnpm first.");
|
|
158
|
-
process.exit(1);
|
|
159
|
-
}
|
|
160
|
-
// check if pnpm major is greater or equal to the one set in package.json packageManager, which should do the trick
|
|
161
|
-
const version = result.stdout.trim();
|
|
162
|
-
const major = Number(version.split(".")[0]);
|
|
163
|
-
if (Number.isNaN(major) || major < minimumPnpmVersion) {
|
|
164
|
-
console.error(`Error: pnpm version ${version} is too old. Minimum required version is ${minimumPnpmVersion}.`);
|
|
165
|
-
process.exit(1);
|
|
166
|
-
}
|
|
167
|
-
prompts.log.step(`Installing dependencies with pnpm...`);
|
|
167
|
+
prompts.log.step(`Installing dependencies with ${pkgManager}...`);
|
|
168
168
|
run(installCmd, {
|
|
169
169
|
stdio: "inherit",
|
|
170
170
|
cwd: root,
|
package/package.json
CHANGED