create-100x-mobile 0.6.7 → 0.6.9
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.
|
@@ -551,12 +551,12 @@ async function pushInstantSchema(projectDir) {
|
|
|
551
551
|
try {
|
|
552
552
|
prompts_1.log.info("");
|
|
553
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
|
|
554
|
+
await (0, run_1.run)("npx", ["instant-cli@latest", "push", "--yes"], { cwd: projectDir });
|
|
555
555
|
return true;
|
|
556
556
|
}
|
|
557
557
|
catch (error) {
|
|
558
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
|
|
559
|
+
prompts_1.log.info(picocolors_1.default.dim("Run manually: npx instant-cli push"));
|
|
560
560
|
return false;
|
|
561
561
|
}
|
|
562
562
|
}
|
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)((0, scaffold_1.isCloudflareInstantAuthMode)(instantAuthMode))],
|
|
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
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
* This file MUST be self-contained — instant-cli evaluates it in
|
|
10
|
+
* Node.js, so it cannot import from lib/instant.ts (which pulls
|
|
11
|
+
* in react-native-get-random-values and other native modules).
|
|
12
|
+
*/
|
|
13
|
+
function instantSchemaTemplate(includeCloudflare = false) {
|
|
14
|
+
const cloudflareEntity = includeCloudflare
|
|
15
|
+
? `
|
|
16
|
+
cloudflareObjects: i.entity({
|
|
17
|
+
uploadId: i.string().indexed(),
|
|
18
|
+
key: i.string(),
|
|
19
|
+
ownerId: i.string().indexed(),
|
|
20
|
+
fileName: i.string(),
|
|
21
|
+
contentType: i.string(),
|
|
22
|
+
size: i.number(),
|
|
23
|
+
workerUrl: i.string(),
|
|
24
|
+
createdAt: i.number().indexed(),
|
|
25
|
+
}),`
|
|
26
|
+
: "";
|
|
27
|
+
return `import { i } from "@instantdb/react-native";
|
|
28
|
+
|
|
29
|
+
const schema = i.schema({
|
|
30
|
+
entities: {
|
|
31
|
+
todos: i.entity({
|
|
32
|
+
text: i.string(),
|
|
33
|
+
completed: i.boolean(),
|
|
34
|
+
createdAt: i.number().indexed(),
|
|
35
|
+
}),${cloudflareEntity}
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default schema;
|
|
40
|
+
`;
|
|
41
|
+
}
|