UNPKG

mframejs

Version:
56 lines (51 loc) 1.68 kB
/* * This build dist folder * Does not emit/remove old dist folder if any errors * Does throw error if any bugs */ const TypeChecker = require('fuse-box-typechecker').TypeChecker const { src } = require('fuse-box/sparky'); // configure typechecker const runBuild = (target = 'es5', moduleType = 'commonjs', folder = 'commonjs') => { const typeChecker = TypeChecker({ tsConfig: './tsconfig.json', basePath: './', tsLint: './tslint.json', name: `build - ${moduleType} with target ${target}`, shortenFilenames: true, yellowOnLint: true, emit: true, clearOnEmit: true, throwOnGlobal: true, throwOnSemantic: true, throwOnTsLint: true, throwOnSyntactic: true, throwOnOptions: true, tsConfigOverride: { "compilerOptions": { "rootDir": "src/mframejs", "outDir": `dist/${folder}/`, "target": target, "module": moduleType, "paths": {}, }, "exclude": [ "node_modules", "dist", "dev", "src/sample", "src/sample-base", "distTS", "test" ] } }); return typeChecker.runSync(); } // start build, will only emit when there is no errors let errors = runBuild(); if (!errors) { runBuild('es6', 'esnext', 'esm'); console.log('Making copy of typescript source...') src('**/*.*', { base: '../src/mframejs' }).clean('../dist/ts').dest('../dist/ts').exec(); }