diff --git a/curriculum/package.json b/curriculum/package.json index 10bfda8a1b..13a3f06d2d 100644 --- a/curriculum/package.json +++ b/curriculum/package.json @@ -14,10 +14,10 @@ "version": "0.0.0-next.4", "main": "lib.js", "scripts": { - "create-empty-steps": "cross-env CALLING_DIR=$INIT_CWD node ./tools/create-empty-steps", - "create-next-step": "cross-env CALLING_DIR=$INIT_CWD node ./tools/create-next-step", - "create-step-between": "cross-env CALLING_DIR=$INIT_CWD node ./tools/create-step-between", - "reorder-steps": "cross-env CALLING_DIR=$INIT_CWD node ./tools/reorder-steps", + "create-empty-steps": "cross-env CALLING_DIR=$INIT_CWD node ../tools/challenge-helper-scripts/create-empty-steps", + "create-next-step": "cross-env CALLING_DIR=$INIT_CWD node ../tools/challenge-helper-scripts/create-next-step", + "create-step-between": "cross-env CALLING_DIR=$INIT_CWD node ../tools/challenge-helper-scripts/create-step-between", + "reorder-steps": "cross-env CALLING_DIR=$INIT_CWD node ../tools/challenge-helper-scripts/reorder-steps", "develop": "gulp", "lint": "gulp lint", "semantic-release": "semantic-release", @@ -49,11 +49,9 @@ "babel-preset-stage-0": "^6.3.13", "babel-preset-stage-3": "^6.24.1", "babel-standalone": "^6.26.0", - "bson-objectid": "^1.3.1", "chai": "4.2.0", "cross-env": "^7.0.2", "fs-extra": "^6.0.1", - "gray-matter": "^4.0.2", "gulp": "^4.0.2", "joi": "^13.3.0", "joi-objectid": "^2.0.0", diff --git a/lerna.json b/lerna.json index c4146d15f0..2d7f20f04f 100644 --- a/lerna.json +++ b/lerna.json @@ -7,7 +7,8 @@ "tools/search-indexing", "tools/challenge-md-parser", "tools/scripts/seed", - "tools/scripts/build" + "tools/scripts/build", + "tools/challenge-helper-scripts" ], "version": "independent" } diff --git a/curriculum/tools/README.md b/tools/challenge-helper-scripts/README.md similarity index 95% rename from curriculum/tools/README.md rename to tools/challenge-helper-scripts/README.md index 04168c5594..b427b17802 100644 --- a/curriculum/tools/README.md +++ b/tools/challenge-helper-scripts/README.md @@ -1,6 +1,6 @@ -# Free Code Camp Project-based Curriculum Tools +# freeCodeCamp Project-based Curriculum Tools -This repo is for tools to help facilitate the creation and maintenance of the Free Code Camp project-based curriculum. +This folder contains tools to help facilitate the creation and maintenance of the freeCodeCamp project-based curriculum. ## [create-next-step.js](create-next-step.js) A one-off script that will automatically add the next step based on the last step numbered as `part-xxx.md` where `xxx` represents the 3-digit step number of the last step. The challenge seed code will use the previous step's challenge seed code with the editable region markers (ERMs) removed. diff --git a/curriculum/tools/create-empty-steps.js b/tools/challenge-helper-scripts/create-empty-steps.js similarity index 79% rename from curriculum/tools/create-empty-steps.js rename to tools/challenge-helper-scripts/create-empty-steps.js index 36f25fcc85..472fdb464f 100644 --- a/curriculum/tools/create-empty-steps.js +++ b/tools/challenge-helper-scripts/create-empty-steps.js @@ -20,11 +20,17 @@ const args = argValuePairs.reduce((argsObj, arg) => { }, {}); let { num, start } = args; +if (!start) { + throw `No steps created. start arg val must be specified.`; +} +if (!num) { + throw `No steps created. num arg val must be specified.`; +} num = parseInt(num, 10); const stepStart = parseInt(start, 10); -if (num > 20) { - throw 'No steps created. num arg val must be less than or equal to 20.'; +if (num > 0 && num < 20) { + throw `No steps created. num arg val must be greater than 1 and less than or equal to 20.`; } const maxStepNum = stepStart + num - 1; diff --git a/curriculum/tools/create-next-step.js b/tools/challenge-helper-scripts/create-next-step.js similarity index 100% rename from curriculum/tools/create-next-step.js rename to tools/challenge-helper-scripts/create-next-step.js diff --git a/curriculum/tools/create-step-between.js b/tools/challenge-helper-scripts/create-step-between.js similarity index 100% rename from curriculum/tools/create-step-between.js rename to tools/challenge-helper-scripts/create-step-between.js diff --git a/tools/challenge-helper-scripts/package-lock.json b/tools/challenge-helper-scripts/package-lock.json new file mode 100644 index 0000000000..0542976392 --- /dev/null +++ b/tools/challenge-helper-scripts/package-lock.json @@ -0,0 +1,150 @@ +{ + "name": "@freecodecamp/curriculum-helper-scripts", + "version": "0.0.0-next.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "bson-objectid": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/bson-objectid/-/bson-objectid-1.3.1.tgz", + "integrity": "sha512-eQBNQXsisEAXlwiSy8zRNZdW2xDBJaEVkTPbodYR9hGxxtE548Qq7ilYOd8WAQ86xF7NRUdiWSQ1pa/TkKiE2A==", + "dev": true + }, + "cross-env": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.2.tgz", + "integrity": "sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.1" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "gray-matter": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.2.tgz", + "integrity": "sha512-7hB/+LxrOjq/dd8APlK0r24uL/67w7SkYnfwhNFwg/VDIGWGmduTDYf3WNstLW2fbbmRwrDGCVSJ2isuf2+4Hw==", + "dev": true, + "requires": { + "js-yaml": "^3.11.0", + "kind-of": "^6.0.2", + "section-matter": "^1.0.0", + "strip-bom-string": "^1.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "js-yaml": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "section-matter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", + "integrity": "sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "kind-of": "^6.0.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "strip-bom-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz", + "integrity": "sha1-5SEekiQ2n7uB1jOi8ABE3IztrZI=", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } +} diff --git a/tools/challenge-helper-scripts/package.json b/tools/challenge-helper-scripts/package.json new file mode 100644 index 0000000000..8887f5f3b8 --- /dev/null +++ b/tools/challenge-helper-scripts/package.json @@ -0,0 +1,33 @@ +{ + "name": "@freecodecamp/curriculum-helper-scripts", + "description": "freeCodeCamp's project-based curriculum scripts", + "license": "(BSD-3-Clause AND CC-BY-SA-4.0)", + "author": "freeCodeCamp ", + "homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme", + "repository": { + "type": "git", + "url": "https://github.com/freeCodeCamp/freeCodeCamp.git" + }, + "bugs": { + "url": "https://github.com/freeCodeCamp/freeCodeCamp/issues" + }, + "version": "0.0.0-next.1", + "main": "utils.js", + "scripts": { + "test": "mocha --delay --reporter progress --bail" + }, + "devDependencies": { + "bson-objectid": "^1.3.1", + "cross-env": "^7.0.2", + "gray-matter": "^4.0.2" + }, + "keywords": [ + "challenges", + "curriculum", + "freecodecamp", + "javascript" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/curriculum/tools/reorder-steps.js b/tools/challenge-helper-scripts/reorder-steps.js similarity index 100% rename from curriculum/tools/reorder-steps.js rename to tools/challenge-helper-scripts/reorder-steps.js diff --git a/curriculum/tools/utils.js b/tools/challenge-helper-scripts/utils.js similarity index 100% rename from curriculum/tools/utils.js rename to tools/challenge-helper-scripts/utils.js