mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(pkg): Reintroduce build step
This commit is contained in:
@@ -16,4 +16,5 @@ node_modules
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
curriculum/dist
|
curriculum/dist
|
||||||
|
curriculum/curricula.json
|
||||||
client/static/js/frame-runner*
|
client/static/js/frame-runner*
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
*
|
*
|
||||||
!lib.js
|
!lib.js
|
||||||
!utils.js
|
!utils.js
|
||||||
!getChallenges.js
|
!curricula.json
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
const fs = require('fs-extra');
|
||||||
|
const gulp = require('gulp');
|
||||||
|
|
||||||
|
const { getChallengesForLang } = require('./getChallenges');
|
||||||
|
const { supportedLangs } = require('./utils');
|
||||||
|
|
||||||
|
function generateCurricula(done) {
|
||||||
|
const promises = supportedLangs.map(lang => getChallengesForLang(lang));
|
||||||
|
return Promise.all(promises)
|
||||||
|
.then(allLangCurriculum =>
|
||||||
|
allLangCurriculum.reduce(
|
||||||
|
(map, current, i) => ({ ...map, [supportedLangs[i]]: current }),
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.then(curricula =>
|
||||||
|
fs.writeFile('./curricula.json', JSON.stringify(curricula))
|
||||||
|
)
|
||||||
|
.then(done);
|
||||||
|
}
|
||||||
|
|
||||||
|
function watchFiles() {
|
||||||
|
return gulp.watch('./challenges/**/*.md', generateCurricula);
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultTask = gulp.series(generateCurricula, watchFiles);
|
||||||
|
|
||||||
|
gulp.task('default', defaultTask);
|
||||||
|
gulp.task('build', generateCurricula);
|
||||||
+3
-13
@@ -1,16 +1,7 @@
|
|||||||
const invariant = require('invariant');
|
const invariant = require('invariant');
|
||||||
|
|
||||||
const { getChallengesForLang } = require('./getChallenges');
|
|
||||||
const { supportedLangs } = require('./utils');
|
const { supportedLangs } = require('./utils');
|
||||||
|
|
||||||
const promises = supportedLangs.map(lang => getChallengesForLang(lang));
|
|
||||||
const curricula = Promise.all(promises).then(allLangCurriculum =>
|
|
||||||
allLangCurriculum.reduce(
|
|
||||||
(map, current, i) => ({ ...map, [supportedLangs[i]]: current }),
|
|
||||||
{}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
function validateLang(lang) {
|
function validateLang(lang) {
|
||||||
invariant(lang, 'Please provide a language');
|
invariant(lang, 'Please provide a language');
|
||||||
invariant(
|
invariant(
|
||||||
@@ -23,11 +14,10 @@ function validateLang(lang) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCurriculum(lang) {
|
function getCurriculum(lang) {
|
||||||
validateLang(lang);
|
validateLang(lang);
|
||||||
const allCurriculum = await curricula;
|
const curricula = require('./curricula.json');
|
||||||
const requested = allCurriculum[lang];
|
return curricula[lang];
|
||||||
return requested;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getChallengesForLang = getCurriculum;
|
exports.getChallengesForLang = getCurriculum;
|
||||||
|
|||||||
Generated
+2828
-34
File diff suppressed because it is too large
Load Diff
@@ -11,14 +11,17 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/freeCodeCamp/freeCodeCamp/issues"
|
"url": "https://github.com/freeCodeCamp/freeCodeCamp/issues"
|
||||||
},
|
},
|
||||||
"version": "0.0.0-next.3",
|
"version": "0.0.0-next.4",
|
||||||
"main": "lib.js",
|
"main": "lib.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"build": "gulp build",
|
||||||
"precommit": "lint-staged",
|
"precommit": "lint-staged",
|
||||||
"commit": "git-cz",
|
"commit": "git-cz",
|
||||||
"commitmsg": "commitlint -e",
|
"commitmsg": "commitlint -e",
|
||||||
|
"develop": "gulp",
|
||||||
"format": "prettier --write es5 './**/*.{js,json}' && npm run lint",
|
"format": "prettier --write es5 './**/*.{js,json}' && npm run lint",
|
||||||
"lint": "eslint ./**/*.js --fix",
|
"lint": "eslint ./**/*.js --fix",
|
||||||
|
"prepare": "npm run build",
|
||||||
"repack": "babel-node ./repack.js",
|
"repack": "babel-node ./repack.js",
|
||||||
"semantic-release": "semantic-release",
|
"semantic-release": "semantic-release",
|
||||||
"test": "babel-node ./test-challenges.js | tap-spec",
|
"test": "babel-node ./test-challenges.js | tap-spec",
|
||||||
@@ -62,6 +65,7 @@
|
|||||||
"eslint-plugin-prefer-object-spread": "^1.2.1",
|
"eslint-plugin-prefer-object-spread": "^1.2.1",
|
||||||
"eslint-plugin-react": "^7.7.0",
|
"eslint-plugin-react": "^7.7.0",
|
||||||
"fs-extra": "^6.0.1",
|
"fs-extra": "^6.0.1",
|
||||||
|
"gulp": "^4.0.0",
|
||||||
"husky": "^0.14.3",
|
"husky": "^0.14.3",
|
||||||
"joi": "^13.3.0",
|
"joi": "^13.3.0",
|
||||||
"joi-objectid": "^2.0.0",
|
"joi-objectid": "^2.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user