makit-recipe-tsc
npm i makit-recipe-tsc --save-dev
A makit recipe for handling TypeScript compilation workflow.
In the following code, ctx is the context of makit.
import {Compiler} from 'makit-recipe-tsc';
const compiler = new Compiler({
baseDir: `${__dirname}/src2`,
outDir: `${__dirname}/src2/dist`,
configPath: `${__dirname}/src2/tsconfig.json`
});
await compiler.compile(ctx);
plugins give users the opportunity to add their own code at specific stages
interface Plugin {
getDepencies?: (context: PluginContext) => string[]
beforeMakeDepencies?: (filePaths: string[], baseDir: string, outDir: string) => string[]
onPreCompile?: (context: PluginContext) => string
afterCompile?: (context: PluginContext) => string
onDest?: (context: PluginContext) => boolean
}
const plugin: Plugin = {
// ...
}
compiler.addPlugin(plugin);
await compiler.compile(ctx);