forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
31 lines (25 loc) · 710 Bytes
/
gulpfile.js
File metadata and controls
31 lines (25 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const fs = require('fs-extra');
const gulp = require('gulp');
const {
locale
} = require('../config/env.json');
const {
getChallengesForLang
} = require('./getChallenges');
function generateCurriculum(done) {
return getChallengesForLang(locale)
.then(curriculum => {
fs.ensureFileSync(`./build/curriculum-${locale}.json`);
fs.writeFile(
`./build/curriculum-${locale}.json`,
JSON.stringify(curriculum)
)
})
.then(done);
}
function watchFiles() {
return gulp.watch('./challenges/**/*.md', generateCurriculum);
}
const defaultTask = gulp.series(generateCurriculum, watchFiles);
gulp.task('default', defaultTask);
gulp.task('build', generateCurriculum);