Skip to content

Commit 4f3bb52

Browse files
Try deploying to github pages
1 parent f52fade commit 4f3bb52

File tree

3 files changed

+59
-34
lines changed

3 files changed

+59
-34
lines changed

.github/workflows/publish.yml

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,52 @@ on:
55
branches:
66
- main
77
tags:
8-
- '*'
8+
- "*"
99

1010
jobs:
1111
build-and-publish:
1212
runs-on: ubuntu-latest
1313
permissions:
1414
contents: write
15+
pages: write
16+
id-token: write
17+
environment:
18+
name: github-pages
19+
url: ${{ steps.deployment.outputs.page_url }}
1520
steps:
16-
- uses: actions/checkout@v4
17-
- uses: actions/setup-node@v4
18-
with:
19-
node-version: '22.x'
20-
cache: 'yarn'
21-
registry-url: 'https://npm.pkg.github.com'
22-
scope: '@saulshanabrook'
23-
- run: yarn install
24-
- run: yarn build
25-
- run: yarn pack -f package.tgz
26-
- uses: softprops/action-gh-release@v2
27-
if: startsWith(github.ref, 'refs/tags/')
28-
with:
29-
files: package.tgz
21+
- uses: actions/checkout@v4
22+
with:
23+
submodules: true
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: "22.x"
27+
cache: "yarn"
28+
registry-url: "https://npm.pkg.github.com"
29+
scope: "@saulshanabrook"
30+
- run: yarn install
31+
- run: yarn build
32+
- run: yarn pack -f package.tgz
33+
- uses: softprops/action-gh-release@v2
34+
if: startsWith(github.ref, 'refs/tags/')
35+
with:
36+
files: package.tgz
37+
- name: Setup Pages
38+
uses: actions/configure-pages@v4
39+
- name: Upload artifact
40+
uses: actions/upload-pages-artifact@v3
41+
with:
42+
# Upload dist folder
43+
path: "./dist"
44+
- name: Deploy to GitHub Pages
45+
id: deployment
46+
uses: actions/deploy-pages@v4
3047
lint:
3148
runs-on: ubuntu-latest
3249
steps:
33-
- uses: actions/checkout@v4
34-
- uses: actions/setup-node@v4
35-
with:
36-
node-version: '22.x'
37-
cache: 'yarn'
38-
- run: yarn install
39-
- run: yarn lint
50+
- uses: actions/checkout@v4
51+
- uses: actions/setup-node@v4
52+
with:
53+
node-version: "22.x"
54+
cache: "yarn"
55+
- run: yarn install
56+
- run: yarn lint

src/Monaco.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { startTransition, use, useEffect, useMemo, useState } from "react";
44
import MonacoEditor from "react-monaco-editor";
55

66
const modules = {
7-
...import.meta.glob("/examples/egraph-serialize/tests/*.json"),
8-
...import.meta.glob("/examples/extraction-gym/data/*/*.json"),
9-
...import.meta.glob("/examples/extraction-gym/test-data/*/*.json"),
7+
...import.meta.glob("/examples/egraph-serialize/tests/*.json", { query: "?raw" }),
8+
...import.meta.glob("/examples/extraction-gym/data/*/*.json", { query: "?raw" }),
109
};
1110

1211
function Monaco({ code, setCode }: { code: string; setCode: (code: string) => void }) {
@@ -25,7 +24,8 @@ function Monaco({ code, setCode }: { code: string; setCode: (code: string) => vo
2524
useEffect(() => {
2625
if (loadedPreset) {
2726
startTransition(() => {
28-
setCode(JSON.stringify(loadedPreset, null, 2));
27+
const codeStr = (loadedPreset as { default: string }).default;
28+
setCode(JSON.stringify(JSON.parse(codeStr), null, 2));
2929
setLoadPreset(false);
3030
});
3131
}

vite.config.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
import { resolve } from 'path'
2-
import { defineConfig } from 'vite'
3-
import react from '@vitejs/plugin-react'
1+
import { resolve } from "path";
2+
import { defineConfig } from "vite";
3+
import react from "@vitejs/plugin-react";
44

55
// https://vitejs.dev/config/
66
export default defineConfig({
7+
base: "/egraph-visualizer/",
78
plugins: [react()],
89
build: {
910
lib: {
10-
entry: [resolve(__dirname, 'src/anywidget.tsx')],
11-
formats: ['es', ],
11+
entry: [resolve(__dirname, "src/anywidget.tsx")],
12+
formats: ["es"],
13+
},
14+
rollupOptions: {
15+
input: {
16+
main: resolve(__dirname, "index.html"),
17+
anywidget: resolve(__dirname, "src/anywidget.tsx"),
18+
},
1219
},
1320
},
21+
1422
define: {
15-
'process.env': {},
16-
}
17-
})
23+
"process.env": {},
24+
},
25+
});

0 commit comments

Comments
 (0)