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

Update excalidraw #1453

Merged
merged 2 commits into from
Mar 11, 2023
Merged
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
4 changes: 3 additions & 1 deletion excalidraw/Dockerfile
Original file line number Diff line number Diff line change
@@ -14,10 +14,12 @@ RUN /usr/local/bin/pkg-fetch -n ${NODE} -p ${PLATFORM} -a $([ "$TARGETARCH" == "

COPY package.json package-lock.json /app/
COPY src /app/src
COPY assets /app/assets
WORKDIR /app

RUN PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 npm ci
RUN npm run lint
RUN npm run prestart

RUN /usr/local/bin/pkg --targets ${NODE}-${PLATFORM}-$([ "$TARGETARCH" == "amd64" ] && echo "x64" || echo "$TARGETARCH") . -o app.bin

@@ -29,7 +31,7 @@ RUN addgroup -g 1000 kroki && adduser -D -G kroki -u 1000 kroki
RUN apk add --quiet --no-cache --update chromium

COPY --from=builder /app/app.bin /usr/bin/excalidraw
COPY --chown=kroki:kroki assets /usr/local/kroki/assets
COPY --from=builder --chown=kroki:kroki /app/assets /usr/local/kroki/assets

ENV KROKI_EXCALIDRAW_PAGE_URL=file:///usr/local/kroki/assets/index.html
ENV PUPPETEER_EXECUTABLE_PATH=/usr/lib/chromium/chrome
2 changes: 0 additions & 2 deletions excalidraw/assets/excalidraw-utils.min.js

This file was deleted.

4 changes: 3 additions & 1 deletion excalidraw/assets/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<!doctype html>
<html>
<body>
<script src="./excalidraw-utils.min.js" charset="utf-8"></script>
<script src="./react.production.min.js" charset="utf-8"></script>
<script src="./react-dom.production.min.js" charset="utf-8"></script>
<script src="./excalidraw.production.min.js" charset="utf-8"></script>
</body>
</html>
103 changes: 81 additions & 22 deletions excalidraw/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions excalidraw/package.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
"main": "src/index.js",
"bin": "src/index.js",
"scripts": {
"prestart": "cp node_modules/@excalidraw/utils/dist/excalidraw-utils.min.js assets/excalidraw-utils.min.js",
"prestart": "cp -r node_modules/@excalidraw/excalidraw/dist/excalidraw.production.min.js node_modules/@excalidraw/excalidraw/dist/excalidraw-assets/* node_modules/react/umd/react.production.min.js node_modules/react-dom/umd/react-dom.production.min.js assets",
"start": "node src/index.js",
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "standard src/**.js"
@@ -18,9 +18,11 @@
"url": "https://github.com/yuzutech/kroki.git"
},
"dependencies": {
"@excalidraw/utils": "0.1.2",
"@excalidraw/excalidraw": "0.14.2",
"micro": "9.4.1",
"puppeteer": "14.4.1"
"puppeteer": "14.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"standard": "17.0.0"
2 changes: 1 addition & 1 deletion excalidraw/src/worker.js
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ class Worker {
await page.goto(this.pageUrl)
// QUESTION: should we reuse the page for performance reason ?
return await page.evaluate(async (definition) => {
const svgElement = await window.ExcalidrawUtils.exportToSvg(JSON.parse(definition))
const svgElement = await window.ExcalidrawLib.exportToSvg(JSON.parse(definition))
return svgElement.outerHTML
}, task.source)
} catch (e) {