sv 0.10.0 → 0.10.2
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/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { $ as ke, C as getSharedFiles, D as parseJson, G as Fe, J as Ke, K as Ge, O as parseScript, Q as et, W as De, X as Ue, Y as T, Z as We, a as getUserAgent, at as program, b as detect, c as packageManagerPrompt, ct as __toESM, d as from, et as ze, f as commonFilePaths, h as getHighlighter, i as addPnpmBuildDependencies, it as Option, k as parseSvelte, m as formatFiles, n as templates, nt as require_picocolors, o as installDependencies, q as J, r as AGENT_NAMES, rt as Command, s as installOption, t as create$1, tt as Vu, u as up$1, w as resolveCommand, z as isVersionUnsupportedBelow } from "./create-BN4H6Ywy.js";
|
|
3
|
-
import { a as communityAddonIds, c as officialAddons, d as create$2, f as overrideProperties, i as createWorkspace, l as createDefault, o as getCommunityAddon, r as setupAddons, s as getAddonDetails, t as applyAddons, u as addDefault } from "./install-
|
|
3
|
+
import { a as communityAddonIds, c as officialAddons, d as create$2, f as overrideProperties, i as createWorkspace, l as createDefault, o as getCommunityAddon, r as setupAddons, s as getAddonDetails, t as applyAddons, u as addDefault } from "./install-DGNvl1vK.js";
|
|
4
4
|
import { exec, execSync } from "node:child_process";
|
|
5
5
|
import path, { dirname, join } from "node:path";
|
|
6
6
|
import fs, { existsSync } from "node:fs";
|
|
@@ -12,7 +12,7 @@ import { pipeline } from "node:stream/promises";
|
|
|
12
12
|
|
|
13
13
|
//#region package.json
|
|
14
14
|
var name = "sv";
|
|
15
|
-
var version = "0.10.
|
|
15
|
+
var version = "0.10.2";
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region ../../node_modules/.pnpm/empathic@1.1.0/node_modules/empathic/package.mjs
|
|
@@ -532,15 +532,16 @@ function parseAddonOptions(optionFlags) {
|
|
|
532
532
|
}
|
|
533
533
|
return options$1;
|
|
534
534
|
}
|
|
535
|
-
function logArgs(agent,
|
|
536
|
-
const
|
|
535
|
+
function logArgs(agent, command, args, lastArgs = []) {
|
|
536
|
+
const allArgs = [
|
|
537
537
|
"sv",
|
|
538
|
-
|
|
538
|
+
command,
|
|
539
539
|
...args
|
|
540
540
|
];
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
541
|
+
if (agent === null || agent === void 0) allArgs.push("--no-install");
|
|
542
|
+
else allArgs.push("--install", agent);
|
|
543
|
+
const res = resolveCommand(agent ?? "npm", "execute", [...allArgs, ...lastArgs]);
|
|
544
|
+
T.message(import_picocolors$3.default.dim([res.command, ...res.args].join(" ")));
|
|
544
545
|
}
|
|
545
546
|
function errorAndExit(message) {
|
|
546
547
|
T.error(message);
|
|
@@ -768,7 +769,7 @@ const add = new Command("add").description("applies specified add-ons into a pro
|
|
|
768
769
|
options: options$1,
|
|
769
770
|
selectedAddons,
|
|
770
771
|
workspace,
|
|
771
|
-
|
|
772
|
+
fromCommand: "add"
|
|
772
773
|
});
|
|
773
774
|
if (nextSteps.length > 0) Ke(nextSteps.join("\n"), "Next steps", { format: (line) => line });
|
|
774
775
|
});
|
|
@@ -979,7 +980,7 @@ async function promptAddonQuestions({ options: options$1, selectedAddonIds, work
|
|
|
979
980
|
answersCommunity
|
|
980
981
|
};
|
|
981
982
|
}
|
|
982
|
-
async function runAddonsApply({ answersOfficial, answersCommunity, options: options$1, selectedAddons, addonSetupResults, workspace,
|
|
983
|
+
async function runAddonsApply({ answersOfficial, answersCommunity, options: options$1, selectedAddons, addonSetupResults, workspace, fromCommand }) {
|
|
983
984
|
if (!addonSetupResults) addonSetupResults = setupAddons(selectedAddons.length ? selectedAddons.map(({ addon }) => addon) : officialAddons$1, workspace);
|
|
984
985
|
if (selectedAddons.length === 0) return {
|
|
985
986
|
nextSteps: [],
|
|
@@ -1033,9 +1034,7 @@ async function runAddonsApply({ answersOfficial, answersCommunity, options: opti
|
|
|
1033
1034
|
if (optionParts.length > 0) argsFormattedAddons.push(`${addonId}="${optionParts.join("+")}"`);
|
|
1034
1035
|
else argsFormattedAddons.push(addonId);
|
|
1035
1036
|
}
|
|
1036
|
-
if (
|
|
1037
|
-
else argsFormattedAddons.push("--install", packageManager);
|
|
1038
|
-
if (withLogArgs) logArgs(packageManager ?? "npm", "add", argsFormattedAddons);
|
|
1037
|
+
if (fromCommand === "add") logArgs(packageManager, "add", argsFormattedAddons);
|
|
1039
1038
|
if (packageManager) {
|
|
1040
1039
|
workspace.packageManager = packageManager;
|
|
1041
1040
|
await installDependencies(packageManager, options$1.cwd);
|
|
@@ -1408,7 +1407,6 @@ const OptionsSchema = strictObject({
|
|
|
1408
1407
|
fromPlayground: optional(string()),
|
|
1409
1408
|
dirCheck: boolean()
|
|
1410
1409
|
});
|
|
1411
|
-
const defaultPath = "./";
|
|
1412
1410
|
const create = new Command("create").description("scaffolds a new SvelteKit project").argument("[path]", "where the project will be created").addOption(templateOption).addOption(langOption).option("--no-types").addOption(noAddonsOption).addOption(addOption).option("--no-install", "skip installing dependencies").option("--from-playground <url>", "create a project from the svelte playground").option("--no-dir-check", "even if the folder is not empty, no prompt will be shown").addOption(installOption).configureHelp(helpConfig).action((projectPath, opts) => {
|
|
1413
1411
|
const cwd = parse(ProjectPathSchema, projectPath);
|
|
1414
1412
|
const options$1 = parse(OptionsSchema, opts);
|
|
@@ -1454,7 +1452,8 @@ async function createProject(cwd, options$1) {
|
|
|
1454
1452
|
if (options$1.fromPlayground) T.warn("The Svelte maintainers have not reviewed playgrounds for malicious code. Use at your discretion.");
|
|
1455
1453
|
const { directory, template, language } = await We({
|
|
1456
1454
|
directory: () => {
|
|
1457
|
-
|
|
1455
|
+
const defaultPath = "./";
|
|
1456
|
+
if (cwd) return Promise.resolve(cwd);
|
|
1458
1457
|
return et({
|
|
1459
1458
|
message: "Where would you like your project to be created?",
|
|
1460
1459
|
placeholder: ` (hit Enter to use '${defaultPath}')`,
|
|
@@ -1566,21 +1565,20 @@ async function createProject(cwd, options$1) {
|
|
|
1566
1565
|
},
|
|
1567
1566
|
selectedAddons,
|
|
1568
1567
|
addonSetupResults: void 0,
|
|
1569
|
-
workspace
|
|
1568
|
+
workspace,
|
|
1569
|
+
fromCommand: "create"
|
|
1570
1570
|
});
|
|
1571
1571
|
argsFormattedAddons = argsFormatted$1;
|
|
1572
1572
|
addOnNextSteps = nextSteps;
|
|
1573
1573
|
}
|
|
1574
1574
|
const packageManager = options$1.install === false ? null : options$1.install === true ? await packageManagerPrompt(projectPath) : options$1.install;
|
|
1575
|
-
const argsFormatted = [
|
|
1575
|
+
const argsFormatted = [];
|
|
1576
1576
|
argsFormatted.push("--template", template);
|
|
1577
1577
|
if (language === "typescript") argsFormatted.push("--types", "ts");
|
|
1578
1578
|
else if (language === "checkjs") argsFormatted.push("--types", "jsdoc");
|
|
1579
1579
|
else if (language === "none") argsFormatted.push("--no-types");
|
|
1580
1580
|
if (argsFormattedAddons.length > 0) argsFormatted.push("--add", ...argsFormattedAddons);
|
|
1581
|
-
|
|
1582
|
-
else argsFormatted.push("--install", packageManager);
|
|
1583
|
-
logArgs(packageManager ?? "npm", "create", argsFormatted);
|
|
1581
|
+
logArgs(packageManager, "create", argsFormatted, [directory]);
|
|
1584
1582
|
await addPnpmBuildDependencies(projectPath, packageManager, ["esbuild"]);
|
|
1585
1583
|
if (packageManager) await installDependencies(packageManager, projectPath);
|
|
1586
1584
|
return {
|
|
@@ -2243,7 +2243,7 @@ const options$3 = defineAddonOptions().add("ide", {
|
|
|
2243
2243
|
],
|
|
2244
2244
|
required: true
|
|
2245
2245
|
}).add("setup", {
|
|
2246
|
-
question: "What setup you
|
|
2246
|
+
question: "What setup would you like to use?",
|
|
2247
2247
|
type: "select",
|
|
2248
2248
|
default: "remote",
|
|
2249
2249
|
options: [{
|
package/dist/lib/index.js
CHANGED