@calo-design/cli 0.9.1 → 0.9.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/bin/mirror-push.js +44 -0
- package/package.json +1 -1
package/bin/mirror-push.js
CHANGED
|
@@ -382,6 +382,50 @@ export default function RootLayout() {
|
|
|
382
382
|
}
|
|
383
383
|
fs.writeFileSync(path.join(stagedAppDir, "_layout.tsx"), managed);
|
|
384
384
|
fs.writeFileSync(path.join(mirrorChromeDir, "mirror-chrome.tsx"), mirrorChromeSource({ slug, owner }));
|
|
385
|
+
injectNativeIntent(stagedAppDir);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// The launcher opens a prototype via `designchef://open/<slug>`. That deep link is
|
|
389
|
+
// the app's native initial URL, and it SURVIVES the expo-updates reload into the
|
|
390
|
+
// prototype's bundle — where `/open/<slug>` isn't a route, so expo-router shows its
|
|
391
|
+
// "Unmatched Route" screen instead of the prototype. (Feed taps don't carry a URL,
|
|
392
|
+
// which is why only QR/link opens were affected.)
|
|
393
|
+
//
|
|
394
|
+
// `+native-intent.tsx` is expo-router's hook for rewriting an incoming native URL
|
|
395
|
+
// before routing: send the launcher's own path to the root and leave every other
|
|
396
|
+
// deep link untouched, so a prototype's own links keep working.
|
|
397
|
+
function injectNativeIntent(stagedAppDir) {
|
|
398
|
+
const existing = [".tsx", ".ts", ".jsx", ".js"].find((e) =>
|
|
399
|
+
fs.existsSync(path.join(stagedAppDir, "+native-intent" + e))
|
|
400
|
+
);
|
|
401
|
+
if (existing) {
|
|
402
|
+
warn("this prototype has its own +native-intent — leaving it alone. If opening by QR/link lands on \"Unmatched Route\", redirect paths starting with /open to \"/\".");
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
fs.writeFileSync(
|
|
406
|
+
path.join(stagedAppDir, "+native-intent.tsx"),
|
|
407
|
+
`// Managed by calo-design push.
|
|
408
|
+
// The Mirror launcher opens this prototype with designchef://open/<slug>. That URL
|
|
409
|
+
// is still the native initial URL after the reload into this bundle, where /open/*
|
|
410
|
+
// is not a route — without this hook expo-router renders "Unmatched Route".
|
|
411
|
+
const LAUNCHER_PATH = /^\\/open(\\/|\$)/;
|
|
412
|
+
|
|
413
|
+
export function redirectSystemPath({ path }: { path: string; initial: boolean }): string {
|
|
414
|
+
try {
|
|
415
|
+
// Bare pathname, e.g. "/open/<slug>".
|
|
416
|
+
if (path.startsWith("/")) return LAUNCHER_PATH.test(path) ? "/" : path;
|
|
417
|
+
const url = new URL(path);
|
|
418
|
+
// Both shapes reach us: "designchef://open/<slug>" parses with host "open" and
|
|
419
|
+
// pathname "/<slug>", while "designchef:///open/<slug>" has an empty host and
|
|
420
|
+
// pathname "/open/<slug>". Treat either as the launcher handing us this app.
|
|
421
|
+
if (url.host === "open" || LAUNCHER_PATH.test(url.pathname)) return "/";
|
|
422
|
+
} catch {
|
|
423
|
+
// Unparseable URL — hand it back untouched rather than swallowing the link.
|
|
424
|
+
}
|
|
425
|
+
return path;
|
|
426
|
+
}
|
|
427
|
+
`
|
|
428
|
+
);
|
|
385
429
|
}
|
|
386
430
|
|
|
387
431
|
// True when the shared runtime can bundle @sentry/react-native. Old runtimes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calo-design/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "One-line setup for Calo design tooling: logs in with your Calo email and installs the calo-design skill + design-system packages. No GitHub account needed.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"calo-design": "bin/cli.js"
|