create-100x-mobile 0.6.6 → 0.6.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.
|
@@ -18,6 +18,7 @@ exports.writeInstantEnvironment = writeInstantEnvironment;
|
|
|
18
18
|
exports.initializeConvex = initializeConvex;
|
|
19
19
|
exports.ensureExpoPublicConvexUrl = ensureExpoPublicConvexUrl;
|
|
20
20
|
exports.setConvexClerkEnv = setConvexClerkEnv;
|
|
21
|
+
exports.pushInstantSchema = pushInstantSchema;
|
|
21
22
|
exports.setupCloudflare = setupCloudflare;
|
|
22
23
|
exports.initializeGit = initializeGit;
|
|
23
24
|
exports.runHealthChecks = runHealthChecks;
|
|
@@ -546,6 +547,19 @@ async function setConvexClerkEnv(projectDir, clerkDomain) {
|
|
|
546
547
|
return false;
|
|
547
548
|
}
|
|
548
549
|
}
|
|
550
|
+
async function pushInstantSchema(projectDir) {
|
|
551
|
+
try {
|
|
552
|
+
prompts_1.log.info("");
|
|
553
|
+
prompts_1.log.info(picocolors_1.default.bold("Pushing InstantDB schema to register entities..."));
|
|
554
|
+
await (0, run_1.run)("npx", ["instant-cli@latest", "push", "--yes"], { cwd: projectDir });
|
|
555
|
+
return true;
|
|
556
|
+
}
|
|
557
|
+
catch (error) {
|
|
558
|
+
prompts_1.log.warn(`InstantDB schema push failed: ${toErrorMessage(error)}`);
|
|
559
|
+
prompts_1.log.info(picocolors_1.default.dim("Run manually: npx instant-cli push"));
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
549
563
|
async function setupCloudflare(projectDir) {
|
|
550
564
|
const result = {
|
|
551
565
|
configured: false,
|
package/dist/commands/new.js
CHANGED
|
@@ -48,6 +48,7 @@ const rootLayout_3 = require("../templates/instant/magic/rootLayout");
|
|
|
48
48
|
const settingsScreen_3 = require("../templates/instant/magic/settingsScreen");
|
|
49
49
|
const signIn_2 = require("../templates/instant/magic/signIn");
|
|
50
50
|
const tabsLayout_3 = require("../templates/instant/magic/tabsLayout");
|
|
51
|
+
const instantSchema_1 = require("../templates/instant/instantSchema");
|
|
51
52
|
// Cloudflare templates
|
|
52
53
|
const alchemyRun_1 = require("../templates/cloudflare/alchemyRun");
|
|
53
54
|
const cloudflareStorage_1 = require("../templates/cloudflare/cloudflareStorage");
|
|
@@ -129,6 +130,7 @@ function buildTemplateFiles(projectName, expoVersion, backend, instantAuthMode =
|
|
|
129
130
|
: [["lib/instant.ts", (0, instantLib_1.instantLibTemplate)()]]),
|
|
130
131
|
// Hooks
|
|
131
132
|
["hooks/useFrameworkReady.ts", (0, useFrameworkReady_1.useFrameworkReadyTemplate)()],
|
|
133
|
+
["instant.schema.ts", (0, instantSchema_1.instantSchemaTemplate)()],
|
|
132
134
|
...cloudflareFiles,
|
|
133
135
|
]
|
|
134
136
|
: [
|
|
@@ -167,6 +169,7 @@ function buildTemplateFiles(projectName, expoVersion, backend, instantAuthMode =
|
|
|
167
169
|
["lib/instant.ts", (0, instantLib_1.instantLibTemplate)()],
|
|
168
170
|
// Hooks
|
|
169
171
|
["hooks/useFrameworkReady.ts", (0, useFrameworkReady_1.useFrameworkReadyTemplate)()],
|
|
172
|
+
["instant.schema.ts", (0, instantSchema_1.instantSchemaTemplate)()],
|
|
170
173
|
];
|
|
171
174
|
return files.map(([path, content]) => ({ path, content }));
|
|
172
175
|
}
|
|
@@ -279,9 +282,11 @@ async function cmdNew(rawArgs) {
|
|
|
279
282
|
prompts_1.log.info(picocolors_1.default.dim(`Clerk publishable key: ${instant.clerkPublishableKey}`));
|
|
280
283
|
}
|
|
281
284
|
const isCloudflareMode = backend === "instantdb" && (0, scaffold_1.isCloudflareInstantAuthMode)(instantAuthMode);
|
|
285
|
+
const hasInstantAppId = instant && "appId" in instant && instant.appId;
|
|
282
286
|
const totalSteps = 1 + // project generation
|
|
283
287
|
(options.installDependencies ? 2 : 0) +
|
|
284
288
|
(backend === "convex" ? 2 + (clerk.domain ? 1 : 0) : 1) +
|
|
289
|
+
(isCloudflareMode && options.installDependencies && hasInstantAppId ? 1 : 0) + // push schema
|
|
285
290
|
(isCloudflareMode && options.installDependencies ? 1 : 0) + // cloudflare setup
|
|
286
291
|
(options.initializeGit ? 1 : 0) +
|
|
287
292
|
1; // health check
|
|
@@ -373,6 +378,15 @@ async function cmdNew(rawArgs) {
|
|
|
373
378
|
}
|
|
374
379
|
}
|
|
375
380
|
if (isCloudflareMode && options.installDependencies) {
|
|
381
|
+
// Push InstantDB schema before Cloudflare deploy so the Worker can write to it
|
|
382
|
+
if (hasInstantAppId) {
|
|
383
|
+
currentStep++;
|
|
384
|
+
prompts_1.log.step(`Pushing InstantDB schema ${stepLabel()}`);
|
|
385
|
+
const schemaPushed = await (0, steps_1.pushInstantSchema)(projectDir);
|
|
386
|
+
if (schemaPushed) {
|
|
387
|
+
prompts_1.log.success("InstantDB schema pushed.");
|
|
388
|
+
}
|
|
389
|
+
}
|
|
376
390
|
currentStep++;
|
|
377
391
|
prompts_1.log.step(`Setting up Cloudflare storage ${stepLabel()}`);
|
|
378
392
|
cloudflareSetup = await (0, steps_1.setupCloudflare)(projectDir);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.instantSchemaTemplate = instantSchemaTemplate;
|
|
4
|
+
/**
|
|
5
|
+
* Generates an `instant.schema.ts` file in the project root.
|
|
6
|
+
* The instant-cli requires this file to exist in the root for
|
|
7
|
+
* `npx instant-cli push` to register entities on the backend.
|
|
8
|
+
*/
|
|
9
|
+
function instantSchemaTemplate() {
|
|
10
|
+
return `import { schema } from "./lib/instant";
|
|
11
|
+
|
|
12
|
+
export default schema;
|
|
13
|
+
`;
|
|
14
|
+
}
|