sv 0.10.5 → 0.10.7
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
|
-
import { $ as et, A as parseSvelte, B as isVersionUnsupportedBelow, C as dist, G as De, J, K as Fe, O as parseJson, Q as We, T as resolveCommand, X as T, Y as Ke, Z as Ue, a as getUserAgent, at as Option, b as detect, c as packageManagerPrompt, d as from, et as ke, f as commonFilePaths, g as getPackageJson, h as getHighlighter, i as addPnpmBuildDependencies, it as Command, k as parseScript, lt as __toESM, m as formatFiles, n as templates, nt as Vu, o as installDependencies, ot as program, q as Ge, r as AGENT_NAMES, rt as require_picocolors, s as installOption, t as create$1, tt as ze, u as up$1, w as getSharedFiles } from "./create-
|
|
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-
|
|
2
|
+
import { $ as et, A as parseSvelte, B as isVersionUnsupportedBelow, C as dist, G as De, J, K as Fe, O as parseJson, Q as We, T as resolveCommand, X as T, Y as Ke, Z as Ue, a as getUserAgent, at as Option, b as detect, c as packageManagerPrompt, d as from, et as ke, f as commonFilePaths, g as getPackageJson, h as getHighlighter, i as addPnpmBuildDependencies, it as Command, k as parseScript, lt as __toESM, m as formatFiles, n as templates, nt as Vu, o as installDependencies, ot as program, q as Ge, r as AGENT_NAMES, rt as require_picocolors, s as installOption, t as create$1, tt as ze, u as up$1, w as getSharedFiles } from "./create-DTIS6AzL.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-BPIL0v3f.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.7";
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region ../../node_modules/.pnpm/empathic@1.1.0/node_modules/empathic/package.mjs
|
|
@@ -984,7 +984,8 @@ async function runAddonsApply({ answersOfficial, answersCommunity, options: opti
|
|
|
984
984
|
if (!addonSetupResults) addonSetupResults = setupAddons(selectedAddons.length ? selectedAddons.map(({ addon }) => addon) : officialAddons$1, workspace);
|
|
985
985
|
if (selectedAddons.length === 0) return {
|
|
986
986
|
nextSteps: [],
|
|
987
|
-
argsFormattedAddons: []
|
|
987
|
+
argsFormattedAddons: [],
|
|
988
|
+
filesToFormat: []
|
|
988
989
|
};
|
|
989
990
|
const officialDetails = Object.keys(answersOfficial).map((id) => getAddonDetails(id));
|
|
990
991
|
const commDetails = Object.keys(answersCommunity).map((id) => communityDetails.find((a) => a.id === id));
|
|
@@ -1038,21 +1039,11 @@ async function runAddonsApply({ answersOfficial, answersCommunity, options: opti
|
|
|
1038
1039
|
if (packageManager) {
|
|
1039
1040
|
workspace.packageManager = packageManager;
|
|
1040
1041
|
await installDependencies(packageManager, options$1.cwd);
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
await formatFiles({
|
|
1047
|
-
packageManager,
|
|
1048
|
-
cwd: options$1.cwd,
|
|
1049
|
-
paths: filesToFormat
|
|
1050
|
-
});
|
|
1051
|
-
stop("Successfully formatted modified files");
|
|
1052
|
-
} catch (e) {
|
|
1053
|
-
stop("Failed to format files");
|
|
1054
|
-
if (e instanceof Error) T.error(e.message);
|
|
1055
|
-
}
|
|
1042
|
+
await formatFiles({
|
|
1043
|
+
packageManager,
|
|
1044
|
+
cwd: options$1.cwd,
|
|
1045
|
+
filesToFormat
|
|
1046
|
+
});
|
|
1056
1047
|
}
|
|
1057
1048
|
const highlighter = getHighlighter();
|
|
1058
1049
|
return {
|
|
@@ -1069,7 +1060,8 @@ async function runAddonsApply({ answersOfficial, answersCommunity, options: opti
|
|
|
1069
1060
|
addonMessage += ` - ${addonNextSteps.join("\n - ")}`;
|
|
1070
1061
|
return addonMessage;
|
|
1071
1062
|
}).filter((msg) => msg !== void 0),
|
|
1072
|
-
argsFormattedAddons
|
|
1063
|
+
argsFormattedAddons,
|
|
1064
|
+
filesToFormat
|
|
1073
1065
|
};
|
|
1074
1066
|
}
|
|
1075
1067
|
/**
|
|
@@ -1551,8 +1543,9 @@ async function createProject(cwd, options$1) {
|
|
|
1551
1543
|
T.success("Project created");
|
|
1552
1544
|
let addOnNextSteps = [];
|
|
1553
1545
|
let argsFormattedAddons = [];
|
|
1546
|
+
let addOnFilesToFormat = [];
|
|
1554
1547
|
if (options$1.addOns || options$1.add.length > 0) {
|
|
1555
|
-
const { nextSteps, argsFormattedAddons: argsFormatted$1 } = await runAddonsApply({
|
|
1548
|
+
const { nextSteps, argsFormattedAddons: argsFormatted$1, filesToFormat } = await runAddonsApply({
|
|
1556
1549
|
answersOfficial,
|
|
1557
1550
|
answersCommunity,
|
|
1558
1551
|
options: {
|
|
@@ -1568,6 +1561,7 @@ async function createProject(cwd, options$1) {
|
|
|
1568
1561
|
fromCommand: "create"
|
|
1569
1562
|
});
|
|
1570
1563
|
argsFormattedAddons = argsFormatted$1;
|
|
1564
|
+
addOnFilesToFormat = filesToFormat;
|
|
1571
1565
|
addOnNextSteps = nextSteps;
|
|
1572
1566
|
}
|
|
1573
1567
|
const packageManager = options$1.install === false ? null : options$1.install === true ? await packageManagerPrompt(projectPath) : options$1.install;
|
|
@@ -1579,7 +1573,14 @@ async function createProject(cwd, options$1) {
|
|
|
1579
1573
|
if (argsFormattedAddons.length > 0) argsFormatted.push("--add", ...argsFormattedAddons);
|
|
1580
1574
|
logArgs(packageManager, "create", argsFormatted, [directory]);
|
|
1581
1575
|
await addPnpmBuildDependencies(projectPath, packageManager, ["esbuild"]);
|
|
1582
|
-
if (packageManager)
|
|
1576
|
+
if (packageManager) {
|
|
1577
|
+
await installDependencies(packageManager, projectPath);
|
|
1578
|
+
await formatFiles({
|
|
1579
|
+
packageManager,
|
|
1580
|
+
cwd: projectPath,
|
|
1581
|
+
filesToFormat: addOnFilesToFormat
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1583
1584
|
return {
|
|
1584
1585
|
directory: projectPath,
|
|
1585
1586
|
addOnNextSteps,
|
|
@@ -32104,20 +32104,35 @@ function getPackageJson(cwd$1) {
|
|
|
32104
32104
|
};
|
|
32105
32105
|
}
|
|
32106
32106
|
async function formatFiles(options) {
|
|
32107
|
+
if (options.filesToFormat.length === 0) return;
|
|
32108
|
+
const { start, stop } = J();
|
|
32109
|
+
start("Formatting modified files");
|
|
32107
32110
|
const args = [
|
|
32108
32111
|
"prettier",
|
|
32109
32112
|
"--write",
|
|
32110
32113
|
"--ignore-unknown",
|
|
32111
|
-
...options.
|
|
32114
|
+
...options.filesToFormat
|
|
32112
32115
|
];
|
|
32113
32116
|
const cmd = resolveCommand(options.packageManager, "execute-local", args);
|
|
32114
|
-
|
|
32115
|
-
|
|
32116
|
-
|
|
32117
|
-
|
|
32118
|
-
|
|
32119
|
-
|
|
32120
|
-
|
|
32117
|
+
try {
|
|
32118
|
+
const result = await be(cmd.command, cmd.args, {
|
|
32119
|
+
nodeOptions: {
|
|
32120
|
+
cwd: options.cwd,
|
|
32121
|
+
stdio: "pipe"
|
|
32122
|
+
},
|
|
32123
|
+
throwOnError: true
|
|
32124
|
+
});
|
|
32125
|
+
if (result.exitCode !== 0) {
|
|
32126
|
+
stop("Failed to format files");
|
|
32127
|
+
T.error(result.stderr);
|
|
32128
|
+
return;
|
|
32129
|
+
}
|
|
32130
|
+
} catch (e$1) {
|
|
32131
|
+
stop("Failed to format files");
|
|
32132
|
+
T.error(e$1?.output?.stderr || "unknown error");
|
|
32133
|
+
return;
|
|
32134
|
+
}
|
|
32135
|
+
stop("Successfully formatted modified files");
|
|
32121
32136
|
}
|
|
32122
32137
|
function readFile(cwd$1, filePath) {
|
|
32123
32138
|
const fullFilePath = path.resolve(cwd$1, filePath);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as parseSvelte, D as parseHtml, E as parseCss, F as serializeScript, H as dedent_default, I as stripAst, L as Element, M as import_picocolors$1, N as parseHtml$1, O as parseJson, P as parseScript$1, R as Tag, T as resolveCommand, U as defineAddon, V as createPrinter, W as defineAddonOptions, X as T, _ as installPackages, a as getUserAgent, b as detect, f as commonFilePaths, g as getPackageJson, h as getHighlighter, j as MagicString, k as parseScript, l as any, lt as __toESM, p as fileExists, rt as require_picocolors, v as readFile, w as getSharedFiles, x as be, y as writeFile, z as walk } from "./create-
|
|
1
|
+
import { A as parseSvelte, D as parseHtml, E as parseCss, F as serializeScript, H as dedent_default, I as stripAst, L as Element, M as import_picocolors$1, N as parseHtml$1, O as parseJson, P as parseScript$1, R as Tag, T as resolveCommand, U as defineAddon, V as createPrinter, W as defineAddonOptions, X as T, _ as installPackages, a as getUserAgent, b as detect, f as commonFilePaths, g as getPackageJson, h as getHighlighter, j as MagicString, k as parseScript, l as any, lt as __toESM, p as fileExists, rt as require_picocolors, v as readFile, w as getSharedFiles, x as be, y as writeFile, z as walk } from "./create-DTIS6AzL.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import process from "node:process";
|
|
@@ -2464,7 +2464,7 @@ var prettier_default = defineAddon({
|
|
|
2464
2464
|
if (!plugins$1.includes("prettier-plugin-tailwindcss")) data.plugins.unshift("prettier-plugin-tailwindcss");
|
|
2465
2465
|
data.tailwindStylesheet ??= files.getRelative({ to: files.stylesheet });
|
|
2466
2466
|
}
|
|
2467
|
-
if (!plugins$1.includes("prettier-plugin-svelte")) data.plugins.
|
|
2467
|
+
if (!plugins$1.includes("prettier-plugin-svelte")) data.plugins.push("prettier-plugin-svelte");
|
|
2468
2468
|
data.overrides ??= [];
|
|
2469
2469
|
const overrides = data.overrides;
|
|
2470
2470
|
if (!overrides.find((o) => o?.options?.parser === "svelte")) overrides.push({
|
|
@@ -2512,11 +2512,11 @@ var storybook_default = defineAddon({
|
|
|
2512
2512
|
},
|
|
2513
2513
|
run: async ({ sv }) => {
|
|
2514
2514
|
const args = [
|
|
2515
|
-
|
|
2515
|
+
`create-storybook@latest`,
|
|
2516
2516
|
"--skip-install",
|
|
2517
2517
|
"--no-dev"
|
|
2518
2518
|
];
|
|
2519
|
-
if (process.env.NODE_ENV?.toLowerCase() === "test") args.push("--yes");
|
|
2519
|
+
if (process.env.NODE_ENV?.toLowerCase() === "test") args.push(...["--no-features", "--yes"]);
|
|
2520
2520
|
await sv.execute(args, "inherit");
|
|
2521
2521
|
sv.devDependency(`@types/node`, getNodeTypesVersion());
|
|
2522
2522
|
}
|
|
@@ -2733,7 +2733,7 @@ var tailwindcss_default = defineAddon({
|
|
|
2733
2733
|
const PLUGIN_NAME = "prettier-plugin-tailwindcss";
|
|
2734
2734
|
data.plugins ??= [];
|
|
2735
2735
|
const plugins$1 = data.plugins;
|
|
2736
|
-
if (!plugins$1.includes(PLUGIN_NAME)) plugins$1.
|
|
2736
|
+
if (!plugins$1.includes(PLUGIN_NAME)) plugins$1.unshift(PLUGIN_NAME);
|
|
2737
2737
|
data.tailwindStylesheet ??= files.getRelative({ to: files.stylesheet });
|
|
2738
2738
|
return generateCode();
|
|
2739
2739
|
});
|
|
@@ -3057,13 +3057,16 @@ async function applyAddons({ addons, workspace, addonSetupResults, options: opti
|
|
|
3057
3057
|
const allPnpmBuildDependencies = [];
|
|
3058
3058
|
const status = {};
|
|
3059
3059
|
const ordered = orderAddons(Object.entries(addons).map(([, addon]) => addon), addonSetupResults);
|
|
3060
|
+
let hasFormatter = false;
|
|
3060
3061
|
for (const addon of ordered) {
|
|
3061
3062
|
const workspaceOptions = options$7[addon.id] || {};
|
|
3063
|
+
const addonWorkspace = await createWorkspace({
|
|
3064
|
+
cwd: workspace.cwd,
|
|
3065
|
+
packageManager: workspace.packageManager
|
|
3066
|
+
});
|
|
3067
|
+
if (!hasFormatter) hasFormatter = !!addonWorkspace.dependencyVersion("prettier");
|
|
3062
3068
|
const { files, pnpmBuildDependencies, cancels } = await runAddon({
|
|
3063
|
-
workspace:
|
|
3064
|
-
cwd: workspace.cwd,
|
|
3065
|
-
packageManager: workspace.packageManager
|
|
3066
|
-
}),
|
|
3069
|
+
workspace: addonWorkspace,
|
|
3067
3070
|
workspaceOptions,
|
|
3068
3071
|
addon,
|
|
3069
3072
|
multiple: ordered.length > 1
|
|
@@ -3074,7 +3077,7 @@ async function applyAddons({ addons, workspace, addonSetupResults, options: opti
|
|
|
3074
3077
|
else status[addon.id] = cancels;
|
|
3075
3078
|
}
|
|
3076
3079
|
return {
|
|
3077
|
-
filesToFormat: Array.from(filesToFormat),
|
|
3080
|
+
filesToFormat: hasFormatter ? Array.from(filesToFormat) : [],
|
|
3078
3081
|
pnpmBuildDependencies: allPnpmBuildDependencies,
|
|
3079
3082
|
status
|
|
3080
3083
|
};
|
package/dist/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as create } from "../create-
|
|
2
|
-
import { c as officialAddons, n as installAddon } from "../install-
|
|
1
|
+
import { t as create } from "../create-DTIS6AzL.js";
|
|
2
|
+
import { c as officialAddons, n as installAddon } from "../install-BPIL0v3f.js";
|
|
3
3
|
|
|
4
4
|
export { create, installAddon, officialAddons };
|
package/dist/lib/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as ve, ct as __require, i as addPnpmBuildDependencies, lt as __toESM, st as __commonJS, t as create, x as be } from "../create-
|
|
1
|
+
import { S as ve, ct as __require, i as addPnpmBuildDependencies, lt as __toESM, st as __commonJS, t as create, x as be } from "../create-DTIS6AzL.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import process$1 from "node:process";
|