Skip to content

Commit ebb7b6d

Browse files
committed
Let gulp build the necessary core files using artisan
1 parent 5f70502 commit ebb7b6d

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

gulpfile.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const babel = require('gulp-babel');
22
const concat = require('gulp-concat');
33
const cssmin = require('gulp-cssmin');
44
const del = require('del');
5+
const exec = require('child_process').exec;
56
const gulp = require('gulp');
67
const gulpif = require('gulp-if');
78
const postcss = require('gulp-postcss');
@@ -74,6 +75,32 @@ function watch() {
7475
}, scripts));
7576
}
7677

78+
/**
79+
* Generate the language files to be consumed by front end.
80+
*
81+
* @returns {Promise<any>}
82+
*/
83+
function i18n() {
84+
return new Promise((resolve, reject) => {
85+
exec('php artisan vue-i18n:generate', {}, (err, stdout, stderr) => {
86+
return err ? reject(err) : resolve({ stdout, stderr });
87+
})
88+
})
89+
}
90+
91+
/**
92+
* Generate the routes file to be used in Vue files.
93+
*
94+
* @returns {Promise<any>}
95+
*/
96+
function routes() {
97+
return new Promise((resolve, reject) => {
98+
exec('php artisan ziggy:generate resources/assets/scripts/helpers/ziggy.js', {}, (err, stdout, stderr) => {
99+
return err ? reject(err) : resolve({ stdout, stderr });
100+
});
101+
})
102+
}
103+
77104
/**
78105
* Cleanup unused versions of hashed assets.
79106
*/
@@ -82,9 +109,12 @@ function clean() {
82109
}
83110

84111
exports.clean = clean;
112+
exports.i18n = i18n;
113+
exports.routes = routes;
85114
exports.styles = styles;
86115
exports.scripts = scripts;
87116
exports.watch = watch;
88117

118+
gulp.task('components', gulp.parallel(i18n, routes));
89119
gulp.task('scripts', gulp.series(clean, scripts));
90-
gulp.task('default', gulp.series(clean, styles, scripts));
120+
gulp.task('default', gulp.series(clean, i18n, routes, styles, scripts));

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"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",
4848
"watch": "./node_modules/gulp-cli/bin/gulp.js watch",
4949
"build": "./node_modules/gulp-cli/bin/gulp.js default",
50+
"build:components": "./node_modules/gulp-cli/bin/gulp.js components",
5051
"build:styles": "./node_modules/gulp-cli/bin/gulp.js styles",
5152
"build:scripts": "./node_modules/gulp-cli/bin/gulp.js scripts"
5253
},

0 commit comments

Comments
 (0)