docs-i18n 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +12 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -52,20 +52,20 @@ async function handleSiteCommand() {
|
|
|
52
52
|
stdio: "inherit"
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
+
const viteBin = resolve(templateRoot, "node_modules", ".bin", "vite");
|
|
56
|
+
const siteEnv = { ...process.env, DOCS_I18N_PROJECT_ROOT: process.cwd() };
|
|
55
57
|
if (!subCommand || subCommand === "dev") {
|
|
56
|
-
const child = spawn(
|
|
58
|
+
const child = spawn(viteBin, ["--port", String(port)], {
|
|
57
59
|
cwd: templateRoot,
|
|
58
60
|
stdio: "inherit",
|
|
59
|
-
env:
|
|
60
|
-
shell: true
|
|
61
|
+
env: siteEnv
|
|
61
62
|
});
|
|
62
63
|
child.on("exit", (code) => process.exit(code ?? 0));
|
|
63
64
|
} else if (subCommand === "build") {
|
|
64
|
-
const child = spawn(
|
|
65
|
+
const child = spawn(viteBin, ["build"], {
|
|
65
66
|
cwd: templateRoot,
|
|
66
67
|
stdio: "inherit",
|
|
67
|
-
env:
|
|
68
|
-
shell: true
|
|
68
|
+
env: siteEnv
|
|
69
69
|
});
|
|
70
70
|
child.on("exit", (code) => process.exit(code ?? 0));
|
|
71
71
|
} else if (subCommand === "upload") {
|
|
@@ -82,10 +82,10 @@ async function handleSiteCommand() {
|
|
|
82
82
|
const sqlFile = resolve(os.tmpdir(), "docs-i18n-upload.sql");
|
|
83
83
|
writeFileSync(sqlFile, allSql.join("\n"));
|
|
84
84
|
const dbName = getOpt("db", "docs-i18n-db");
|
|
85
|
-
const
|
|
85
|
+
const wranglerBin = resolve(templateRoot, "node_modules", ".bin", "wrangler");
|
|
86
|
+
const child = spawn(wranglerBin, ["d1", "execute", dbName, "--file", sqlFile], {
|
|
86
87
|
cwd: templateRoot,
|
|
87
|
-
stdio: "inherit"
|
|
88
|
-
shell: true
|
|
88
|
+
stdio: "inherit"
|
|
89
89
|
});
|
|
90
90
|
child.on("exit", (code) => {
|
|
91
91
|
if (code === 0) {
|
|
@@ -94,11 +94,11 @@ async function handleSiteCommand() {
|
|
|
94
94
|
process.exit(code ?? 0);
|
|
95
95
|
});
|
|
96
96
|
} else if (subCommand === "deploy") {
|
|
97
|
-
const
|
|
97
|
+
const wranglerBin2 = resolve(templateRoot, "node_modules", ".bin", "wrangler");
|
|
98
|
+
const child = spawn(wranglerBin2, ["deploy"], {
|
|
98
99
|
cwd: templateRoot,
|
|
99
100
|
stdio: "inherit",
|
|
100
|
-
env:
|
|
101
|
-
shell: true
|
|
101
|
+
env: siteEnv
|
|
102
102
|
});
|
|
103
103
|
child.on("exit", (code) => process.exit(code ?? 0));
|
|
104
104
|
} else {
|