@woodsportal/hubspot-kit 1.0.33 → 1.0.34
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/CHANGELOG.md +5 -0
- package/dist/cli.js +102 -77
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
- **CSS entries** — shared `tailwind.css.config.css`; documented never-merge rules on `main.dev.css` / `main.prod.css`
|
|
20
20
|
- **`wp doctor`** — CSS pipeline checks (prefix, `.temp` @source, `skipRuntimeCss`, `module.css` dw utilities, CDN `require_css` warning)
|
|
21
21
|
|
|
22
|
+
## 1.0.34 — 2026-06-08
|
|
23
|
+
|
|
24
|
+
### Dev server
|
|
25
|
+
- **`wp dev` / `wp local`** — spawn Vite via `node …/vite/bin/vite.js` (or `vite.cmd` on Windows) instead of `.bin/vite` shell shim; fixes `ENOENT` on Windows
|
|
26
|
+
|
|
22
27
|
## 1.0.33 — 2026-06-08
|
|
23
28
|
|
|
24
29
|
### Dev server
|
package/dist/cli.js
CHANGED
|
@@ -302,8 +302,8 @@ function defaultBaselineDir(projectRoot, config) {
|
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
// src/cli/commands/doctor.ts
|
|
305
|
-
import { existsSync as
|
|
306
|
-
import { join, resolve as
|
|
305
|
+
import { existsSync as existsSync7, readFileSync as readFileSync5 } from "fs";
|
|
306
|
+
import { join, resolve as resolve8 } from "path";
|
|
307
307
|
|
|
308
308
|
// src/lib/cli-spinner.ts
|
|
309
309
|
import * as p from "@clack/prompts";
|
|
@@ -797,6 +797,44 @@ function isUploadOnlyPreexistingProject(projectRoot, moduleArtifactDirs) {
|
|
|
797
797
|
return moduleArtifactDirs.some((dir) => existsSync5(resolve6(dir, "fields.json")));
|
|
798
798
|
}
|
|
799
799
|
|
|
800
|
+
// src/vite/resolve-dev-config.ts
|
|
801
|
+
import { existsSync as existsSync6 } from "fs";
|
|
802
|
+
import { platform } from "os";
|
|
803
|
+
import { resolve as resolve7 } from "path";
|
|
804
|
+
var CONSUMER_DEV_CONFIG = "vite.config.dev.mjs";
|
|
805
|
+
var VITE_JS_SEGMENTS = ["node_modules", "vite", "bin", "vite.js"];
|
|
806
|
+
function resolveDevViteConfigPath(projectRoot) {
|
|
807
|
+
const consumerConfig = resolve7(projectRoot, CONSUMER_DEV_CONFIG);
|
|
808
|
+
if (existsSync6(consumerConfig)) {
|
|
809
|
+
return consumerConfig;
|
|
810
|
+
}
|
|
811
|
+
return kitPath("vite", "vite.config.dev.mjs");
|
|
812
|
+
}
|
|
813
|
+
function isProjectViteInstalled(projectRoot) {
|
|
814
|
+
return existsSync6(resolve7(projectRoot, ...VITE_JS_SEGMENTS));
|
|
815
|
+
}
|
|
816
|
+
function resolveProjectViteSpawn(projectRoot) {
|
|
817
|
+
const viteJs = resolve7(projectRoot, ...VITE_JS_SEGMENTS);
|
|
818
|
+
if (existsSync6(viteJs)) {
|
|
819
|
+
return { command: process.execPath, prefixArgs: [viteJs] };
|
|
820
|
+
}
|
|
821
|
+
const binDir = resolve7(projectRoot, "node_modules", ".bin");
|
|
822
|
+
if (platform() === "win32") {
|
|
823
|
+
const winCmd = resolve7(binDir, "vite.cmd");
|
|
824
|
+
if (existsSync6(winCmd)) {
|
|
825
|
+
return { command: winCmd, prefixArgs: [] };
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
const posixShim = resolve7(binDir, "vite");
|
|
829
|
+
if (existsSync6(posixShim)) {
|
|
830
|
+
return { command: posixShim, prefixArgs: [] };
|
|
831
|
+
}
|
|
832
|
+
return null;
|
|
833
|
+
}
|
|
834
|
+
function formatProjectViteSpawn(spawn2) {
|
|
835
|
+
return [spawn2.command, ...spawn2.prefixArgs].join(" ");
|
|
836
|
+
}
|
|
837
|
+
|
|
800
838
|
// src/cli/commands/doctor.ts
|
|
801
839
|
function checkNode() {
|
|
802
840
|
const major = Number(process.versions.node.split(".")[0]);
|
|
@@ -862,8 +900,8 @@ function checkConfig(ctx) {
|
|
|
862
900
|
function checkEnvFiles(ctx) {
|
|
863
901
|
return ctx.config.env.tiers.map((tier) => {
|
|
864
902
|
const file = tier === "dev" ? ".env.dev" : tier === "stg" ? ".env.stg" : ".env.prod";
|
|
865
|
-
const path =
|
|
866
|
-
const ok =
|
|
903
|
+
const path = resolve8(ctx.projectRoot, file);
|
|
904
|
+
const ok = existsSync7(path);
|
|
867
905
|
return {
|
|
868
906
|
name: `env-${tier}`,
|
|
869
907
|
ok,
|
|
@@ -875,8 +913,8 @@ function checkEnvFiles(ctx) {
|
|
|
875
913
|
}
|
|
876
914
|
function checkLegacyBuildIdFile(ctx) {
|
|
877
915
|
if (isThemeProject(ctx.config) || !usesCdnPipeline(ctx.config)) return null;
|
|
878
|
-
const legacy =
|
|
879
|
-
if (!
|
|
916
|
+
const legacy = resolve8(ctx.projectRoot, ".portal-build-id");
|
|
917
|
+
if (!existsSync7(legacy)) return null;
|
|
880
918
|
return {
|
|
881
919
|
name: "legacy-build-id",
|
|
882
920
|
ok: false,
|
|
@@ -887,8 +925,8 @@ function checkLegacyBuildIdFile(ctx) {
|
|
|
887
925
|
}
|
|
888
926
|
function checkBuildId(ctx) {
|
|
889
927
|
if (isThemeProject(ctx.config) || !usesCdnPipeline(ctx.config)) return null;
|
|
890
|
-
const file =
|
|
891
|
-
const ok =
|
|
928
|
+
const file = resolve8(ctx.projectRoot, ctx.config.cdn.buildIdFile);
|
|
929
|
+
const ok = existsSync7(file);
|
|
892
930
|
return {
|
|
893
931
|
name: "build-id",
|
|
894
932
|
ok,
|
|
@@ -942,7 +980,7 @@ function checkDevSlug(ctx) {
|
|
|
942
980
|
};
|
|
943
981
|
}
|
|
944
982
|
function isUploadOnlyProject(ctx) {
|
|
945
|
-
const moduleDirs = [
|
|
983
|
+
const moduleDirs = [resolve8(ctx.projectRoot, ctx.config.module.uploadPath)];
|
|
946
984
|
return isUploadOnlyPreexistingProject(ctx.projectRoot, moduleDirs);
|
|
947
985
|
}
|
|
948
986
|
function checkUploadOnlyNote(ctx) {
|
|
@@ -956,8 +994,8 @@ function checkUploadOnlyNote(ctx) {
|
|
|
956
994
|
};
|
|
957
995
|
}
|
|
958
996
|
function checkDevViteConfig(ctx) {
|
|
959
|
-
const path =
|
|
960
|
-
const ok =
|
|
997
|
+
const path = resolve8(ctx.projectRoot, "vite.config.dev.mjs");
|
|
998
|
+
const ok = existsSync7(path);
|
|
961
999
|
return {
|
|
962
1000
|
name: "vite-dev-config",
|
|
963
1001
|
ok,
|
|
@@ -968,8 +1006,8 @@ function checkDevViteConfig(ctx) {
|
|
|
968
1006
|
}
|
|
969
1007
|
function checkMetaJson(ctx) {
|
|
970
1008
|
if (isThemeProject(ctx.config)) return null;
|
|
971
|
-
const path =
|
|
972
|
-
if (!
|
|
1009
|
+
const path = resolve8(ctx.projectRoot, "public/meta.json");
|
|
1010
|
+
if (!existsSync7(path)) {
|
|
973
1011
|
return {
|
|
974
1012
|
name: "meta-json",
|
|
975
1013
|
ok: false,
|
|
@@ -1001,8 +1039,8 @@ function checkMetaJson(ctx) {
|
|
|
1001
1039
|
}
|
|
1002
1040
|
async function checkCdnMirrorPublic(ctx) {
|
|
1003
1041
|
if (isThemeProject(ctx.config) || !usesCdnPipeline(ctx.config)) return null;
|
|
1004
|
-
const mirrorPath =
|
|
1005
|
-
if (!
|
|
1042
|
+
const mirrorPath = resolve8(ctx.projectRoot, ctx.config.cdn?.mirror ?? "portal.cdn.json");
|
|
1043
|
+
if (!existsSync7(mirrorPath)) {
|
|
1006
1044
|
return {
|
|
1007
1045
|
name: "cdn-mirror-public",
|
|
1008
1046
|
ok: false,
|
|
@@ -1065,8 +1103,8 @@ async function checkCdnMirrorPublic(ctx) {
|
|
|
1065
1103
|
severity: "warn"
|
|
1066
1104
|
};
|
|
1067
1105
|
}
|
|
1068
|
-
const manifestPath =
|
|
1069
|
-
if (!
|
|
1106
|
+
const manifestPath = resolve8(ctx.projectRoot, "dist/cdn/manifest.json");
|
|
1107
|
+
if (!existsSync7(manifestPath)) {
|
|
1070
1108
|
return {
|
|
1071
1109
|
name: "cdn-mirror-public",
|
|
1072
1110
|
ok: true,
|
|
@@ -1112,8 +1150,8 @@ async function checkCdnMirrorPublic(ctx) {
|
|
|
1112
1150
|
}
|
|
1113
1151
|
function checkFieldsJson(ctx) {
|
|
1114
1152
|
if (isThemeProject(ctx.config)) return null;
|
|
1115
|
-
const path =
|
|
1116
|
-
if (!
|
|
1153
|
+
const path = resolve8(ctx.projectRoot, "public/fields.json");
|
|
1154
|
+
if (!existsSync7(path)) {
|
|
1117
1155
|
return {
|
|
1118
1156
|
name: "fields-json",
|
|
1119
1157
|
ok: false,
|
|
@@ -1153,8 +1191,8 @@ function checkFieldsJson(ctx) {
|
|
|
1153
1191
|
}
|
|
1154
1192
|
}
|
|
1155
1193
|
function readProjectFile(projectRoot, relativePath) {
|
|
1156
|
-
const path =
|
|
1157
|
-
if (!
|
|
1194
|
+
const path = resolve8(projectRoot, relativePath);
|
|
1195
|
+
if (!existsSync7(path)) {
|
|
1158
1196
|
return null;
|
|
1159
1197
|
}
|
|
1160
1198
|
return readFileSync5(path, "utf8");
|
|
@@ -1224,8 +1262,8 @@ function checkCssPipeline(ctx) {
|
|
|
1224
1262
|
}
|
|
1225
1263
|
const moduleOutDir = ctx.config.module?.outDir;
|
|
1226
1264
|
if (moduleOutDir && usesCdnPipeline(ctx.config)) {
|
|
1227
|
-
const moduleCssPath =
|
|
1228
|
-
if (
|
|
1265
|
+
const moduleCssPath = resolve8(ctx.projectRoot, moduleOutDir, "module.css");
|
|
1266
|
+
if (existsSync7(moduleCssPath)) {
|
|
1229
1267
|
const css = readFileSync5(moduleCssPath, "utf8");
|
|
1230
1268
|
const hasDwUtilities = /dw\\:/.test(css) || /\.dw:/.test(css);
|
|
1231
1269
|
checks.push({
|
|
@@ -1241,8 +1279,8 @@ function checkCssPipeline(ctx) {
|
|
|
1241
1279
|
}
|
|
1242
1280
|
function checkHybridModuleHtml(ctx) {
|
|
1243
1281
|
if (isThemeProject(ctx.config) || !usesCdnPipeline(ctx.config)) return null;
|
|
1244
|
-
const path =
|
|
1245
|
-
if (!
|
|
1282
|
+
const path = resolve8(ctx.projectRoot, "public/module.html");
|
|
1283
|
+
if (!existsSync7(path)) {
|
|
1246
1284
|
return {
|
|
1247
1285
|
name: "module-html",
|
|
1248
1286
|
ok: false,
|
|
@@ -1269,8 +1307,8 @@ function checkHybridModuleHtml(ctx) {
|
|
|
1269
1307
|
function checkCdnViteConfigs(ctx) {
|
|
1270
1308
|
if (isThemeProject(ctx.config) || !usesCdnPipeline(ctx.config)) return [];
|
|
1271
1309
|
return ["vite.config.cdn-vendor.mjs", "vite.config.cdn-app.mjs"].map((file) => {
|
|
1272
|
-
const path =
|
|
1273
|
-
const ok =
|
|
1310
|
+
const path = resolve8(ctx.projectRoot, file);
|
|
1311
|
+
const ok = existsSync7(path);
|
|
1274
1312
|
return {
|
|
1275
1313
|
name: file.replace(/\./g, "-"),
|
|
1276
1314
|
ok,
|
|
@@ -1282,8 +1320,8 @@ function checkCdnViteConfigs(ctx) {
|
|
|
1282
1320
|
}
|
|
1283
1321
|
function checkDevEntry(ctx) {
|
|
1284
1322
|
const checks = [];
|
|
1285
|
-
const indexHtml =
|
|
1286
|
-
const hasIndex =
|
|
1323
|
+
const indexHtml = resolve8(ctx.projectRoot, "index.html");
|
|
1324
|
+
const hasIndex = existsSync7(indexHtml);
|
|
1287
1325
|
checks.push({
|
|
1288
1326
|
name: "index-html",
|
|
1289
1327
|
ok: hasIndex,
|
|
@@ -1291,8 +1329,8 @@ function checkDevEntry(ctx) {
|
|
|
1291
1329
|
remediation: hasIndex ? void 0 : "Re-run wp init or copy index.html from kit templates",
|
|
1292
1330
|
severity: "error"
|
|
1293
1331
|
});
|
|
1294
|
-
const localDev =
|
|
1295
|
-
const hasEntry =
|
|
1332
|
+
const localDev = resolve8(ctx.projectRoot, ctx.config.entries.localDev);
|
|
1333
|
+
const hasEntry = existsSync7(localDev);
|
|
1296
1334
|
checks.push({
|
|
1297
1335
|
name: "local-dev-entry",
|
|
1298
1336
|
ok: hasEntry,
|
|
@@ -1319,7 +1357,7 @@ function checkDevEntry(ctx) {
|
|
|
1319
1357
|
}
|
|
1320
1358
|
function checkKitScripts() {
|
|
1321
1359
|
const script = kitPath("scripts", "build-cdn.mjs");
|
|
1322
|
-
const ok =
|
|
1360
|
+
const ok = existsSync7(script);
|
|
1323
1361
|
return {
|
|
1324
1362
|
name: "kit-scripts",
|
|
1325
1363
|
ok,
|
|
@@ -1332,8 +1370,8 @@ function checkWphsWorkspace(ctx) {
|
|
|
1332
1370
|
const workspace = ctx.config.dev.moduleConfigDir;
|
|
1333
1371
|
const checks = [];
|
|
1334
1372
|
for (const legacy of [".dev", ".woodsportal"]) {
|
|
1335
|
-
const legacyPath =
|
|
1336
|
-
if (
|
|
1373
|
+
const legacyPath = resolve8(ctx.projectRoot, legacy);
|
|
1374
|
+
if (existsSync7(legacyPath)) {
|
|
1337
1375
|
checks.push({
|
|
1338
1376
|
name: `legacy-${legacy}`,
|
|
1339
1377
|
ok: false,
|
|
@@ -1343,7 +1381,7 @@ function checkWphsWorkspace(ctx) {
|
|
|
1343
1381
|
});
|
|
1344
1382
|
}
|
|
1345
1383
|
}
|
|
1346
|
-
if (
|
|
1384
|
+
if (existsSync7(resolve8(ctx.projectRoot, ".wp-hs-baseline"))) {
|
|
1347
1385
|
checks.push({
|
|
1348
1386
|
name: "legacy-baseline",
|
|
1349
1387
|
ok: false,
|
|
@@ -1362,10 +1400,10 @@ function checkWphsWorkspace(ctx) {
|
|
|
1362
1400
|
});
|
|
1363
1401
|
return checks;
|
|
1364
1402
|
}
|
|
1365
|
-
const wphsRoot =
|
|
1403
|
+
const wphsRoot = resolve8(ctx.projectRoot, workspace);
|
|
1366
1404
|
const required = ["config", "assets/branding", "fixtures", "cache", "audit/baseline", "state"];
|
|
1367
1405
|
for (const sub of required) {
|
|
1368
|
-
const ok =
|
|
1406
|
+
const ok = existsSync7(join(wphsRoot, sub));
|
|
1369
1407
|
checks.push({
|
|
1370
1408
|
name: `wphs-${sub.replace(/\//g, "-")}`,
|
|
1371
1409
|
ok,
|
|
@@ -1378,8 +1416,8 @@ function checkWphsWorkspace(ctx) {
|
|
|
1378
1416
|
}
|
|
1379
1417
|
function checkAdapter(ctx) {
|
|
1380
1418
|
if (isThemeProject(ctx.config)) return null;
|
|
1381
|
-
const adapterPath =
|
|
1382
|
-
const ok =
|
|
1419
|
+
const adapterPath = resolve8(ctx.projectRoot, ctx.config.dev.adapter);
|
|
1420
|
+
const ok = existsSync7(adapterPath);
|
|
1383
1421
|
return {
|
|
1384
1422
|
name: "wphs-adapter",
|
|
1385
1423
|
ok,
|
|
@@ -1390,8 +1428,8 @@ function checkAdapter(ctx) {
|
|
|
1390
1428
|
}
|
|
1391
1429
|
function checkModuleConfigUiDeps(ctx) {
|
|
1392
1430
|
if (isThemeProject(ctx.config)) return [];
|
|
1393
|
-
const pkgPath =
|
|
1394
|
-
if (!
|
|
1431
|
+
const pkgPath = resolve8(ctx.projectRoot, "package.json");
|
|
1432
|
+
if (!existsSync7(pkgPath)) return [];
|
|
1395
1433
|
let deps = {};
|
|
1396
1434
|
try {
|
|
1397
1435
|
const pkg = JSON.parse(readFileSync5(pkgPath, "utf8"));
|
|
@@ -1411,11 +1449,10 @@ function checkModuleConfigUiDeps(ctx) {
|
|
|
1411
1449
|
});
|
|
1412
1450
|
}
|
|
1413
1451
|
function checkViteInstalled(ctx) {
|
|
1414
|
-
if (isThemeProject(ctx.config) && !
|
|
1452
|
+
if (isThemeProject(ctx.config) && !existsSync7(resolve8(ctx.projectRoot, "vite.config.dev.mjs"))) {
|
|
1415
1453
|
return null;
|
|
1416
1454
|
}
|
|
1417
|
-
const
|
|
1418
|
-
const ok = existsSync6(localBin);
|
|
1455
|
+
const ok = isProjectViteInstalled(ctx.projectRoot);
|
|
1419
1456
|
return {
|
|
1420
1457
|
name: "vite",
|
|
1421
1458
|
ok,
|
|
@@ -1569,21 +1606,21 @@ async function runConfigValidate(ctx) {
|
|
|
1569
1606
|
}
|
|
1570
1607
|
|
|
1571
1608
|
// src/cli/commands/build.ts
|
|
1572
|
-
import { resolve as
|
|
1609
|
+
import { resolve as resolve10 } from "path";
|
|
1573
1610
|
|
|
1574
1611
|
// src/lib/cli-banner.ts
|
|
1575
1612
|
import pc3 from "picocolors";
|
|
1576
1613
|
|
|
1577
1614
|
// src/lib/kit-version.ts
|
|
1578
1615
|
import { readFileSync as readFileSync6 } from "fs";
|
|
1579
|
-
import { resolve as
|
|
1616
|
+
import { resolve as resolve9 } from "path";
|
|
1580
1617
|
var cachedVersion = null;
|
|
1581
1618
|
function readKitVersion() {
|
|
1582
1619
|
if (cachedVersion) {
|
|
1583
1620
|
return cachedVersion;
|
|
1584
1621
|
}
|
|
1585
1622
|
try {
|
|
1586
|
-
const pkg = JSON.parse(readFileSync6(
|
|
1623
|
+
const pkg = JSON.parse(readFileSync6(resolve9(getKitRoot(), "package.json"), "utf8"));
|
|
1587
1624
|
cachedVersion = pkg.version ?? "0.0.0";
|
|
1588
1625
|
} catch {
|
|
1589
1626
|
cachedVersion = "0.0.0";
|
|
@@ -1715,7 +1752,7 @@ function buildTasks(ctx, options, run) {
|
|
|
1715
1752
|
title: `Building monolith module (${tier})`,
|
|
1716
1753
|
task: async () => {
|
|
1717
1754
|
await run("run-vite-build.mjs", [
|
|
1718
|
-
|
|
1755
|
+
resolve10(ctx.projectRoot, "vite.config.monolith.mjs"),
|
|
1719
1756
|
...tierToStgFlag(tier)
|
|
1720
1757
|
]);
|
|
1721
1758
|
await run("run-hubspot-module-postbuild.mjs");
|
|
@@ -1729,7 +1766,7 @@ function buildTasks(ctx, options, run) {
|
|
|
1729
1766
|
task: async () => {
|
|
1730
1767
|
if (options.cdnEsm) {
|
|
1731
1768
|
await run("run-vite-build.mjs", [
|
|
1732
|
-
|
|
1769
|
+
resolve10(ctx.projectRoot, "vite.config.cdn-esm.mjs"),
|
|
1733
1770
|
...tierToStgFlag(tier)
|
|
1734
1771
|
]);
|
|
1735
1772
|
} else {
|
|
@@ -1744,7 +1781,7 @@ function buildTasks(ctx, options, run) {
|
|
|
1744
1781
|
title: `Building HubSpot module (${tier})`,
|
|
1745
1782
|
task: async () => {
|
|
1746
1783
|
await run("run-vite-build.mjs", [
|
|
1747
|
-
|
|
1784
|
+
resolve10(ctx.projectRoot, "vite.config.hubspot.mjs"),
|
|
1748
1785
|
...tierToStgFlag(tier)
|
|
1749
1786
|
]);
|
|
1750
1787
|
await run("run-hubspot-module-postbuild.mjs");
|
|
@@ -1841,7 +1878,7 @@ async function runBuild(ctx, options) {
|
|
|
1841
1878
|
command: "build",
|
|
1842
1879
|
tier,
|
|
1843
1880
|
ok: true,
|
|
1844
|
-
outDir:
|
|
1881
|
+
outDir: resolve10(ctx.projectRoot, ctx.config.module.outDir)
|
|
1845
1882
|
});
|
|
1846
1883
|
} else if (!options.quiet) {
|
|
1847
1884
|
printCommandDone(ctx, "Build complete");
|
|
@@ -1858,27 +1895,6 @@ async function runBuild(ctx, options) {
|
|
|
1858
1895
|
import { existsSync as existsSync8 } from "fs";
|
|
1859
1896
|
import { resolve as resolve11 } from "path";
|
|
1860
1897
|
import { spawn } from "child_process";
|
|
1861
|
-
|
|
1862
|
-
// src/vite/resolve-dev-config.ts
|
|
1863
|
-
import { existsSync as existsSync7 } from "fs";
|
|
1864
|
-
import { resolve as resolve10 } from "path";
|
|
1865
|
-
var CONSUMER_DEV_CONFIG = "vite.config.dev.mjs";
|
|
1866
|
-
function resolveDevViteConfigPath(projectRoot) {
|
|
1867
|
-
const consumerConfig = resolve10(projectRoot, CONSUMER_DEV_CONFIG);
|
|
1868
|
-
if (existsSync7(consumerConfig)) {
|
|
1869
|
-
return consumerConfig;
|
|
1870
|
-
}
|
|
1871
|
-
return kitPath("vite", "vite.config.dev.mjs");
|
|
1872
|
-
}
|
|
1873
|
-
function resolveProjectViteBin(projectRoot) {
|
|
1874
|
-
const localBin = resolve10(projectRoot, "node_modules", ".bin", "vite");
|
|
1875
|
-
if (existsSync7(localBin)) {
|
|
1876
|
-
return localBin;
|
|
1877
|
-
}
|
|
1878
|
-
return "vite";
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
|
-
// src/cli/commands/dev.ts
|
|
1882
1898
|
async function runDev(ctx, options) {
|
|
1883
1899
|
const port = options.port ?? 3e3;
|
|
1884
1900
|
const env = {
|
|
@@ -1886,12 +1902,13 @@ async function runDev(ctx, options) {
|
|
|
1886
1902
|
WP_HS_PROJECT_ROOT: ctx.projectRoot
|
|
1887
1903
|
};
|
|
1888
1904
|
const configPath = resolveDevViteConfigPath(ctx.projectRoot);
|
|
1889
|
-
const
|
|
1905
|
+
const viteSpawn = resolveProjectViteSpawn(ctx.projectRoot);
|
|
1890
1906
|
if (ctx.global.dryRun) {
|
|
1891
|
-
|
|
1907
|
+
const dryRunTarget = viteSpawn ? formatProjectViteSpawn(viteSpawn) : "vite";
|
|
1908
|
+
ctx.logger.info(`[dry-run] ${dryRunTarget} --config ${configPath} --port ${port}`);
|
|
1892
1909
|
return ExitCode.SUCCESS;
|
|
1893
1910
|
}
|
|
1894
|
-
if (
|
|
1911
|
+
if (!viteSpawn) {
|
|
1895
1912
|
throw new WpHsError("vite is not installed in this project.", {
|
|
1896
1913
|
exitCode: ExitCode.PREREQUISITE,
|
|
1897
1914
|
remediation: "Run yarn install or npm install. If this is an older wp init project, add vite and peers to devDependencies (run wp init again or see @woodsportal/hubspot-kit templates)."
|
|
@@ -1911,8 +1928,16 @@ async function runDev(ctx, options) {
|
|
|
1911
1928
|
});
|
|
1912
1929
|
return new Promise((resolvePromise) => {
|
|
1913
1930
|
const child = spawn(
|
|
1914
|
-
|
|
1915
|
-
[
|
|
1931
|
+
viteSpawn.command,
|
|
1932
|
+
[
|
|
1933
|
+
...viteSpawn.prefixArgs,
|
|
1934
|
+
"--config",
|
|
1935
|
+
configPath,
|
|
1936
|
+
"--port",
|
|
1937
|
+
String(port),
|
|
1938
|
+
"--mode",
|
|
1939
|
+
"dev"
|
|
1940
|
+
],
|
|
1916
1941
|
{
|
|
1917
1942
|
cwd: ctx.projectRoot,
|
|
1918
1943
|
env,
|