updated gulpfile to work with github

This commit is contained in:
Rohit Pai 2022-01-01 00:26:39 +00:00
parent 4614dff2b1
commit a7cc4f4a45
2 changed files with 23 additions and 7 deletions

View File

@ -15,6 +15,7 @@ jobs:
- name: 🔨Run Gulp - name: 🔨Run Gulp
run: | run: |
export github="true"
npm install npm install
npm start npm start

View File

@ -6,10 +6,12 @@ const terser = require("gulp-terser");
const ftp = require("vinyl-ftp"); const ftp = require("vinyl-ftp");
const env = require("gulp-env"); const env = require("gulp-env");
env({ /*env({
file: ".env", file: ".env",
type: ".ini" type: ".ini"
}); });*/
const github = (process.env.github) ? true : false;
gulp.task("minifyHTML", () => gulp.task("minifyHTML", () =>
{ {
@ -57,7 +59,7 @@ gulp.task("watchFiles", () =>
gulp.watch("src/api/*.php", gulp.task("movePHPFiles")) gulp.watch("src/api/*.php", gulp.task("movePHPFiles"))
}); });
gulp.task("ftp", () => /*gulp.task("ftp", () =>
{ {
let conn = ftp.create( let conn = ftp.create(
{ {
@ -69,12 +71,12 @@ gulp.task("ftp", () =>
return gulp.src("dist/**", {base: "dist", dot: true}) return gulp.src("dist/**", {base: "dist", dot: true})
.pipe(conn.newerOrDifferentSize("/")) .pipe(conn.newerOrDifferentSize("/"))
.pipe(conn.dest("/")); .pipe(conn.dest("/"));
}); });*/
gulp.task("deploy", () => /*gulp.task("deploy", () =>
{ {
gulp.watch("dist", gulp.task("ftp")); gulp.watch("dist", gulp.task("ftp"));
}); });*/
gulp.task("browserSync", () => gulp.task("browserSync", () =>
{ {
@ -89,4 +91,17 @@ gulp.task("browserSync", () =>
gulp.watch("dist").on("change", browserSync.reload) gulp.watch("dist").on("change", browserSync.reload)
}); });
gulp.task("default", gulp.series(gulp.parallel("watchFiles", "browserSync"))); gulp.task("default", () =>
{
if(github)
{
(gulp.series("movePHPFiles", "minifyJS", "minifyHTML", "minifyCSS")());
}
else
{
(gulp.series("watchFiles", "browserSync")());
}
}
//gulp.task("default", gulp.series(gulp.parallel("watchFiles", "browserSync")));