diff --git a/Ombi/Ombi/gulpfile.js b/Ombi/Ombi/gulpfile.js index 08614359b..57dd86369 100644 --- a/Ombi/Ombi/gulpfile.js +++ b/Ombi/Ombi/gulpfile.js @@ -16,8 +16,10 @@ var filter = require('gulp-filter'); var systemJSBuilder = require('systemjs-builder'); var run = require('gulp-run'); +var wwwroot = './wwwroot'; + var paths = { - wwwroot: './wwwroot/', + wwwroot: wwwroot, npm: { // These will be resolved automatically and copied to output directory as its name, only works for pre-bundled modules e.g. angular src: [ '@angular/animations', @@ -125,8 +127,22 @@ var paths = { }, bundle: { // This is the config for the bundler, you shouldn't need to change this root: './', - dest: './lib/bundle.js', + dest: './lib/bundles/full.js', + libdest: './lib/bundles/lib.js', bundle: 'app/main.js', + app: 'app/**/*', + config: { + baseURL: wwwroot, + packages: { + '.': { + defaultExtension: 'js' + } + }, + paths: { + '*': 'lib/*', + 'app/*': 'app/*' + } + } } } @@ -229,26 +245,37 @@ gulp.task('sass', function () { .pipe(gulp.dest(path.join(paths.wwwroot, paths.sass.dest))) }); + +// This bundles the entire application and libraries for deployment gulp.task('bundle', function () { var builder = new systemJSBuilder(paths.bundle.root); - builder.config({ - baseURL: paths.wwwroot, - packages: { - '.': { - defaultExtension: 'js' - } - }, - paths: { - '*': 'lib/*', - 'app/*': 'app/*' - } - }); + builder.config(paths.bundle.config); + del.sync(path.join(paths.wwwroot, paths.bundle.dest), { force: true }); return builder.bundle(paths.bundle.bundle, path.join(paths.wwwroot, paths.bundle.dest), { sourceMaps: true }) }) +// This bundles only third party dependencies for development +gulp.task('bundlelib', function () { + var builder = new systemJSBuilder(paths.bundle.root); + builder.config(paths.bundle.config); + del.sync(path.join(paths.wwwroot, paths.bundle.libdest), { force: true }); + return builder.bundle(paths.bundle.bundle + ' - [' + paths.bundle.app + ']', path.join(paths.wwwroot, paths.bundle.libdest), { + sourceMaps: global.full + }) +}) + +gulp.task('clean', function () { + return del([ + paths.sass.dest, + paths.lib.dest, + paths.bundle.dest, + ...paths.modules.map(m => m.dest) + ].map(x => path.join(paths.wwwroot, x)), { force: true }); +}) + gulp.task('typescript', function () { return run('tsc').exec(); }); @@ -256,9 +283,9 @@ gulp.task('typescript', function () { gulp.task('fullvar', () => { global.full = true }); gulp.task('libs') gulp.task('copy', ['lib', 'libcss', 'libfonts', 'libimages', 'npm', 'modules']); -gulp.task('compile', ['sass']); -gulp.task('build', callback => runSequence('copy', 'compile', callback)); -gulp.task('full', callback => runSequence('build', callback)); +gulp.task('compile', callback => runSequence('copy', 'sass', callback)); +gulp.task('build', callback => runSequence('compile', 'bundlelib', callback)); +gulp.task('full', callback => runSequence('clean', 'compile', callback)); // Use this in a build server environment to compile and bundle everything gulp.task('publish', callback => runSequence('fullvar', 'full', 'typescript', 'bundle', callback)); diff --git a/Ombi/Ombi/systemjs.config.ts b/Ombi/Ombi/systemjs.config.ts index b31bed9a4..c007c8d9a 100644 --- a/Ombi/Ombi/systemjs.config.ts +++ b/Ombi/Ombi/systemjs.config.ts @@ -10,11 +10,7 @@ map: { app: '../app' } }) - if (config.bundle) { - System.import('bundle').then(() => { - System.import('/app/main'); - }) - } else { - System.import('/app/main') - } + System.import(config.bundle ? 'bundles/full' : 'bundles/lib').then(() => { + System.import('/app/main'); + }) }); \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index f97cdb039..6aeb2aa9b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ version: 3.0.{build} configuration: Release -os: Visual Studio 2015 Preview +os: Visual Studio 2017 assembly_info: patch: true file: '**\AssemblyInfo.*' @@ -11,11 +11,12 @@ before_build: - cmd: cd ombi/ombi - appveyor-retry dotnet restore - appveyor-retry npm install bower -g -#- appveyor-retry npm install -g gulp -- appveyor-retry npm install -g typescript +- appveyor-retry npm install -g gulp +#- appveyor-retry npm install -g typescript - appveyor-retry npm install - appveyor-retry bower install -#- gulp publish +- gulp publish +- node --version build_script: - dotnet build after_build: