From c099d3f021293711987760c15bc835e7ec80e82f Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Wed, 7 Feb 2018 09:51:51 +0100 Subject: [PATCH] auto create nginx temp folder --- gulpfile.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 327a51579c..4c529708e3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -191,6 +191,11 @@ gulp.task('nginx-stop', ['nginx-conf'], async () => { gulp.task('nginx-conf', async () => { const mustache = require('mustache'); + // crear carpeta nginx &{nginxTemp} si no existe + if (!fs.existsSync(nginxTemp)) { + fs.mkdirSync(nginxTemp); + } + let params = { services: await getServices(), defaultService: defaultService, @@ -208,12 +213,12 @@ gulp.task('nginx-conf', async () => { let template = await fs.readFile(confFile, 'utf8'); let nginxConf = mustache.render(template, params); - await fs.writeFile(`${nginxDir}/temp/nginx.conf`, nginxConf); + await fs.writeFile(`${nginxTemp}/nginx.conf`, nginxConf); }); gulp.task('nginx-clean', () => { const del = require('del'); - return del([`${nginxDir}/temp/*`], {force: true}); + return del([`${nginxTemp}/*`], {force: true}); }); let services;