vite-plus 0.2.6 → 0.2.8
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/AGENTS.md +4 -0
- package/LICENSE +5 -1
- package/README.md +1 -1
- package/bin/vpr +3 -2
- package/binding/index.cjs +193 -80
- package/binding/index.d.cts +99 -8
- package/dist/agent-CI79DuSy.js +600 -0
- package/dist/bin.js +1367 -11
- package/dist/{cli-truncate-BVOlIIPy.js → cli-truncate-Bg3RDXpi.js} +0 -2
- package/dist/client/bundledDevClient.mjs +1 -0
- package/dist/config/bin.js +13 -126
- package/dist/{constants-CaXMuYUG.js → constants-BppDcRc1.js} +1 -1
- package/dist/create/bin.js +90 -77
- package/dist/{define-config-iGV0CGUk.cjs → define-config-CEm_MtvJ.cjs} +1 -1
- package/dist/{define-config-hV8qyU8p.js → define-config-DPnHe1Mx.js} +2 -2
- package/dist/{define-config-eLQH9us2.d.ts → define-config-DWoAkNdp.d.ts} +16 -0
- 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-CKz3vcoG.js → dist-CSQWHI6y.js} +3 -8
- package/dist/dist-DT25H9pj.js +3 -0
- package/dist/{agent-0gFJkIKu.js → editor-CGWdbLgD.js} +709 -579
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-DiRs8ceZ.js → json-BU88uu6o.js} +2 -6
- package/dist/migration/bin.js +60 -50
- package/dist/{oxlint-plugin-config-CMSCIkks.js → oxlint-plugin-config-BHOzlwMw.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +2 -2
- package/dist/{package-CP5EUXlu.js → package-hV-77cBb.js} +2 -2
- package/dist/{tsconfig-Cac-NNdT.js → prompts-DYap08te.js} +32 -174
- package/dist/{resolve-vite-config-BY7PB-LW.js → resolve-vite-config-EWXclqvV.js} +1 -1
- package/dist/{rolldown-runtime-C7HZzL1F.js → rolldown-runtime-CMFfr-1z.js} +1 -1
- package/dist/staged/bin.js +20 -23
- package/dist/{help-YP84FSEz.js → terminal-CrqqK8WT.js} +39 -2
- package/dist/tsconfig-CVUKLfL8.js +151 -0
- package/dist/{tsgolint-path-B-yOos8p.js → tsgolint-path-eMZT-oea.js} +4 -2
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +5 -5
- package/dist/versions.js +5 -5
- package/docs/config/index.md +13 -0
- package/docs/config/staged.md +2 -1
- package/docs/guide/build.md +1 -1
- package/docs/guide/ci.md +28 -3
- package/docs/guide/commit-hooks.md +76 -9
- package/docs/guide/dev.md +4 -0
- package/docs/guide/env.md +8 -4
- package/docs/guide/index.md +1 -1
- package/docs/guide/install.md +2 -0
- package/docs/guide/installer-env-vars.md +3 -3
- package/docs/guide/migrate.md +11 -3
- package/docs/guide/monorepo.md +94 -6
- package/docs/guide/run.md +15 -0
- package/docs/guide/test.md +4 -0
- package/docs/guide/troubleshooting.md +9 -5
- package/package.json +18 -24
- package/dist/dist-CtM2JRbM.js +0 -3
- package/dist/editor-D4T70tKk.js +0 -675
- package/dist/terminal-uTv0ZaMr.js +0 -33
- package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@voidzero-dev/vite-plus-core/dist/client/bundledDevClient.mjs';
|
package/dist/config/bin.js
CHANGED
|
@@ -1,123 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as printHeader, c as renderCliDoc, r as log } from "../terminal-CrqqK8WT.js";
|
|
2
|
+
import { i as promptGitHooks, n as defaultInteractive } from "../prompts-DYap08te.js";
|
|
3
3
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
4
|
-
import {
|
|
5
|
-
import { t as renderCliDoc } from "../help-YP84FSEz.js";
|
|
4
|
+
import { d as install, o as updateExistingAgentInstructions } from "../agent-CI79DuSy.js";
|
|
6
5
|
import { join } from "node:path";
|
|
7
|
-
import { existsSync
|
|
8
|
-
import { spawnSync } from "node:child_process";
|
|
9
|
-
//#region src/config/hooks.ts
|
|
10
|
-
const HOOKS = [
|
|
11
|
-
"pre-commit",
|
|
12
|
-
"pre-merge-commit",
|
|
13
|
-
"prepare-commit-msg",
|
|
14
|
-
"commit-msg",
|
|
15
|
-
"post-commit",
|
|
16
|
-
"applypatch-msg",
|
|
17
|
-
"pre-applypatch",
|
|
18
|
-
"post-applypatch",
|
|
19
|
-
"pre-rebase",
|
|
20
|
-
"post-rewrite",
|
|
21
|
-
"post-checkout",
|
|
22
|
-
"post-merge",
|
|
23
|
-
"pre-push",
|
|
24
|
-
"pre-auto-gc"
|
|
25
|
-
];
|
|
26
|
-
function nestedDirname(depth) {
|
|
27
|
-
let expr = "\"$0\"";
|
|
28
|
-
for (let i = 0; i < depth; i++) expr = `"$(dirname ${expr})"`;
|
|
29
|
-
return expr;
|
|
30
|
-
}
|
|
31
|
-
function hookScript(dir) {
|
|
32
|
-
return `#!/usr/bin/env sh
|
|
33
|
-
{ [ "$HUSKY" = "2" ] || [ "$VITE_GIT_HOOKS" = "2" ]; } && set -x
|
|
34
|
-
n=$(basename "$0")
|
|
35
|
-
s=$(dirname "$(dirname "$0")")/$n
|
|
36
|
-
|
|
37
|
-
[ ! -f "$s" ] && exit 0
|
|
38
|
-
|
|
39
|
-
i="\${XDG_CONFIG_HOME:-$HOME/.config}/vite-plus/hooks-init.sh"
|
|
40
|
-
[ ! -f "$i" ] && i="\${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh"
|
|
41
|
-
[ -f "$i" ] && . "$i"
|
|
42
|
-
|
|
43
|
-
{ [ "\${HUSKY-}" = "0" ] || [ "\${VITE_GIT_HOOKS-}" = "0" ]; } && exit 0
|
|
44
|
-
|
|
45
|
-
d=${nestedDirname(dir.split("/").filter((s) => s !== "" && s !== ".").length + 2)}
|
|
46
|
-
__vp_shell=/bin/sh
|
|
47
|
-
[ -x "$__vp_shell" ] || __vp_shell=$(command -v sh)
|
|
48
|
-
|
|
49
|
-
if [ -n "\${VP_HOME-}" ]; then
|
|
50
|
-
__vp_bin="$VP_HOME/bin"
|
|
51
|
-
elif [ -n "\${HOME-}" ]; then
|
|
52
|
-
__vp_bin="$HOME/.vite-plus/bin"
|
|
53
|
-
else
|
|
54
|
-
__vp_bin=""
|
|
55
|
-
fi
|
|
56
|
-
[ -n "$__vp_bin" ] && [ -d "$__vp_bin" ] && export PATH="$PATH:$__vp_bin"
|
|
57
|
-
|
|
58
|
-
export PATH="$d/node_modules/.bin:$PATH"
|
|
59
|
-
"$__vp_shell" -e "$s" "$@"
|
|
60
|
-
c=$?
|
|
61
|
-
|
|
62
|
-
[ $c != 0 ] && echo "VITE+ - $n script failed (code $c)"
|
|
63
|
-
[ $c = 127 ] && echo "VITE+ - command not found in PATH=$PATH"
|
|
64
|
-
exit $c`;
|
|
65
|
-
}
|
|
66
|
-
function install(dir = ".vite-hooks") {
|
|
67
|
-
if (process.env.HUSKY === "0" || process.env.VITE_GIT_HOOKS === "0") return {
|
|
68
|
-
message: "skip install (git hooks disabled)",
|
|
69
|
-
isError: false
|
|
70
|
-
};
|
|
71
|
-
if (dir.includes("..")) return {
|
|
72
|
-
message: ".. not allowed",
|
|
73
|
-
isError: false
|
|
74
|
-
};
|
|
75
|
-
const prefixResult = spawnSync("git", ["rev-parse", "--show-prefix"]);
|
|
76
|
-
if (prefixResult.status == null) return {
|
|
77
|
-
message: "git command not found",
|
|
78
|
-
isError: true
|
|
79
|
-
};
|
|
80
|
-
if (prefixResult.status !== 0) return {
|
|
81
|
-
message: ".git can't be found",
|
|
82
|
-
isError: false
|
|
83
|
-
};
|
|
84
|
-
const internal = (x = "") => join(dir, "_", x);
|
|
85
|
-
const rel = prefixResult.stdout.toString().trim().replace(/\/$/, "");
|
|
86
|
-
const target = rel ? `${rel}/${dir}/_` : `${dir}/_`;
|
|
87
|
-
const checkResult = spawnSync("git", [
|
|
88
|
-
"config",
|
|
89
|
-
"--local",
|
|
90
|
-
"core.hooksPath"
|
|
91
|
-
]);
|
|
92
|
-
const existingHooksPath = checkResult.status === 0 ? checkResult.stdout?.toString().trim() : "";
|
|
93
|
-
if (existingHooksPath && existingHooksPath !== target && existingHooksPath !== ".husky" && !existingHooksPath.startsWith(".husky/")) return {
|
|
94
|
-
message: `core.hooksPath is already set to "${existingHooksPath}", skipping`,
|
|
95
|
-
isError: false
|
|
96
|
-
};
|
|
97
|
-
const { status, stderr } = spawnSync("git", [
|
|
98
|
-
"config",
|
|
99
|
-
"core.hooksPath",
|
|
100
|
-
target
|
|
101
|
-
]);
|
|
102
|
-
if (status == null) return {
|
|
103
|
-
message: "git command not found",
|
|
104
|
-
isError: true
|
|
105
|
-
};
|
|
106
|
-
if (status) return {
|
|
107
|
-
message: "" + stderr,
|
|
108
|
-
isError: true
|
|
109
|
-
};
|
|
110
|
-
rmSync(internal("husky.sh"), { force: true });
|
|
111
|
-
mkdirSync(internal(), { recursive: true });
|
|
112
|
-
writeFileSync(internal(".gitignore"), "*");
|
|
113
|
-
writeFileSync(internal("h"), hookScript(dir), { mode: 493 });
|
|
114
|
-
for (const hook of HOOKS) writeFileSync(internal(hook), `#!/usr/bin/env sh\n. "$(dirname "$0")/h"`, { mode: 493 });
|
|
115
|
-
return {
|
|
116
|
-
message: "",
|
|
117
|
-
isError: false
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
//#endregion
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
121
7
|
//#region src/config/bin.ts
|
|
122
8
|
async function main() {
|
|
123
9
|
const args = lib_default(process.argv.slice(3), {
|
|
@@ -132,7 +18,7 @@ async function main() {
|
|
|
132
18
|
if (args.help) {
|
|
133
19
|
const helpMessage = renderCliDoc({
|
|
134
20
|
usage: "vp config [OPTIONS]",
|
|
135
|
-
summary: "Configure Vite+ for the current project (
|
|
21
|
+
summary: "Configure Vite+ for the current project (hook dispatcher + agent integration).",
|
|
136
22
|
documentationUrl: "https://viteplus.dev/guide/commit-hooks",
|
|
137
23
|
sections: [{
|
|
138
24
|
title: "Options",
|
|
@@ -143,7 +29,7 @@ async function main() {
|
|
|
143
29
|
},
|
|
144
30
|
{
|
|
145
31
|
label: "--no-hooks",
|
|
146
|
-
description: "Skip hook installation"
|
|
32
|
+
description: "Skip hook dispatcher installation"
|
|
147
33
|
},
|
|
148
34
|
{
|
|
149
35
|
label: "--no-agent",
|
|
@@ -157,8 +43,8 @@ async function main() {
|
|
|
157
43
|
}, {
|
|
158
44
|
title: "Environment",
|
|
159
45
|
rows: [{
|
|
160
|
-
label: "
|
|
161
|
-
description: "Skip hook installation"
|
|
46
|
+
label: "VP_GIT_HOOKS=0",
|
|
47
|
+
description: "Skip hook dispatcher installation"
|
|
162
48
|
}]
|
|
163
49
|
}]
|
|
164
50
|
});
|
|
@@ -173,17 +59,18 @@ async function main() {
|
|
|
173
59
|
const lifecycleEvent = process.env.npm_lifecycle_event;
|
|
174
60
|
const isLifecycleScript = lifecycleEvent === "prepare" || lifecycleEvent === "postinstall";
|
|
175
61
|
const root = process.cwd();
|
|
176
|
-
const
|
|
177
|
-
const isFirstHooksRun = !existsSync(join(root, hooksDir, "_", "pre-commit"));
|
|
62
|
+
const isFirstHooksRun = !existsSync(join(root, dir ?? ".vite-hooks", "_", "pre-commit"));
|
|
178
63
|
let shouldSetupHooks = !skipHooks;
|
|
179
|
-
if (shouldSetupHooks && interactive && isFirstHooksRun && !dir && !isLifecycleScript
|
|
64
|
+
if (shouldSetupHooks && interactive && isFirstHooksRun && !dir && !isLifecycleScript) shouldSetupHooks = await promptGitHooks({
|
|
65
|
+
interactive,
|
|
66
|
+
message: "Install the Git hook dispatcher for this project?"
|
|
67
|
+
});
|
|
180
68
|
if (shouldSetupHooks) {
|
|
181
69
|
const { message, isError } = install(dir);
|
|
182
70
|
if (message) {
|
|
183
71
|
log(message);
|
|
184
72
|
if (isError) process.exit(1);
|
|
185
73
|
}
|
|
186
|
-
if (!message) ensurePreCommitHook(root, hooksDir);
|
|
187
74
|
}
|
|
188
75
|
if (!skipAgent) updateExistingAgentInstructions(root);
|
|
189
76
|
}
|