@bardioc/create-bardioc-app 0.4.0 → 0.5.1
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 +7 -13
- package/bin/create.mjs +5 -5
- package/package.json +1 -1
- package/src/scaffold.js +2 -2
- package/templates/_base/.changeset/README.md +3 -3
- package/templates/_base/.claude/commands/changeset-app.md +5 -5
- package/templates/_base/.claude/commands/refresh-bundle.md +5 -5
- package/templates/_base/README.md +9 -9
- package/templates/angular/package.json +6 -6
- package/templates/nextjs/.env.example +1 -1
- package/templates/nextjs/package.json +1 -1
- package/templates/preact/package.json +1 -1
- package/templates/solid/package.json +1 -1
- package/templates/svelte/package.json +1 -1
- package/templates/vite/.env.example +1 -1
- package/templates/vite/CLAUDE.md +199 -59
- package/templates/vite/package.json +5 -1
- package/templates/vite/public/app-manifest.json +25 -0
- package/templates/vite/src/App.tsx +11 -133
- package/templates/vite/src/auth/onboarding.tsx +67 -0
- package/templates/vite/src/climate/climate-data.ts +92 -0
- package/templates/vite/src/climate/conditions-chart.tsx +38 -0
- package/templates/vite/src/climate/location-card.tsx +50 -0
- package/templates/vite/src/climate/location-select.tsx +26 -0
- package/templates/vite/src/climate/metrics-grid.tsx +22 -0
- package/templates/vite/src/climate/overview-view.tsx +52 -0
- package/templates/vite/src/climate/stations-view.tsx +149 -0
- package/templates/vite/src/climate/types.ts +93 -0
- package/templates/vite/src/climate/use-climate.ts +123 -0
- package/templates/vite/src/dashboard-provider.tsx +27 -0
- package/templates/vite/src/events/live-events-view.tsx +74 -0
- package/templates/vite/src/graph/explorer-view.tsx +118 -0
- package/templates/vite/src/graph/requests.ts +142 -0
- package/templates/vite/src/i18n.tsx +68 -0
- package/templates/vite/src/index.css +12 -64
- package/templates/vite/src/locales/de.json +141 -0
- package/templates/vite/src/locales/en.json +141 -0
- package/templates/vite/src/main.tsx +10 -4
- package/templates/vite/src/profile/profile-view.tsx +75 -0
- package/templates/vite/src/profile/use-profile.ts +52 -0
- package/templates/vite/src/shell/about-dialog.tsx +129 -0
- package/templates/vite/src/shell/app-shell.tsx +160 -0
- package/templates/vite/src/shell/header.tsx +39 -0
- package/templates/vite/src/use-app-notify.ts +23 -0
- package/templates/vite/src/vite-env.d.ts +5 -5
- package/templates/vue/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,20 +22,14 @@ You can also run it without a global install:
|
|
|
22
22
|
npm exec --yes @bardioc/create-bardioc-app my-app -- --port 3005
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Or with pnpm:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
pnpm dlx @bardioc/create-bardioc-app my-app --port 3005
|
|
29
|
-
```
|
|
30
|
-
|
|
31
25
|
## Quick start
|
|
32
26
|
|
|
33
27
|
```bash
|
|
34
28
|
create-bardioc-app my-app --port 3005
|
|
35
|
-
cd
|
|
36
|
-
|
|
29
|
+
cd my-app
|
|
30
|
+
npm install
|
|
37
31
|
bardioc login
|
|
38
|
-
|
|
32
|
+
npm run dev
|
|
39
33
|
```
|
|
40
34
|
|
|
41
35
|
## Generated app
|
|
@@ -55,7 +49,7 @@ Every scaffolded app ships a lightweight versioning toolkit:
|
|
|
55
49
|
|
|
56
50
|
- **Changesets** (`.changeset/` + `changeset`/`release:*` scripts) for semver-versioning the app
|
|
57
51
|
- **`scripts/stamp-manifest.mjs`** — folds `package.json`'s version into the built `app-manifest.json`
|
|
58
|
-
so the WebOS app store shows the real release version (wired into `
|
|
52
|
+
so the WebOS app store shows the real release version (wired into `npm run build` / `npm run bundle`)
|
|
59
53
|
- Two Claude skills under `.claude/commands/`: **`/changeset-app`** (bump locally) and
|
|
60
54
|
**`/refresh-bundle`** (rebuild the zip and swap it into a WebOS host checkout)
|
|
61
55
|
|
|
@@ -79,11 +73,11 @@ Generated apps can opt into the same host-backed standalone dev-session flow use
|
|
|
79
73
|
3. Run `bardioc login` once for that host
|
|
80
74
|
4. Set `VITE_ENABLE_DEV_AUTH=true`
|
|
81
75
|
|
|
82
|
-
Important: standalone login will not start unless `VITE_ENABLE_DEV_AUTH=true` is present in `.env`. Running `
|
|
76
|
+
Important: standalone login will not start unless `VITE_ENABLE_DEV_AUTH=true` is present in `.env`. Running `npm run dev` with only `VITE_APP_NAME` and `VITE_APP_ID` is not enough.
|
|
83
77
|
|
|
84
|
-
When enabled, running `
|
|
78
|
+
When enabled, running `npm run dev` outside the host iframe will use your stored CLI login to mint a fresh host dev session before the dev server starts, then route SDK transport calls through the local proxy into the host transport. `DEV_SESSION_KEY` no longer needs to be copied manually. If a request needs a specific scope, pass `scopeId` on that request.
|
|
85
79
|
|
|
86
|
-
For public testing, run `
|
|
80
|
+
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.
|
|
87
81
|
|
|
88
82
|
## Options
|
|
89
83
|
|
package/bin/create.mjs
CHANGED
|
@@ -47,7 +47,7 @@ const { name, port, template, withPipeline, withLink } = argsResult;
|
|
|
47
47
|
const destBase = resolve(process.cwd());
|
|
48
48
|
const templateDir = join(TEMPLATES_DIR, template);
|
|
49
49
|
|
|
50
|
-
console.log(`\nCreating
|
|
50
|
+
console.log(`\nCreating ${name}/ with ${template} template...\n`);
|
|
51
51
|
|
|
52
52
|
const result = scaffoldApp({
|
|
53
53
|
name,
|
|
@@ -65,12 +65,12 @@ if (!result.success) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
console.log(` Done! Next steps:\n`);
|
|
68
|
-
console.log(` cd
|
|
69
|
-
console.log(`
|
|
68
|
+
console.log(` cd ${name}`);
|
|
69
|
+
console.log(` npm install`);
|
|
70
70
|
console.log(` bardioc login`);
|
|
71
|
-
console.log(`
|
|
71
|
+
console.log(` npm run dev\n`);
|
|
72
72
|
console.log(` Open http://localhost:${port} to see your app.`);
|
|
73
73
|
console.log(
|
|
74
|
-
` Standalone host-backed auth now refreshes automatically from your CLI login during
|
|
74
|
+
` Standalone host-backed auth now refreshes automatically from your CLI login during npm run dev.`
|
|
75
75
|
);
|
|
76
76
|
console.log(` Use "pnpm dev:live" for a public tunnel/live URL.\n`);
|
package/package.json
CHANGED
package/src/scaffold.js
CHANGED
|
@@ -338,10 +338,10 @@ export function scaffoldApp({
|
|
|
338
338
|
withPipeline = false,
|
|
339
339
|
withLink = false,
|
|
340
340
|
}) {
|
|
341
|
-
const dest = join(destBase,
|
|
341
|
+
const dest = join(destBase, name);
|
|
342
342
|
|
|
343
343
|
if (existsSync(dest)) {
|
|
344
|
-
return { success: false, error: `directory "
|
|
344
|
+
return { success: false, error: `directory "${name}" already exists` };
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
const vars = {
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
This app versions itself with [Changesets](https://github.com/changesets/changesets) — the same flow
|
|
4
4
|
as the `@bardioc/*` libraries.
|
|
5
5
|
|
|
6
|
-
**To cut a release: run the `/changeset-app` skill** (or `
|
|
7
|
-
and applies it locally (`
|
|
6
|
+
**To cut a release: run the `/changeset-app` skill** (or `npm run changeset`) — it picks the semver bump
|
|
7
|
+
and applies it locally (`npm run release:version`), so `package.json`'s `version` always reflects the
|
|
8
8
|
release. Commit the result with your PR; merging to `dev` runs the publish step in the pipeline.
|
|
9
9
|
|
|
10
10
|
The skill is named `changeset-app` (not `changeset`) to avoid clashing with the `/changeset` command
|
|
11
11
|
in `bardioc-desktop-frontend` when both repos are open in one workspace. It's app-agnostic — it reads
|
|
12
12
|
the published package name from `package.json` — so the same skill file works in any app repo.
|
|
13
13
|
|
|
14
|
-
> **This app ships private + unscoped, so publishing is dormant.** `
|
|
14
|
+
> **This app ships private + unscoped, so publishing is dormant.** `npm run changeset publish` no-ops on
|
|
15
15
|
> a private package — versioning works, but nothing is pushed to a registry. To actually publish to
|
|
16
16
|
> Nexus, scope the name (e.g. `@bardioc/<app>`), set `"private": false`, and add a
|
|
17
17
|
> `publishConfig.registry`; then the pipeline's publish step starts shipping the built `dist/`.
|
|
@@ -8,7 +8,7 @@ argument-hint: "[optional: summary, and/or 'minor'/'major' to override the bump]
|
|
|
8
8
|
|
|
9
9
|
This is a **single-package hosted-app repo**: it publishes exactly one package (read its name from
|
|
10
10
|
this repo's `package.json` `name` field). This skill writes the `.changeset/*.md`, picks the **bump**,
|
|
11
|
-
and **applies it** (`
|
|
11
|
+
and **applies it** (`npm run release:version`), so `package.json`'s `version` always reflects the
|
|
12
12
|
release. The result is committed with your PR; the pipeline only publishes.
|
|
13
13
|
|
|
14
14
|
> Named `changeset-app` (not `changeset`) on purpose: `bardioc-desktop-frontend` ships its own
|
|
@@ -72,7 +72,7 @@ Write `.changeset/<short-kebab-slug>.md` using **this repo's** package name (fro
|
|
|
72
72
|
Then apply the version bump locally:
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
|
|
75
|
+
npm run release:version # = changeset version && npm install
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
This rewrites `package.json`'s `version`, updates `CHANGELOG.md`, syncs the lockfile, and
|
|
@@ -89,16 +89,16 @@ manifest note below) — a bump alone does not update the zip.
|
|
|
89
89
|
|
|
90
90
|
- **App-store version is auto-stamped — never hand-edit the manifest.** This app stamps its
|
|
91
91
|
`public/app-manifest.json` version from `package.json` at bundle time (via
|
|
92
|
-
`scripts/stamp-manifest.mjs`, wired into `
|
|
92
|
+
`scripts/stamp-manifest.mjs`, wired into `npm run bundle`/`npm run build`), so the WebOS app store reads
|
|
93
93
|
that stamped version, and this skill's `package.json` bump is the _only_ edit needed. It reaches
|
|
94
94
|
the store only after a **re-bundle**: run **`/refresh-bundle`** after bumping (before merging) to
|
|
95
95
|
rebuild the zip and swap it into the host's `apps/webos-host/public/_apps/`. The committed
|
|
96
96
|
`app-manifest.json` `version` is just a seed — the stamp overwrites it in the build output, so
|
|
97
97
|
don't sync it by hand.
|
|
98
98
|
- **Bump before merging to `dev`** so the release carries a fresh version. There is **no
|
|
99
|
-
release gate**: if you forget, `
|
|
99
|
+
release gate**: if you forget, `npm run changeset publish` just no-ops (green, "No unpublished
|
|
100
100
|
projects") rather than failing — the merge succeeds but publishes nothing until you bump. (While
|
|
101
101
|
the package is private, publish always no-ops regardless.)
|
|
102
102
|
- Bumping locally is why CI needs **no git-write token** — the version is already in the PR;
|
|
103
|
-
the pipeline only runs `
|
|
103
|
+
the pipeline only runs `npm run changeset publish` (which publishes only if the version isn't on
|
|
104
104
|
Nexus yet and the package is publishable).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: refresh-bundle
|
|
3
|
-
description: Rebuild this app's zip and replace the committed copy in the WebOS host's apps/webos-host/public/_apps/. Removes the stale zip first, runs `
|
|
3
|
+
description: Rebuild this app's zip and replace the committed copy in the WebOS host's apps/webos-host/public/_apps/. Removes the stale zip first, runs `npm run bundle`, then copies the fresh zip over.
|
|
4
4
|
argument-hint: '[absolute path to the bardioc-desktop-frontend (WebOS host) checkout]'
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ Re-bundle **this** standalone hosted app and swap the fresh zip into the WebOS h
|
|
|
12
12
|
The flow, end to end:
|
|
13
13
|
|
|
14
14
|
1. **Remove** the stale zip in this app repo (forces a clean rebundle, never copies a stale artifact).
|
|
15
|
-
2. **Bundle** via this repo's `
|
|
15
|
+
2. **Bundle** via this repo's `npm run bundle` script (`<build> && node scripts/stamp-manifest.mjs && zip → <app>.zip`).
|
|
16
16
|
3. **Replace** `<host>/apps/webos-host/public/_apps/<app>.zip` with the freshly built one.
|
|
17
17
|
|
|
18
18
|
## Arguments
|
|
@@ -60,7 +60,7 @@ rm -f "$REPO/$ZIP"
|
|
|
60
60
|
## Step 3 — Bundle in this repo
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
cd "$REPO" &&
|
|
63
|
+
cd "$REPO" && npm run bundle
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
Then verify the artifact was actually produced:
|
|
@@ -69,7 +69,7 @@ Then verify the artifact was actually produced:
|
|
|
69
69
|
test -f "$REPO/$ZIP" && ls -l "$REPO/$ZIP" || { echo "Bundle did not produce $ZIP"; exit 1; }
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
If `
|
|
72
|
+
If `npm run bundle` fails (build errors), **stop and report the real failure** — do not copy anything.
|
|
73
73
|
You may fix an obvious issue and retry once; on a second failure, report it truthfully and ask the
|
|
74
74
|
user how to proceed.
|
|
75
75
|
|
|
@@ -94,7 +94,7 @@ Do **not** commit unless the user asks.
|
|
|
94
94
|
## Notes
|
|
95
95
|
|
|
96
96
|
- This app is decoupled from the host's workspace (its own `pnpm-lock.yaml`). Always run
|
|
97
|
-
`
|
|
97
|
+
`npm run bundle` from inside `REPO`, never from the host root.
|
|
98
98
|
- Removing the repo zip first (Step 2) is deliberate: it guarantees the copy in Step 4 is a
|
|
99
99
|
brand-new build, never a leftover artifact.
|
|
100
100
|
- The `public/_apps/<app>.zip` is git-tracked in the host repo, so the previous bundle is always
|
|
@@ -7,17 +7,17 @@ app.
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
npm install
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Develop
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
npm run dev # http://localhost:{{PORT}}
|
|
17
|
+
npm run dev:live # public tunnel (BARDIOC_TUNNEL=1)
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Run `bardioc login` once; `
|
|
20
|
+
Run `bardioc login` once; `npm run dev` then mints and refreshes the standalone dev session
|
|
21
21
|
automatically. See `.env.example` for the required variables.
|
|
22
22
|
|
|
23
23
|
## Develop against `@bardioc/*` source (optional)
|
|
@@ -54,8 +54,8 @@ resolves from Nexus. No overlay or CI-only workspace file needed.
|
|
|
54
54
|
## Build & Bundle
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
npm run build # type-check + build (+ stamp the manifest version) → output dir
|
|
58
|
+
npm run bundle # build + zip → {{APP_NAME}}.zip
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
`scripts/stamp-manifest.mjs` folds `package.json`'s `version` into the built `app-manifest.json` so
|
|
@@ -74,14 +74,14 @@ forgotten bump just publishes nothing rather than failing the deploy.
|
|
|
74
74
|
|
|
75
75
|
**To cut a release:**
|
|
76
76
|
|
|
77
|
-
1. On your feature branch, run the **`/changeset-app`** skill (or `
|
|
78
|
-
semver bump, writes `.changeset/*.md`, and applies it locally (`
|
|
77
|
+
1. On your feature branch, run the **`/changeset-app`** skill (or `npm run changeset`) — it picks the
|
|
78
|
+
semver bump, writes `.changeset/*.md`, and applies it locally (`npm run release:version`). Commit the
|
|
79
79
|
result with your PR. Then run **`/refresh-bundle`** so the new version reaches the shipped zip.
|
|
80
80
|
2. Open a PR. The PR pipeline runs `check-types`, `build`, and `audit` in parallel. No publish.
|
|
81
81
|
3. Merge to `dev`. CI runs again, then the publish step runs.
|
|
82
82
|
|
|
83
83
|
> **Publishing is dormant by default.** This app ships `"private": true` with an unscoped name, so
|
|
84
|
-
> `
|
|
84
|
+
> `npm run changeset publish` cleanly no-ops. To publish to Nexus, scope the package name
|
|
85
85
|
> (e.g. `@bardioc/{{APP_NAME}}`), set `"private": false`, and add a `publishConfig.registry` — then
|
|
86
86
|
> the pipeline's publish step ships the built output (set `"files": ["<output-dir>"]` accordingly).
|
|
87
87
|
>
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"sync:runtime-env": "node ./scripts/sync-runtime-env.mjs",
|
|
7
7
|
"ng": "ng",
|
|
8
|
-
"predev": "
|
|
8
|
+
"predev": "npm run sync:runtime-env",
|
|
9
9
|
"dev": "node ./scripts/dev-auth-proxy.mjs --app-port {{PORT}} & PROXY_PID=$!; ng serve --port {{PORT}}; EXIT_CODE=$?; kill $PROXY_PID; exit $EXIT_CODE",
|
|
10
|
-
"predev:live": "
|
|
10
|
+
"predev:live": "npm run sync:runtime-env",
|
|
11
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",
|
|
12
|
-
"prebuild": "
|
|
12
|
+
"prebuild": "npm run sync:runtime-env",
|
|
13
13
|
"build": "ng build && node scripts/stamp-manifest.mjs dist/{{APP_NAME}}/browser",
|
|
14
14
|
"bundle": "ng build && node scripts/stamp-manifest.mjs dist/{{APP_NAME}}/browser && cd dist/{{APP_NAME}}/browser && zip -r ../../../{{APP_NAME}}.zip .",
|
|
15
|
-
"prewatch": "
|
|
15
|
+
"prewatch": "npm run sync:runtime-env",
|
|
16
16
|
"watch": "ng build --watch --configuration development",
|
|
17
|
-
"precheck-types": "
|
|
17
|
+
"precheck-types": "npm run sync:runtime-env",
|
|
18
18
|
"check-types": "ng build --configuration development",
|
|
19
19
|
"changeset": "changeset",
|
|
20
20
|
"release:status": "changeset status --verbose",
|
|
21
|
-
"release:version": "changeset version &&
|
|
21
|
+
"release:version": "changeset version && npm install",
|
|
22
22
|
"release:publish": "changeset publish"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
@@ -3,6 +3,6 @@ NEXT_PUBLIC_APP_ID=your-app-client-id-here
|
|
|
3
3
|
NEXT_PUBLIC_ENABLE_DEV_AUTH=false
|
|
4
4
|
|
|
5
5
|
# Required host URL for standalone dev auth. Run `bardioc login` once, then
|
|
6
|
-
# `
|
|
6
|
+
# `npm run dev` will refresh DEV_SESSION_KEY automatically before Next starts.
|
|
7
7
|
DEV_AUTH_HOST_URL=
|
|
8
8
|
DEV_SESSION_KEY=
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"check-types": "tsc --noEmit",
|
|
12
12
|
"changeset": "changeset",
|
|
13
13
|
"release:status": "changeset status --verbose",
|
|
14
|
-
"release:version": "changeset version &&
|
|
14
|
+
"release:version": "changeset version && npm install",
|
|
15
15
|
"release:publish": "changeset publish"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"check-types": "tsc --noEmit",
|
|
13
13
|
"changeset": "changeset",
|
|
14
14
|
"release:status": "changeset status --verbose",
|
|
15
|
-
"release:version": "changeset version &&
|
|
15
|
+
"release:version": "changeset version && npm install",
|
|
16
16
|
"release:publish": "changeset publish"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"check-types": "tsc --noEmit",
|
|
13
13
|
"changeset": "changeset",
|
|
14
14
|
"release:status": "changeset status --verbose",
|
|
15
|
-
"release:version": "changeset version &&
|
|
15
|
+
"release:version": "changeset version && npm install",
|
|
16
16
|
"release:publish": "changeset publish"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"check-types": "svelte-check",
|
|
13
13
|
"changeset": "changeset",
|
|
14
14
|
"release:status": "changeset status --verbose",
|
|
15
|
-
"release:version": "changeset version &&
|
|
15
|
+
"release:version": "changeset version && npm install",
|
|
16
16
|
"release:publish": "changeset publish"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
@@ -9,6 +9,6 @@ VITE_APP_ID=your-app-client-id-here
|
|
|
9
9
|
VITE_ENABLE_DEV_AUTH=false
|
|
10
10
|
|
|
11
11
|
# Required host URL for standalone dev auth. Run `bardioc login` once, then
|
|
12
|
-
# `
|
|
12
|
+
# `npm run dev` will refresh DEV_SESSION_KEY automatically before Vite starts.
|
|
13
13
|
DEV_AUTH_HOST_URL=
|
|
14
14
|
DEV_SESSION_KEY=
|