diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f83477b..a90103d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,6 +17,8 @@ permissions: jobs: build: runs-on: ubuntu-latest + env: + PUBLIC_BASE: /pipeline-visualization steps: - name: Checkout your repository using git uses: actions/checkout@v4 diff --git a/website/build.cmd b/website/build.cmd new file mode 100644 index 0000000..b7fa1d3 --- /dev/null +++ b/website/build.cmd @@ -0,0 +1 @@ +pnpm run build \ No newline at end of file diff --git a/website/config.js b/website/config.js index a359908..f4584b3 100644 --- a/website/config.js +++ b/website/config.js @@ -1,19 +1,12 @@ -import {readFile} from 'fs/promises' import {join} from 'path' -import yaml from 'js-yaml' - -async function load_yaml_abs(abs_path){ - const fileContent = await readFile(abs_path,'utf-8') - const data = yaml.load(fileContent); - return data; -} +import {loadEnv} from 'vite' const webdir = process.cwd() +const env = loadEnv("",webdir,"PUBLIC_BASE") const rootdir = join(webdir,"..") const cachedir = join(rootdir,"cache") -const manifets = await load_yaml_abs(join(rootdir,"manifest.yaml")) const outdir = join(cachedir,"web") -const base = manifets.website.base +const base = env.PUBLIC_BASE const config = { rootdir, diff --git a/website/package.json b/website/package.json index 5679668..5b40d23 100644 --- a/website/package.json +++ b/website/package.json @@ -13,6 +13,7 @@ "astro": "^4.6.3", "js-yaml": "^4.1.0", "vis-data": "^7.1.9", - "vis-timeline": "^7.7.3" + "vis-timeline": "^7.7.3", + "vite": "^5.2.10" } } \ No newline at end of file diff --git a/website/pnpm-lock.yaml b/website/pnpm-lock.yaml index ab3b638..a2d56ce 100644 --- a/website/pnpm-lock.yaml +++ b/website/pnpm-lock.yaml @@ -17,6 +17,9 @@ dependencies: vis-timeline: specifier: ^7.7.3 version: 7.7.3(@egjs/hammerjs@2.0.17)(component-emitter@1.3.1)(keycharm@0.4.0)(moment@2.30.1)(propagating-hammerjs@2.0.1)(uuid@9.0.1)(vis-data@7.1.9)(vis-util@5.0.7)(xss@1.0.15) + vite: + specifier: ^5.2.10 + version: 5.2.10 packages: diff --git a/website/src/components/timeline.js b/website/src/components/timeline.js index 13502b6..7e180cc 100644 --- a/website/src/components/timeline.js +++ b/website/src/components/timeline.js @@ -11,7 +11,9 @@ async function init(){ for (const timeline_element of containers_els) { const data_file = timeline_element.dataset.file; try { - const response = await fetch(`${config.base}/artifacts/${data_file}`); + const file_url = `${config.base}/artifacts/${data_file}` + console.log(`fetching ${file_url}`) + const response = await fetch(file_url); const data_timeline = await response.json(); // Assuming the response needs to be converted to JSON new Timeline(timeline_element, data_timeline, {}) } catch (error) { diff --git a/website/src/env.d.ts b/website/src/env.d.ts index f964fe0..acef35f 100644 --- a/website/src/env.d.ts +++ b/website/src/env.d.ts @@ -1 +1,2 @@ +/// ///