@makoai/app-sdk 2.7.2 → 2.7.3
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/README.md +9 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -149,12 +149,18 @@ import {
|
|
|
149
149
|
names with a build-time define in `vite.config.ts`:
|
|
150
150
|
|
|
151
151
|
```ts
|
|
152
|
-
import { readdirSync } from "node:fs";
|
|
152
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
153
|
+
const bindingsDir = new URL("./bindings", import.meta.url);
|
|
153
154
|
// inside defineConfig({ … }):
|
|
154
155
|
define: {
|
|
155
156
|
__APP_BINDING_NAMES__: JSON.stringify(
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
// An app with no bindings/ folder yet (a new shell app) has none:
|
|
158
|
+
// without the existsSync guard the config throws ENOENT and
|
|
159
|
+
// `vite build` fails before it starts.
|
|
160
|
+
existsSync(bindingsDir)
|
|
161
|
+
? readdirSync(bindingsDir)
|
|
162
|
+
.filter(f => f.endsWith(".sql")).map(f => f.slice(0, -4))
|
|
163
|
+
: [],
|
|
158
164
|
),
|
|
159
165
|
},
|
|
160
166
|
```
|