Skip to content

Commit

Permalink
⚡ Improve devSetup.gulpfile.js
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Mar 14, 2020
1 parent 955d7da commit 73f0ad7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.

This file was deleted.

22 changes: 21 additions & 1 deletion devSetup.gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ const argv = minimist(process.argv.slice(2));

spawnise.logs = argv.logs || false; // gulp --logs

const cleanup = () => {
const fs = require('fs-extra');
return Promise.all([
fs.remove('./app/data/node_requires'),
fs.remove('./app/data/docs')
]);
};

const npmInstall = path => done => {
console.log(`Running 'npm install' for ${path}…`);
spawnise.spawn((/^win/).test(process.platform) ? 'npm.cmd' : 'npm', ['install'], {
Expand All @@ -21,6 +29,16 @@ const npmInstall = path => done => {
});
};

const bakeDocs = async () => {
const npm = (/^win/).test(process.platform) ? 'npm.cmd' : 'npm';
const fs = require('fs-extra');
await fs.remove('./app/data/docs/');
await spawnise.spawn(npm, ['run', 'build'], {
cwd: './docs'
});
await fs.copy('./docs/docs/.vuepress/dist', './app/data/docs/');
};

const updateGitSubmodules = () =>
spawnise.spawn('git', ['submodule', 'update', '--init', '--recursive']);

Expand All @@ -30,7 +48,9 @@ const defaultTask = gulp.series([
npmInstall('./'),
npmInstall('./app'),
npmInstall('./docs')
])
]),
cleanup,
bakeDocs
]);

gulp.task('default', defaultTask);

0 comments on commit 73f0ad7

Please sign in to comment.