Skip to content

Commit 09b3bd1

Browse files
committed
fix and improve env var usage
1 parent 67bf465 commit 09b3bd1

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

.github/workflows/deploy.yml

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ permissions:
1717
jobs:
1818
build:
1919
runs-on: ubuntu-latest
20+
env:
21+
PUBLIC_BASE: /pipeline-visualization
2022
steps:
2123
- name: Checkout your repository using git
2224
uses: actions/checkout@v4

website/build.cmd

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm run build

website/config.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
import {readFile} from 'fs/promises'
21
import {join} from 'path'
3-
import yaml from 'js-yaml'
4-
5-
async function load_yaml_abs(abs_path){
6-
const fileContent = await readFile(abs_path,'utf-8')
7-
const data = yaml.load(fileContent);
8-
return data;
9-
}
2+
import {loadEnv} from 'vite'
103

114
const webdir = process.cwd()
5+
const env = loadEnv("",webdir,"PUBLIC_BASE")
126
const rootdir = join(webdir,"..")
137
const cachedir = join(rootdir,"cache")
14-
const manifets = await load_yaml_abs(join(rootdir,"manifest.yaml"))
158
const outdir = join(cachedir,"web")
16-
const base = manifets.website.base
9+
const base = env.PUBLIC_BASE
1710

1811
const config = {
1912
rootdir,

website/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"astro": "^4.6.3",
1414
"js-yaml": "^4.1.0",
1515
"vis-data": "^7.1.9",
16-
"vis-timeline": "^7.7.3"
16+
"vis-timeline": "^7.7.3",
17+
"vite": "^5.2.10"
1718
}
1819
}

website/pnpm-lock.yaml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

website/src/components/timeline.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ async function init(){
1111
for (const timeline_element of containers_els) {
1212
const data_file = timeline_element.dataset.file;
1313
try {
14-
const response = await fetch(`${config.base}/artifacts/${data_file}`);
14+
const file_url = `${config.base}/artifacts/${data_file}`
15+
console.log(`fetching ${file_url}`)
16+
const response = await fetch(file_url);
1517
const data_timeline = await response.json(); // Assuming the response needs to be converted to JSON
1618
new Timeline(timeline_element, data_timeline, {})
1719
} catch (error) {

website/src/env.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
/// <reference path="../.astro/types.d.ts" />
12
/// <reference types="astro/client" />

0 commit comments

Comments
 (0)