@bardioc/create-bardioc-app 0.5.5 → 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 -3
- package/bin/create.mjs +2 -4
- package/package.json +1 -1
- package/templates/_base/README.md +17 -3
- package/templates/_base/scripts/stamp-manifest.mjs +1 -1
- package/templates/_opt-link/scripts/link-source.mjs +7 -5
- package/templates/angular/.env.example +7 -2
- package/templates/angular/_gitignore +1 -0
- package/templates/angular/package.json +2 -4
- 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 +3 -48
- package/templates/angular/src/app/app.component.ts +6 -6
- package/templates/angular/src/styles.css +4 -0
- package/templates/angular/tsconfig.json +1 -0
- package/templates/nextjs/.env.example +7 -2
- package/templates/nextjs/_gitignore +1 -0
- package/templates/nextjs/app/layout.tsx +2 -0
- package/templates/nextjs/app/page.tsx +13 -7
- package/templates/nextjs/eslint.config.mjs +4 -0
- package/templates/nextjs/next.config.ts +2 -21
- package/templates/nextjs/package.json +8 -3
- package/templates/nextjs/prettier.config.mjs +1 -0
- package/templates/nextjs/scripts/dev-env.mjs +41 -0
- package/templates/nextjs/scripts/dev.mjs +27 -0
- package/templates/nextjs/tsconfig.json +3 -18
- package/templates/preact/.env.example +3 -0
- package/templates/preact/eslint.config.mjs +3 -0
- package/templates/preact/package.json +8 -3
- package/templates/preact/prettier.config.mjs +1 -0
- package/templates/preact/src/App.tsx +6 -6
- package/templates/preact/tsconfig.json +4 -10
- package/templates/preact/vite.config.ts +9 -1
- package/templates/solid/.env.example +3 -0
- package/templates/solid/eslint.config.mjs +3 -0
- package/templates/solid/package.json +8 -4
- package/templates/solid/prettier.config.mjs +1 -0
- package/templates/solid/src/App.tsx +7 -7
- package/templates/solid/tsconfig.json +4 -9
- package/templates/solid/vite.config.ts +10 -2
- package/templates/svelte/.env.example +3 -0
- package/templates/svelte/_gitignore +1 -0
- package/templates/svelte/eslint.config.mjs +3 -0
- package/templates/svelte/package.json +8 -3
- package/templates/svelte/prettier.config.mjs +1 -0
- package/templates/svelte/src/App.svelte +6 -6
- package/templates/svelte/tsconfig.json +4 -4
- package/templates/svelte/vite.config.ts +9 -1
- package/templates/vite/.env.example +3 -0
- package/templates/vite/CLAUDE.md +40 -8
- package/templates/vite/eslint.config.mjs +3 -0
- package/templates/vite/package.json +9 -3
- package/templates/vite/prettier.config.mjs +1 -0
- package/templates/vite/src/auth/onboarding.tsx +4 -4
- package/templates/vite/src/climate/climate-data.ts +13 -6
- 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/graph/requests.ts +2 -1
- 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/tsconfig.json +4 -10
- package/templates/vite/vite.config.ts +10 -2
- package/templates/vue/.env.example +3 -0
- package/templates/vue/_gitignore +1 -0
- package/templates/vue/eslint.config.mjs +3 -0
- package/templates/vue/package.json +8 -3
- package/templates/vue/prettier.config.mjs +1 -0
- package/templates/vue/src/App.vue +6 -6
- package/templates/vue/tsconfig.json +5 -9
- package/templates/vue/vite.config.ts +10 -2
- package/templates/angular/scripts/dev-auth-proxy.mjs +0 -91
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { bardiocApp, bardiocDevAuth } from '@bardioc/app-sdk/vite';
|
|
2
|
-
import react from '@vitejs/plugin-react';
|
|
3
2
|
import tailwindcss from '@tailwindcss/vite';
|
|
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');
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
return {
|
|
15
|
-
plugins: [
|
|
18
|
+
plugins: [
|
|
19
|
+
bardiocDevAuth({ appName }),
|
|
20
|
+
react(),
|
|
21
|
+
bardiocApp({ appName, port }),
|
|
22
|
+
tailwindcss(),
|
|
23
|
+
],
|
|
16
24
|
};
|
|
17
25
|
});
|
|
@@ -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}}
|
package/templates/vue/_gitignore
CHANGED
|
@@ -5,25 +5,30 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
|
-
"dev:live": "BARDIOC_TUNNEL=1 vite",
|
|
9
8
|
"build": "vue-tsc -b && vite build && node scripts/stamp-manifest.mjs dist",
|
|
10
9
|
"bundle": "vue-tsc -b && vite build && node scripts/stamp-manifest.mjs dist && cd dist && zip -r ../{{APP_NAME}}.zip .",
|
|
11
10
|
"preview": "vite preview",
|
|
12
11
|
"check-types": "vue-tsc --noEmit",
|
|
12
|
+
"lint": "eslint .",
|
|
13
|
+
"format": "prettier --write .",
|
|
14
|
+
"format:check": "prettier --check .",
|
|
13
15
|
"changeset": "changeset",
|
|
14
16
|
"release:status": "changeset status --verbose",
|
|
15
17
|
"release:version": "changeset version && npm install",
|
|
16
18
|
"release:publish": "changeset publish"
|
|
17
19
|
},
|
|
18
20
|
"dependencies": {
|
|
19
|
-
"@bardioc/app-sdk": "
|
|
21
|
+
"@bardioc/app-sdk": "^0.5.0",
|
|
20
22
|
"vue": "^3.5.16"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
25
|
+
"@bardioc/configs": "0.2.1",
|
|
23
26
|
"@changesets/cli": "^2.31.0",
|
|
24
27
|
"@tailwindcss/vite": "^4.3.0",
|
|
25
28
|
"@types/node": "^22.19.19",
|
|
26
|
-
"@vitejs/plugin-vue": "^
|
|
29
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
30
|
+
"eslint": "^10.0.0",
|
|
31
|
+
"prettier": "^3.6.2",
|
|
27
32
|
"tailwindcss": "4.3.0",
|
|
28
33
|
"typescript": "6.0.3",
|
|
29
34
|
"vite": "8.0.13",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@bardioc/configs/prettier';
|
|
@@ -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">
|
|
@@ -110,7 +110,7 @@ function clearResult() {
|
|
|
110
110
|
<div class="text-muted-foreground border-border border-b pb-2 font-mono text-xs">
|
|
111
111
|
{{ result.request }}
|
|
112
112
|
</div>
|
|
113
|
-
<div class="text-destructive whitespace-pre-wrap
|
|
113
|
+
<div class="text-destructive break-all whitespace-pre-wrap">{{ result.message }}</div>
|
|
114
114
|
</div>
|
|
115
115
|
<div
|
|
116
116
|
v-else-if="result.status === 'success'"
|
|
@@ -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.
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@bardioc/configs/typescript/base.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
4
|
+
"declaration": false,
|
|
5
|
+
"declarationMap": false,
|
|
5
6
|
"module": "ESNext",
|
|
6
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
-
"skipLibCheck": true,
|
|
8
7
|
"moduleResolution": "bundler",
|
|
9
|
-
"allowImportingTsExtensions": true,
|
|
10
|
-
"isolatedModules": true,
|
|
11
|
-
"moduleDetection": "force",
|
|
12
8
|
"noEmit": true,
|
|
9
|
+
"useDefineForClassFields": true,
|
|
10
|
+
"allowImportingTsExtensions": true,
|
|
13
11
|
"jsx": "preserve",
|
|
14
|
-
"strict": true,
|
|
15
12
|
"noUnusedLocals": true,
|
|
16
13
|
"noUnusedParameters": true,
|
|
17
14
|
"noFallthroughCasesInSwitch": true,
|
|
18
15
|
"noUncheckedSideEffectImports": true,
|
|
19
|
-
"ignoreDeprecations": "6.0",
|
|
20
16
|
"baseUrl": ".",
|
|
21
17
|
"paths": {
|
|
22
18
|
"@/*": ["./src/*"]
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { bardiocApp, bardiocDevAuth } from '@bardioc/app-sdk/vite';
|
|
2
|
-
import vue from '@vitejs/plugin-vue';
|
|
3
2
|
import tailwindcss from '@tailwindcss/vite';
|
|
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');
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
return {
|
|
15
|
-
plugins: [
|
|
18
|
+
plugins: [
|
|
19
|
+
bardiocDevAuth({ appName }),
|
|
20
|
+
vue(),
|
|
21
|
+
bardiocApp({ appName, port }),
|
|
22
|
+
tailwindcss(),
|
|
23
|
+
],
|
|
16
24
|
};
|
|
17
25
|
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { readFileSync } from 'node:fs';
|
|
4
|
-
import { createServer } from 'node:http';
|
|
5
|
-
import { dirname, join, resolve } from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { createDevAuthProxyHandler } from '@bardioc/app-sdk/dev-proxy';
|
|
8
|
-
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const projectRoot = resolve(__dirname, '..');
|
|
11
|
-
const appPort = readAppPort();
|
|
12
|
-
const proxyPort = appPort + 100;
|
|
13
|
-
const env = loadEnv(projectRoot);
|
|
14
|
-
|
|
15
|
-
if (!env.DEV_SECRET || !env.API_BASE_URL) {
|
|
16
|
-
process.stderr.write('[bardioc-dev-auth-proxy] missing DEV_SECRET or API_BASE_URL, proxy disabled\n');
|
|
17
|
-
await new Promise(() => {});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const handler = createDevAuthProxyHandler({
|
|
21
|
-
apiBaseUrl: env.API_BASE_URL,
|
|
22
|
-
devSecret: env.DEV_SECRET,
|
|
23
|
-
allowOrigin: '*',
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const server = createServer((req, res) => {
|
|
27
|
-
void handler(req, res);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
server.listen(proxyPort, '127.0.0.1', () => {
|
|
31
|
-
process.stdout.write(`[bardioc-dev-auth-proxy] listening on http://127.0.0.1:${proxyPort}/rest\n`);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
for (const signal of ['SIGINT', 'SIGTERM']) {
|
|
35
|
-
process.on(signal, () => {
|
|
36
|
-
server.close(() => process.exit(0));
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function readAppPort() {
|
|
41
|
-
const flagIndex = process.argv.indexOf('--app-port');
|
|
42
|
-
const raw = flagIndex >= 0 ? process.argv[flagIndex + 1] : undefined;
|
|
43
|
-
const parsed = Number.parseInt(raw ?? '{{PORT}}', 10);
|
|
44
|
-
return Number.isFinite(parsed) ? parsed : {{PORT}};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function loadEnv(projectDir) {
|
|
48
|
-
const result = {};
|
|
49
|
-
|
|
50
|
-
for (const fileName of ['.env', '.env.local']) {
|
|
51
|
-
const filePath = join(projectDir, fileName);
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
Object.assign(result, parseEnv(readFileSync(filePath, 'utf8')));
|
|
55
|
-
} catch {
|
|
56
|
-
// Ignore missing env files.
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function parseEnv(source) {
|
|
64
|
-
const result = {};
|
|
65
|
-
|
|
66
|
-
for (const rawLine of source.split(/\r?\n/)) {
|
|
67
|
-
const line = rawLine.trim();
|
|
68
|
-
if (!line || line.startsWith('#')) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const equalsIndex = line.indexOf('=');
|
|
73
|
-
if (equalsIndex <= 0) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const key = line.slice(0, equalsIndex).trim();
|
|
78
|
-
let value = line.slice(equalsIndex + 1).trim();
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
(value.startsWith('"') && value.endsWith('"')) ||
|
|
82
|
-
(value.startsWith("'") && value.endsWith("'"))
|
|
83
|
-
) {
|
|
84
|
-
value = value.slice(1, -1);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
result[key] = value;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return result;
|
|
91
|
-
}
|