Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion packages/keystatic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"dist"
],
"scripts": {
"setup": "ts-gql build && tsx scripts/l10n.cts && tsx scripts/build-prism.cts",
"setup": "ts-gql build && tsx scripts/l10n.ts && tsx scripts/build-prism.ts",
"build": "pnpm run setup && next build",
"dev": "next dev",
"start": "next start"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'fs/promises';
import { fileURLToPath } from 'url';

const languages = [
'clike',
Expand Down Expand Up @@ -45,11 +46,18 @@ const languages = [
const otherLanguages = (
await Promise.all(
languages.map(lang =>
fs.readFile(require.resolve(`prismjs/components/prism-${lang}`), 'utf8')
fs.readFile(
fileURLToPath(
import.meta.resolve(`prismjs/components/prism-${lang}`)
),
'utf8'
)
)
)
).join('\n\n');
const prism = (await fs.readFile(require.resolve('prismjs'), 'utf8'))
const prism = (
await fs.readFile(fileURLToPath(import.meta.resolve('prismjs')), 'utf8')
)
.replace(
`if (typeof module !== 'undefined' && module.exports) {
\tmodule.exports = Prism;
Expand All @@ -72,7 +80,7 @@ if (typeof global !== 'undefined') {
`var _self = globalThis;`
);
await fs.writeFile(
`${__dirname}/../src/form/fields/document/DocumentEditor/prism.js`,
`src/form/fields/document/DocumentEditor/prism.js`,
'/* eslint-disable */\nglobalThis.Prism = { manual: true };\n' +
prism +
'\n' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs/promises';
import path from 'path';
import { compileString } from '@internationalized/string-compiler';

const localesDir = path.join(__dirname, '../src/app/l10n');
const localesDir = 'src/app/l10n';
(async () => {
const locales: Record<string, Record<string, string>> = {};
await Promise.all(
Expand Down