@bardioc/create-bardioc-app 0.5.6 → 0.5.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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/templates/_base/README.md +1 -1
- package/templates/angular/.env.example +4 -1
- package/templates/angular/package.json +2 -2
- package/templates/angular/scripts/dev-env.mjs +41 -0
- package/templates/angular/scripts/dev.mjs +27 -0
- package/templates/angular/scripts/sync-runtime-env.mjs +2 -28
- package/templates/angular/src/app/app.component.ts +5 -5
- package/templates/angular/src/styles.css +4 -0
- package/templates/nextjs/.env.example +4 -1
- package/templates/nextjs/app/page.tsx +11 -8
- package/templates/nextjs/next.config.ts +1 -1
- package/templates/nextjs/package.json +3 -3
- package/templates/nextjs/scripts/dev-env.mjs +41 -0
- package/templates/nextjs/scripts/dev.mjs +27 -0
- package/templates/preact/.env.example +3 -0
- package/templates/preact/package.json +2 -2
- package/templates/preact/src/App.tsx +5 -5
- package/templates/preact/vite.config.ts +4 -1
- package/templates/solid/.env.example +3 -0
- package/templates/solid/package.json +2 -2
- package/templates/solid/src/App.tsx +5 -5
- package/templates/solid/vite.config.ts +4 -1
- package/templates/svelte/.env.example +3 -0
- package/templates/svelte/package.json +2 -2
- package/templates/svelte/src/App.svelte +5 -5
- package/templates/svelte/vite.config.ts +4 -1
- package/templates/vite/.env.example +3 -0
- package/templates/vite/CLAUDE.md +34 -7
- package/templates/vite/package.json +3 -3
- package/templates/vite/src/auth/onboarding.tsx +4 -4
- package/templates/vite/src/climate/conditions-chart.tsx +2 -2
- package/templates/vite/src/climate/overview-view.tsx +1 -1
- package/templates/vite/src/climate/stations-view.tsx +3 -3
- package/templates/vite/src/climate/use-climate.ts +2 -2
- package/templates/vite/src/events/live-events-view.tsx +2 -2
- package/templates/vite/src/graph/explorer-view.tsx +4 -4
- package/templates/vite/src/locales/de.json +4 -4
- package/templates/vite/src/locales/en.json +44 -44
- package/templates/vite/src/profile/profile-view.tsx +5 -5
- package/templates/vite/src/shell/about-dialog.tsx +3 -3
- package/templates/vite/src/shell/app-shell.tsx +16 -12
- package/templates/vite/src/shell/header.tsx +24 -24
- package/templates/vite/vite.config.ts +4 -1
- package/templates/vue/.env.example +3 -0
- package/templates/vue/package.json +2 -2
- package/templates/vue/src/App.vue +5 -5
- package/templates/vue/vite.config.ts +4 -1
- package/templates/angular/scripts/dev-auth-proxy.mjs +0 -17
- package/templates/nextjs/scripts/dev-auth-proxy.mjs +0 -17
|
@@ -4,35 +4,35 @@ import { LocationSelect } from '../climate/location-select';
|
|
|
4
4
|
import { useDashboard } from '../dashboard-provider';
|
|
5
5
|
import { SUPPORTED_LOCALES, useI18n, useTranslation } from '../i18n';
|
|
6
6
|
|
|
7
|
+
// Goes into Page's `actions` slot, so it renders bare controls: Page owns the header row, its
|
|
8
|
+
// padding and its border, and lines all three up with the body below.
|
|
7
9
|
export function Header() {
|
|
8
10
|
const { t } = useTranslation();
|
|
9
11
|
const { state, syncing, refresh, setActiveStation } = useDashboard();
|
|
10
12
|
|
|
11
13
|
return (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
onSelect={setActiveStation}
|
|
19
|
-
/>
|
|
20
|
-
)}
|
|
21
|
-
<ConnectedLanguageSwitcher
|
|
22
|
-
useI18n={useI18n}
|
|
23
|
-
supportedLocales={[...SUPPORTED_LOCALES]}
|
|
24
|
-
flags={{ en: 'EN', de: 'DE' }}
|
|
14
|
+
<>
|
|
15
|
+
{state?.stations && (
|
|
16
|
+
<LocationSelect
|
|
17
|
+
stations={state.stations}
|
|
18
|
+
value={state.activeStationId}
|
|
19
|
+
onSelect={setActiveStation}
|
|
25
20
|
/>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
)}
|
|
22
|
+
<ConnectedLanguageSwitcher
|
|
23
|
+
useI18n={useI18n}
|
|
24
|
+
supportedLocales={[...SUPPORTED_LOCALES]}
|
|
25
|
+
flags={{ en: 'EN', de: 'DE' }}
|
|
26
|
+
/>
|
|
27
|
+
<Button
|
|
28
|
+
className="gap-2"
|
|
29
|
+
size="sm"
|
|
30
|
+
onClick={() => void refresh()}
|
|
31
|
+
disabled={syncing || !state}
|
|
32
|
+
>
|
|
33
|
+
<RefreshCw className={`size-4 ${syncing ? 'animate-spin' : ''}`} />
|
|
34
|
+
{t('header.sync', { fallback: 'Sync' })}
|
|
35
|
+
</Button>
|
|
36
|
+
</>
|
|
37
37
|
);
|
|
38
38
|
}
|
|
@@ -3,9 +3,12 @@ import tailwindcss from '@tailwindcss/vite';
|
|
|
3
3
|
import react from '@vitejs/plugin-react';
|
|
4
4
|
import { defineConfig, loadEnv } from 'vite';
|
|
5
5
|
|
|
6
|
+
const DEFAULT_PORT = {{PORT}};
|
|
7
|
+
|
|
6
8
|
export default defineConfig(({ mode }) => {
|
|
7
9
|
const env = loadEnv(mode, __dirname, '');
|
|
8
10
|
const appName = env.VITE_APP_NAME?.trim();
|
|
11
|
+
const port = Number(env.LOCALHOST_PORT) || DEFAULT_PORT;
|
|
9
12
|
|
|
10
13
|
if (!appName) {
|
|
11
14
|
throw new Error('Missing VITE_APP_NAME for Vite config');
|
|
@@ -15,7 +18,7 @@ export default defineConfig(({ mode }) => {
|
|
|
15
18
|
plugins: [
|
|
16
19
|
bardiocDevAuth({ appName }),
|
|
17
20
|
react(),
|
|
18
|
-
bardiocApp({ appName, port
|
|
21
|
+
bardiocApp({ appName, port }),
|
|
19
22
|
tailwindcss(),
|
|
20
23
|
],
|
|
21
24
|
};
|
|
@@ -7,3 +7,6 @@ DEV_SECRET=
|
|
|
7
7
|
|
|
8
8
|
# Base URL of the Bardioc BFF / backend-for-frontend (e.g. https://your-host).
|
|
9
9
|
API_BASE_URL=
|
|
10
|
+
|
|
11
|
+
# By default, the app will start on port {{PORT}}. Feel free to uncomment the following variable and change it to match your local setup preferences.
|
|
12
|
+
#LOCALHOST_PORT={{PORT}}
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"release:publish": "changeset publish"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@bardioc/app-sdk": "^0.
|
|
21
|
+
"@bardioc/app-sdk": "^0.5.0",
|
|
22
22
|
"vue": "^3.5.16"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@bardioc/configs": "
|
|
25
|
+
"@bardioc/configs": "0.2.1",
|
|
26
26
|
"@changesets/cli": "^2.31.0",
|
|
27
27
|
"@tailwindcss/vite": "^4.3.0",
|
|
28
28
|
"@types/node": "^22.19.19",
|
|
@@ -23,13 +23,13 @@ async function runGetProfile() {
|
|
|
23
23
|
result.value = { status: 'loading', request };
|
|
24
24
|
|
|
25
25
|
const startTime = Date.now();
|
|
26
|
-
notify('Getting user profile', 'info');
|
|
26
|
+
notify('Getting user profile…', 'info');
|
|
27
27
|
|
|
28
28
|
try {
|
|
29
29
|
const data = await bridge.transport.os.profile.get();
|
|
30
30
|
|
|
31
31
|
const duration = Date.now() - startTime;
|
|
32
|
-
notify(`Profile loaded (${duration}ms)
|
|
32
|
+
notify(`Profile loaded (${duration}ms).`, 'success');
|
|
33
33
|
result.value = { status: 'success', request, data };
|
|
34
34
|
} catch (err) {
|
|
35
35
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -41,7 +41,7 @@ async function runGetProfile() {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function handleNotify() {
|
|
44
|
-
notify('Hello from {{DISPLAY_NAME}}', 'info');
|
|
44
|
+
notify('Hello from {{DISPLAY_NAME}}.', 'info');
|
|
45
45
|
result.value = {
|
|
46
46
|
status: 'success',
|
|
47
47
|
request: 'SDK_NOTIFY',
|
|
@@ -55,7 +55,7 @@ function clearResult() {
|
|
|
55
55
|
</script>
|
|
56
56
|
|
|
57
57
|
<template>
|
|
58
|
-
<div class="bg-background text-foreground min-h-screen">
|
|
58
|
+
<div class="bg-background text-foreground @container/app min-h-screen">
|
|
59
59
|
<template v-if="showSdkDemo">
|
|
60
60
|
<div class="mx-auto flex min-h-screen w-full max-w-3xl flex-col gap-3 p-4">
|
|
61
61
|
<div class="flex flex-col gap-1">
|
|
@@ -132,7 +132,7 @@ function clearResult() {
|
|
|
132
132
|
<div class="mx-auto flex min-h-screen w-full max-w-3xl flex-col gap-4 p-4">
|
|
133
133
|
<h1 class="m-0 text-2xl font-semibold">Hello Bardioc App</h1>
|
|
134
134
|
<p class="text-muted-foreground m-0 max-w-2xl text-xs leading-5">
|
|
135
|
-
Open this app inside Bardioc
|
|
135
|
+
Open this app inside Bardioc to use transport requests and send host notifications.
|
|
136
136
|
</p>
|
|
137
137
|
<div class="border-border bg-muted/20 rounded-xl border p-3 text-xs leading-5">
|
|
138
138
|
Outside the host iframe this page is only a local preview shell.
|
|
@@ -3,9 +3,12 @@ import tailwindcss from '@tailwindcss/vite';
|
|
|
3
3
|
import vue from '@vitejs/plugin-vue';
|
|
4
4
|
import { defineConfig, loadEnv } from 'vite';
|
|
5
5
|
|
|
6
|
+
const DEFAULT_PORT = {{PORT}};
|
|
7
|
+
|
|
6
8
|
export default defineConfig(({ mode }) => {
|
|
7
9
|
const env = loadEnv(mode, __dirname, '');
|
|
8
10
|
const appName = env.VITE_APP_NAME?.trim();
|
|
11
|
+
const port = Number(env.LOCALHOST_PORT) || DEFAULT_PORT;
|
|
9
12
|
|
|
10
13
|
if (!appName) {
|
|
11
14
|
throw new Error('Missing VITE_APP_NAME for Vite config');
|
|
@@ -15,7 +18,7 @@ export default defineConfig(({ mode }) => {
|
|
|
15
18
|
plugins: [
|
|
16
19
|
bardiocDevAuth({ appName }),
|
|
17
20
|
vue(),
|
|
18
|
-
bardiocApp({ appName, port
|
|
21
|
+
bardiocApp({ appName, port }),
|
|
19
22
|
tailwindcss(),
|
|
20
23
|
],
|
|
21
24
|
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { startDevAuthProxy } from '@bardioc/app-sdk/dev-proxy';
|
|
4
|
-
import { dirname, resolve } from 'node:path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
|
|
7
|
-
const projectDir = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
|
-
|
|
9
|
-
// Angular's dev server cannot host the SDK Vite plugin, so the proxy runs beside it
|
|
10
|
-
// on the app port + 100 — the same origin src/main.ts points installDevBridge at.
|
|
11
|
-
const server = await startDevAuthProxy({ projectDir, port: {{PORT}} + 100 });
|
|
12
|
-
|
|
13
|
-
// Without DEV_SECRET / API_BASE_URL there is nothing to serve — exit and let the dev server run
|
|
14
|
-
// on its own, matching how the SDK Vite plugin disables itself.
|
|
15
|
-
if (!server) {
|
|
16
|
-
process.exit(0);
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { startDevAuthProxy } from '@bardioc/app-sdk/dev-proxy';
|
|
4
|
-
import { dirname, resolve } from 'node:path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
|
|
7
|
-
const projectDir = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
|
-
|
|
9
|
-
// `next dev` cannot host the SDK Vite plugin, so the proxy runs beside it on the app
|
|
10
|
-
// port + 100 — the same origin app/page.tsx points installDevBridge at.
|
|
11
|
-
const server = await startDevAuthProxy({ projectDir, port: {{PORT}} + 100 });
|
|
12
|
-
|
|
13
|
-
// Without DEV_SECRET / API_BASE_URL there is nothing to serve — exit and let the dev server run
|
|
14
|
-
// on its own, matching how the SDK Vite plugin disables itself.
|
|
15
|
-
if (!server) {
|
|
16
|
-
process.exit(0);
|
|
17
|
-
}
|