generated from garrettmills/template-npm-typescript
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
#!/usr/bin/env node
|
|
// Read config
|
|
// Create build phases
|
|
// Copy base files to compile directory
|
|
// Run initial phases
|
|
// Run compilation into output directory
|
|
|
|
import { ArgumentParser } from 'argparse'
|
|
import { ExCompiler } from './ExCompiler'
|
|
import {Logger} from './Logger'
|
|
import * as path from 'path'
|
|
|
|
(async () => {
|
|
const parser = new ArgumentParser({
|
|
description: 'Early-phase compiler for Extollo projects',
|
|
})
|
|
|
|
parser.add_argument('-c', '--config', {
|
|
help: 'path to the package.json of the project to compile',
|
|
required: true,
|
|
})
|
|
|
|
parser.add_argument('-t', '--tsconfig', {
|
|
help: 'path to the tsconfig.json for the project to compile',
|
|
required: true,
|
|
})
|
|
|
|
parser.add_argument('-v', '--verbose', {
|
|
help: 'output more verbose and debugging output',
|
|
action: 'store_true',
|
|
})
|
|
|
|
const args = parser.parse_args()
|
|
|
|
Logger.setVerbosity(Boolean(args.verbose))
|
|
|
|
const tsconfig = await import(path.resolve(args.tsconfig))
|
|
const packageJson = await import(path.resolve(args.config))
|
|
|
|
const config = packageJson?.extollo?.cc ?? {}
|
|
|
|
const cc = new ExCompiler(
|
|
args.tsconfig,
|
|
tsconfig?.compilerOptions?.outDir || './lib',
|
|
tsconfig,
|
|
config,
|
|
)
|
|
|
|
await cc.run()
|
|
})()
|
|
|