vite-plus 0.2.9 → 0.3.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/LICENSE +29 -29
- package/README.md +6 -5
- package/binding/index.cjs +63 -55
- package/binding/index.d.cts +218 -14
- package/dist/{agent-DQU8uS6P.js → agent-C5jMYVfB.js} +3 -2
- package/dist/bin.js +101 -60
- package/dist/cli-parse-DHE8NrBU.js +13 -0
- package/dist/client/bundledDevClient.mjs +1 -1
- package/dist/client/client.mjs +1 -1
- package/dist/client/env.mjs +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/command-CLJK5jGW.js +2 -0
- package/dist/command-CguLh2KL.js +471 -0
- package/dist/config/bin.js +85 -55
- package/dist/{constants-CG513DRa.js → constants-0IAVgpox.js} +5 -3
- package/dist/create/bin.d.ts +13 -5
- package/dist/create/bin.js +55 -232
- package/dist/{define-config-DyNLA_f0.cjs → define-config-DIE9de46.cjs} +2 -2
- package/dist/{define-config-DWoAkNdp.d.ts → define-config-DPNEJxPz.d.ts} +5 -9
- package/dist/{define-config-CV4bQG_8.js → define-config-U3_xg7i-.js} +2 -2
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/dist-DfmT__Aw.js +619 -0
- package/dist/{editor-g4PosU99.js → editor-B5-lvRaU.js} +619 -88
- package/dist/{terminal-Bz-ps6rJ.js → help-BmKpeOP9.js} +1 -38
- package/dist/hooks/bin.js +9 -113
- package/dist/{hooks-pNCBWtFT.js → hooks-C-4gykWR.js} +5 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/migration/bin.js +76 -146
- package/dist/migration/compat/worker.js +1 -1
- package/dist/module-runner.d.ts +1 -1
- package/dist/module-runner.js +1 -1
- package/dist/{oxlint-plugin-config-BEZ9IUf7.js → oxlint-plugin-config-Drdl67Xp.js} +1 -1
- package/dist/oxlint-plugin.d.ts +2 -2
- package/dist/oxlint-plugin.js +1 -1
- package/dist/{pack-PvUg_xpv.d.ts → pack-BK38MLVZ.d.ts} +1 -1
- package/dist/pack-bin.d.ts +2 -3
- package/dist/pack-bin.js +9 -625
- package/dist/pack-client.d.ts +1 -1
- package/dist/pack.d.ts +2 -2
- package/dist/pack.js +1 -1
- package/dist/{package-B4T8RGMG.js → package-BZz2Ij68.js} +2 -2
- package/dist/{prompts-CHz_98bJ.js → prompts-CtzEgFY-.js} +7 -1872
- package/dist/{report-BS7ULx7A.js → report-CK5TnTsr.js} +2 -0
- package/dist/{resolve-vite-config-Dmeyeyj-.js → resolve-vite-config-CGks1xR7.js} +3 -3
- package/dist/resolve-vite-config-Dnmc-lBc.js +2 -0
- package/dist/semver-CaDAb8vV.js +1400 -0
- package/dist/staged/bin.js +82 -187
- package/dist/sync-versions/bin.d.ts +1 -0
- package/dist/sync-versions/bin.js +3884 -0
- package/dist/sync-versions/bin.mjs +13323 -0
- package/dist/terminal-MKGAuy-p.js +39 -0
- package/dist/toolchain.js +11 -11
- package/dist/toolchain.json +11 -11
- package/dist/{tsconfig-7v_BHagU.js → tsconfig-CUggNuJR.js} +5 -4
- package/dist/tsconfig-VAbm4ZzJ.js +2 -0
- package/dist/tsgolint-path.d.ts +3 -4
- package/dist/types/customEvent.d.ts +1 -1
- package/dist/types/hmrPayload.d.ts +1 -1
- package/dist/types/hot.d.ts +1 -1
- package/dist/types/import-meta.d.ts +1 -1
- package/dist/types/importGlob.d.ts +1 -1
- package/dist/types/importMeta.d.ts +1 -1
- package/dist/types/metadata.d.ts +1 -1
- package/dist/version.d.ts +2 -3
- package/dist/version.js +4 -3
- package/dist/versions.js +6 -6
- package/dist/vitest-ecosystem-BiRqcaRI.js +23 -0
- package/docs/guide/check.md +1 -0
- package/docs/guide/ci.md +42 -2
- package/docs/guide/env.md +136 -50
- package/docs/guide/ide-integration.md +14 -2
- package/docs/guide/index.md +1 -1
- package/docs/guide/install.md +5 -2
- package/docs/guide/installer-env-vars.md +51 -5
- package/docs/guide/migrate-rules.md +66 -2
- package/docs/guide/migrate.md +5 -5
- package/docs/guide/test.md +8 -0
- package/docs/guide/upgrade.md +48 -1
- package/package.json +34 -37
- package/dist/lib-L3DWSRQp.js +0 -75
- package/docs/_data/team.ts +0 -131
- package/docs/package.json +0 -30
- package/docs/pnpm-lock.yaml +0 -4003
- package/docs/pnpm-workspace.yaml +0 -13
- package/docs/public/checkmark.svg +0 -1
- package/docs/public/cta-background.jpg +0 -0
- package/docs/public/favicon.svg +0 -1
- package/docs/public/icon.svg +0 -1
- package/docs/public/logo.svg +0 -1
- package/docs/public/og.jpg +0 -0
- package/docs/vite.config.ts +0 -20
- package/dist/{json-qlK6UH0r.js → json-cULBl7Pi.js} +107 -107
package/dist/create/bin.d.ts
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
+
import "../../binding/index.js";
|
|
2
|
+
//#region src/types/package.d.ts
|
|
3
|
+
declare const PackageManager: {
|
|
4
|
+
readonly pnpm: "pnpm";
|
|
5
|
+
readonly npm: "npm";
|
|
6
|
+
readonly yarn: "yarn";
|
|
7
|
+
readonly bun: "bun";
|
|
8
|
+
};
|
|
9
|
+
type PackageManager = (typeof PackageManager)[keyof typeof PackageManager];
|
|
10
|
+
//#endregion
|
|
1
11
|
//#region src/create/bin.d.ts
|
|
2
|
-
interface Options {
|
|
12
|
+
export interface Options {
|
|
3
13
|
directory?: string;
|
|
4
14
|
interactive: boolean;
|
|
5
15
|
list: boolean;
|
|
6
|
-
help: boolean;
|
|
7
16
|
verbose: boolean;
|
|
8
17
|
agent?: string | string[] | false;
|
|
9
18
|
editor?: string | false;
|
|
10
19
|
git?: boolean;
|
|
11
20
|
hooks?: boolean;
|
|
12
|
-
packageManager?:
|
|
21
|
+
packageManager?: PackageManager;
|
|
13
22
|
/**
|
|
14
23
|
* Approve and run gated dependency build scripts without prompting. Useful in
|
|
15
24
|
* non-interactive runs that need a ready-to-use project.
|
|
16
25
|
*/
|
|
17
26
|
approveBuilds?: boolean;
|
|
18
27
|
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { Options };
|
|
28
|
+
//#endregion
|
package/dist/create/bin.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { i as readJsonFile, n as editJsonFile } from "../json-
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import { o as
|
|
9
|
-
import { a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as templatesDir, l as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID } from "../agent-
|
|
10
|
-
import {
|
|
2
|
+
import { t as renderCliDoc } from "../help-BmKpeOP9.js";
|
|
3
|
+
import { a as muted, i as log, o as printHeader, r as formatDuration, s as success, t as accent } from "../terminal-MKGAuy-p.js";
|
|
4
|
+
import { u as VITE_PLUS_NAME } from "../constants-0IAVgpox.js";
|
|
5
|
+
import { i as readJsonFile, n as editJsonFile } from "../json-cULBl7Pi.js";
|
|
6
|
+
import { o as fetchNpmResource, r as getScopeFromPackageName, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-BZz2Ij68.js";
|
|
7
|
+
import { i as hasViteConfig, o as resolveViteConfig, r as findWorkspaceRoot, t as findViteConfig } from "../resolve-vite-config-CGks1xR7.js";
|
|
8
|
+
import { C as multiselect, D as text, E as spinner, O as require_picocolors, S as log$1, T as select, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, k as isCancel, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, x as intro, y as PackageManager } from "../prompts-CtzEgFY-.js";
|
|
9
|
+
import { a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as templatesDir, l as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID } from "../agent-C5jMYVfB.js";
|
|
10
|
+
import { F as addFrameworkShim, I as detectFramework, K as promptPrettierMigration, L as hasFrameworkShim, M as isBingoTemplate, N as updatePackageJsonWithDeps, P as updateWorkspaceConfig, Q as promptEslintMigration, S as injectCreateDefaultTemplate, V as promptTsupMigration, W as detectPrettierProject, Y as detectEslintProject, _ as installGitHooks, a as selectEditors, b as findGitRoot, c as rewriteMonorepoProject, h as setPackageManager, j as detectWorkspace$1, l as rewriteStandaloneProject, n as detectExistingEditors, o as writeEditorConfigs, s as rewriteMonorepo, x as initGitRepository, y as shouldSkipStagedMigrationForHooks, z as detectTsupProject } from "../editor-B5-lvRaU.js";
|
|
11
|
+
import { n as runCommandSilently, t as runCommand$1 } from "../command-CguLh2KL.js";
|
|
12
|
+
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
|
|
11
13
|
import path from "node:path";
|
|
12
|
-
import { runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
|
|
14
|
+
import { getVpDirs, parseCreateArgs, runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
|
|
13
15
|
import { styleText } from "node:util";
|
|
14
16
|
import fs from "node:fs";
|
|
15
17
|
import os from "node:os";
|
|
@@ -17,7 +19,6 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
17
19
|
import fsPromises from "node:fs/promises";
|
|
18
20
|
import assert from "node:assert";
|
|
19
21
|
//#region src/create/command.ts
|
|
20
|
-
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
21
22
|
async function runCommandAndDetectProjectDir(options, parentDir) {
|
|
22
23
|
const cwd = parentDir ? path.join(options.cwd, parentDir) : options.cwd;
|
|
23
24
|
const existingDirs = /* @__PURE__ */ new Set();
|
|
@@ -245,8 +246,7 @@ function _parseExtendedHeaders(data) {
|
|
|
245
246
|
//#endregion
|
|
246
247
|
//#region src/create/org-tarball.ts
|
|
247
248
|
function getCacheRoot() {
|
|
248
|
-
|
|
249
|
-
return path.join(home, "tmp", "create-org");
|
|
249
|
+
return path.join(getVpDirs().cache, "create-org");
|
|
250
250
|
}
|
|
251
251
|
/**
|
|
252
252
|
* Replace characters that are illegal in Windows path segments
|
|
@@ -3976,11 +3976,6 @@ function getRandomProjectName(options = {}) {
|
|
|
3976
3976
|
function hasExplicitEditorOptIn(editor) {
|
|
3977
3977
|
return typeof editor === "string" && editor.trim() !== "";
|
|
3978
3978
|
}
|
|
3979
|
-
function normalizeEditorOption(editor) {
|
|
3980
|
-
if (!Array.isArray(editor)) return editor;
|
|
3981
|
-
if (editor.includes(false)) return false;
|
|
3982
|
-
return editor.findLast((value) => typeof value === "string");
|
|
3983
|
-
}
|
|
3984
3979
|
function shouldConfigureEditorsForCreate({ editor, isMonorepo }) {
|
|
3985
3980
|
if (editor === false) return false;
|
|
3986
3981
|
if (!isMonorepo) return true;
|
|
@@ -4642,13 +4637,14 @@ function alignMonorepoTypeScriptVersion(workspaceRootPath, appProjectPath, libra
|
|
|
4642
4637
|
* scaffolded sub-package. After migration its scripts already use `vp ...` and
|
|
4643
4638
|
* nothing imports `'vite'` directly, so `vite-plus` provides them transitively.
|
|
4644
4639
|
*
|
|
4645
|
-
* pnpm is the exception and keeps them:
|
|
4646
|
-
*
|
|
4647
|
-
*
|
|
4648
|
-
*
|
|
4649
|
-
*
|
|
4650
|
-
*
|
|
4651
|
-
*
|
|
4640
|
+
* pnpm is the exception and keeps them: a package needs a DIRECT `vite` edge for
|
|
4641
|
+
* `vite` to resolve to @voidzero-dev/vite-plus-core there (and for `vp why vite`
|
|
4642
|
+
* to show it) rather than pnpm auto-installing an upstream Vite to satisfy
|
|
4643
|
+
* Vitest's peer. Migration points that edge at the workspace catalog, which owns
|
|
4644
|
+
* the alias; the `vite@*` workspace override covers the transitive and peer
|
|
4645
|
+
* declarations instead (see `pnpmOverrideKey`). npm, yarn, and bun redirect the
|
|
4646
|
+
* transitive/peer vite via their root overrides/resolutions regardless of a
|
|
4647
|
+
* direct dep, so the aliased keys are dead weight and are dropped.
|
|
4652
4648
|
*/
|
|
4653
4649
|
function dropAliasedRuntimeDevDeps(appProjectPath, packageManager) {
|
|
4654
4650
|
if (packageManager === PackageManager.pnpm) return;
|
|
@@ -4663,129 +4659,6 @@ function dropAliasedRuntimeDevDeps(appProjectPath, packageManager) {
|
|
|
4663
4659
|
}
|
|
4664
4660
|
//#endregion
|
|
4665
4661
|
//#region src/create/bin.ts
|
|
4666
|
-
const helpMessage = renderCliDoc({
|
|
4667
|
-
usage: "vp create [TEMPLATE] [OPTIONS] [-- TEMPLATE_OPTIONS]",
|
|
4668
|
-
summary: "Use any builtin, local or remote template with Vite+.",
|
|
4669
|
-
documentationUrl: "https://viteplus.dev/guide/create",
|
|
4670
|
-
sections: [
|
|
4671
|
-
{
|
|
4672
|
-
title: "Arguments",
|
|
4673
|
-
rows: [{
|
|
4674
|
-
label: "TEMPLATE",
|
|
4675
|
-
description: [
|
|
4676
|
-
`Template name. Run \`${accent("vp create --list")}\` to see available templates.`,
|
|
4677
|
-
`- Default: ${accent("vite:monorepo")}, ${accent("vite:application")}, ${accent("vite:library")}, ${accent("vite:generator")}`,
|
|
4678
|
-
"- Remote: vite, @tanstack/start, create-next-app,",
|
|
4679
|
-
" create-nuxt, github:user/repo, https://github.com/user/template-repo, etc.",
|
|
4680
|
-
"- Local: a `create.templates` entry name from vite.config.ts (monorepo)",
|
|
4681
|
-
`- Org scope: ${accent("@your-org")} → picker from ${accent("@your-org/create")}'s ${accent("createConfig.templates")} manifest`,
|
|
4682
|
-
`- Org entry: ${accent("@your-org:web")} → manifest entry "web" from ${accent("@your-org/create")}`,
|
|
4683
|
-
`When omitted, uses \`create.defaultTemplate\` from vite.config.ts if set.`
|
|
4684
|
-
]
|
|
4685
|
-
}]
|
|
4686
|
-
},
|
|
4687
|
-
{
|
|
4688
|
-
title: "Options",
|
|
4689
|
-
rows: [
|
|
4690
|
-
{
|
|
4691
|
-
label: "--directory DIR",
|
|
4692
|
-
description: "Target directory for the generated project."
|
|
4693
|
-
},
|
|
4694
|
-
{
|
|
4695
|
-
label: "--agent NAME",
|
|
4696
|
-
description: "Write coding agent instructions to AGENTS.md, CLAUDE.md, etc."
|
|
4697
|
-
},
|
|
4698
|
-
{
|
|
4699
|
-
label: "--no-agent",
|
|
4700
|
-
description: "Skip writing coding agent instructions"
|
|
4701
|
-
},
|
|
4702
|
-
{
|
|
4703
|
-
label: "--editor NAME",
|
|
4704
|
-
description: "Write editor config files for the specified editor."
|
|
4705
|
-
},
|
|
4706
|
-
{
|
|
4707
|
-
label: "--no-editor",
|
|
4708
|
-
description: "Skip writing editor config files"
|
|
4709
|
-
},
|
|
4710
|
-
{
|
|
4711
|
-
label: "--git",
|
|
4712
|
-
description: "Initialize a git repository"
|
|
4713
|
-
},
|
|
4714
|
-
{
|
|
4715
|
-
label: "--no-git",
|
|
4716
|
-
description: "Skip git repository initialization"
|
|
4717
|
-
},
|
|
4718
|
-
{
|
|
4719
|
-
label: "--hooks",
|
|
4720
|
-
description: "Set up pre-commit hooks (default in non-interactive mode)"
|
|
4721
|
-
},
|
|
4722
|
-
{
|
|
4723
|
-
label: "--no-hooks",
|
|
4724
|
-
description: "Skip pre-commit hooks setup"
|
|
4725
|
-
},
|
|
4726
|
-
{
|
|
4727
|
-
label: "--package-manager NAME",
|
|
4728
|
-
description: "Use specified package manager (pnpm, npm, yarn, bun)"
|
|
4729
|
-
},
|
|
4730
|
-
{
|
|
4731
|
-
label: "--approve-builds",
|
|
4732
|
-
description: "Approve and run gated dependency build scripts without prompting"
|
|
4733
|
-
},
|
|
4734
|
-
{
|
|
4735
|
-
label: "--verbose",
|
|
4736
|
-
description: "Show detailed scaffolding output"
|
|
4737
|
-
},
|
|
4738
|
-
{
|
|
4739
|
-
label: "--no-interactive",
|
|
4740
|
-
description: "Run in non-interactive mode"
|
|
4741
|
-
},
|
|
4742
|
-
{
|
|
4743
|
-
label: "--list",
|
|
4744
|
-
description: "List all available templates"
|
|
4745
|
-
},
|
|
4746
|
-
{
|
|
4747
|
-
label: "-h, --help",
|
|
4748
|
-
description: "Show this help message"
|
|
4749
|
-
}
|
|
4750
|
-
]
|
|
4751
|
-
},
|
|
4752
|
-
{
|
|
4753
|
-
title: "Template Options",
|
|
4754
|
-
lines: [" Any arguments after -- are passed directly to the template."]
|
|
4755
|
-
},
|
|
4756
|
-
{
|
|
4757
|
-
title: "Examples",
|
|
4758
|
-
lines: [
|
|
4759
|
-
` ${muted("# Interactive mode")}`,
|
|
4760
|
-
` ${accent("vp create")}`,
|
|
4761
|
-
"",
|
|
4762
|
-
` ${muted("# Use existing templates (shorthand expands to create-* packages)")}`,
|
|
4763
|
-
` ${accent("vp create vite")}`,
|
|
4764
|
-
` ${accent("vp create @tanstack/start")}`,
|
|
4765
|
-
` ${accent("vp create svelte")}`,
|
|
4766
|
-
` ${accent("vp create vite -- --template react-ts")}`,
|
|
4767
|
-
"",
|
|
4768
|
-
` ${muted("# Full package names also work")}`,
|
|
4769
|
-
` ${accent("vp create create-vite")}`,
|
|
4770
|
-
` ${accent("vp create create-next-app")}`,
|
|
4771
|
-
"",
|
|
4772
|
-
` ${muted("# Create Vite+ monorepo, application, library, or generator scaffolds")}`,
|
|
4773
|
-
` ${accent("vp create vite:monorepo")}`,
|
|
4774
|
-
` ${accent("vp create vite:application")}`,
|
|
4775
|
-
` ${accent("vp create vite:library")}`,
|
|
4776
|
-
` ${accent("vp create vite:generator")}`,
|
|
4777
|
-
"",
|
|
4778
|
-
` ${muted("# Use templates from GitHub (via degit)")}`,
|
|
4779
|
-
` ${accent("vp create github:user/repo")}`,
|
|
4780
|
-
` ${accent("vp create https://github.com/user/template-repo")}`,
|
|
4781
|
-
"",
|
|
4782
|
-
` ${muted("# Pick from an org that publishes @scope/create with createConfig.templates")}`,
|
|
4783
|
-
` ${accent("vp create @your-org")} ${muted("# interactive picker")}`,
|
|
4784
|
-
` ${accent("vp create @your-org:web")} ${muted("# direct manifest-entry selection")}`
|
|
4785
|
-
]
|
|
4786
|
-
}
|
|
4787
|
-
]
|
|
4788
|
-
});
|
|
4789
4662
|
const listTemplatesMessage = renderCliDoc({
|
|
4790
4663
|
usage: "vp create --list",
|
|
4791
4664
|
summary: "List available builtin and popular project templates.",
|
|
@@ -4860,52 +4733,23 @@ const listTemplatesMessage = renderCliDoc({
|
|
|
4860
4733
|
}
|
|
4861
4734
|
]
|
|
4862
4735
|
});
|
|
4863
|
-
function normalizeAgentOption(agent) {
|
|
4864
|
-
if (!Array.isArray(agent)) return agent;
|
|
4865
|
-
if (agent.includes(false)) return false;
|
|
4866
|
-
return agent.filter((value) => typeof value === "string");
|
|
4867
|
-
}
|
|
4868
4736
|
function parseArgs() {
|
|
4869
|
-
const
|
|
4870
|
-
const separatorIndex = args.indexOf("--");
|
|
4871
|
-
const viteArgs = separatorIndex >= 0 ? args.slice(0, separatorIndex) : args;
|
|
4872
|
-
const templateArgs = separatorIndex >= 0 ? args.slice(separatorIndex + 1) : [];
|
|
4873
|
-
const parsed = lib_default(viteArgs, {
|
|
4874
|
-
alias: { h: "help" },
|
|
4875
|
-
boolean: [
|
|
4876
|
-
"help",
|
|
4877
|
-
"list",
|
|
4878
|
-
"all",
|
|
4879
|
-
"interactive",
|
|
4880
|
-
"hooks",
|
|
4881
|
-
"verbose",
|
|
4882
|
-
"git",
|
|
4883
|
-
"approve-builds"
|
|
4884
|
-
],
|
|
4885
|
-
string: [
|
|
4886
|
-
"directory",
|
|
4887
|
-
"agent",
|
|
4888
|
-
"editor",
|
|
4889
|
-
"package-manager"
|
|
4890
|
-
],
|
|
4891
|
-
default: { interactive: defaultInteractive() }
|
|
4892
|
-
});
|
|
4737
|
+
const parsed = unwrapCliParseOutcome(parseCreateArgs(process.argv.slice(3)));
|
|
4893
4738
|
return {
|
|
4894
|
-
templateName: parsed.
|
|
4739
|
+
templateName: parsed.templateName,
|
|
4895
4740
|
options: {
|
|
4896
4741
|
directory: parsed.directory,
|
|
4897
|
-
interactive: parsed.interactive,
|
|
4898
|
-
list: parsed.list
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
editor: normalizeEditorOption(parsed.editor),
|
|
4742
|
+
interactive: parsed.interactive ?? defaultInteractive(),
|
|
4743
|
+
list: parsed.list ?? false,
|
|
4744
|
+
verbose: parsed.verbose ?? false,
|
|
4745
|
+
agent: parsed.agent,
|
|
4746
|
+
editor: parsed.editor,
|
|
4903
4747
|
git: parsed.git,
|
|
4904
4748
|
hooks: parsed.hooks,
|
|
4905
|
-
packageManager: parsed
|
|
4906
|
-
approveBuilds: parsed
|
|
4749
|
+
packageManager: parsed.packageManager,
|
|
4750
|
+
approveBuilds: parsed.approveBuilds ?? false
|
|
4907
4751
|
},
|
|
4908
|
-
templateArgs
|
|
4752
|
+
templateArgs: parsed.templateArgs
|
|
4909
4753
|
};
|
|
4910
4754
|
}
|
|
4911
4755
|
function describeScaffold(templateName, templateArgs) {
|
|
@@ -4943,27 +4787,31 @@ function formatTemplateName(templateName) {
|
|
|
4943
4787
|
}
|
|
4944
4788
|
function getNextCommand(projectDir, command) {
|
|
4945
4789
|
if (!projectDir || projectDir === ".") return command;
|
|
4946
|
-
return `cd ${projectDir} && ${command}`;
|
|
4790
|
+
return `cd ${formatProjectDirArgument(projectDir)} && ${command}`;
|
|
4791
|
+
}
|
|
4792
|
+
function formatProjectDirArgument(projectDir) {
|
|
4793
|
+
const argument = projectDir.startsWith("-") ? `./${projectDir}` : projectDir;
|
|
4794
|
+
return /^[A-Za-z0-9_@./\\-]+$/.test(argument) ? argument : JSON.stringify(argument);
|
|
4947
4795
|
}
|
|
4948
4796
|
function getCopilotSetupRoot(projectRoot, isExistingMonorepo) {
|
|
4949
4797
|
if (!isExistingMonorepo) return projectRoot;
|
|
4950
4798
|
return findGitRoot(projectRoot) ?? projectRoot;
|
|
4951
4799
|
}
|
|
4952
4800
|
function showCreateSummary(options) {
|
|
4953
|
-
const { description, installSummary, nextCommand, packageManager, packageManagerVersion, projectDir } = options;
|
|
4801
|
+
const { description, gitInitialized, installSummary, nextCommand, packageManager, packageManagerVersion, projectDir } = options;
|
|
4954
4802
|
log(`${styleText("magenta", "◇")} Scaffolded ${accent(projectDir)}${description ? ` with ${description}` : ""}`);
|
|
4955
4803
|
log(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
|
|
4956
4804
|
if (installSummary?.status === "installed") log(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installSummary.durationMs)}`);
|
|
4805
|
+
if (gitInitialized) {
|
|
4806
|
+
const git = !projectDir || projectDir === "." ? "git" : `git -C ${formatProjectDirArgument(projectDir)}`;
|
|
4807
|
+
const gitCommand = `${git} add -A && ${git} commit -m "chore: initial commit"`;
|
|
4808
|
+
log(`${styleText("blue", "→")} Git (optional): ${accent(gitCommand)}`);
|
|
4809
|
+
}
|
|
4957
4810
|
log(`${styleText("blue", "→")} Next: ${accent(nextCommand)}`);
|
|
4958
4811
|
}
|
|
4959
4812
|
async function main() {
|
|
4960
4813
|
const { templateName, options, templateArgs } = parseArgs();
|
|
4961
4814
|
let compactOutput = !options.verbose;
|
|
4962
|
-
if (options.help) {
|
|
4963
|
-
printHeader();
|
|
4964
|
-
log(helpMessage);
|
|
4965
|
-
return;
|
|
4966
|
-
}
|
|
4967
4815
|
if (options.list) {
|
|
4968
4816
|
await showAvailableTemplates();
|
|
4969
4817
|
return;
|
|
@@ -4995,6 +4843,7 @@ async function main() {
|
|
|
4995
4843
|
let selectedEditors;
|
|
4996
4844
|
let selectedParentDir;
|
|
4997
4845
|
let remoteTargetDir;
|
|
4846
|
+
let gitInitialized = false;
|
|
4998
4847
|
let shouldSetupHooks = false;
|
|
4999
4848
|
let bundled;
|
|
5000
4849
|
let skipShorthandExpansion = false;
|
|
@@ -5158,11 +5007,6 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5158
5007
|
targetDir = selectedParentDir ? path.join(selectedParentDir, selected.targetDir).split(path.sep).join("/") : selected.targetDir;
|
|
5159
5008
|
}
|
|
5160
5009
|
}
|
|
5161
|
-
if (options.packageManager && !Object.values(PackageManager).includes(options.packageManager)) {
|
|
5162
|
-
const valid = Object.values(PackageManager).join(", ");
|
|
5163
|
-
log$1.error(`Invalid package manager: ${options.packageManager}. Must be one of: ${valid}`);
|
|
5164
|
-
cancelAndExit("Invalid --package-manager value", 1);
|
|
5165
|
-
}
|
|
5166
5010
|
const requestedPackageManager = options.packageManager;
|
|
5167
5011
|
const detectedPackageManager = workspaceInfoOptional.packageManager;
|
|
5168
5012
|
const packageManager = (isMonorepo ? detectedPackageManager ?? requestedPackageManager : requestedPackageManager ?? detectedPackageManager) ?? await selectPackageManager(options.interactive, compactOutput);
|
|
@@ -5195,7 +5039,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5195
5039
|
onCancel: () => cancelAndExit()
|
|
5196
5040
|
});
|
|
5197
5041
|
const shouldSetupGit = await resolveGitInit(options, isMonorepo);
|
|
5198
|
-
if (!isMonorepo) shouldSetupHooks = await promptGitHooks(options);
|
|
5042
|
+
if (!isMonorepo && (!options.interactive || shouldSetupGit || options.hooks === true)) shouldSetupHooks = await promptGitHooks(options);
|
|
5199
5043
|
const createProgress = options.interactive && compactOutput ? spinner({ indicator: "timer" }) : void 0;
|
|
5200
5044
|
let createProgressStarted = false;
|
|
5201
5045
|
let createProgressMessage = "Scaffolding project";
|
|
@@ -5265,19 +5109,6 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5265
5109
|
resumeCreateProgress();
|
|
5266
5110
|
}
|
|
5267
5111
|
if (templateInfo.command === BuiltinTemplate.monorepo || isBundledMonorepo) {
|
|
5268
|
-
let shouldInitGit = shouldSetupGit;
|
|
5269
|
-
if (options.interactive && !compactOutput && options.git === void 0) {
|
|
5270
|
-
pauseCreateProgress();
|
|
5271
|
-
const selected = await confirm({
|
|
5272
|
-
message: "Initialize git repository:",
|
|
5273
|
-
initialValue: true
|
|
5274
|
-
});
|
|
5275
|
-
resumeCreateProgress();
|
|
5276
|
-
if (isCancel(selected)) {
|
|
5277
|
-
log$1.info("Operation cancelled. Skipping git initialization");
|
|
5278
|
-
shouldInitGit = false;
|
|
5279
|
-
} else shouldInitGit = selected;
|
|
5280
|
-
} else if (shouldInitGit && !compactOutput) log$1.info("Initializing git repository (default: yes)");
|
|
5281
5112
|
updateCreateProgress("Creating monorepo");
|
|
5282
5113
|
await checkProjectDirExists(path.join(workspaceInfo.rootDir, targetDir), options.interactive);
|
|
5283
5114
|
const result = isBundledMonorepo ? await executeBundledTemplate(workspaceInfo, {
|
|
@@ -5300,18 +5131,10 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5300
5131
|
workspaceInfo.workspacePatterns = scaffoldedWorkspace.workspacePatterns;
|
|
5301
5132
|
workspaceInfo.parentDirs = scaffoldedWorkspace.parentDirs;
|
|
5302
5133
|
workspaceInfo.packages = scaffoldedWorkspace.packages;
|
|
5303
|
-
if (
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
});
|
|
5308
|
-
if (gitResult.status === 0) {
|
|
5309
|
-
if (!compactOutput) log$1.success("Git repository initialized");
|
|
5310
|
-
ensureDefaultGitignoreEntries(fullPath);
|
|
5311
|
-
} else {
|
|
5312
|
-
log$1.warn("Failed to initialize git repository");
|
|
5313
|
-
if (gitResult.stderr) log$1.info(gitResult.stderr.toString());
|
|
5314
|
-
}
|
|
5134
|
+
if (shouldSetupGit) {
|
|
5135
|
+
updateCreateProgress("Initializing git repository");
|
|
5136
|
+
gitInitialized = await initGitRepository(fullPath);
|
|
5137
|
+
if (gitInitialized) ensureDefaultGitignoreEntries(fullPath);
|
|
5315
5138
|
}
|
|
5316
5139
|
updateCreateProgress("Writing agent instructions");
|
|
5317
5140
|
pauseCreateProgress();
|
|
@@ -5342,10 +5165,6 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5342
5165
|
updateCreateProgress("Integrating monorepo");
|
|
5343
5166
|
const skipStagedMigration = shouldSkipStagedMigrationForHooks(fullPath, shouldSetupHooks, workspaceInfo.packageManager, workspaceInfo.packages);
|
|
5344
5167
|
rewriteMonorepo(workspaceInfo, skipStagedMigration, compactOutput);
|
|
5345
|
-
if (shouldSetupGit) {
|
|
5346
|
-
updateCreateProgress("Initializing git repository");
|
|
5347
|
-
if (await initGitRepository(fullPath)) ensureDefaultGitignoreEntries(fullPath);
|
|
5348
|
-
}
|
|
5349
5168
|
if (bundled?.monorepo) injectCreateDefaultTemplate(fullPath, bundled.scope, compactOutput);
|
|
5350
5169
|
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager, workspaceInfo.packages);
|
|
5351
5170
|
updateCreateProgress("Installing dependencies");
|
|
@@ -5361,6 +5180,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5361
5180
|
clearCreateProgress();
|
|
5362
5181
|
showCreateSummary({
|
|
5363
5182
|
description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
|
|
5183
|
+
gitInitialized,
|
|
5364
5184
|
installSummary,
|
|
5365
5185
|
nextCommand: getNextCommand(projectDir, "vp run"),
|
|
5366
5186
|
packageManager: workspaceInfo.packageManager,
|
|
@@ -5458,7 +5278,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5458
5278
|
if (selectedEditors?.includes("vscode")) ensureGitignoreVsCodeEditorConfigs(fullPath);
|
|
5459
5279
|
resumeCreateProgress();
|
|
5460
5280
|
}
|
|
5461
|
-
const shouldMigrateLintFmtTools = detectEslintProject(fullPath).hasDependency || detectPrettierProject(fullPath).hasDependency;
|
|
5281
|
+
const shouldMigrateLintFmtTools = detectEslintProject(fullPath).hasDependency || detectPrettierProject(fullPath).hasDependency || detectTsupProject(fullPath).hasDependency;
|
|
5462
5282
|
let installSummary;
|
|
5463
5283
|
const installAndMigrate = async (installCwd) => {
|
|
5464
5284
|
setPackageManager(fullPath, workspaceInfo.downloadPackageManager);
|
|
@@ -5475,10 +5295,11 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5475
5295
|
});
|
|
5476
5296
|
if (installSummary.status !== "installed") return;
|
|
5477
5297
|
if (installSummary.pendingBuilds && installSummary.pendingBuilds.length > 0) migratePendingBuilds = installSummary.pendingBuilds;
|
|
5478
|
-
updateCreateProgress("Migrating lint
|
|
5298
|
+
updateCreateProgress("Migrating lint, format & pack tools");
|
|
5479
5299
|
pauseCreateProgress();
|
|
5480
5300
|
await promptEslintMigration(fullPath, false);
|
|
5481
5301
|
await promptPrettierMigration(fullPath, false);
|
|
5302
|
+
await promptTsupMigration(fullPath, false, packageManager);
|
|
5482
5303
|
resumeCreateProgress();
|
|
5483
5304
|
};
|
|
5484
5305
|
if (isMonorepo) {
|
|
@@ -5534,7 +5355,8 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5534
5355
|
} else {
|
|
5535
5356
|
if (shouldSetupGit) {
|
|
5536
5357
|
updateCreateProgress("Initializing git repository");
|
|
5537
|
-
|
|
5358
|
+
gitInitialized = await initGitRepository(fullPath);
|
|
5359
|
+
if (gitInitialized) ensureDefaultGitignoreEntries(fullPath);
|
|
5538
5360
|
}
|
|
5539
5361
|
if (shouldMigrateLintFmtTools) await installAndMigrate(fullPath);
|
|
5540
5362
|
updateCreateProgress("Applying Vite+ project setup");
|
|
@@ -5556,6 +5378,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5556
5378
|
clearCreateProgress();
|
|
5557
5379
|
showCreateSummary({
|
|
5558
5380
|
description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
|
|
5381
|
+
gitInitialized,
|
|
5559
5382
|
installSummary,
|
|
5560
5383
|
nextCommand: getNextCommand(projectDir, "vp run"),
|
|
5561
5384
|
packageManager: workspaceInfo.packageManager,
|
|
@@ -37,10 +37,10 @@ let node_module = require("node:module");
|
|
|
37
37
|
let node_url = require("node:url");
|
|
38
38
|
let vitest_config = require("vitest/config");
|
|
39
39
|
//#region package.json
|
|
40
|
-
var version = "0.
|
|
40
|
+
var version = "0.3.1", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
|
|
41
41
|
var init_constants = __esmMin((() => {
|
|
42
42
|
VITE_PLUS_VERSION = process.env.VP_VERSION || version;
|
|
43
|
-
VITEST_VERSION = "4.1.
|
|
43
|
+
VITEST_VERSION = "4.1.11";
|
|
44
44
|
process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : `${VITE_PLUS_VERSION}`;
|
|
45
45
|
(0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
46
46
|
process.versions.node, process.release.name;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as PackUserConfig } from "./pack-
|
|
1
|
+
import { t as PackUserConfig } from "./pack-BK38MLVZ.js";
|
|
2
2
|
import { ConfigEnv, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig } from "vitest/config";
|
|
3
|
-
import { PluginOption, UserConfig } from "
|
|
3
|
+
import { PluginOption, UserConfig } from "vite";
|
|
4
4
|
import { OxfmtConfig } from "oxfmt";
|
|
5
5
|
import { OxlintConfig } from "oxlint";
|
|
6
6
|
import { InlineConfig } from "vitest/node";
|
|
@@ -169,7 +169,7 @@ type Configuration = Record<string, string | TaskFunction | GenerateTask | (stri
|
|
|
169
169
|
type StagedConfig = Configuration;
|
|
170
170
|
//#endregion
|
|
171
171
|
//#region src/define-config.d.ts
|
|
172
|
-
declare module '
|
|
172
|
+
declare module 'vite' {
|
|
173
173
|
interface UserConfig {
|
|
174
174
|
/**
|
|
175
175
|
* Options for oxlint
|
|
@@ -236,12 +236,8 @@ declare module '@voidzero-dev/vite-plus-core' {
|
|
|
236
236
|
templates?: CreateTemplateEntry[];
|
|
237
237
|
};
|
|
238
238
|
/**
|
|
239
|
-
* Vitest
|
|
240
|
-
*
|
|
241
|
-
* Vitest augments vite's `UserConfig` with a `test` field via
|
|
242
|
-
* `declare module 'vite'`, but vite-plus-core is a fork of vite so that
|
|
243
|
-
* augmentation does not apply here. Re-declare it locally so user
|
|
244
|
-
* configs like `defineConfig({ test: { globals: true } })` typecheck.
|
|
239
|
+
* Vitest may augment a separate Vite copy, for example an npm peer dependency.
|
|
240
|
+
* Keep the public test field on the CLI's core types in that layout too.
|
|
245
241
|
*/
|
|
246
242
|
test?: InlineConfig;
|
|
247
243
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-0IAVgpox.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { defineConfig, defineProject } from "vitest/config";
|
|
7
|
-
//#region ../../node_modules/.pnpm/tsdown@0.
|
|
7
|
+
//#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_d87cbece06b286a357367d730f55a698/node_modules/tsdown/esm-shims.js
|
|
8
8
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
9
9
|
const getDirname = () => path.dirname(getFilename());
|
|
10
10
|
const __dirname = /* @__PURE__ */ getDirname();
|
package/dist/define-config.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_define_config = require("./define-config-
|
|
2
|
+
const require_define_config = require("./define-config-DIE9de46.cjs");
|
|
3
3
|
require_define_config.init_define_config();
|
|
4
4
|
exports.AUTO_INLINE_DEPS = require_define_config.AUTO_INLINE_DEPS;
|
|
5
5
|
exports.assertCoverageProviderVersionMatch = require_define_config.assertCoverageProviderVersionMatch;
|
package/dist/define-config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-DPNEJxPz.js";
|
|
2
2
|
export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
|
package/dist/define-config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-U3_xg7i-.js";
|
|
2
2
|
export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
|