Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use local data build in codespace #118

Merged
merged 4 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
"containerEnv": {
"DATA_WORKSPACE": "/workspaces/web/data"
},
"remoteEnv": {
"PUBLIC_DATA_URL": "https://${localEnv:CODESPACE_NAME}-3141.${localEnv:GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
},
"onCreateCommand": "pnpm install && pnpm run --filter core build",
"postAttachCommand": {
"compile": "pnpm run --filter compile dev",
"core": "pnpm run --filter core dev",
"viewer": "pnpm run --filter viewer dev --host"
},
"forwardPorts": [
5173
],
"forwardPorts": [3141, 5173],
"portsAttributes": {
"3141": {
"label": "compile"
},
"5173": {
"label": "viewer"
}
},
"postCreateCommand": "git clone https://github.com/pi-base/data.git",
"customizations": {
"codespaces": {
Expand Down
3 changes: 3 additions & 0 deletions doc/codespace/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ As the viewer starts up, you may see an `Open in Browser` popup. You can always
access the browser preview by going to the `Ports` tab, and clicking the
`Open in Browser` globe icon for port `5173`.

You must also set port `3143` to "Public" uisng the Ports tab. If you make changes
to local data, you must manually refresh them using the Advanced tab of the viewer.

## Checking Compiled Data

In a console run
Expand Down
8 changes: 7 additions & 1 deletion packages/viewer/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { bundle } from '@pi-base/core'
import { dev } from '$app/environment'
import * as envPublic from '$env/static/public'

export const mainBranch = 'main'
export const contributingUrl = `https://github.com/pi-base/data/wiki/Contributing`
export const defaultHost = bundle.defaultHost
let _defaultHost = bundle.defaultHost
try {
_defaultHost = dev ? envPublic.PUBLIC_DATA_URL : bundle.defaultHost
} catch {}
export const defaultHost = _defaultHost

export const build = {
branch: import.meta.env.VITE_BRANCH || 'unknown',
Expand Down
3 changes: 2 additions & 1 deletion packages/viewer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "./.svelte-kit/tsconfig.json",
"include": [
"src/**/*",
"cypress/**/*"
"cypress/**/*",
".svelte-kit/ambient.d.ts"
],
"exclude": [
"node_modules/*",
Expand Down