Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
]
})
}
createBundle(fuse) {
const app = fuse.bundle("app");
if (!this.isProduction) {
app.watch()
app.hmr()
}
app.instructions(">index.jsx");
return app;
}
});
task("clean", () => src("dist").clean("dist").exec() )
task("default", ["clean"], async context => {
const fuse = context.getConfig();
fuse.dev();
context.createBundle(fuse);
await fuse.run();
});
task("dist", ["clean"], async context => {
context.isProduction = true;
const fuse = context.getConfig();
fuse.dev(); // remove it later
context.createBundle(fuse);
await fuse.run();
});
// If commonjs had no errors then we do amd/system and copy css/html
// ------------------------------------------
// Transpile
// ------------------------------------------
transpileTo('dist/amd/', 'amd');
transpileTo('dist/system/', 'system');
transpileTo('dist/es2015/', 'es2015');
// ------------------------------------------
// Ts code
// ------------------------------------------
src('**/*.*', { base: `../src/${FOLDER_NAME}` })
.clean('../distTS/')
.dest('../distTS/')
.exec();
// ------------------------------------------
// Css
// ------------------------------------------
src('../dist/**/*.*').clean('*.css');
src('**/*.css', { base: `../src/${FOLDER_NAME}` })
.dest('../dist/commonjs/')
.dest('../dist/amd/')
.dest('../dist/system/')
.dest('../dist/es2015/')
.exec();
.dest('dist/amd/')
.dest('dist/system/')
.dest('dist/es2015/')
.exec();
// ------------------------------------------
// html
// ------------------------------------------
// clean
src('./dist/**/*.*').clean('*.html')
// copy
src('**/*.html', { base: `src/${packageName}` })
.dest('dist/commonjs/')
.dest('dist/amd/')
.dest('dist/system/')
.dest('dist/es2015/')
.exec();
});
// ------------------------------------------
// Ts code
// ------------------------------------------
src('**/*.*', { base: `../src/${FOLDER_NAME}` })
.clean('../distTS/')
.dest('../distTS/')
.exec();
// ------------------------------------------
// Css
// ------------------------------------------
src('../dist/**/*.*').clean('*.css');
src('**/*.css', { base: `../src/${FOLDER_NAME}` })
.dest('../dist/commonjs/')
.dest('../dist/amd/')
.dest('../dist/system/')
.dest('../dist/es2015/')
.exec();
// ------------------------------------------
// Html
// ------------------------------------------
src('../dist/**/*.*').clean('*.html');
src('**/*.html', { base: `../src/${FOLDER_NAME}` })
.dest('../dist/commonjs/')
.dest('../dist/amd/')
.dest('../dist/system/')
// ts code
// ------------------------------------------
src('**/*.*', { base: `src/${packageName}` })
.clean('distTS/')
.dest('distTS/')
.exec();
// ------------------------------------------
// css
// ------------------------------------------
// clean
src('./dist/**/*.*').clean('*.css')
//copy
src('**/*.css', { base: `src/${packageName}` })
.dest('dist/commonjs/')
.dest('dist/amd/')
.dest('dist/system/')
.dest('dist/es2015/')
.exec();
// ------------------------------------------
// html
// ------------------------------------------
// clean
await fetch( platform, [ 'ffmpeg', 'rethinkdb', 'libvips', 'sharp' ] );
const buildFolder = `builds/${ platform }/`;
await reset( buildFolder );
await tsc( __dirname, {
...JSON.parse( ( await fs.readFile( 'tsconfig.json', 'utf8' ) ) ).compilerOptions
} );
await pkg( [ '.', '--target', getPackageHost( platform ), '--out-path', buildFolder ] );
for ( let native of nativeFolders ) {
await makeDir( path.join( buildFolder, native ) );
await src( path.join( native, '**/*' ), { base: "." } )
.dest( buildFolder )
.exec();
}
await copy(
'./lib/Extensions',
path.join( buildFolder, 'Extensions' )
);
await copy(
'./config',
path.join( buildFolder, 'config' ),
[ 'default*.yaml' ]
);
task('cp.jest', () => {
return src('jest/**', { base: 'src/templates/unit-tests' }).dest('.build/')
})
async prepareDistFolder() {
await bumpVersion("package.json", {type : "patch"});
await src("./package.json").dest("dist/").exec();
}
async function copy ( source, dest, filters = null ) {
await makeDir( dest );
const globs = !filters || filters.len == 0
? [ path.join( '**', '*' ) ]
: filters;
await src( globs, { base: source } )
.dest( dest )
.exec();
}
async clean() {
await src("./dist").clean("dist/").exec();
}