Let gulp build the necessary core files using artisan

This commit is contained in:
Dane Everitt 2018-06-02 15:54:52 -07:00
parent 6c598f9100
commit cf07ba5746
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 32 additions and 1 deletions

View file

@ -2,6 +2,7 @@ const babel = require('gulp-babel');
const concat = require('gulp-concat');
const cssmin = require('gulp-cssmin');
const del = require('del');
const exec = require('child_process').exec;
const gulp = require('gulp');
const gulpif = require('gulp-if');
const postcss = require('gulp-postcss');
@ -74,6 +75,32 @@ function watch() {
}, scripts));
}
/**
* Generate the language files to be consumed by front end.
*
* @returns {Promise<any>}
*/
function i18n() {
return new Promise((resolve, reject) => {
exec('php artisan vue-i18n:generate', {}, (err, stdout, stderr) => {
return err ? reject(err) : resolve({ stdout, stderr });
})
})
}
/**
* Generate the routes file to be used in Vue files.
*
* @returns {Promise<any>}
*/
function routes() {
return new Promise((resolve, reject) => {
exec('php artisan ziggy:generate resources/assets/scripts/helpers/ziggy.js', {}, (err, stdout, stderr) => {
return err ? reject(err) : resolve({ stdout, stderr });
});
})
}
/**
* Cleanup unused versions of hashed assets.
*/
@ -82,9 +109,12 @@ function clean() {
}
exports.clean = clean;
exports.i18n = i18n;
exports.routes = routes;
exports.styles = styles;
exports.scripts = scripts;
exports.watch = watch;
gulp.task('components', gulp.parallel(i18n, routes));
gulp.task('scripts', gulp.series(clean, scripts));
gulp.task('default', gulp.series(clean, styles, scripts));
gulp.task('default', gulp.series(clean, i18n, routes, styles, scripts));

View file

@ -50,6 +50,7 @@
"build:filemanager": "./node_modules/babel-cli/bin/babel.js public/themes/pterodactyl/js/frontend/files/src --source-maps --out-file public/themes/pterodactyl/js/frontend/files/filemanager.min.js",
"watch": "./node_modules/gulp-cli/bin/gulp.js watch",
"build": "./node_modules/gulp-cli/bin/gulp.js default",
"build:components": "./node_modules/gulp-cli/bin/gulp.js components",
"build:styles": "./node_modules/gulp-cli/bin/gulp.js styles",
"build:scripts": "./node_modules/gulp-cli/bin/gulp.js scripts"
},