refactor: rewrite scripts in typescript

This commit is contained in:
Amaan Qureshi 2025-01-16 01:11:19 -05:00
parent 31ceb99603
commit 169d7ad57f
5 changed files with 70 additions and 53 deletions

View file

@ -1,25 +1,24 @@
import fs from 'fs';
import path from 'path';
const isDebug = process.env.npm_config_web_tree_sitter_debug === 'true';
const isDebug = process.env.npm_config_debug === 'true';
if (isDebug) {
// Copy debug versions to root
fs.copyFileSync(
path.join(__dirname, '../debug/tree-sitter.js'),
path.join(__dirname, '../tree-sitter.js')
path.join(__dirname, '../tree-sitter.js'),
);
fs.copyFileSync(
path.join(__dirname, '../debug/tree-sitter.wasm'),
path.join(__dirname, '../tree-sitter.wasm')
path.join(__dirname, '../tree-sitter.wasm'),
);
// Copy sourcemaps too
fs.copyFileSync(
path.join(__dirname, '../debug/tree-sitter.js.map'),
path.join(__dirname, '../tree-sitter.js.map')
path.join(__dirname, '../tree-sitter.js.map'),
);
fs.copyFileSync(
path.join(__dirname, '../debug/tree-sitter.wasm.map'),
path.join(__dirname, '../tree-sitter.wasm.map')
path.join(__dirname, '../tree-sitter.wasm.map'),
);
}