mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 22:39:26 +02:00
build: build .langium
file using generate
from langium-cli
This commit is contained in:
@@ -1,11 +1,5 @@
|
|||||||
import { execFileSync } from 'child_process';
|
import { generate } from 'langium-cli';
|
||||||
|
|
||||||
export function generateLangium() {
|
export async function generateLangium() {
|
||||||
execFileSync('pnpm', [
|
await generate({ file: `./packages/parser/langium-config.json` });
|
||||||
'--prefix',
|
|
||||||
`${process.cwd()}/packages/parser`,
|
|
||||||
'exec',
|
|
||||||
'langium',
|
|
||||||
'generate',
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
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 () => {
|
const main = async () => {
|
||||||
generateLangium();
|
await generateLangium();
|
||||||
await mkdir('stats').catch(() => {});
|
await mkdir('stats').catch(() => {});
|
||||||
const packageNames = Object.keys(packageOptions) as (keyof typeof packageOptions)[];
|
const packageNames = Object.keys(packageOptions) as (keyof typeof packageOptions)[];
|
||||||
// it should build `parser` before `mermaid` because it's a dependecy
|
// it should build `parser` before `mermaid` because it's a dependecy
|
||||||
|
@@ -79,7 +79,7 @@ function sendEventsToAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createServer() {
|
async function createServer() {
|
||||||
generateLangium();
|
await generateLangium();
|
||||||
handleFileChange();
|
handleFileChange();
|
||||||
const app = express();
|
const app = express();
|
||||||
chokidar
|
chokidar
|
||||||
@@ -93,7 +93,7 @@ async function createServer() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (/\.langium$/.test(path)) {
|
if (/\.langium$/.test(path)) {
|
||||||
generateLangium();
|
await generateLangium();
|
||||||
}
|
}
|
||||||
console.log(`${path} changed. Rebuilding...`);
|
console.log(`${path} changed. Rebuilding...`);
|
||||||
handleFileChange();
|
handleFileChange();
|
||||||
|
@@ -114,7 +114,7 @@ const main = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
generateLangium();
|
await generateLangium();
|
||||||
|
|
||||||
if (watch) {
|
if (watch) {
|
||||||
await build(getBuildConfig({ minify: false, watch, core: false, entryName: 'parser' }));
|
await build(getBuildConfig({ minify: false, watch, core: false, entryName: 'parser' }));
|
||||||
|
@@ -107,6 +107,7 @@
|
|||||||
"jison": "^0.4.18",
|
"jison": "^0.4.18",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"jsdom": "^22.0.0",
|
"jsdom": "^22.0.0",
|
||||||
|
"langium-cli": "2.0.1",
|
||||||
"lint-staged": "^13.2.1",
|
"lint-staged": "^13.2.1",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
|
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -149,6 +149,9 @@ importers:
|
|||||||
jsdom:
|
jsdom:
|
||||||
specifier: ^22.0.0
|
specifier: ^22.0.0
|
||||||
version: 22.0.0
|
version: 22.0.0
|
||||||
|
langium-cli:
|
||||||
|
specifier: 2.0.1
|
||||||
|
version: 2.0.1
|
||||||
lint-staged:
|
lint-staged:
|
||||||
specifier: ^13.2.1
|
specifier: ^13.2.1
|
||||||
version: 13.2.1
|
version: 13.2.1
|
||||||
|
Reference in New Issue
Block a user