fix(core): update

This commit is contained in:
2020-07-07 18:55:17 +00:00
parent e244ca30b9
commit 558edb8f09
4 changed files with 7177 additions and 184 deletions

View File

@ -18,17 +18,19 @@ export class TsBundle {
name: 'tsbundle',
file: toArg,
format: 'iife',
sourcemap: true
sourcemap: true,
},
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
external: [],
watch: {
include: ['src/**']
include: ['src/**'],
},
plugins: [
// Compile TypeScript files
plugins.rollupTypescript({
include: plugins.path.parse(fromArg).dir ? plugins.path.parse(fromArg).dir + '/**/*.ts' : '**/*.ts',
include: plugins.path.parse(fromArg).dir
? plugins.path.parse(fromArg).dir + '/**/*.ts'
: '**/*.ts',
declaration: false,
emitDecoratorMetadata: true,
experimentalDecorators: true,
@ -37,7 +39,7 @@ export class TsBundle {
lib: ['esnext', 'dom', 'es2017.object'],
noImplicitAny: false,
target: 'es2018',
allowSyntheticDefaultImports: true
allowSyntheticDefaultImports: true,
}),
plugins.rollupJson(),
// Allow node_modules resolution, so you can use 'external' to control
@ -47,7 +49,7 @@ export class TsBundle {
plugins.rollupCommonjs({}),
// Resolve source maps to the original source
plugins.rollupSourceMaps()
plugins.rollupSourceMaps(),
/*plugins.rollupBabel({
runtimeHelpers: true,
extensions: ['.js', '.jsx', '.ts', '.tsx'],
@ -72,7 +74,7 @@ export class TsBundle {
]
]
})*/
]
],
};
return baseOptions;
}
@ -87,7 +89,7 @@ export class TsBundle {
plugins.rollupTerser({
compress: true,
mangle: true,
sourcemap: true
sourcemap: true,
})
);
return productionOptions;
@ -100,14 +102,26 @@ export class TsBundle {
/**
* creates a bundle for the test enviroment
*/
public async buildTest(fromArg: string, toArg: string) {
public async buildTest(
fromArg: string,
toArg: string,
bundlerArg: 'rollup' | 'parcel' = 'rollup'
) {
// create a bundle
logger.log('info', `bundling for TEST!`);
const buildOptions = this.getOptionsTest(fromArg, toArg);
const bundle = await plugins.rollup.rollup(buildOptions);
bundle.generate(buildOptions.output as plugins.rollup.OutputOptions);
await bundle.write(buildOptions.output as plugins.rollup.OutputOptions);
logger.log('ok', `Successfully bundled files!`);
switch (bundlerArg) {
case 'rollup':
logger.log('info', `bundling for TEST!`);
const buildOptions = this.getOptionsTest(fromArg, toArg);
const bundle = await plugins.rollup.rollup(buildOptions);
bundle.generate(buildOptions.output as plugins.rollup.OutputOptions);
await bundle.write(buildOptions.output as plugins.rollup.OutputOptions);
logger.log('ok', `Successfully bundled files!`);
break;
case 'parcel':
const parsedPath = plugins.path.parse(toArg);
const parcelInstance = new plugins.smartparcel.Parcel(fromArg, parsedPath.dir, parsedPath.base);
await parcelInstance.build();
}
}
/**

View File

@ -8,8 +8,9 @@ import * as smartcli from '@pushrocks/smartcli';
import * as smartfile from '@pushrocks/smartfile';
import * as smartlog from '@pushrocks/smartlog';
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
import * as smartparcel from '@pushrocks/smartparcel';
export { smartcli, smartfile, smartlog, smartlogDestinationLocal };
export { smartcli, smartfile, smartlog, smartlogDestinationLocal, smartparcel };
// third party scope
import * as rollup from 'rollup';