create-vidra-app 0.1.7 → 0.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +69 -21
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -527,7 +527,7 @@ var runDoctor = async () => {
527
527
  console.log(
528
528
  footer(
529
529
  `${dim("all checks passed \u2014 you're ready to run")} ${lime(
530
- "vidra dev"
530
+ "npm run dev"
531
531
  )}${dim(".")}`
532
532
  )
533
533
  );
@@ -539,7 +539,7 @@ var runDoctor = async () => {
539
539
  footer(
540
540
  `${dim(
541
541
  `${n} issue${n === 1 ? "" : "s"} found. apply the ${n === 1 ? "fix" : "fixes"} above, then re-run`
542
- )} ${lime("vidra doctor")}${dim(".")}`
542
+ )} ${lime("npm run doctor")}${dim(".")}`
543
543
  )
544
544
  );
545
545
  console.log();
@@ -1072,7 +1072,11 @@ var DevSession = class {
1072
1072
  });
1073
1073
  return this.registerChild(vite, "ui", "Vite dev server");
1074
1074
  }
1075
- launchMacosHost() {
1075
+ // Builds the MAUI host as a discrete step (a plain `dotnet build`, never
1076
+ // MSBuild's `-t:Run`) so the per-OS launch paths can spawn the produced
1077
+ // binary directly. `-t:Run` shells out in ways that break for both locally
1078
+ // signed mac apps and unpackaged Windows apps (see the call sites).
1079
+ buildHostSync() {
1076
1080
  console.log(
1077
1081
  taggedRow(
1078
1082
  "active",
@@ -1107,6 +1111,9 @@ var DevSession = class {
1107
1111
  }
1108
1112
  process.exit(1);
1109
1113
  }
1114
+ }
1115
+ launchMacosHost() {
1116
+ this.buildHostSync();
1110
1117
  const appBundle = findMacAppBundle(
1111
1118
  this.project.hostDir,
1112
1119
  this.target.framework,
@@ -1148,26 +1155,42 @@ var DevSession = class {
1148
1155
  });
1149
1156
  return this.registerChild(host, "host", path6.basename(binary));
1150
1157
  }
1158
+ // Build first, then spawn the produced .exe directly. A single
1159
+ // `dotnet build -t:Run` on an unpackaged MAUI Windows app
1160
+ // (`WindowsPackageType=None`) execs the binary before the WindowsAppSDK
1161
+ // native assets are laid out beside it, so the app can't resolve its deps and
1162
+ // dies with a bare `MSB3073 ... exited with code 3` (ERROR_PATH_NOT_FOUND —
1163
+ // "The system cannot find the path specified"). Building as a discrete step
1164
+ // and then launching the binary is the documented workaround.
1165
+ // See dotnet/maui#13942 and dotnet/maui#5975.
1151
1166
  launchWindowsHost() {
1152
- console.log(taggedRow("active", "host", dim("launching\u2026")));
1153
- const host = spawn(
1154
- DOTNET_COMMAND,
1155
- [
1156
- "build",
1157
- "-t:Run",
1158
- "-c",
1159
- this.buildConfig,
1160
- "-f",
1161
- this.target.framework,
1162
- this.project.csprojPath
1163
- ],
1164
- {
1165
- cwd: this.project.root,
1166
- stdio: ["ignore", "pipe", "pipe"],
1167
- env: { ...process.env, VIDRA_DEV_URL: this.viteUrl }
1168
- }
1167
+ this.buildHostSync();
1168
+ const exe = findWindowsExecutable(
1169
+ this.project.hostDir,
1170
+ this.project.csprojPath,
1171
+ this.target.framework,
1172
+ this.buildConfig
1169
1173
  );
1170
- return this.registerChild(host, "host", "MAUI host");
1174
+ if (!exe) {
1175
+ console.error(
1176
+ row({
1177
+ glyph: "error",
1178
+ detail: dim(
1179
+ `could not find the host .exe under ${path6.join(this.project.hostDir, "bin", this.buildConfig, this.target.framework)}`
1180
+ )
1181
+ })
1182
+ );
1183
+ process.exit(1);
1184
+ }
1185
+ console.log(
1186
+ taggedRow("done", "host", `${dim("launched")} ${value(path6.basename(exe))}`)
1187
+ );
1188
+ const host = spawn(exe, [], {
1189
+ cwd: path6.dirname(exe),
1190
+ stdio: ["ignore", "pipe", "pipe"],
1191
+ env: { ...process.env, VIDRA_DEV_URL: this.viteUrl }
1192
+ });
1193
+ return this.registerChild(host, "host", path6.basename(exe));
1171
1194
  }
1172
1195
  registerChild(child, tag2, label) {
1173
1196
  this.children.push(child);
@@ -1314,6 +1337,31 @@ var findMacExecutable = (appBundle) => {
1314
1337
  }
1315
1338
  return null;
1316
1339
  };
1340
+ var findWindowsExecutable = (hostDir, csprojPath, framework, buildConfig) => {
1341
+ const outputDir = path6.join(hostDir, "bin", buildConfig, framework);
1342
+ if (!fs5.existsSync(outputDir)) return null;
1343
+ const exeName = `${path6.basename(csprojPath, ".csproj")}.exe`.toLowerCase();
1344
+ return findFileRecursive(outputDir, (name) => name.toLowerCase() === exeName) ?? findFileRecursive(
1345
+ outputDir,
1346
+ (name) => name.toLowerCase().endsWith(".host.exe")
1347
+ ) ?? findFileRecursive(outputDir, (name) => name.toLowerCase().endsWith(".exe"));
1348
+ };
1349
+ var findFileRecursive = (dir, match) => {
1350
+ if (!fs5.existsSync(dir)) return null;
1351
+ const entries = fs5.readdirSync(dir, { withFileTypes: true });
1352
+ for (const entry of entries) {
1353
+ if (entry.isFile() && match(entry.name)) {
1354
+ return path6.join(dir, entry.name);
1355
+ }
1356
+ }
1357
+ for (const entry of entries) {
1358
+ if (entry.isDirectory()) {
1359
+ const found = findFileRecursive(path6.join(dir, entry.name), match);
1360
+ if (found) return found;
1361
+ }
1362
+ }
1363
+ return null;
1364
+ };
1317
1365
  var killChild = (child) => {
1318
1366
  if (!child.pid || child.exitCode !== null) return;
1319
1367
  if (process.platform === "win32") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vidra-app",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Scaffold a new Vidra application (React + .NET MAUI)",
5
5
  "type": "module",
6
6
  "bin": {