vite-plus 0.3.0 → 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 +2 -2
- package/binding/index.cjs +60 -55
- package/binding/index.d.cts +125 -14
- package/dist/{agent-Wqx0MPk0.js → agent-C5jMYVfB.js} +3 -2
- package/dist/bin.js +89 -58
- 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/config/bin.js +83 -55
- package/dist/{constants-Bn-U8o4v.js → constants-0IAVgpox.js} +3 -3
- package/dist/create/bin.d.ts +13 -5
- package/dist/create/bin.js +37 -190
- package/dist/{define-config-WiVlryJ2.cjs → define-config-DIE9de46.cjs} +1 -1
- package/dist/{define-config-DWoAkNdp.d.ts → define-config-DPNEJxPz.d.ts} +5 -9
- package/dist/{define-config-GXUdVT-0.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-CC4DqODz.js → editor-B5-lvRaU.js} +68 -40
- package/dist/hooks/bin.js +9 -114
- package/dist/{hooks-DFqViZqZ.js → hooks-C-4gykWR.js} +1 -1
- 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 +24 -143
- 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-DX5ezKbB.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 +5 -622
- package/dist/pack-client.d.ts +1 -1
- package/dist/pack.d.ts +2 -2
- package/dist/pack.js +1 -1
- package/dist/{package-CBe9EWPY.js → package-BZz2Ij68.js} +1 -1
- package/dist/{prompts-DF3yU-eU.js → prompts-CtzEgFY-.js} +3 -1400
- package/dist/{report-ZNR1Mk6h.js → report-CK5TnTsr.js} +1 -0
- package/dist/{resolve-vite-config-ipGb39Jo.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 +83 -218
- 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/toolchain.js +9 -9
- package/dist/toolchain.json +9 -9
- package/dist/{tsconfig-LD2QhQ0O.js → tsconfig-CUggNuJR.js} +2 -2
- package/dist/{tsconfig-BVHG3DpR.js → tsconfig-VAbm4ZzJ.js} +1 -1
- 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 +2 -2
- package/dist/versions.js +4 -4
- 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 +124 -52
- package/docs/guide/ide-integration.md +14 -2
- package/docs/guide/index.md +1 -1
- package/docs/guide/install.md +3 -1
- package/docs/guide/installer-env-vars.md +10 -0
- package/docs/guide/migrate-rules.md +57 -2
- package/package.json +17 -19
- package/dist/lib-L3DWSRQp.js +0 -75
- package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
//#region package.json
|
|
3
|
-
var version = "0.3.
|
|
3
|
+
var version = "0.3.1";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/utils/constants.ts
|
|
6
6
|
const VITE_PLUS_NAME = "vite-plus";
|
|
@@ -14,7 +14,7 @@ const VITE_CONFIG_FILES = [
|
|
|
14
14
|
"vite.config.cts"
|
|
15
15
|
];
|
|
16
16
|
const VITEST_VERSION = "4.1.11";
|
|
17
|
-
const
|
|
17
|
+
const SETUP_VP_VERSION = "v1.19.0";
|
|
18
18
|
const TSDOWN_MIGRATION_SKILL_URL = "https://github.com/rolldown/tsdown/blob/main/skills/tsdown-migrate/SKILL.md";
|
|
19
19
|
const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
|
|
20
20
|
vite: `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`,
|
|
@@ -77,4 +77,4 @@ const DEFAULT_ENVS = {
|
|
|
77
77
|
};
|
|
78
78
|
const CONFIG_METADATA_ENV = "VP_RESOLVING_CONFIG_METADATA";
|
|
79
79
|
//#endregion
|
|
80
|
-
export { version as _,
|
|
80
|
+
export { version as _, SETUP_VP_VERSION as a, VITEST_VERSION as c, VITE_PLUS_OVERRIDE_PACKAGES as d, VITE_PLUS_VERSION as f, resolveBundled as g, resolve as h, DEFAULT_ENVS as i, VITE_CONFIG_FILES as l, isForceOverrideMode as m, BASEURL_TSCONFIG_WARNING as n, TSDOWN_MIGRATION_SKILL_URL as o, createBaseUrlTsconfigFixArgs as p, CONFIG_METADATA_ENV as r, VITEST_AGE_GATE_EXEMPT_PACKAGES as s, BASEURL_TSCONFIG_FIX_PACKAGE as t, VITE_PLUS_NAME as u };
|
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,21 +1,21 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
|
|
2
2
|
import { t as renderCliDoc } from "../help-BmKpeOP9.js";
|
|
3
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-
|
|
5
|
-
import { a as resolveViteConfig, n as findWorkspaceRoot, r as hasViteConfig, t as findViteConfig } from "../resolve-vite-config-ipGb39Jo.js";
|
|
6
|
-
import { A as isCancel, C as log$1, D as spinner, E as select, O as text, S as intro, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, k as require_picocolors, 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, w as multiselect, y as PackageManager } from "../prompts-DF3yU-eU.js";
|
|
7
|
-
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
4
|
+
import { u as VITE_PLUS_NAME } from "../constants-0IAVgpox.js";
|
|
8
5
|
import { i as readJsonFile, n as editJsonFile } from "../json-cULBl7Pi.js";
|
|
9
|
-
import { o as fetchNpmResource, r as getScopeFromPackageName, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
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";
|
|
12
11
|
import { n as runCommandSilently, t as runCommand$1 } from "../command-CguLh2KL.js";
|
|
12
|
+
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
|
|
13
13
|
import path from "node:path";
|
|
14
|
-
import { getVpDirs, runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
|
|
14
|
+
import { getVpDirs, parseCreateArgs, runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
|
|
15
15
|
import { styleText } from "node:util";
|
|
16
16
|
import fs from "node:fs";
|
|
17
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
18
17
|
import os from "node:os";
|
|
18
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
19
19
|
import fsPromises from "node:fs/promises";
|
|
20
20
|
import assert from "node:assert";
|
|
21
21
|
//#region src/create/command.ts
|
|
@@ -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;
|
|
@@ -4664,129 +4659,6 @@ function dropAliasedRuntimeDevDeps(appProjectPath, packageManager) {
|
|
|
4664
4659
|
}
|
|
4665
4660
|
//#endregion
|
|
4666
4661
|
//#region src/create/bin.ts
|
|
4667
|
-
const helpMessage = renderCliDoc({
|
|
4668
|
-
usage: "vp create [TEMPLATE] [OPTIONS] [-- TEMPLATE_OPTIONS]",
|
|
4669
|
-
summary: "Use any builtin, local or remote template with Vite+.",
|
|
4670
|
-
documentationUrl: "https://viteplus.dev/guide/create",
|
|
4671
|
-
sections: [
|
|
4672
|
-
{
|
|
4673
|
-
title: "Arguments",
|
|
4674
|
-
rows: [{
|
|
4675
|
-
label: "TEMPLATE",
|
|
4676
|
-
description: [
|
|
4677
|
-
`Template name. Run \`${accent("vp create --list")}\` to see available templates.`,
|
|
4678
|
-
`- Default: ${accent("vite:monorepo")}, ${accent("vite:application")}, ${accent("vite:library")}, ${accent("vite:generator")}`,
|
|
4679
|
-
"- Remote: vite, @tanstack/start, create-next-app,",
|
|
4680
|
-
" create-nuxt, github:user/repo, https://github.com/user/template-repo, etc.",
|
|
4681
|
-
"- Local: a `create.templates` entry name from vite.config.ts (monorepo)",
|
|
4682
|
-
`- Org scope: ${accent("@your-org")} → picker from ${accent("@your-org/create")}'s ${accent("createConfig.templates")} manifest`,
|
|
4683
|
-
`- Org entry: ${accent("@your-org:web")} → manifest entry "web" from ${accent("@your-org/create")}`,
|
|
4684
|
-
`When omitted, uses \`create.defaultTemplate\` from vite.config.ts if set.`
|
|
4685
|
-
]
|
|
4686
|
-
}]
|
|
4687
|
-
},
|
|
4688
|
-
{
|
|
4689
|
-
title: "Options",
|
|
4690
|
-
rows: [
|
|
4691
|
-
{
|
|
4692
|
-
label: "--directory DIR",
|
|
4693
|
-
description: "Target directory for the generated project."
|
|
4694
|
-
},
|
|
4695
|
-
{
|
|
4696
|
-
label: "--agent NAME",
|
|
4697
|
-
description: "Write coding agent instructions to AGENTS.md, CLAUDE.md, etc."
|
|
4698
|
-
},
|
|
4699
|
-
{
|
|
4700
|
-
label: "--no-agent",
|
|
4701
|
-
description: "Skip writing coding agent instructions"
|
|
4702
|
-
},
|
|
4703
|
-
{
|
|
4704
|
-
label: "--editor NAME",
|
|
4705
|
-
description: "Write editor config files for the specified editor."
|
|
4706
|
-
},
|
|
4707
|
-
{
|
|
4708
|
-
label: "--no-editor",
|
|
4709
|
-
description: "Skip writing editor config files"
|
|
4710
|
-
},
|
|
4711
|
-
{
|
|
4712
|
-
label: "--git",
|
|
4713
|
-
description: "Initialize a git repository"
|
|
4714
|
-
},
|
|
4715
|
-
{
|
|
4716
|
-
label: "--no-git",
|
|
4717
|
-
description: "Skip git repository initialization"
|
|
4718
|
-
},
|
|
4719
|
-
{
|
|
4720
|
-
label: "--hooks",
|
|
4721
|
-
description: "Set up pre-commit hooks (default in non-interactive mode)"
|
|
4722
|
-
},
|
|
4723
|
-
{
|
|
4724
|
-
label: "--no-hooks",
|
|
4725
|
-
description: "Skip pre-commit hooks setup"
|
|
4726
|
-
},
|
|
4727
|
-
{
|
|
4728
|
-
label: "--package-manager NAME",
|
|
4729
|
-
description: "Use specified package manager (pnpm, npm, yarn, bun)"
|
|
4730
|
-
},
|
|
4731
|
-
{
|
|
4732
|
-
label: "--approve-builds",
|
|
4733
|
-
description: "Approve and run gated dependency build scripts without prompting"
|
|
4734
|
-
},
|
|
4735
|
-
{
|
|
4736
|
-
label: "--verbose",
|
|
4737
|
-
description: "Show detailed scaffolding output"
|
|
4738
|
-
},
|
|
4739
|
-
{
|
|
4740
|
-
label: "--no-interactive",
|
|
4741
|
-
description: "Run in non-interactive mode"
|
|
4742
|
-
},
|
|
4743
|
-
{
|
|
4744
|
-
label: "--list",
|
|
4745
|
-
description: "List all available templates"
|
|
4746
|
-
},
|
|
4747
|
-
{
|
|
4748
|
-
label: "-h, --help",
|
|
4749
|
-
description: "Show this help message"
|
|
4750
|
-
}
|
|
4751
|
-
]
|
|
4752
|
-
},
|
|
4753
|
-
{
|
|
4754
|
-
title: "Template Options",
|
|
4755
|
-
lines: [" Any arguments after -- are passed directly to the template."]
|
|
4756
|
-
},
|
|
4757
|
-
{
|
|
4758
|
-
title: "Examples",
|
|
4759
|
-
lines: [
|
|
4760
|
-
` ${muted("# Interactive mode")}`,
|
|
4761
|
-
` ${accent("vp create")}`,
|
|
4762
|
-
"",
|
|
4763
|
-
` ${muted("# Use existing templates (shorthand expands to create-* packages)")}`,
|
|
4764
|
-
` ${accent("vp create vite")}`,
|
|
4765
|
-
` ${accent("vp create @tanstack/start")}`,
|
|
4766
|
-
` ${accent("vp create svelte")}`,
|
|
4767
|
-
` ${accent("vp create vite -- --template react-ts")}`,
|
|
4768
|
-
"",
|
|
4769
|
-
` ${muted("# Full package names also work")}`,
|
|
4770
|
-
` ${accent("vp create create-vite")}`,
|
|
4771
|
-
` ${accent("vp create create-next-app")}`,
|
|
4772
|
-
"",
|
|
4773
|
-
` ${muted("# Create Vite+ monorepo, application, library, or generator scaffolds")}`,
|
|
4774
|
-
` ${accent("vp create vite:monorepo")}`,
|
|
4775
|
-
` ${accent("vp create vite:application")}`,
|
|
4776
|
-
` ${accent("vp create vite:library")}`,
|
|
4777
|
-
` ${accent("vp create vite:generator")}`,
|
|
4778
|
-
"",
|
|
4779
|
-
` ${muted("# Use templates from GitHub (via degit)")}`,
|
|
4780
|
-
` ${accent("vp create github:user/repo")}`,
|
|
4781
|
-
` ${accent("vp create https://github.com/user/template-repo")}`,
|
|
4782
|
-
"",
|
|
4783
|
-
` ${muted("# Pick from an org that publishes @scope/create with createConfig.templates")}`,
|
|
4784
|
-
` ${accent("vp create @your-org")} ${muted("# interactive picker")}`,
|
|
4785
|
-
` ${accent("vp create @your-org:web")} ${muted("# direct manifest-entry selection")}`
|
|
4786
|
-
]
|
|
4787
|
-
}
|
|
4788
|
-
]
|
|
4789
|
-
});
|
|
4790
4662
|
const listTemplatesMessage = renderCliDoc({
|
|
4791
4663
|
usage: "vp create --list",
|
|
4792
4664
|
summary: "List available builtin and popular project templates.",
|
|
@@ -4861,52 +4733,23 @@ const listTemplatesMessage = renderCliDoc({
|
|
|
4861
4733
|
}
|
|
4862
4734
|
]
|
|
4863
4735
|
});
|
|
4864
|
-
function normalizeAgentOption(agent) {
|
|
4865
|
-
if (!Array.isArray(agent)) return agent;
|
|
4866
|
-
if (agent.includes(false)) return false;
|
|
4867
|
-
return agent.filter((value) => typeof value === "string");
|
|
4868
|
-
}
|
|
4869
4736
|
function parseArgs() {
|
|
4870
|
-
const
|
|
4871
|
-
const separatorIndex = args.indexOf("--");
|
|
4872
|
-
const viteArgs = separatorIndex >= 0 ? args.slice(0, separatorIndex) : args;
|
|
4873
|
-
const templateArgs = separatorIndex >= 0 ? args.slice(separatorIndex + 1) : [];
|
|
4874
|
-
const parsed = lib_default(viteArgs, {
|
|
4875
|
-
alias: { h: "help" },
|
|
4876
|
-
boolean: [
|
|
4877
|
-
"help",
|
|
4878
|
-
"list",
|
|
4879
|
-
"all",
|
|
4880
|
-
"interactive",
|
|
4881
|
-
"hooks",
|
|
4882
|
-
"verbose",
|
|
4883
|
-
"git",
|
|
4884
|
-
"approve-builds"
|
|
4885
|
-
],
|
|
4886
|
-
string: [
|
|
4887
|
-
"directory",
|
|
4888
|
-
"agent",
|
|
4889
|
-
"editor",
|
|
4890
|
-
"package-manager"
|
|
4891
|
-
],
|
|
4892
|
-
default: { interactive: defaultInteractive() }
|
|
4893
|
-
});
|
|
4737
|
+
const parsed = unwrapCliParseOutcome(parseCreateArgs(process.argv.slice(3)));
|
|
4894
4738
|
return {
|
|
4895
|
-
templateName: parsed.
|
|
4739
|
+
templateName: parsed.templateName,
|
|
4896
4740
|
options: {
|
|
4897
4741
|
directory: parsed.directory,
|
|
4898
|
-
interactive: parsed.interactive,
|
|
4899
|
-
list: parsed.list
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
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,
|
|
4904
4747
|
git: parsed.git,
|
|
4905
4748
|
hooks: parsed.hooks,
|
|
4906
|
-
packageManager: parsed
|
|
4907
|
-
approveBuilds: parsed
|
|
4749
|
+
packageManager: parsed.packageManager,
|
|
4750
|
+
approveBuilds: parsed.approveBuilds ?? false
|
|
4908
4751
|
},
|
|
4909
|
-
templateArgs
|
|
4752
|
+
templateArgs: parsed.templateArgs
|
|
4910
4753
|
};
|
|
4911
4754
|
}
|
|
4912
4755
|
function describeScaffold(templateName, templateArgs) {
|
|
@@ -4944,27 +4787,31 @@ function formatTemplateName(templateName) {
|
|
|
4944
4787
|
}
|
|
4945
4788
|
function getNextCommand(projectDir, command) {
|
|
4946
4789
|
if (!projectDir || projectDir === ".") return command;
|
|
4947
|
-
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);
|
|
4948
4795
|
}
|
|
4949
4796
|
function getCopilotSetupRoot(projectRoot, isExistingMonorepo) {
|
|
4950
4797
|
if (!isExistingMonorepo) return projectRoot;
|
|
4951
4798
|
return findGitRoot(projectRoot) ?? projectRoot;
|
|
4952
4799
|
}
|
|
4953
4800
|
function showCreateSummary(options) {
|
|
4954
|
-
const { description, installSummary, nextCommand, packageManager, packageManagerVersion, projectDir } = options;
|
|
4801
|
+
const { description, gitInitialized, installSummary, nextCommand, packageManager, packageManagerVersion, projectDir } = options;
|
|
4955
4802
|
log(`${styleText("magenta", "◇")} Scaffolded ${accent(projectDir)}${description ? ` with ${description}` : ""}`);
|
|
4956
4803
|
log(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
|
|
4957
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
|
+
}
|
|
4958
4810
|
log(`${styleText("blue", "→")} Next: ${accent(nextCommand)}`);
|
|
4959
4811
|
}
|
|
4960
4812
|
async function main() {
|
|
4961
4813
|
const { templateName, options, templateArgs } = parseArgs();
|
|
4962
4814
|
let compactOutput = !options.verbose;
|
|
4963
|
-
if (options.help) {
|
|
4964
|
-
printHeader();
|
|
4965
|
-
log(helpMessage);
|
|
4966
|
-
return;
|
|
4967
|
-
}
|
|
4968
4815
|
if (options.list) {
|
|
4969
4816
|
await showAvailableTemplates();
|
|
4970
4817
|
return;
|
|
@@ -4996,6 +4843,7 @@ async function main() {
|
|
|
4996
4843
|
let selectedEditors;
|
|
4997
4844
|
let selectedParentDir;
|
|
4998
4845
|
let remoteTargetDir;
|
|
4846
|
+
let gitInitialized = false;
|
|
4999
4847
|
let shouldSetupHooks = false;
|
|
5000
4848
|
let bundled;
|
|
5001
4849
|
let skipShorthandExpansion = false;
|
|
@@ -5159,11 +5007,6 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5159
5007
|
targetDir = selectedParentDir ? path.join(selectedParentDir, selected.targetDir).split(path.sep).join("/") : selected.targetDir;
|
|
5160
5008
|
}
|
|
5161
5009
|
}
|
|
5162
|
-
if (options.packageManager && !Object.values(PackageManager).includes(options.packageManager)) {
|
|
5163
|
-
const valid = Object.values(PackageManager).join(", ");
|
|
5164
|
-
log$1.error(`Invalid package manager: ${options.packageManager}. Must be one of: ${valid}`);
|
|
5165
|
-
cancelAndExit("Invalid --package-manager value", 1);
|
|
5166
|
-
}
|
|
5167
5010
|
const requestedPackageManager = options.packageManager;
|
|
5168
5011
|
const detectedPackageManager = workspaceInfoOptional.packageManager;
|
|
5169
5012
|
const packageManager = (isMonorepo ? detectedPackageManager ?? requestedPackageManager : requestedPackageManager ?? detectedPackageManager) ?? await selectPackageManager(options.interactive, compactOutput);
|
|
@@ -5290,7 +5133,8 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5290
5133
|
workspaceInfo.packages = scaffoldedWorkspace.packages;
|
|
5291
5134
|
if (shouldSetupGit) {
|
|
5292
5135
|
updateCreateProgress("Initializing git repository");
|
|
5293
|
-
|
|
5136
|
+
gitInitialized = await initGitRepository(fullPath);
|
|
5137
|
+
if (gitInitialized) ensureDefaultGitignoreEntries(fullPath);
|
|
5294
5138
|
}
|
|
5295
5139
|
updateCreateProgress("Writing agent instructions");
|
|
5296
5140
|
pauseCreateProgress();
|
|
@@ -5336,6 +5180,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5336
5180
|
clearCreateProgress();
|
|
5337
5181
|
showCreateSummary({
|
|
5338
5182
|
description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
|
|
5183
|
+
gitInitialized,
|
|
5339
5184
|
installSummary,
|
|
5340
5185
|
nextCommand: getNextCommand(projectDir, "vp run"),
|
|
5341
5186
|
packageManager: workspaceInfo.packageManager,
|
|
@@ -5510,7 +5355,8 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5510
5355
|
} else {
|
|
5511
5356
|
if (shouldSetupGit) {
|
|
5512
5357
|
updateCreateProgress("Initializing git repository");
|
|
5513
|
-
|
|
5358
|
+
gitInitialized = await initGitRepository(fullPath);
|
|
5359
|
+
if (gitInitialized) ensureDefaultGitignoreEntries(fullPath);
|
|
5514
5360
|
}
|
|
5515
5361
|
if (shouldMigrateLintFmtTools) await installAndMigrate(fullPath);
|
|
5516
5362
|
updateCreateProgress("Applying Vite+ project setup");
|
|
@@ -5532,6 +5378,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5532
5378
|
clearCreateProgress();
|
|
5533
5379
|
showCreateSummary({
|
|
5534
5380
|
description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
|
|
5381
|
+
gitInitialized,
|
|
5535
5382
|
installSummary,
|
|
5536
5383
|
nextCommand: getNextCommand(projectDir, "vp run"),
|
|
5537
5384
|
packageManager: workspaceInfo.packageManager,
|
|
@@ -37,7 +37,7 @@ 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.3.
|
|
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
43
|
VITEST_VERSION = "4.1.11";
|
|
@@ -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 { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-
|
|
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 };
|