1
0
Fork 0

fix(build): use absolute paths and windows-friendly chunk tests

This commit is contained in:
ssube 2019-09-18 08:35:45 -05:00
parent 9f11653749
commit 12d4560cac
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 13 additions and 11 deletions

View File

@ -9,9 +9,11 @@ import typescript from 'rollup-plugin-typescript2';
const metadata = require('../package.json'); const metadata = require('../package.json');
const namedExports = require('./rollup-named.json'); const namedExports = require('./rollup-named.json');
const targetPath = process.env['TARGET_PATH'];
const shebang = '#! /usr/bin/env node\n\n'; const shebang = '#! /usr/bin/env node\n\n';
const rootPath = process.env['ROOT_PATH'];
const targetPath = process.env['TARGET_PATH'];
const bundle = { const bundle = {
external: [ external: [
'async_hooks', 'async_hooks',
@ -19,24 +21,24 @@ const bundle = {
'sinon', 'sinon',
], ],
input: [ input: [
'src/index.ts', join(rootPath, 'src/index.ts'),
'test/harness.ts', join(rootPath, 'test/harness.ts'),
'test/**/Test*.ts', join(rootPath, 'test/**/Test*.ts'),
], ],
manualChunks(id) { manualChunks(id) {
if (id.includes('/test/')) { if (id.match(/[\/\\]test[\/\\]/)) {
return 'test' return 'test'
} }
if (id.includes('/node_modules/')) { if (id.match(/[\/\\]node_modules[\/\\]/)) {
return 'vendor'; return 'vendor';
} }
if (id.includes('/src/index')) { if (id.match(/[\/\\]src[\/\\]index[\/\\]/)) {
return 'index'; return 'index';
} }
if (id.includes('/src/')) { if (id.match(/[\/\\]src[\/\\]/)) {
return 'main'; return 'main';
} }
}, },
@ -72,11 +74,11 @@ const bundle = {
namedExports, namedExports,
}), }),
tslint({ tslint({
configuration: './config/tslint.json', configuration: require('./tslint.json'),
throwOnError: true, throwOnError: true,
}), }),
typescript({ typescript({
cacheRoot: 'out/cache/rts2', cacheRoot: join(targetPath, 'cache/rts2'),
rollupCommonJSResolveHack: true, rollupCommonJSResolveHack: true,
}), }),
], ],

View File

@ -1,6 +1,6 @@
{ {
"extends": ["./tslint.cc.json", "tslint-clean-code", "tslint-sonarts"], "extends": ["./tslint.cc.json", "tslint-clean-code", "tslint-sonarts"],
"rulesDirectory": ["../node_modules/tslint-microsoft-contrib"], "rulesDirectory": ["./node_modules/tslint-microsoft-contrib"],
"rules": { "rules": {
"mocha-unneeded-done": true, "mocha-unneeded-done": true,
"no-banned-terms": true, "no-banned-terms": true,