@base44-preview/cli 0.1.7-pr.588.7702fbb → 0.1.8-pr.580.d80a0ce
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/dist/assets/templates/backend-and-client/package.json +2 -1
- package/dist/assets/templates/backend-and-client/src/api/base44Client.js +13 -0
- package/dist/assets/templates/backend-and-client/src/lib/app-params.js +28 -0
- package/dist/assets/templates/backend-and-client/vite.config.js +3 -8
- package/dist/cli/index.js +1487 -332
- package/dist/cli/index.js.map +16 -11
- package/package.json +1 -1
- package/dist/assets/templates/backend-and-client/src/api/base44Client.js.ejs +0 -5
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createClient } from '@base44/sdk';
|
|
2
|
+
import { appParams } from '@/lib/app-params';
|
|
3
|
+
|
|
4
|
+
const { appId, token, functionsVersion, appBaseUrl } = appParams;
|
|
5
|
+
|
|
6
|
+
export const base44 = createClient({
|
|
7
|
+
appId,
|
|
8
|
+
token,
|
|
9
|
+
functionsVersion,
|
|
10
|
+
serverUrl: '',
|
|
11
|
+
requiresAuth: false,
|
|
12
|
+
appBaseUrl
|
|
13
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getAccessToken } from '@base44/sdk';
|
|
2
|
+
|
|
3
|
+
const isNode = typeof window === 'undefined';
|
|
4
|
+
|
|
5
|
+
const isClearAccessTokenRequested = () =>
|
|
6
|
+
!isNode && new URLSearchParams(window.location.search).get("clear_access_token") === 'true';
|
|
7
|
+
|
|
8
|
+
const clearStoredAccessToken = () => {
|
|
9
|
+
window.localStorage.removeItem('base44_access_token');
|
|
10
|
+
window.localStorage.removeItem('token');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const getAppParams = () => {
|
|
14
|
+
if (isClearAccessTokenRequested()) {
|
|
15
|
+
clearStoredAccessToken();
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
appId: import.meta.env.VITE_BASE44_APP_ID,
|
|
19
|
+
token: getAccessToken(),
|
|
20
|
+
functionsVersion: import.meta.env.VITE_BASE44_FUNCTIONS_VERSION,
|
|
21
|
+
appBaseUrl: import.meta.env.VITE_BASE44_APP_BASE_URL,
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export const appParams = {
|
|
27
|
+
...getAppParams()
|
|
28
|
+
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import base44 from '@base44/vite-plugin';
|
|
2
2
|
import react from '@vitejs/plugin-react';
|
|
3
|
-
import
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
|
-
plugins: [react()],
|
|
7
|
-
resolve: {
|
|
8
|
-
alias: {
|
|
9
|
-
'@': path.resolve(__dirname, './src'),
|
|
10
|
-
},
|
|
11
|
-
},
|
|
6
|
+
plugins: [base44(), react()],
|
|
12
7
|
});
|