Fix gulpfile to handle rename
This commit is contained in:
106
gulpfile.js
106
gulpfile.js
@@ -17,21 +17,21 @@ var argv = require('yargs').argv,
|
||||
|
||||
gulp.task('3rdparty', function () {
|
||||
gulp.src([
|
||||
'webadmin/src/3rdparty/**/*.js',
|
||||
'webadmin/src/3rdparty/**/*.map',
|
||||
'webadmin/src/3rdparty/**/*.css',
|
||||
'webadmin/src/3rdparty/**/*.otf',
|
||||
'webadmin/src/3rdparty/**/*.eot',
|
||||
'webadmin/src/3rdparty/**/*.svg',
|
||||
'webadmin/src/3rdparty/**/*.gif',
|
||||
'webadmin/src/3rdparty/**/*.ttf',
|
||||
'webadmin/src/3rdparty/**/*.woff',
|
||||
'webadmin/src/3rdparty/**/*.woff2'
|
||||
'dashboard/src/3rdparty/**/*.js',
|
||||
'dashboard/src/3rdparty/**/*.map',
|
||||
'dashboard/src/3rdparty/**/*.css',
|
||||
'dashboard/src/3rdparty/**/*.otf',
|
||||
'dashboard/src/3rdparty/**/*.eot',
|
||||
'dashboard/src/3rdparty/**/*.svg',
|
||||
'dashboard/src/3rdparty/**/*.gif',
|
||||
'dashboard/src/3rdparty/**/*.ttf',
|
||||
'dashboard/src/3rdparty/**/*.woff',
|
||||
'dashboard/src/3rdparty/**/*.woff2'
|
||||
])
|
||||
.pipe(gulp.dest('webadmin/dist/3rdparty/'));
|
||||
.pipe(gulp.dest('dashboard/dist/3rdparty/'));
|
||||
|
||||
gulp.src('node_modules/bootstrap-sass/assets/javascripts/bootstrap.min.js')
|
||||
.pipe(gulp.dest('webadmin/dist/3rdparty/js'));
|
||||
.pipe(gulp.dest('dashboard/dist/3rdparty/js'));
|
||||
});
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ if (argv.help || argv.h) {
|
||||
gulp.task('js', ['js-index', 'js-logs', 'js-terminal', 'js-setup', 'js-setupdns', 'js-restore', 'js-update'], function () {});
|
||||
|
||||
var oauth = {
|
||||
clientId: argv.clientId || 'cid-webadmin',
|
||||
clientId: argv.clientId || 'cid-dashboard',
|
||||
clientSecret: argv.clientSecret || 'unused',
|
||||
apiOrigin: argv.apiOrigin || '',
|
||||
apiOriginHostname: argv.apiOrigin ? url.parse(argv.apiOrigin).hostname : ''
|
||||
@@ -74,18 +74,18 @@ gulp.task('js-index', function () {
|
||||
});
|
||||
|
||||
gulp.src([
|
||||
'webadmin/src/js/index.js',
|
||||
'webadmin/src/js/client.js',
|
||||
'webadmin/src/js/appstore.js',
|
||||
'webadmin/src/js/main.js',
|
||||
'webadmin/src/views/*.js'
|
||||
'dashboard/src/js/index.js',
|
||||
'dashboard/src/js/client.js',
|
||||
'dashboard/src/js/appstore.js',
|
||||
'dashboard/src/js/main.js',
|
||||
'dashboard/src/views/*.js'
|
||||
])
|
||||
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(concat('index.js', { newLine: ';' }))
|
||||
.pipe(uglifyer)
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('webadmin/dist/js'));
|
||||
.pipe(gulp.dest('dashboard/dist/js'));
|
||||
});
|
||||
|
||||
gulp.task('js-logs', function () {
|
||||
@@ -95,13 +95,13 @@ gulp.task('js-logs', function () {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
gulp.src(['webadmin/src/js/logs.js', 'webadmin/src/js/client.js'])
|
||||
gulp.src(['dashboard/src/js/logs.js', 'dashboard/src/js/client.js'])
|
||||
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(concat('logs.js', { newLine: ';' }))
|
||||
.pipe(uglifyer)
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('webadmin/dist/js'));
|
||||
.pipe(gulp.dest('dashboard/dist/js'));
|
||||
});
|
||||
|
||||
gulp.task('js-terminal', function () {
|
||||
@@ -111,13 +111,13 @@ gulp.task('js-terminal', function () {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
gulp.src(['webadmin/src/js/terminal.js', 'webadmin/src/js/client.js'])
|
||||
gulp.src(['dashboard/src/js/terminal.js', 'dashboard/src/js/client.js'])
|
||||
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(concat('terminal.js', { newLine: ';' }))
|
||||
.pipe(uglifyer)
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('webadmin/dist/js'));
|
||||
.pipe(gulp.dest('dashboard/dist/js'));
|
||||
});
|
||||
|
||||
gulp.task('js-setup', function () {
|
||||
@@ -127,13 +127,13 @@ gulp.task('js-setup', function () {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
gulp.src(['webadmin/src/js/setup.js', 'webadmin/src/js/client.js'])
|
||||
gulp.src(['dashboard/src/js/setup.js', 'dashboard/src/js/client.js'])
|
||||
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(concat('setup.js', { newLine: ';' }))
|
||||
.pipe(uglifyer)
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('webadmin/dist/js'));
|
||||
.pipe(gulp.dest('dashboard/dist/js'));
|
||||
});
|
||||
|
||||
gulp.task('js-setupdns', function () {
|
||||
@@ -143,13 +143,13 @@ gulp.task('js-setupdns', function () {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
gulp.src(['webadmin/src/js/setupdns.js', 'webadmin/src/js/client.js'])
|
||||
gulp.src(['dashboard/src/js/setupdns.js', 'dashboard/src/js/client.js'])
|
||||
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(concat('setupdns.js', { newLine: ';' }))
|
||||
.pipe(uglifyer)
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('webadmin/dist/js'));
|
||||
.pipe(gulp.dest('dashboard/dist/js'));
|
||||
});
|
||||
|
||||
gulp.task('js-restore', function () {
|
||||
@@ -159,13 +159,13 @@ gulp.task('js-restore', function () {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
gulp.src(['webadmin/src/js/restore.js', 'webadmin/src/js/client.js'])
|
||||
gulp.src(['dashboard/src/js/restore.js', 'dashboard/src/js/client.js'])
|
||||
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(concat('restore.js', { newLine: ';' }))
|
||||
.pipe(uglifyer)
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('webadmin/dist/js'));
|
||||
.pipe(gulp.dest('dashboard/dist/js'));
|
||||
});
|
||||
|
||||
|
||||
@@ -176,11 +176,11 @@ gulp.task('js-update', function () {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
gulp.src(['webadmin/src/js/update.js'])
|
||||
gulp.src(['dashboard/src/js/update.js'])
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(uglifyer)
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('webadmin/dist/js'));
|
||||
.pipe(gulp.dest('dashboard/dist/js'));
|
||||
});
|
||||
|
||||
|
||||
@@ -189,15 +189,15 @@ gulp.task('js-update', function () {
|
||||
// --------------
|
||||
|
||||
gulp.task('html', ['html-views', 'html-templates'], function () {
|
||||
return gulp.src('webadmin/src/*.html').pipe(ejs({ apiOriginHostname: oauth.apiOriginHostname }, {}, { ext: '.html' })).pipe(gulp.dest('webadmin/dist'));
|
||||
return gulp.src('dashboard/src/*.html').pipe(ejs({ apiOriginHostname: oauth.apiOriginHostname }, {}, { ext: '.html' })).pipe(gulp.dest('dashboard/dist'));
|
||||
});
|
||||
|
||||
gulp.task('html-views', function () {
|
||||
return gulp.src('webadmin/src/views/**/*.html').pipe(gulp.dest('webadmin/dist/views'));
|
||||
return gulp.src('dashboard/src/views/**/*.html').pipe(gulp.dest('dashboard/dist/views'));
|
||||
});
|
||||
|
||||
gulp.task('html-templates', function () {
|
||||
return gulp.src('webadmin/src/templates/**/*.html').pipe(gulp.dest('webadmin/dist/templates'));
|
||||
return gulp.src('dashboard/src/templates/**/*.html').pipe(gulp.dest('dashboard/dist/templates'));
|
||||
});
|
||||
|
||||
// --------------
|
||||
@@ -205,18 +205,18 @@ gulp.task('html-templates', function () {
|
||||
// --------------
|
||||
|
||||
gulp.task('css', function () {
|
||||
return gulp.src('webadmin/src/*.scss')
|
||||
return gulp.src('dashboard/src/*.scss')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(sass({ includePaths: ['node_modules/bootstrap-sass/assets/stylesheets/'] }).on('error', sass.logError))
|
||||
.pipe(autoprefixer())
|
||||
.pipe(cssnano())
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('webadmin/dist'));
|
||||
.pipe(gulp.dest('dashboard/dist'));
|
||||
});
|
||||
|
||||
gulp.task('images', function () {
|
||||
return gulp.src('webadmin/src/img/**')
|
||||
.pipe(gulp.dest('webadmin/dist/img'));
|
||||
return gulp.src('dashboard/src/img/**')
|
||||
.pipe(gulp.dest('dashboard/dist/img'));
|
||||
});
|
||||
|
||||
// --------------
|
||||
@@ -224,25 +224,25 @@ gulp.task('images', function () {
|
||||
// --------------
|
||||
|
||||
gulp.task('watch', ['default'], function () {
|
||||
gulp.watch(['webadmin/src/*.scss'], ['css']);
|
||||
gulp.watch(['webadmin/src/img/*'], ['images']);
|
||||
gulp.watch(['webadmin/src/**/*.html'], ['html']);
|
||||
gulp.watch(['webadmin/src/views/*.html'], ['html-views']);
|
||||
gulp.watch(['webadmin/src/templates/*.html'], ['html-templates']);
|
||||
gulp.watch(['webadmin/src/js/update.js'], ['js-update']);
|
||||
gulp.watch(['webadmin/src/js/setup.js', 'webadmin/src/js/client.js'], ['js-setup']);
|
||||
gulp.watch(['webadmin/src/js/setupdns.js', 'webadmin/src/js/client.js'], ['js-setupdns']);
|
||||
gulp.watch(['webadmin/src/js/restore.js', 'webadmin/src/js/client.js'], ['js-restore']);
|
||||
gulp.watch(['webadmin/src/js/logs.js', 'webadmin/src/js/client.js'], ['js-logs']);
|
||||
gulp.watch(['webadmin/src/js/terminal.js', 'webadmin/src/js/client.js'], ['js-terminal']);
|
||||
gulp.watch(['webadmin/src/js/index.js', 'webadmin/src/js/client.js', 'webadmin/src/js/appstore.js', 'webadmin/src/js/main.js', 'webadmin/src/views/*.js'], ['js-index']);
|
||||
gulp.watch(['webadmin/src/3rdparty/**/*'], ['3rdparty']);
|
||||
gulp.watch(['dashboard/src/*.scss'], ['css']);
|
||||
gulp.watch(['dashboard/src/img/*'], ['images']);
|
||||
gulp.watch(['dashboard/src/**/*.html'], ['html']);
|
||||
gulp.watch(['dashboard/src/views/*.html'], ['html-views']);
|
||||
gulp.watch(['dashboard/src/templates/*.html'], ['html-templates']);
|
||||
gulp.watch(['dashboard/src/js/update.js'], ['js-update']);
|
||||
gulp.watch(['dashboard/src/js/setup.js', 'dashboard/src/js/client.js'], ['js-setup']);
|
||||
gulp.watch(['dashboard/src/js/setupdns.js', 'dashboard/src/js/client.js'], ['js-setupdns']);
|
||||
gulp.watch(['dashboard/src/js/restore.js', 'dashboard/src/js/client.js'], ['js-restore']);
|
||||
gulp.watch(['dashboard/src/js/logs.js', 'dashboard/src/js/client.js'], ['js-logs']);
|
||||
gulp.watch(['dashboard/src/js/terminal.js', 'dashboard/src/js/client.js'], ['js-terminal']);
|
||||
gulp.watch(['dashboard/src/js/index.js', 'dashboard/src/js/client.js', 'dashboard/src/js/appstore.js', 'dashboard/src/js/main.js', 'dashboard/src/views/*.js'], ['js-index']);
|
||||
gulp.watch(['dashboard/src/3rdparty/**/*'], ['3rdparty']);
|
||||
});
|
||||
|
||||
gulp.task('clean', function () {
|
||||
rimraf.sync('webadmin/dist');
|
||||
rimraf.sync('dashboard/dist');
|
||||
});
|
||||
|
||||
gulp.task('default', ['clean', 'html', 'js', '3rdparty', 'images', 'css'], function () {});
|
||||
|
||||
gulp.task('develop', ['watch'], serve({ root: 'webadmin/dist', port: 4000 }));
|
||||
gulp.task('develop', ['watch'], serve({ root: 'dashboard/dist', port: 4000 }));
|
||||
|
||||
Reference in New Issue
Block a user