|
@@ -32,11 +32,9 @@ deploy.programs.forEach(program => {
|
|
|
file.put(distPath + '/data/.gitkeep', '');
|
|
|
// Copie des fichiers commun
|
|
|
file.makedir(distPath + '/src');
|
|
|
- file.fs.readdirSync('./src').forEach(f => {
|
|
|
+ file.list('./src').forEach(f => {
|
|
|
if (!file.isDir('./src/' + f)) {
|
|
|
- file.fs.copyFile('./src/' + f, distPath + '/src/' + f, (err) => {
|
|
|
- if (err) throw err;
|
|
|
- });
|
|
|
+ file.copy('./src/' + f, distPath + '/src/' + f);
|
|
|
}
|
|
|
});
|
|
|
// Copie dossier propre à chaque programme
|
|
@@ -46,9 +44,7 @@ deploy.programs.forEach(program => {
|
|
|
cover: true
|
|
|
});
|
|
|
// Copie fichier main
|
|
|
- file.fs.copyFile(program.main, distPath + '/main.js', (err) => {
|
|
|
- if (err) throw err;
|
|
|
- });
|
|
|
+ file.copy(program.main, distPath + '/main.js');
|
|
|
// Copie package.json
|
|
|
const pckg = require('./package.json');
|
|
|
pckg.scripts = program.scripts;
|
|
@@ -63,24 +59,26 @@ deploy.programs.forEach(program => {
|
|
|
file.put(distPath + '/README.md', readMe(program.part).replace(new RegExp(program.main, 'g'), 'main.js'));
|
|
|
// Zip du code pour distribution
|
|
|
if (zip) {
|
|
|
+ //zipdir.zipFolder(distPath, distPath + '.zip', err => {});
|
|
|
+
|
|
|
zipdir(distPath, {saveTo: distPath + '.zip'}, (err, buffer) => {
|
|
|
if (err) {
|
|
|
console.error('Error when zipping files', err);
|
|
|
} else {
|
|
|
console.info(`Zip file created for ${program.name} in ${distPath}.zip`);
|
|
|
+ // Si besoins on supprime les versions non zipper des dossier
|
|
|
+ if (remove) {
|
|
|
+ del(distPath + '/**').then(deletedPaths => {
|
|
|
+ file.fs.rmdir(distPath, () => {
|
|
|
+ console.info(`Directory ${distPath} deleted`);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
// Message de fin
|
|
|
console.info(`${program.name} deployed in ${distPath}`);
|
|
|
- // Si besoins on supprime les versions non zipper des dossier
|
|
|
- if (remove) {
|
|
|
- del(distPath + '/**').then(deletedPaths => {
|
|
|
- file.fs.rmdir(distPath, () => {
|
|
|
- console.info(`Directory ${distPath} deleted`);
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
});
|
|
|
|
|
|
// Fonction découpage readme
|