From 5f90ed04397905cbd82e20c4b49a4c4eede3e604 Mon Sep 17 00:00:00 2001 From: Vincent Calame Date: Sat, 30 Jul 2022 09:30:54 +0200 Subject: [PATCH] Distinction entre build et dist --- Jakefile.js | 18 +++++++++++++----- demos/{dist.css => build.css} | 0 demos/{dist.html => build.html} | 0 3 files changed, 13 insertions(+), 5 deletions(-) rename demos/{dist.css => build.css} (100%) rename demos/{dist.html => build.html} (100%) diff --git a/Jakefile.js b/Jakefile.js index 84862ca..4d2d45b 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -2,16 +2,24 @@ /** * Installer Jake avec npm install -g jake (NodeJs doit être installé préalablement) * - * Lancer la compilation avec jake build[$version] où $version est le numéro de version + * Lancer la compilation avec jake build[$version] où $version est le numéro de version. + * + * Si $version commence par v, le répertoire de destination est dist, sinon c'est build. + * + * */ var fs = require('fs') , exec = require('child_process').exec; task('build', function (version) { - jake.rmRf('dist'); - jake.mkdirP('dist'); - compileJs(version, 'html2ods.js'); + var destinationDir = 'build'; + if (version.startsWith("v")) { + destinationDir = 'dist'; + } + jake.rmRf(destinationDir); + jake.mkdirP(destinationDir); + compileJs(version, destinationDir + '/html2ods.js'); }); task('default', ['build']); @@ -42,5 +50,5 @@ function compileJs(version, destination) { moduleContent = "/* version: " + version + " */\n" + moduleContent.replace(/\/\*[\s\S]*?\*\//g,''); moduleContent = moduleContent.replace("//compile target", result); - fs.writeFileSync('dist/' + destination, moduleContent, 'utf8'); + fs.writeFileSync(destination, moduleContent, 'utf8'); } diff --git a/demos/dist.css b/demos/build.css similarity index 100% rename from demos/dist.css rename to demos/build.css diff --git a/demos/dist.html b/demos/build.html similarity index 100% rename from demos/dist.html rename to demos/build.html