mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
build: build .langium
file using generate
from langium-cli
This commit is contained in:
parent
fc96ebefd4
commit
8d0ca2c876
@ -1,11 +1,5 @@
|
||||
import { execFileSync } from 'child_process';
|
||||
import { generate } from 'langium-cli';
|
||||
|
||||
export function generateLangium() {
|
||||
execFileSync('pnpm', [
|
||||
'--prefix',
|
||||
`${process.cwd()}/packages/parser`,
|
||||
'exec',
|
||||
'langium',
|
||||
'generate',
|
||||
]);
|
||||
export async function generateLangium() {
|
||||
await generate({ file: `./packages/parser/langium-config.json` });
|
||||
}
|
||||
|
9
.build/langium-cli.d.ts
vendored
Normal file
9
.build/langium-cli.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
declare module 'langium-cli' {
|
||||
export interface GenerateOptions {
|
||||
file?: string;
|
||||
mode?: 'development' | 'production';
|
||||
watch?: boolean;
|
||||
}
|
||||
|
||||
export function generate(options: GenerateOptions): Promise<boolean>;
|
||||
}
|
@ -53,7 +53,7 @@ const handler = (e) => {
|
||||
};
|
||||
|
||||
const main = async () => {
|
||||
generateLangium();
|
||||
await generateLangium();
|
||||
await mkdir('stats').catch(() => {});
|
||||
const packageNames = Object.keys(packageOptions) as (keyof typeof packageOptions)[];
|
||||
// it should build `parser` before `mermaid` because it's a dependecy
|
||||
|
@ -79,7 +79,7 @@ function sendEventsToAll() {
|
||||
}
|
||||
|
||||
async function createServer() {
|
||||
generateLangium();
|
||||
await generateLangium();
|
||||
handleFileChange();
|
||||
const app = express();
|
||||
chokidar
|
||||
@ -93,7 +93,7 @@ async function createServer() {
|
||||
return;
|
||||
}
|
||||
if (/\.langium$/.test(path)) {
|
||||
generateLangium();
|
||||
await generateLangium();
|
||||
}
|
||||
console.log(`${path} changed. Rebuilding...`);
|
||||
handleFileChange();
|
||||
|
@ -114,7 +114,7 @@ const main = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
generateLangium();
|
||||
await generateLangium();
|
||||
|
||||
if (watch) {
|
||||
await build(getBuildConfig({ minify: false, watch, core: false, entryName: 'parser' }));
|
||||
|
@ -107,6 +107,7 @@
|
||||
"jison": "^0.4.18",
|
||||
"js-yaml": "^4.1.0",
|
||||
"jsdom": "^22.0.0",
|
||||
"langium-cli": "2.0.1",
|
||||
"lint-staged": "^13.2.1",
|
||||
"nyc": "^15.1.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
|
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@ -149,6 +149,9 @@ importers:
|
||||
jsdom:
|
||||
specifier: ^22.0.0
|
||||
version: 22.0.0
|
||||
langium-cli:
|
||||
specifier: 2.0.1
|
||||
version: 2.0.1
|
||||
lint-staged:
|
||||
specifier: ^13.2.1
|
||||
version: 13.2.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user