@bardioc/create-bardioc-app 0.5.5 → 0.5.6
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 +4 -2
- package/templates/angular/_gitignore +1 -0
- package/templates/angular/package.json +2 -4
- package/templates/angular/scripts/dev-auth-proxy.mjs +10 -84
- package/templates/angular/scripts/sync-runtime-env.mjs +17 -36
- package/templates/angular/src/app/app.component.ts +2 -2
- package/templates/angular/tsconfig.json +1 -0
- package/templates/nextjs/.env.example +4 -2
- package/templates/nextjs/_gitignore +1 -0
- package/templates/nextjs/app/layout.tsx +2 -0
- package/templates/nextjs/app/page.tsx +5 -2
- 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-auth-proxy.mjs +17 -0
- package/templates/nextjs/tsconfig.json +3 -18
- 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 +1 -1
- package/templates/preact/tsconfig.json +4 -10
- package/templates/preact/vite.config.ts +6 -1
- 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 +2 -2
- package/templates/solid/tsconfig.json +4 -9
- package/templates/solid/vite.config.ts +7 -2
- 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 +1 -1
- package/templates/svelte/tsconfig.json +4 -4
- package/templates/svelte/vite.config.ts +6 -1
- package/templates/vite/CLAUDE.md +6 -1
- 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/climate/climate-data.ts +13 -6
- package/templates/vite/src/graph/requests.ts +2 -1
- package/templates/vite/tsconfig.json +4 -10
- package/templates/vite/vite.config.ts +7 -2
- 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 +1 -1
- package/templates/vue/tsconfig.json +5 -9
- package/templates/vue/vite.config.ts +7 -2
package/README.md
CHANGED
|
@@ -72,9 +72,7 @@ Generated apps can run standalone with the `DEV_SECRET` dev-auth proxy.
|
|
|
72
72
|
2. Fill in `VITE_APP_NAME`, `DEV_SECRET`, and `API_BASE_URL`
|
|
73
73
|
3. Run `npm run dev`
|
|
74
74
|
|
|
75
|
-
When running outside the host iframe, the
|
|
76
|
-
|
|
77
|
-
For public testing, run `npm run dev:live` and use the emitted tunnel URL as the app's live URL in the host App Store configuration.
|
|
75
|
+
When running outside the host iframe, the SDK proxies `/rest/*` to `API_BASE_URL` with the `X-Dev-Secret` header and `installDevBridge()` handles SDK messages. Vite templates do this through the `bardiocDevAuth` plugin; the angular and nextjs templates run `scripts/dev-auth-proxy.mjs`, which `npm run dev` starts alongside their dev server.
|
|
78
76
|
|
|
79
77
|
## Options
|
|
80
78
|
|
package/bin/create.mjs
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
2
3
|
|
|
3
|
-
import { readFileSync } from 'node:fs';
|
|
4
4
|
import { join, resolve } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { getDefaultTemplate, listTemplates, parseArgs, scaffoldApp } from '../src/scaffold.js';
|
|
7
7
|
|
|
8
8
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
9
9
|
const TEMPLATES_DIR = join(__dirname, '..', 'templates');
|
|
10
|
-
const packageJsonPath = join(__dirname, '..', 'package.json');
|
|
11
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
12
10
|
|
|
13
11
|
const args = process.argv.slice(2);
|
|
14
12
|
|
|
@@ -66,7 +64,7 @@ if (!result.success) {
|
|
|
66
64
|
|
|
67
65
|
console.log(` Done! Next steps:\n`);
|
|
68
66
|
console.log(` cd ${name}`);
|
|
67
|
+
console.log(` cp .env.example .env`);
|
|
69
68
|
console.log(` npm install`);
|
|
70
69
|
console.log(` npm run dev\n`);
|
|
71
70
|
console.log(` Open http://localhost:${port} to see your app.`);
|
|
72
|
-
console.log(` Use "pnpm dev:live" for a public tunnel/live URL.\n`);
|
package/package.json
CHANGED
|
@@ -14,11 +14,25 @@ npm install
|
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
npm run dev # http://localhost:{{PORT}}
|
|
17
|
-
npm run dev:live # public tunnel (BARDIOC_TUNNEL=1)
|
|
18
17
|
```
|
|
19
18
|
|
|
20
|
-
`npm run dev`
|
|
21
|
-
opened inside the host
|
|
19
|
+
`npm run dev` starts the dev server as a local preview shell. Live SDK data comes when the app is
|
|
20
|
+
opened inside the host, or standalone once `DEV_SECRET` and `API_BASE_URL` are set — the SDK then
|
|
21
|
+
proxies `/rest/*` to the BFF (via the `bardiocDevAuth` Vite plugin, or `scripts/dev-auth-proxy.mjs`
|
|
22
|
+
in the angular and nextjs templates, which `npm run dev` starts alongside the dev server). See
|
|
23
|
+
`.env.example` for the required variables.
|
|
24
|
+
|
|
25
|
+
## Lint & format
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm run check-types # TypeScript
|
|
29
|
+
npm run lint # ESLint
|
|
30
|
+
npm run format # Prettier (format:check to verify only)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
ESLint, Prettier and the `tsconfig.json` base all come from the shared `@bardioc/configs` presets
|
|
34
|
+
(`eslint.config.mjs`, `prettier.config.mjs`), so an app lints exactly like the SDK does. The angular
|
|
35
|
+
template is the exception — Angular 19 pins TypeScript 5.8, which the presets do not support yet.
|
|
22
36
|
|
|
23
37
|
## Develop against `@bardioc/*` source (optional)
|
|
24
38
|
|
|
@@ -14,4 +14,4 @@ manifest.version = version;
|
|
|
14
14
|
manifest.description = base ? `${base} (v${version})` : `v${version}`;
|
|
15
15
|
|
|
16
16
|
writeFileSync(url, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
17
|
-
|
|
17
|
+
process.stdout.write(`[stamp-manifest] ${version} → ${outDir}/app-manifest.json\n`);
|
|
@@ -29,7 +29,7 @@ if (argv[0] === '--remove') {
|
|
|
29
29
|
const link = `${LINK_DIR}/${name}`;
|
|
30
30
|
if (!exists(link)) fail(`No link at ${link}`);
|
|
31
31
|
rmSync(link);
|
|
32
|
-
|
|
32
|
+
process.stdout.write(`✓ unlinked ${name}\n`);
|
|
33
33
|
syncCatalogs();
|
|
34
34
|
process.exit(0);
|
|
35
35
|
}
|
|
@@ -53,11 +53,11 @@ mkdirSync(LINK_DIR, { recursive: true });
|
|
|
53
53
|
const link = `${LINK_DIR}/${name}`;
|
|
54
54
|
if (exists(link)) rmSync(link);
|
|
55
55
|
symlinkSync(abs, link, 'junction');
|
|
56
|
-
|
|
56
|
+
process.stdout.write(`✓ linked ${name} → ${abs}\n`);
|
|
57
57
|
|
|
58
58
|
syncCatalogs();
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
process.stdout.write('Next: pnpm install\n');
|
|
61
61
|
|
|
62
62
|
// ── helpers ──────────────────────────────────────────────────────────
|
|
63
63
|
|
|
@@ -140,9 +140,11 @@ function replaceMarkerBlock(workspace, beginIdx, endIdx, marker) {
|
|
|
140
140
|
|
|
141
141
|
function logSyncOutcome(sources) {
|
|
142
142
|
if (sources.length === 1) {
|
|
143
|
-
|
|
143
|
+
process.stdout.write(
|
|
144
|
+
`✓ synced catalogs from .linked/${sources[0].name} into ${WORKSPACE_FILE}\n`
|
|
145
|
+
);
|
|
144
146
|
} else {
|
|
145
|
-
|
|
147
|
+
process.stdout.write(`✓ removed managed catalogs block from ${WORKSPACE_FILE}\n`);
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# Hosted app slug used by local runtime/dev-auth wiring.
|
|
1
2
|
VITE_APP_NAME={{APP_NAME}}
|
|
2
3
|
|
|
3
|
-
#
|
|
4
|
+
# Paste the dev secret from the BardiocOS AppStore after registering your app.
|
|
5
|
+
# Used by the dev-auth proxy (scripts/dev-auth-proxy.mjs) to sign requests to the BFF.
|
|
4
6
|
DEV_SECRET=
|
|
5
7
|
|
|
6
|
-
# Base URL of the Bardioc
|
|
8
|
+
# Base URL of the Bardioc BFF / backend-for-frontend (e.g. https://your-host).
|
|
7
9
|
API_BASE_URL=
|
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
"sync:runtime-env": "node ./scripts/sync-runtime-env.mjs",
|
|
7
7
|
"ng": "ng",
|
|
8
8
|
"predev": "npm run sync:runtime-env",
|
|
9
|
-
"dev": "node ./scripts/dev-auth-proxy.mjs
|
|
10
|
-
"predev:live": "npm run sync:runtime-env",
|
|
11
|
-
"dev:live": "node ./scripts/dev-auth-proxy.mjs --app-port {{PORT}} & PROXY_PID=$!; BARDIOC_TUNNEL=1 ng serve --port {{PORT}}; EXIT_CODE=$?; kill $PROXY_PID; exit $EXIT_CODE",
|
|
9
|
+
"dev": "node ./scripts/dev-auth-proxy.mjs & PROXY_PID=$!; ng serve --port {{PORT}}; EXIT_CODE=$?; kill $PROXY_PID 2>/dev/null; exit $EXIT_CODE",
|
|
12
10
|
"prebuild": "npm run sync:runtime-env",
|
|
13
11
|
"build": "ng build && node scripts/stamp-manifest.mjs dist/{{APP_NAME}}/browser",
|
|
14
12
|
"bundle": "ng build && node scripts/stamp-manifest.mjs dist/{{APP_NAME}}/browser && cd dist/{{APP_NAME}}/browser && zip -r ../../../{{APP_NAME}}.zip .",
|
|
@@ -30,7 +28,7 @@
|
|
|
30
28
|
"@angular/platform-browser": "^19.2.12",
|
|
31
29
|
"@angular/platform-browser-dynamic": "^19.2.12",
|
|
32
30
|
"@angular/router": "^19.2.12",
|
|
33
|
-
"@bardioc/app-sdk": "
|
|
31
|
+
"@bardioc/app-sdk": "^0.4.9",
|
|
34
32
|
"rxjs": "~7.8.2",
|
|
35
33
|
"tslib": "^2.8.1",
|
|
36
34
|
"zone.js": "~0.15.1"
|
|
@@ -1,91 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { dirname, join, resolve } from 'node:path';
|
|
3
|
+
import { startDevAuthProxy } from '@bardioc/app-sdk/dev-proxy';
|
|
4
|
+
import { dirname, resolve } from 'node:path';
|
|
6
5
|
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { createDevAuthProxyHandler } from '@bardioc/app-sdk/dev-proxy';
|
|
8
6
|
|
|
9
|
-
const
|
|
10
|
-
const projectRoot = resolve(__dirname, '..');
|
|
11
|
-
const appPort = readAppPort();
|
|
12
|
-
const proxyPort = appPort + 100;
|
|
13
|
-
const env = loadEnv(projectRoot);
|
|
7
|
+
const projectDir = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
}
|
|
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 });
|
|
89
12
|
|
|
90
|
-
|
|
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);
|
|
91
17
|
}
|
|
@@ -6,10 +6,9 @@ import { fileURLToPath } from 'node:url';
|
|
|
6
6
|
|
|
7
7
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
8
|
const projectRoot = resolve(__dirname, '..');
|
|
9
|
-
const env = loadEnv(projectRoot);
|
|
10
9
|
|
|
11
10
|
const runtimeEnv = {
|
|
12
|
-
VITE_APP_NAME:
|
|
11
|
+
VITE_APP_NAME: readEnvValue(projectRoot, 'VITE_APP_NAME'),
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
const outputPath = join(projectRoot, 'public', 'runtime-env.js');
|
|
@@ -20,48 +19,30 @@ writeFileSync(
|
|
|
20
19
|
'utf8'
|
|
21
20
|
);
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
// Angular has no import.meta.env, so the app slug is baked into a runtime script instead.
|
|
23
|
+
function readEnvValue(projectDir, key) {
|
|
24
|
+
let value;
|
|
25
25
|
|
|
26
26
|
for (const fileName of ['.env', '.env.local']) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
let source;
|
|
29
28
|
try {
|
|
30
|
-
|
|
29
|
+
source = readFileSync(join(projectDir, fileName), 'utf8');
|
|
31
30
|
} catch {
|
|
32
|
-
// Ignore missing env files.
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function parseEnv(source) {
|
|
40
|
-
const result = {};
|
|
41
|
-
|
|
42
|
-
for (const rawLine of source.split(/\r?\n/)) {
|
|
43
|
-
const line = rawLine.trim();
|
|
44
|
-
if (!line || line.startsWith('#')) {
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const equalsIndex = line.indexOf('=');
|
|
49
|
-
if (equalsIndex <= 0) {
|
|
50
31
|
continue;
|
|
51
32
|
}
|
|
52
33
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
34
|
+
for (const rawLine of source.split(/\r?\n/)) {
|
|
35
|
+
const line = rawLine.trim();
|
|
36
|
+
if (!line.startsWith(`${key}=`)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
value = line
|
|
40
|
+
.slice(key.length + 1)
|
|
41
|
+
.trim()
|
|
42
|
+
.replace(/^['"]|['"]$/g, '');
|
|
61
43
|
}
|
|
62
|
-
|
|
63
|
-
result[key] = value;
|
|
64
44
|
}
|
|
65
45
|
|
|
66
|
-
|
|
46
|
+
// A shell value always wins over the dotenv files, like Vite's env loading.
|
|
47
|
+
return process.env[key] ?? value;
|
|
67
48
|
}
|
|
@@ -64,7 +64,7 @@ type ResultState =
|
|
|
64
64
|
<div class="text-muted-foreground border-border border-b pb-2 font-mono text-xs">
|
|
65
65
|
{{ resultRequest() }}
|
|
66
66
|
</div>
|
|
67
|
-
<div class="text-destructive whitespace-pre-wrap
|
|
67
|
+
<div class="text-destructive break-all whitespace-pre-wrap">{{ resultMessage() }}</div>
|
|
68
68
|
</div>
|
|
69
69
|
}
|
|
70
70
|
@case ('success') {
|
|
@@ -112,7 +112,7 @@ export class AppComponent {
|
|
|
112
112
|
try {
|
|
113
113
|
const data = await this.bridge.transport.os.profile.get();
|
|
114
114
|
const duration = Date.now() - startTime;
|
|
115
|
-
this.bridge.notify(`Profile loaded (${duration}ms)`, 'success
|
|
115
|
+
this.bridge.notify(`Profile loaded (${duration}ms)`, 'success');
|
|
116
116
|
this.result.set({ status: 'success', request, data });
|
|
117
117
|
} catch (err) {
|
|
118
118
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# Hosted app slug used by local runtime/dev-auth wiring.
|
|
1
2
|
NEXT_PUBLIC_APP_NAME={{APP_NAME}}
|
|
2
3
|
|
|
3
|
-
#
|
|
4
|
+
# Paste the dev secret from the BardiocOS AppStore after registering your app.
|
|
5
|
+
# Used by the dev-auth proxy (scripts/dev-auth-proxy.mjs) to sign requests to the BFF.
|
|
4
6
|
DEV_SECRET=
|
|
5
7
|
|
|
6
|
-
# Base URL of the Bardioc
|
|
8
|
+
# Base URL of the Bardioc BFF / backend-for-frontend (e.g. https://your-host).
|
|
7
9
|
API_BASE_URL=
|
|
@@ -9,6 +9,8 @@ export default function RootLayout({ children }: Readonly<{ children: React.Reac
|
|
|
9
9
|
return (
|
|
10
10
|
<html lang="en" className="dark" style={{ height: '100%', margin: 0 }}>
|
|
11
11
|
<head>
|
|
12
|
+
{/* Platform font contract — a fixed absolute URL the host serves, not a bundled asset. */}
|
|
13
|
+
{/* eslint-disable-next-line @next/next/no-css-tags */}
|
|
12
14
|
<link rel="stylesheet" href="/fonts/bardioc-fonts.css" />
|
|
13
15
|
</head>
|
|
14
16
|
<body style={{ height: '100%', margin: 0 }}>{children}</body>
|
|
@@ -12,6 +12,9 @@ type ResultState =
|
|
|
12
12
|
|
|
13
13
|
const APP_NAME = process.env.NEXT_PUBLIC_APP_NAME?.trim();
|
|
14
14
|
|
|
15
|
+
// scripts/dev-auth-proxy.mjs listens on the app port + 100 for standalone dev auth.
|
|
16
|
+
const DEV_PROXY_PORT = Number('{{PORT}}') + 100;
|
|
17
|
+
|
|
15
18
|
function SdkDemo() {
|
|
16
19
|
const bridge = useSdk();
|
|
17
20
|
const notify = useNotify();
|
|
@@ -103,7 +106,7 @@ function SdkDemo() {
|
|
|
103
106
|
<div className="text-muted-foreground border-border border-b pb-2 font-mono text-xs">
|
|
104
107
|
{result.request}
|
|
105
108
|
</div>
|
|
106
|
-
<div className="text-destructive whitespace-pre-wrap
|
|
109
|
+
<div className="text-destructive break-all whitespace-pre-wrap">{result.message}</div>
|
|
107
110
|
</div>
|
|
108
111
|
)}
|
|
109
112
|
{result.status === 'success' && (
|
|
@@ -144,7 +147,7 @@ export default function Page() {
|
|
|
144
147
|
|
|
145
148
|
useEffect(() => {
|
|
146
149
|
if (isDevStandalone()) {
|
|
147
|
-
installDevBridge();
|
|
150
|
+
installDevBridge({ apiBaseUrl: `http://127.0.0.1:${DEV_PROXY_PORT}/rest` });
|
|
148
151
|
}
|
|
149
152
|
}, []);
|
|
150
153
|
|
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
import type { NextConfig } from 'next';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
// Standalone dev auth lives in scripts/dev-auth-proxy.mjs (the SDK dev-auth proxy), not here:
|
|
4
|
+
// the BFF needs Origin dropped and X-Requested-With stamped, which rewrites cannot do.
|
|
6
5
|
const nextConfig: NextConfig = {
|
|
7
6
|
output: 'export',
|
|
8
7
|
images: {
|
|
9
8
|
unoptimized: true,
|
|
10
9
|
},
|
|
11
10
|
trailingSlash: true,
|
|
12
|
-
async headers() {
|
|
13
|
-
if (!devSecret) return [];
|
|
14
|
-
return [
|
|
15
|
-
{
|
|
16
|
-
source: '/rest/:path*',
|
|
17
|
-
headers: [{ key: 'X-Dev-Secret', value: devSecret }],
|
|
18
|
-
},
|
|
19
|
-
];
|
|
20
|
-
},
|
|
21
|
-
async rewrites() {
|
|
22
|
-
if (!apiBaseUrl) return [];
|
|
23
|
-
return [
|
|
24
|
-
{
|
|
25
|
-
source: '/rest/:path*',
|
|
26
|
-
destination: `${apiBaseUrl}/:path*`,
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
},
|
|
30
11
|
};
|
|
31
12
|
|
|
32
13
|
export default nextConfig;
|
|
@@ -3,29 +3,34 @@
|
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "next dev --port {{PORT}}",
|
|
7
|
-
"dev:live": "BARDIOC_TUNNEL=1 next dev --port {{PORT}}",
|
|
6
|
+
"dev": "node ./scripts/dev-auth-proxy.mjs & PROXY_PID=$!; next dev --port {{PORT}}; EXIT_CODE=$?; kill $PROXY_PID 2>/dev/null; exit $EXIT_CODE",
|
|
8
7
|
"build": "next build && node scripts/stamp-manifest.mjs out",
|
|
9
8
|
"bundle": "next build && node scripts/stamp-manifest.mjs out && cd out && zip -r ../{{APP_NAME}}.zip .",
|
|
10
9
|
"start": "next start",
|
|
11
10
|
"check-types": "tsc --noEmit",
|
|
11
|
+
"lint": "eslint .",
|
|
12
|
+
"format": "prettier --write .",
|
|
13
|
+
"format:check": "prettier --check .",
|
|
12
14
|
"changeset": "changeset",
|
|
13
15
|
"release:status": "changeset status --verbose",
|
|
14
16
|
"release:version": "changeset version && npm install",
|
|
15
17
|
"release:publish": "changeset publish"
|
|
16
18
|
},
|
|
17
19
|
"dependencies": {
|
|
18
|
-
"@bardioc/app-sdk": "
|
|
20
|
+
"@bardioc/app-sdk": "^0.4.9",
|
|
19
21
|
"next": "^15.3.2",
|
|
20
22
|
"react": "^19.2.5",
|
|
21
23
|
"react-dom": "^19.2.5"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
26
|
+
"@bardioc/configs": "^0.2.1",
|
|
24
27
|
"@changesets/cli": "^2.31.0",
|
|
25
28
|
"@tailwindcss/postcss": "^4.2.4",
|
|
26
29
|
"@types/node": "^22.10.0",
|
|
27
30
|
"@types/react": "^19.2.14",
|
|
28
31
|
"@types/react-dom": "^19.2.3",
|
|
32
|
+
"eslint": "^10.0.0",
|
|
33
|
+
"prettier": "^3.6.2",
|
|
29
34
|
"tailwindcss": "^4.2.4",
|
|
30
35
|
"typescript": "^6.0.3"
|
|
31
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@bardioc/configs/prettier';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@bardioc/configs/typescript/nextjs.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"allowJs": true,
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"noEmit": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"module": "esnext",
|
|
11
|
-
"moduleResolution": "bundler",
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"isolatedModules": true,
|
|
14
|
-
"jsx": "preserve",
|
|
15
|
-
"incremental": true,
|
|
16
|
-
"plugins": [
|
|
17
|
-
{
|
|
18
|
-
"name": "next"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
4
|
+
"declaration": false,
|
|
5
|
+
"declarationMap": false,
|
|
21
6
|
"paths": {
|
|
22
7
|
"@/*": ["./*"]
|
|
23
8
|
}
|
|
@@ -5,26 +5,31 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
|
-
"dev:live": "BARDIOC_TUNNEL=1 vite",
|
|
9
8
|
"build": "tsc && vite build && node scripts/stamp-manifest.mjs dist",
|
|
10
9
|
"bundle": "tsc && vite build && node scripts/stamp-manifest.mjs dist && cd dist && zip -r ../{{APP_NAME}}.zip .",
|
|
11
10
|
"preview": "vite preview",
|
|
12
11
|
"check-types": "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.4.9",
|
|
20
22
|
"preact": "^10.26.7"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
25
|
+
"@bardioc/configs": "^0.2.1",
|
|
23
26
|
"@changesets/cli": "^2.31.0",
|
|
24
|
-
"@preact/preset-vite": "^2.10.
|
|
27
|
+
"@preact/preset-vite": "^2.10.6",
|
|
25
28
|
"@tailwindcss/vite": "^4.3.0",
|
|
26
29
|
"@types/node": "^22.19.19",
|
|
30
|
+
"eslint": "^10.0.0",
|
|
27
31
|
"preact-render-to-string": "^6.6.1",
|
|
32
|
+
"prettier": "^3.6.2",
|
|
28
33
|
"tailwindcss": "4.3.0",
|
|
29
34
|
"typescript": "6.0.3",
|
|
30
35
|
"vite": "8.0.13"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@bardioc/configs/prettier';
|
|
@@ -99,7 +99,7 @@ function SdkDemo() {
|
|
|
99
99
|
<div className="text-muted-foreground border-border border-b pb-2 font-mono text-xs">
|
|
100
100
|
{result.request}
|
|
101
101
|
</div>
|
|
102
|
-
<div className="text-destructive whitespace-pre-wrap
|
|
102
|
+
<div className="text-destructive break-all whitespace-pre-wrap">{result.message}</div>
|
|
103
103
|
</div>
|
|
104
104
|
)}
|
|
105
105
|
{result.status === 'success' && (
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@bardioc/configs/typescript/react-library.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
+
"declaration": false,
|
|
5
|
+
"declarationMap": false,
|
|
4
6
|
"module": "ESNext",
|
|
5
7
|
"moduleResolution": "Bundler",
|
|
6
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"jsxImportSource": "preact",
|
|
9
|
-
"strict": true,
|
|
10
8
|
"noEmit": true,
|
|
11
|
-
"
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"forceConsistentCasingInFileNames": true,
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"isolatedModules": true
|
|
9
|
+
"jsxImportSource": "preact"
|
|
16
10
|
},
|
|
17
11
|
"include": ["src"],
|
|
18
12
|
"exclude": ["node_modules", "dist"]
|
|
@@ -12,6 +12,11 @@ export default defineConfig(({ mode }) => {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return {
|
|
15
|
-
plugins: [
|
|
15
|
+
plugins: [
|
|
16
|
+
bardiocDevAuth({ appName }),
|
|
17
|
+
preact(),
|
|
18
|
+
bardiocApp({ appName, port: {{PORT}} }),
|
|
19
|
+
tailwindcss(),
|
|
20
|
+
],
|
|
16
21
|
};
|
|
17
22
|
});
|
|
@@ -5,28 +5,32 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
|
-
"dev:live": "BARDIOC_TUNNEL=1 vite",
|
|
9
8
|
"build": "tsc && vite build && node scripts/stamp-manifest.mjs dist",
|
|
10
9
|
"bundle": "tsc && vite build && node scripts/stamp-manifest.mjs dist && cd dist && zip -r ../{{APP_NAME}}.zip .",
|
|
11
10
|
"preview": "vite preview",
|
|
12
11
|
"check-types": "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.4.9",
|
|
20
22
|
"solid-js": "^1.9.7"
|
|
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
|
-
"
|
|
29
|
+
"eslint": "^10.0.0",
|
|
30
|
+
"prettier": "^3.6.2",
|
|
27
31
|
"tailwindcss": "4.3.0",
|
|
28
32
|
"typescript": "6.0.3",
|
|
29
33
|
"vite": "8.0.13",
|
|
30
|
-
"vite-plugin-solid": "^2.11.
|
|
34
|
+
"vite-plugin-solid": "^2.11.14"
|
|
31
35
|
}
|
|
32
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@bardioc/configs/prettier';
|
|
@@ -60,7 +60,7 @@ function SdkDemo() {
|
|
|
60
60
|
<div class="flex flex-wrap gap-2">
|
|
61
61
|
<button
|
|
62
62
|
class="bg-primary text-primary-foreground hover:bg-primary/90 rounded px-3 py-1 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50"
|
|
63
|
-
onclick={runGetProfile}
|
|
63
|
+
onclick={() => void runGetProfile()}
|
|
64
64
|
disabled={running()}
|
|
65
65
|
>
|
|
66
66
|
Get Profile
|
|
@@ -106,7 +106,7 @@ function SdkDemo() {
|
|
|
106
106
|
<div class="text-muted-foreground border-border border-b pb-2 font-mono text-xs">
|
|
107
107
|
{r.request}
|
|
108
108
|
</div>
|
|
109
|
-
<div class="text-destructive whitespace-pre-wrap
|
|
109
|
+
<div class="text-destructive break-all whitespace-pre-wrap">{r.message}</div>
|
|
110
110
|
</div>
|
|
111
111
|
);
|
|
112
112
|
}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@bardioc/configs/typescript/base.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
+
"declaration": false,
|
|
5
|
+
"declarationMap": false,
|
|
4
6
|
"module": "ESNext",
|
|
5
7
|
"moduleResolution": "Bundler",
|
|
6
|
-
"
|
|
8
|
+
"noEmit": true,
|
|
7
9
|
"jsx": "preserve",
|
|
8
10
|
"jsxImportSource": "solid-js",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"noEmit": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"forceConsistentCasingInFileNames": true,
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"isolatedModules": true,
|
|
16
11
|
"types": ["vite/client"]
|
|
17
12
|
},
|
|
18
13
|
"include": ["src"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { bardiocApp, bardiocDevAuth } from '@bardioc/app-sdk/vite';
|
|
2
2
|
import tailwindcss from '@tailwindcss/vite';
|
|
3
|
-
import solid from 'vite-plugin-solid';
|
|
4
3
|
import { defineConfig, loadEnv } from 'vite';
|
|
4
|
+
import solid from 'vite-plugin-solid';
|
|
5
5
|
|
|
6
6
|
export default defineConfig(({ mode }) => {
|
|
7
7
|
const env = loadEnv(mode, __dirname, '');
|
|
@@ -12,6 +12,11 @@ export default defineConfig(({ mode }) => {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return {
|
|
15
|
-
plugins: [
|
|
15
|
+
plugins: [
|
|
16
|
+
bardiocDevAuth({ appName }),
|
|
17
|
+
solid(),
|
|
18
|
+
bardiocApp({ appName, port: {{PORT}} }),
|
|
19
|
+
tailwindcss(),
|
|
20
|
+
],
|
|
16
21
|
};
|
|
17
22
|
});
|
|
@@ -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": "svelte-check && vite build && node scripts/stamp-manifest.mjs dist",
|
|
10
9
|
"bundle": "svelte-check && vite build && node scripts/stamp-manifest.mjs dist && cd dist && zip -r ../{{APP_NAME}}.zip .",
|
|
11
10
|
"preview": "vite preview",
|
|
12
11
|
"check-types": "svelte-check",
|
|
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.4.9",
|
|
20
22
|
"svelte": "^5.33.14"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
25
|
+
"@bardioc/configs": "^0.2.1",
|
|
23
26
|
"@changesets/cli": "^2.31.0",
|
|
24
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
27
|
+
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
|
25
28
|
"@tailwindcss/vite": "^4.3.0",
|
|
26
29
|
"@types/node": "^22.19.19",
|
|
30
|
+
"eslint": "^10.0.0",
|
|
31
|
+
"prettier": "^3.6.2",
|
|
27
32
|
"svelte-check": "^4.2.1",
|
|
28
33
|
"tailwindcss": "4.3.0",
|
|
29
34
|
"typescript": "6.0.3",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@bardioc/configs/prettier';
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
<div class="text-muted-foreground border-border border-b pb-2 font-mono text-xs">
|
|
110
110
|
{result.request}
|
|
111
111
|
</div>
|
|
112
|
-
<div class="text-destructive whitespace-pre-wrap
|
|
112
|
+
<div class="text-destructive break-all whitespace-pre-wrap">{result.message}</div>
|
|
113
113
|
</div>
|
|
114
114
|
{:else if result.status === 'success'}
|
|
115
115
|
<div class="flex h-full flex-col gap-0 overflow-hidden">
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@bardioc/configs/typescript/base.json",
|
|
2
3
|
"compilerOptions": {
|
|
4
|
+
"declaration": false,
|
|
5
|
+
"declarationMap": false,
|
|
3
6
|
"target": "ESNext",
|
|
4
7
|
"module": "ESNext",
|
|
5
8
|
"moduleResolution": "bundler",
|
|
6
|
-
"strict": true,
|
|
7
9
|
"noEmit": true,
|
|
8
|
-
"
|
|
9
|
-
"verbatimModuleSyntax": true,
|
|
10
|
-
"isolatedModules": true
|
|
10
|
+
"verbatimModuleSyntax": true
|
|
11
11
|
},
|
|
12
12
|
"include": ["src/**/*.ts", "src/**/*.svelte"]
|
|
13
13
|
}
|
|
@@ -12,6 +12,11 @@ export default defineConfig(({ mode }) => {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return {
|
|
15
|
-
plugins: [
|
|
15
|
+
plugins: [
|
|
16
|
+
bardiocDevAuth({ appName }),
|
|
17
|
+
svelte(),
|
|
18
|
+
bardiocApp({ appName, port: {{PORT}} }),
|
|
19
|
+
tailwindcss(),
|
|
20
|
+
],
|
|
16
21
|
};
|
|
17
22
|
});
|
package/templates/vite/CLAUDE.md
CHANGED
|
@@ -69,11 +69,16 @@ an `app`-kind root next to the host's About / Version entries — the example of
|
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
71
|
pnpm dev # http://localhost:{{PORT}}
|
|
72
|
-
pnpm dev:live # public tunnel
|
|
73
72
|
pnpm build # → dist/
|
|
74
73
|
pnpm bundle # → {{APP_NAME}}.zip
|
|
74
|
+
pnpm check-types # tsc
|
|
75
|
+
pnpm lint # eslint (@bardioc/configs preset)
|
|
76
|
+
pnpm format # prettier (@bardioc/configs preset)
|
|
75
77
|
```
|
|
76
78
|
|
|
79
|
+
ESLint, Prettier and the `tsconfig.json` base come from `@bardioc/configs` — edit
|
|
80
|
+
`eslint.config.mjs` / `prettier.config.mjs` only to add app-specific overrides on top of the preset.
|
|
81
|
+
|
|
77
82
|
`npm run dev` runs plain Vite — a local preview shell (no transport): the dashboard renders, but
|
|
78
83
|
live SDK data comes only when the app is opened inside the host, or when `DEV_SECRET` and
|
|
79
84
|
`API_BASE_URL` are set for standalone dev auth (see `.env.example`).
|
|
@@ -9,26 +9,32 @@
|
|
|
9
9
|
"bundle": "rm -f {{APP_NAME}}.zip && tsc && vite build && node scripts/stamp-manifest.mjs dist && cd dist && zip -r ../{{APP_NAME}}.zip .",
|
|
10
10
|
"preview": "vite preview",
|
|
11
11
|
"check-types": "tsc --noEmit",
|
|
12
|
+
"lint": "eslint .",
|
|
13
|
+
"format": "prettier --write .",
|
|
14
|
+
"format:check": "prettier --check .",
|
|
12
15
|
"changeset": "changeset",
|
|
13
16
|
"release:status": "changeset status --verbose",
|
|
14
17
|
"release:version": "changeset version && npm install",
|
|
15
18
|
"release:publish": "changeset publish"
|
|
16
19
|
},
|
|
17
20
|
"dependencies": {
|
|
18
|
-
"@bardioc/app-sdk": "
|
|
19
|
-
"@bardioc/i18n-core": "
|
|
20
|
-
"@bardioc/ui": "
|
|
21
|
+
"@bardioc/app-sdk": "^0.4.9",
|
|
22
|
+
"@bardioc/i18n-core": "^0.1.1",
|
|
23
|
+
"@bardioc/ui": "^0.3.1",
|
|
21
24
|
"lucide-react": "^0.544.0",
|
|
22
25
|
"react": "19.2.6",
|
|
23
26
|
"react-dom": "19.2.6"
|
|
24
27
|
},
|
|
25
28
|
"devDependencies": {
|
|
29
|
+
"@bardioc/configs": "^0.2.1",
|
|
26
30
|
"@changesets/cli": "^2.31.0",
|
|
27
31
|
"@tailwindcss/vite": "^4.3.0",
|
|
28
32
|
"@types/node": "^22.19.19",
|
|
29
33
|
"@types/react": "^19.2.14",
|
|
30
34
|
"@types/react-dom": "^19.2.3",
|
|
31
35
|
"@vitejs/plugin-react": "5.2.0",
|
|
36
|
+
"eslint": "^10.0.0",
|
|
37
|
+
"prettier": "^3.6.2",
|
|
32
38
|
"tailwindcss": "4.3.0",
|
|
33
39
|
"typescript": "6.0.3",
|
|
34
40
|
"vite": "8.0.13"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@bardioc/configs/prettier';
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import type { ClimateReading, ClimateState, Condition, ForecastDay, Station } from './types';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type StationBase = Pick<Station, 'id' | 'name' | 'region'>;
|
|
4
|
+
|
|
5
|
+
// Non-empty tuples, so indexing them stays type-safe under noUncheckedIndexedAccess.
|
|
6
|
+
const STATIONS: [StationBase, ...StationBase[]] = [
|
|
4
7
|
{ id: 'lagoon', name: 'Lagoon Station', region: 'Equatorial Belt' },
|
|
5
8
|
{ id: 'verdant', name: 'Verdant Ridge', region: 'Highlands' },
|
|
6
9
|
{ id: 'aurora', name: 'Aurora Flats', region: 'Polar Rim' },
|
|
7
10
|
{ id: 'cinder', name: 'Cinder Basin', region: 'Volcanic Plains' },
|
|
8
11
|
{ id: 'mistral', name: 'Mistral Cove', region: 'Coastal Shelf' },
|
|
9
12
|
];
|
|
10
|
-
const CONDITIONS: Condition[] = ['sunny', 'cloudy', 'rainy'];
|
|
11
|
-
const DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
|
13
|
+
const CONDITIONS: [Condition, ...Condition[]] = ['sunny', 'cloudy', 'rainy'];
|
|
14
|
+
const DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] as const;
|
|
12
15
|
|
|
13
|
-
function pick<T>(items: readonly T[]): T {
|
|
14
|
-
return items[Math.floor(Math.random() * items.length)];
|
|
16
|
+
function pick<T>(items: readonly [T, ...T[]]): T {
|
|
17
|
+
return items[Math.floor(Math.random() * items.length)] ?? items[0];
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
function round(value: number, decimals: number): number {
|
|
@@ -63,7 +66,11 @@ export function generateState(
|
|
|
63
66
|
activeStationId?: string,
|
|
64
67
|
source: ClimateState['source'] = 'mock'
|
|
65
68
|
): ClimateState {
|
|
66
|
-
const
|
|
69
|
+
const [firstBase, ...restBases] = STATIONS;
|
|
70
|
+
const stations: [Station, ...Station[]] = [
|
|
71
|
+
buildStation(firstBase),
|
|
72
|
+
...restBases.map(buildStation),
|
|
73
|
+
];
|
|
67
74
|
const active = stations.find(station => station.id === activeStationId) ?? stations[0];
|
|
68
75
|
return {
|
|
69
76
|
stations,
|
|
@@ -42,7 +42,8 @@ async function sampleNodes(bridge: HostBridge, limit: number): Promise<GraphNode
|
|
|
42
42
|
// query by a type that actually exists, a node lookup, and a Gremlin neighbor traversal — the
|
|
43
43
|
// lookup/traversal presets discover a real node from the wildcard query first, so nothing is
|
|
44
44
|
// hard-coded to a specific instance.
|
|
45
|
-
|
|
45
|
+
// Non-empty tuple, so the Explorer can index the first preset as its default.
|
|
46
|
+
export const SDK_REQUESTS: [SdkRequest, ...SdkRequest[]] = [
|
|
46
47
|
{
|
|
47
48
|
id: 'graph.query.all',
|
|
48
49
|
category: 'graph',
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@bardioc/configs/typescript/react-library.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
+
"declaration": false,
|
|
5
|
+
"declarationMap": false,
|
|
4
6
|
"module": "ESNext",
|
|
5
7
|
"moduleResolution": "Bundler",
|
|
6
|
-
"
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"noEmit": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"isolatedModules": true
|
|
8
|
+
"noEmit": true
|
|
15
9
|
},
|
|
16
10
|
"include": ["src"],
|
|
17
11
|
"exclude": ["node_modules", "dist"]
|
|
@@ -1,6 +1,6 @@
|
|
|
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
6
|
export default defineConfig(({ mode }) => {
|
|
@@ -12,6 +12,11 @@ export default defineConfig(({ mode }) => {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return {
|
|
15
|
-
plugins: [
|
|
15
|
+
plugins: [
|
|
16
|
+
bardiocDevAuth({ appName }),
|
|
17
|
+
react(),
|
|
18
|
+
bardiocApp({ appName, port: {{PORT}} }),
|
|
19
|
+
tailwindcss(),
|
|
20
|
+
],
|
|
16
21
|
};
|
|
17
22
|
});
|
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.4.9",
|
|
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';
|
|
@@ -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'"
|
|
@@ -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,6 +1,6 @@
|
|
|
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
6
|
export default defineConfig(({ mode }) => {
|
|
@@ -12,6 +12,11 @@ export default defineConfig(({ mode }) => {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return {
|
|
15
|
-
plugins: [
|
|
15
|
+
plugins: [
|
|
16
|
+
bardiocDevAuth({ appName }),
|
|
17
|
+
vue(),
|
|
18
|
+
bardiocApp({ appName, port: {{PORT}} }),
|
|
19
|
+
tailwindcss(),
|
|
20
|
+
],
|
|
16
21
|
};
|
|
17
22
|
});
|