Skip to content

Commit

Permalink
fix code highlighter
Browse files Browse the repository at this point in the history
  • Loading branch information
caipira113 committed Nov 1, 2023
1 parent 6504331 commit 3244f1c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
NODE_ENV=production pnpm build-pre
NODE_ENV=production pnpm --filter cherrypick-js build
NODE_ENV=production pnpm --filter frontend build
NODE_ENV=production pnpm build-locales
NODE_ENV=production pnpm build-deploy
- name: Deploy static
run: |
mv built/_frontend_dist_ built/assets
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build-pre": "node ./scripts/build-pre.js",
"build-assets": "node ./scripts/build-assets.mjs",
"build-assets-d": "node ./scripts/build-assets-d.mjs",
"build-locales": "node ./scripts/build-locales.mjs",
"build-deploy": "node ./scripts/build-deploy.mjs",
"build": "pnpm build-pre && pnpm -r build && pnpm build-assets",
"build-d": "pnpm -r build && pnpm build-assets-d",
"build-storybook": "pnpm --filter frontend build-storybook",
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/scripts/code-highlighter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { setWasm, setCDN, Highlighter, getHighlighter as _getHighlighter } from 'shiki';

setWasm('/assets/shiki/dist/onig.wasm');
setCDN('/assets/shiki/');
setWasm(`${_CLIENT_ASSETS_BASE_URL_}/assets/shiki/dist/onig.wasm`);
setCDN(`${_CLIENT_ASSETS_BASE_URL_}/assets/shiki/`);

let _highlighter: Highlighter | null = null;

Expand Down
8 changes: 8 additions & 0 deletions scripts/build-locales.mjs → scripts/build-deploy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ async function copyFrontendLocales() {
}
}

async function copyFrontendShikiAssets() {
await fs.cp('./packages/frontend/node_modules/shiki/dist', './built/_frontend_dist_/shiki/dist', { dereference: true, recursive: true });
await fs.cp('./packages/frontend/node_modules/shiki/languages', './built/_frontend_dist_/shiki/languages', { dereference: true, recursive: true });
await fs.cp('./packages/frontend/node_modules/aiscript-vscode/aiscript/syntaxes', './built/_frontend_dist_/shiki/languages', { dereference: true, recursive: true });
await fs.cp('./packages/frontend/node_modules/shiki/themes', './built/_frontend_dist_/shiki/themes', { dereference: true, recursive: true });
}

async function build() {
await Promise.all([
copyFrontendLocales(),
copyFrontendShikiAssets(),
]);
}

Expand Down

0 comments on commit 3244f1c

Please sign in to comment.