2021-05-04 17:04:14 +02:00
|
|
|
import child_process from "child_process";
|
|
|
|
|
|
|
|
import {logger} from "../Logger.js";
|
|
|
|
import CopyAssetPreCompiler from "./CopyAssetPreCompiler.js";
|
|
|
|
|
|
|
|
export default class TypeScriptPreCompiler extends CopyAssetPreCompiler {
|
|
|
|
public constructor(
|
|
|
|
targetDir: string,
|
|
|
|
additionalFallbackAssetPaths: string[] = [],
|
|
|
|
) {
|
|
|
|
super(targetDir, 'ts', 'ts', additionalFallbackAssetPaths, false, 'ts-source');
|
|
|
|
|
|
|
|
this.onPreCompile(async _watch => {
|
|
|
|
logger.info('Building ts assets...');
|
2021-05-27 15:26:19 +02:00
|
|
|
await child_process.execSync(`yarn tsc -b src/assets/ts/tsconfig.json`, {stdio: [process.stdin, process.stdout, process.stderr]});
|
2021-05-04 17:04:14 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|