vite-plus 0.1.23 → 0.1.24
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/binding/index.cjs +52 -52
- package/dist/{agent-aSGY0osq.js → agent-Nuk-9l77.js} +29 -20
- package/dist/bin.js +8 -4
- package/dist/config/bin.js +2 -2
- package/dist/create/bin.d.ts +1 -1
- package/dist/create/bin.js +73 -37
- package/dist/migration/bin.js +13 -12
- package/dist/staged/bin.js +147 -414
- package/dist/{tsconfig-DlUVXT3J.js → tsconfig-DFb5BKyT.js} +43 -35
- package/dist/version.js +1 -1
- package/dist/versions.js +3 -3
- package/dist/{workspace-DElv730L.js → workspace-NL-m9wgM.js} +11 -11
- package/docs/_data/team.ts +3 -3
- package/docs/guide/index.md +4 -0
- package/docs/guide/install.md +17 -0
- package/docs/guide/migrate.md +1 -1
- package/docs/guide/troubleshooting.md +1 -27
- package/docs/guide/upgrade.md +12 -1
- package/package.json +14 -14
package/dist/create/bin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../chunk-DnnnRqeS.js";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as R, C as log, D as spinner, E as select, M as runCommandSilently, N as require_cross_spawn, O as text, S as intro, _ as DependencyType, b as cancel, c as defaultInteractive, d as promptGitHooks, f as promptGitInit, h as selectPackageManager, j as runCommand$1, k as require_picocolors, l as downloadPackageManager$1, m as runViteInstall, p as runViteFmt, v as PackageManager, w as multiselect, x as confirm } from "../tsconfig-DFb5BKyT.js";
|
|
3
3
|
import { a as printHeader, i as muted, o as success, r as log$1, t as accent } from "../terminal-uTv0ZaMr.js";
|
|
4
4
|
import { i as resolveViteConfig, n as hasViteConfig, t as findWorkspaceRoot } from "../resolve-vite-config-TTvhycU1.js";
|
|
5
5
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
6
6
|
import { c as editJsonFile, o as fetchNpmResource, s as getNpmRegistry, t as checkNpmPackageExists, u as readJsonFile } from "../package-PmBUZ-ve.js";
|
|
7
|
-
import { A as promptEslintMigration, F as setPackageManager, H as displayRelative, M as rewriteMonorepo, N as rewriteMonorepoProject, P as rewriteStandaloneProject, S as injectCreateDefaultTemplate, U as templatesDir, a as selectAgentTargets, b as hasFrameworkShim, c as writeCopilotSetupWorkflow, h as detectFramework, j as promptPrettierMigration, l as addFrameworkShim, m as detectEslintProject, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID, v as detectPrettierProject, w as installGitHooks } from "../agent-
|
|
8
|
-
import { a as detectExistingEditors, c as writeEditorConfigs, n as updatePackageJsonWithDeps, r as updateWorkspaceConfig, s as selectEditors, t as detectWorkspace$1 } from "../workspace-
|
|
7
|
+
import { A as promptEslintMigration, F as setPackageManager, H as displayRelative, M as rewriteMonorepo, N as rewriteMonorepoProject, P as rewriteStandaloneProject, S as injectCreateDefaultTemplate, U as templatesDir, a as selectAgentTargets, b as hasFrameworkShim, c as writeCopilotSetupWorkflow, h as detectFramework, j as promptPrettierMigration, l as addFrameworkShim, m as detectEslintProject, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID, v as detectPrettierProject, w as installGitHooks } from "../agent-Nuk-9l77.js";
|
|
8
|
+
import { a as detectExistingEditors, c as writeEditorConfigs, n as updatePackageJsonWithDeps, r as updateWorkspaceConfig, s as selectEditors, t as detectWorkspace$1 } from "../workspace-NL-m9wgM.js";
|
|
9
9
|
import { t as renderCliDoc } from "../help-YP84FSEz.js";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import { runCommand, vitePlusHeader } from "../../binding/index.js";
|
|
@@ -496,7 +496,7 @@ async function pickOrgTemplate(manifest, opts) {
|
|
|
496
496
|
message: `Pick a template from ${manifest.scope}`,
|
|
497
497
|
options
|
|
498
498
|
});
|
|
499
|
-
if (
|
|
499
|
+
if (R(picked)) return ORG_PICKER_CANCEL;
|
|
500
500
|
const found = lookup.get(picked);
|
|
501
501
|
if (found === ESCAPE_HATCH) return ORG_PICKER_BUILTIN_ESCAPE;
|
|
502
502
|
if (!found) throw new Error(`org-picker: prompts.select returned an unregistered value: ${picked}`);
|
|
@@ -3763,6 +3763,19 @@ function getRandomProjectName(options = {}) {
|
|
|
3763
3763
|
}
|
|
3764
3764
|
//#endregion
|
|
3765
3765
|
//#region src/create/utils.ts
|
|
3766
|
+
function hasExplicitEditorOptIn(editor) {
|
|
3767
|
+
return typeof editor === "string" && editor.trim() !== "";
|
|
3768
|
+
}
|
|
3769
|
+
function normalizeEditorOption(editor) {
|
|
3770
|
+
if (!Array.isArray(editor)) return editor;
|
|
3771
|
+
if (editor.includes(false)) return false;
|
|
3772
|
+
return editor.findLast((value) => typeof value === "string");
|
|
3773
|
+
}
|
|
3774
|
+
function shouldConfigureEditorsForCreate({ editor, isMonorepo }) {
|
|
3775
|
+
if (editor === false) return false;
|
|
3776
|
+
if (!isMonorepo) return true;
|
|
3777
|
+
return hasExplicitEditorOptIn(editor);
|
|
3778
|
+
}
|
|
3766
3779
|
function copy(src, dest) {
|
|
3767
3780
|
if (fs.statSync(src).isDirectory()) copyDir(src, dest);
|
|
3768
3781
|
else fs.copyFileSync(src, dest);
|
|
@@ -3930,7 +3943,7 @@ async function promptPackageNameAndTargetDir(defaultPackageName, interactive) {
|
|
|
3930
3943
|
return result?.errors?.[0] ?? result?.warnings?.[0] ?? "Invalid package name";
|
|
3931
3944
|
}
|
|
3932
3945
|
});
|
|
3933
|
-
if (
|
|
3946
|
+
if (R(selected)) cancelAndExit();
|
|
3934
3947
|
packageName = selected;
|
|
3935
3948
|
targetDir = getProjectDirFromPackageName(packageName);
|
|
3936
3949
|
} else {
|
|
@@ -3952,7 +3965,7 @@ async function promptTargetDir(defaultTargetDir, interactive, options) {
|
|
|
3952
3965
|
defaultValue: defaultTargetDir,
|
|
3953
3966
|
validate: (value) => validateTargetDir(value ?? defaultTargetDir, options?.cwd).error
|
|
3954
3967
|
});
|
|
3955
|
-
if (
|
|
3968
|
+
if (R(selected)) cancelAndExit();
|
|
3956
3969
|
targetDir = validateTargetDir(selected ?? defaultTargetDir, options?.cwd).directory;
|
|
3957
3970
|
} else {
|
|
3958
3971
|
targetDir = validateTargetDir(defaultTargetDir, options?.cwd).directory;
|
|
@@ -3985,7 +3998,7 @@ async function checkProjectDirExists(projectDirFullPath, interactive) {
|
|
|
3985
3998
|
value: "yes"
|
|
3986
3999
|
}]
|
|
3987
4000
|
});
|
|
3988
|
-
if (
|
|
4001
|
+
if (R(overwrite)) cancelAndExit();
|
|
3989
4002
|
switch (overwrite) {
|
|
3990
4003
|
case "yes":
|
|
3991
4004
|
emptyDir(projectDirFullPath);
|
|
@@ -4154,7 +4167,7 @@ async function executeGeneratorScaffold(workspaceInfo, templateInfo, options) {
|
|
|
4154
4167
|
placeholder: defaultDescription,
|
|
4155
4168
|
defaultValue: defaultDescription
|
|
4156
4169
|
});
|
|
4157
|
-
if (!
|
|
4170
|
+
if (!R(descPrompt)) description = descPrompt;
|
|
4158
4171
|
}
|
|
4159
4172
|
const fullPath = path.join(workspaceInfo.rootDir, templateInfo.targetDir);
|
|
4160
4173
|
copyDir(path.join(templatesDir, "generator"), fullPath);
|
|
@@ -4374,14 +4387,7 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
|
|
|
4374
4387
|
const appProjectPath = path.join(fullPath, InitialMonorepoAppDir);
|
|
4375
4388
|
setPackageName(appProjectPath, appPackageName);
|
|
4376
4389
|
rewriteMonorepoProject(appProjectPath, workspaceInfo.packageManager, void 0, options?.silent ?? false);
|
|
4377
|
-
|
|
4378
|
-
let changed = false;
|
|
4379
|
-
for (const name of ["vite", "vitest"]) if (pkg.devDependencies?.[name]) {
|
|
4380
|
-
delete pkg.devDependencies[name];
|
|
4381
|
-
changed = true;
|
|
4382
|
-
}
|
|
4383
|
-
return changed ? pkg : void 0;
|
|
4384
|
-
});
|
|
4390
|
+
dropAliasedRuntimeDevDeps(appProjectPath, workspaceInfo.packageManager);
|
|
4385
4391
|
if (!options?.silent) log.step("Creating default library in packages/utils...");
|
|
4386
4392
|
const libraryDir = "packages/utils";
|
|
4387
4393
|
const libraryResult = await runRemoteTemplateCommand(workspaceInfo, fullPath, discoverTemplate(LibraryTemplateRepo, [libraryDir], workspaceInfo), false, options?.silent ?? false);
|
|
@@ -4398,6 +4404,30 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
|
|
|
4398
4404
|
projectDir: templateInfo.targetDir
|
|
4399
4405
|
};
|
|
4400
4406
|
}
|
|
4407
|
+
/**
|
|
4408
|
+
* Drop the aliased `vite` / `vitest` devDeps that `create-vite` leaves on a
|
|
4409
|
+
* scaffolded sub-package. After migration its scripts already use `vp ...` and
|
|
4410
|
+
* nothing imports `'vite'` directly, so `vite-plus` provides them transitively.
|
|
4411
|
+
*
|
|
4412
|
+
* pnpm is the exception and keeps them: pnpm only surfaces the
|
|
4413
|
+
* pnpm-workspace.yaml `overrides.vite: catalog:` entry through a package that
|
|
4414
|
+
* directly depends on `vite`, so keeping the aliased devDep lets `vp why vite`
|
|
4415
|
+
* reflect the override (resolving to @voidzero-dev/vite-plus-core). npm, yarn,
|
|
4416
|
+
* and bun redirect the transitive/peer vite via their root
|
|
4417
|
+
* overrides/resolutions regardless of a direct dep, so the aliased keys are
|
|
4418
|
+
* dead weight and are dropped.
|
|
4419
|
+
*/
|
|
4420
|
+
function dropAliasedRuntimeDevDeps(appProjectPath, packageManager) {
|
|
4421
|
+
if (packageManager === PackageManager.pnpm) return;
|
|
4422
|
+
editJsonFile(path.join(appProjectPath, "package.json"), (pkg) => {
|
|
4423
|
+
let changed = false;
|
|
4424
|
+
for (const name of ["vite", "vitest"]) if (pkg.devDependencies?.[name]) {
|
|
4425
|
+
delete pkg.devDependencies[name];
|
|
4426
|
+
changed = true;
|
|
4427
|
+
}
|
|
4428
|
+
return changed ? pkg : void 0;
|
|
4429
|
+
});
|
|
4430
|
+
}
|
|
4401
4431
|
function getScopeFromPackageName(packageName) {
|
|
4402
4432
|
if (packageName.startsWith("@")) return packageName.split("/")[0];
|
|
4403
4433
|
return "";
|
|
@@ -4627,7 +4657,7 @@ function parseArgs() {
|
|
|
4627
4657
|
help: parsed.help || false,
|
|
4628
4658
|
verbose: parsed.verbose || false,
|
|
4629
4659
|
agent: normalizeAgentOption(parsed.agent),
|
|
4630
|
-
editor: parsed.editor,
|
|
4660
|
+
editor: normalizeEditorOption(parsed.editor),
|
|
4631
4661
|
git: parsed.git,
|
|
4632
4662
|
hooks: parsed.hooks,
|
|
4633
4663
|
packageManager: parsed["package-manager"]
|
|
@@ -4776,7 +4806,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4776
4806
|
message: "",
|
|
4777
4807
|
options: getInitialTemplateOptions(isMonorepo)
|
|
4778
4808
|
});
|
|
4779
|
-
if (
|
|
4809
|
+
if (R(template)) cancelAndExit();
|
|
4780
4810
|
selectedTemplateName = template;
|
|
4781
4811
|
}
|
|
4782
4812
|
const isBuiltinTemplate = selectedTemplateName.startsWith("vite:");
|
|
@@ -4817,7 +4847,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4817
4847
|
options: dirOptions,
|
|
4818
4848
|
initialValue: shouldOfferCwdOption ? cwdRelativeToRoot : inferParentDir(selectedTemplateName, workspaceInfoOptional) ?? workspaceInfoOptional.parentDirs[0]
|
|
4819
4849
|
});
|
|
4820
|
-
if (
|
|
4850
|
+
if (R(selected)) cancelAndExit();
|
|
4821
4851
|
if (selected !== "other") parentDir = selected;
|
|
4822
4852
|
}
|
|
4823
4853
|
if (!parentDir) {
|
|
@@ -4828,7 +4858,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4828
4858
|
return value ? formatTargetDir(value).error : "Target directory is required";
|
|
4829
4859
|
}
|
|
4830
4860
|
});
|
|
4831
|
-
if (
|
|
4861
|
+
if (R(customTargetDir)) cancelAndExit();
|
|
4832
4862
|
parentDir = customTargetDir;
|
|
4833
4863
|
}
|
|
4834
4864
|
selectedParentDir = parentDir;
|
|
@@ -4892,7 +4922,11 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4892
4922
|
selectedAgentTargetPaths = agentSelection.targetPaths;
|
|
4893
4923
|
shouldWriteCopilotSetupWorkflow = agentSelection.selectedAgents.some((agent) => agent.id === COPILOT_AGENT_ID);
|
|
4894
4924
|
}
|
|
4895
|
-
|
|
4925
|
+
const shouldConfigureEditors = shouldConfigureEditorsForCreate({
|
|
4926
|
+
editor: options.editor,
|
|
4927
|
+
isMonorepo
|
|
4928
|
+
});
|
|
4929
|
+
if (shouldConfigureEditors) selectedEditors = (options.editor || !options.interactive ? void 0 : detectExistingEditors(workspaceInfoOptional.rootDir)) ?? await selectEditors({
|
|
4896
4930
|
interactive: options.interactive,
|
|
4897
4931
|
editor: options.editor,
|
|
4898
4932
|
onCancel: () => cancelAndExit()
|
|
@@ -4955,7 +4989,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4955
4989
|
initialValue: true
|
|
4956
4990
|
});
|
|
4957
4991
|
resumeCreateProgress();
|
|
4958
|
-
if (
|
|
4992
|
+
if (R(selected)) {
|
|
4959
4993
|
log.info("Operation cancelled. Skipping git initialization");
|
|
4960
4994
|
shouldInitGit = false;
|
|
4961
4995
|
} else shouldInitGit = selected;
|
|
@@ -5022,7 +5056,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5022
5056
|
await initGitRepository(fullPath);
|
|
5023
5057
|
}
|
|
5024
5058
|
if (bundled?.monorepo) injectCreateDefaultTemplate(fullPath, bundled.scope, compactOutput);
|
|
5025
|
-
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput);
|
|
5059
|
+
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager);
|
|
5026
5060
|
updateCreateProgress("Installing dependencies");
|
|
5027
5061
|
const installSummary = await runViteInstall(fullPath, options.interactive, installArgs, {
|
|
5028
5062
|
silent: compactOutput,
|
|
@@ -5103,17 +5137,19 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5103
5137
|
silent: compactOutput
|
|
5104
5138
|
});
|
|
5105
5139
|
resumeCreateProgress();
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5140
|
+
if (shouldConfigureEditors) {
|
|
5141
|
+
updateCreateProgress("Writing editor configs");
|
|
5142
|
+
pauseCreateProgress();
|
|
5143
|
+
await writeEditorConfigs({
|
|
5144
|
+
projectRoot: fullPath,
|
|
5145
|
+
editorId: selectedEditors,
|
|
5146
|
+
interactive: options.interactive,
|
|
5147
|
+
silent: compactOutput,
|
|
5148
|
+
extraVsCodeSettings: { "npm.scriptRunner": "vp" }
|
|
5149
|
+
});
|
|
5150
|
+
if (selectedEditors?.includes("vscode")) ensureGitignoreVsCodeEditorConfigs(fullPath);
|
|
5151
|
+
resumeCreateProgress();
|
|
5152
|
+
}
|
|
5117
5153
|
const shouldMigrateLintFmtTools = detectEslintProject(fullPath).hasDependency || detectPrettierProject(fullPath).hasDependency;
|
|
5118
5154
|
let installSummary;
|
|
5119
5155
|
const installAndMigrate = async (installCwd) => {
|
|
@@ -5151,7 +5187,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5151
5187
|
required: false
|
|
5152
5188
|
});
|
|
5153
5189
|
let selectedDepTypes = [];
|
|
5154
|
-
if (!
|
|
5190
|
+
if (!R(selectedDepTypeOptions)) selectedDepTypes = selectedDepTypeOptions;
|
|
5155
5191
|
for (const selectedDepType of selectedDepTypes) {
|
|
5156
5192
|
const selected = await multiselect({
|
|
5157
5193
|
message: `Which packages should be added as ${selectedDepType} to ${success(projectDir)}?`,
|
|
@@ -5162,7 +5198,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5162
5198
|
required: false
|
|
5163
5199
|
});
|
|
5164
5200
|
let selectedDeps = [];
|
|
5165
|
-
if (!
|
|
5201
|
+
if (!R(selected)) selectedDeps = selected;
|
|
5166
5202
|
if (selectedDeps.length > 0) updatePackageJsonWithDeps(workspaceInfo.rootDir, projectDir, selectedDeps, selectedDepType);
|
|
5167
5203
|
}
|
|
5168
5204
|
resumeCreateProgress();
|
|
@@ -5195,7 +5231,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5195
5231
|
updateCreateProgress("Initializing git repository");
|
|
5196
5232
|
await initGitRepository(fullPath);
|
|
5197
5233
|
}
|
|
5198
|
-
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput);
|
|
5234
|
+
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager);
|
|
5199
5235
|
updateCreateProgress("Installing dependencies");
|
|
5200
5236
|
installSummary = await runViteInstall(fullPath, options.interactive, installArgs, {
|
|
5201
5237
|
silent: compactOutput,
|
package/dist/migration/bin.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { r as __toESM } from "../chunk-DnnnRqeS.js";
|
|
2
2
|
import { c as isForceOverrideMode } from "../constants-DCBWlNrn.js";
|
|
3
|
-
import { A as
|
|
3
|
+
import { A as R, C as log, D as spinner, E as select, T as outro, c as defaultInteractive, d as promptGitHooks, g as upgradeYarn, h as selectPackageManager, i as hasBaseUrlInTsconfig, l as downloadPackageManager, m as runViteInstall, r as fixBaseUrlInTsconfig, s as cancelAndExit, t as confirmBaseUrlFix, v as PackageManager, x as confirm, y as require_semver } from "../tsconfig-DFb5BKyT.js";
|
|
4
4
|
import { a as printHeader, i as muted, r as log$1, t as accent } from "../terminal-uTv0ZaMr.js";
|
|
5
5
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
6
6
|
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-PmBUZ-ve.js";
|
|
7
|
-
import { A as promptEslintMigration, C as injectLintTypeCheckDefaults, D as migrateNodeVersionManagerFile, E as migrateEslintToOxlint, H as displayRelative, I as warnIncompatibleEslintIntegration, L as warnLegacyEslintConfig, M as rewriteMonorepo, O as migratePrettierToOxfmt, P as rewriteStandaloneProject, R as warnPackageLevelEslint, T as mergeViteConfigFiles, _ as detectNodeVersionManagerFile, b as hasFrameworkShim, d as checkVitestVersion, f as confirmEslintMigration, g as detectIncompatibleEslintIntegration, h as detectFramework, i as selectAgentTargetPaths, j as promptPrettierMigration, k as preflightGitHooksSetup, l as addFrameworkShim, m as detectEslintProject, n as detectAgentConflicts, p as confirmPrettierMigration, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, u as checkViteVersion, v as detectPrettierProject, w as installGitHooks, z as warnPackageLevelPrettier } from "../agent-
|
|
7
|
+
import { A as promptEslintMigration, C as injectLintTypeCheckDefaults, D as migrateNodeVersionManagerFile, E as migrateEslintToOxlint, H as displayRelative, I as warnIncompatibleEslintIntegration, L as warnLegacyEslintConfig, M as rewriteMonorepo, O as migratePrettierToOxfmt, P as rewriteStandaloneProject, R as warnPackageLevelEslint, T as mergeViteConfigFiles, _ as detectNodeVersionManagerFile, b as hasFrameworkShim, d as checkVitestVersion, f as confirmEslintMigration, g as detectIncompatibleEslintIntegration, h as detectFramework, i as selectAgentTargetPaths, j as promptPrettierMigration, k as preflightGitHooksSetup, l as addFrameworkShim, m as detectEslintProject, n as detectAgentConflicts, p as confirmPrettierMigration, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, u as checkViteVersion, v as detectPrettierProject, w as installGitHooks, z as warnPackageLevelPrettier } from "../agent-Nuk-9l77.js";
|
|
8
8
|
import { n as addMigrationWarning, r as createMigrationReport } from "../report-DgSBQUdz.js";
|
|
9
|
-
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-
|
|
9
|
+
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-NL-m9wgM.js";
|
|
10
10
|
import { t as renderCliDoc } from "../help-YP84FSEz.js";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import { styleText } from "node:util";
|
|
@@ -22,7 +22,7 @@ async function confirmNodeVersionFileMigration(interactive, detection) {
|
|
|
22
22
|
message,
|
|
23
23
|
initialValue: true
|
|
24
24
|
});
|
|
25
|
-
if (
|
|
25
|
+
if (R(confirmed)) cancelAndExit();
|
|
26
26
|
return confirmed;
|
|
27
27
|
}
|
|
28
28
|
return true;
|
|
@@ -37,7 +37,7 @@ async function confirmFrameworkShim(framework, interactive) {
|
|
|
37
37
|
message: `Add TypeScript shim for ${name} component files (*.${framework})?\n ` + styleText("gray", `Lets TypeScript recognize .${framework} files until vp check fully supports them.`),
|
|
38
38
|
initialValue: true
|
|
39
39
|
});
|
|
40
|
-
if (
|
|
40
|
+
if (R(confirmed)) cancelAndExit();
|
|
41
41
|
return confirmed;
|
|
42
42
|
}
|
|
43
43
|
return true;
|
|
@@ -144,8 +144,9 @@ const helpMessage = renderCliDoc({
|
|
|
144
144
|
" After the migration:",
|
|
145
145
|
" - Confirm `vite` imports were rewritten to `vite-plus` where needed",
|
|
146
146
|
" - Confirm `vitest` imports were rewritten to `vite-plus/test` where needed",
|
|
147
|
-
" -
|
|
148
|
-
"
|
|
147
|
+
" - On pnpm, keep the `vite` / `vitest` entries that `vp migrate` aliased to",
|
|
148
|
+
" the Vite+ packages so the workspace override stays effective; with other",
|
|
149
|
+
" package managers you can remove them once those rewrites are confirmed",
|
|
149
150
|
" - Move remaining tool-specific config into the appropriate blocks in",
|
|
150
151
|
" `vite.config.ts`",
|
|
151
152
|
"",
|
|
@@ -200,7 +201,7 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
200
201
|
const packageManager = detectedPackageManager ?? await selectPackageManager(options.interactive, true);
|
|
201
202
|
let shouldSetupHooks = await promptGitHooks(options);
|
|
202
203
|
if (shouldSetupHooks) {
|
|
203
|
-
const reason = preflightGitHooksSetup(rootDir);
|
|
204
|
+
const reason = preflightGitHooksSetup(rootDir, packageManager);
|
|
204
205
|
if (reason) {
|
|
205
206
|
log.warn(`⚠ ${reason}`);
|
|
206
207
|
shouldSetupHooks = false;
|
|
@@ -231,7 +232,7 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
231
232
|
}],
|
|
232
233
|
initialValue: "skip"
|
|
233
234
|
});
|
|
234
|
-
if (
|
|
235
|
+
if (R(action)) cancelAndExit();
|
|
235
236
|
agentConflictDecisions.set(conflict.targetPath, action);
|
|
236
237
|
} else agentConflictDecisions.set(conflict.targetPath, "skip");
|
|
237
238
|
const selectedEditor = await selectEditor({
|
|
@@ -258,7 +259,7 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
258
259
|
}],
|
|
259
260
|
initialValue: "skip"
|
|
260
261
|
});
|
|
261
|
-
if (
|
|
262
|
+
if (R(action)) cancelAndExit();
|
|
262
263
|
editorConflictDecisions.set(conflict.fileName, action);
|
|
263
264
|
} else editorConflictDecisions.set(conflict.fileName, "merge");
|
|
264
265
|
const eslintProject = detectEslintProject(rootDir, packages);
|
|
@@ -440,7 +441,7 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
|
440
441
|
else rewriteStandaloneProject(workspaceInfo.rootDir, workspaceInfo, skipStagedMigration, true, report);
|
|
441
442
|
if (plan.shouldSetupHooks) {
|
|
442
443
|
updateMigrationProgress("Configuring git hooks");
|
|
443
|
-
installGitHooks(workspaceInfo.rootDir, true, report);
|
|
444
|
+
installGitHooks(workspaceInfo.rootDir, true, report, plan.packageManager);
|
|
444
445
|
}
|
|
445
446
|
updateMigrationProgress("Writing agent instructions");
|
|
446
447
|
await writeAgentInstructions({
|
|
@@ -546,7 +547,7 @@ async function main() {
|
|
|
546
547
|
if (rootPkg?.devDependencies?.husky || rootPkg?.dependencies?.husky || rootPkg?.devDependencies?.["lint-staged"] || rootPkg?.dependencies?.["lint-staged"]) {
|
|
547
548
|
const shouldSetupHooks = await promptGitHooks(options);
|
|
548
549
|
if (shouldSetupHooks) updateMigrationProgress("Configuring git hooks");
|
|
549
|
-
if (shouldSetupHooks && installGitHooks(workspaceInfoOptional.rootDir, true, report)) didMigrate = true;
|
|
550
|
+
if (shouldSetupHooks && installGitHooks(workspaceInfoOptional.rootDir, true, report, workspaceInfoOptional.packageManager)) didMigrate = true;
|
|
550
551
|
}
|
|
551
552
|
await checkRolldownCompatibility(workspaceInfoOptional.rootDir, report);
|
|
552
553
|
if (workspaceInfoOptional.packages) for (const pkg of workspaceInfoOptional.packages) await checkRolldownCompatibility(path.join(workspaceInfoOptional.rootDir, pkg.path), report);
|