Skip to content

Commit 3f8e03b

Browse files
committed
auto run generate-lua-tmlanguage
1 parent a38b9f8 commit 3f8e03b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

web/mta_highlighting/generate-lua-tmlanguage.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import fs from 'fs';
22
import path from 'path';
33
import yaml from 'js-yaml';
44
import { glob } from 'glob';
5+
import { fileURLToPath } from 'url';
56

6-
const functionsDir = path.resolve('../../functions');
7-
const basePath = path.resolve('./lua-base.tmLanguage.json');
8-
const outputPath = path.resolve('../src/grammars/lua-mta.tmLanguage.json');
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
10+
const functionsDir = path.resolve(__dirname, '../../functions');
11+
const basePath = path.resolve(__dirname, './lua-base.tmLanguage.json');
12+
const outputPath = path.resolve(__dirname, '../src/grammars/lua-mta.tmLanguage.json');
913

1014
function extractFunctionsWithScope(yamlContent) {
1115
if (yamlContent.shared?.name) {

web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
"type": "module",
44
"version": "0.0.1",
55
"scripts": {
6+
"predev": "node mta_highlighting/generate-lua-tmlanguage.js",
67
"dev": "astro dev",
78
"start": "astro dev",
9+
"prebuild": "node mta_highlighting/generate-lua-tmlanguage.js",
810
"build": "astro build",
911
"preview": "astro preview",
1012
"astro": "astro"

0 commit comments

Comments
 (0)