diff --git a/.eslintignore b/.eslintignore index 30acae6947..4da9030394 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,6 +2,6 @@ client/.cache/** client/static/** client/public/** -api-server/public/** +api-server/src/public/** api-server/lib/** tools/contributor/** diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 22827119c8..44d2c72829 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -51,6 +51,7 @@ jobs: run: | npm ci npm run ensure-env + npm run build:curriculum - name: Seed Database run: npm run seed @@ -60,9 +61,9 @@ jobs: with: record: ${{ env.CYPRESS_RECORD_KEY != 0 }} build: npm run build - # this should mirror the production build, but for now we're just using the dev - # server and gatsby serve instead (the npm script serve:client needs updating!) - start: npm start + # this should mirror the production build, but for now we're using gatsby + # serve instead (the npm script serve:client needs updating!) + start: npm run start-ci wait-on: http://localhost:8000 # the site builds in about 8 minutes, so there is currently 12 minutes of time # left for testing. diff --git a/.github/workflows/node.js-tests.yml b/.github/workflows/node.js-tests.yml index bd1be5e768..d7f6ace7d4 100644 --- a/.github/workflows/node.js-tests.yml +++ b/.github/workflows/node.js-tests.yml @@ -39,6 +39,7 @@ jobs: run: | npm ci npm run ensure-env + npm run build:curriculum npm run lint test: @@ -79,6 +80,7 @@ jobs: run: | npm ci npm run ensure-env + npm run build:curriculum - name: Run Tests run: npm test diff --git a/.gitignore b/.gitignore index 0ceab59a0b..71c7b4895c 100644 --- a/.gitignore +++ b/.gitignore @@ -159,6 +159,7 @@ config/env.json config/client/sass-compile.json config/client/frame-runner.json config/client/test-evaluator.json +config/curriculum.json ### Additional Files ### *.csv diff --git a/.gitpod.yml b/.gitpod.yml index da48f0874f..9a0187b91d 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -40,6 +40,7 @@ tasks: mongo --eval "db.fsyncLock(); db.fsyncUnlock()" command: > npm run ensure-env && + npm run build:curriculum && gp await-port 27017 && npm run develop:server diff --git a/api-server/package-lock.json b/api-server/package-lock.json index 8ab28d3f71..1dd37d45f9 100644 --- a/api-server/package-lock.json +++ b/api-server/package-lock.json @@ -4922,10 +4922,9 @@ "dev": true }, "@types/passport": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.0.tgz", - "integrity": "sha512-R2FXqM+AgsMIym0PuKj08Ybx+GR6d2rU3b1/8OcHolJ+4ga2pRPX105wboV6hq1AJvMo2frQzYKdqXS5+4cyMw==", - "dev": true, + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.5.tgz", + "integrity": "sha512-wNL4kT/5rnZgyGkqX7V2qH/R/te+bklv+nXcvHzyX99vNggx9DGN+F8CEOW3P/gRi7Cjm991uidRgTHsYkSuMg==", "requires": { "@types/express": "*" } @@ -4936,6 +4935,11 @@ "integrity": "sha512-UEyp8LwZ4Dg30kVU2Q3amHHyTn1jEdhCIE59ANed76GaT1Vp76DD3ZWSAxgCrw6wJ0TqeoBpqmfUHiUDPs//HQ==", "dev": true }, + "@types/qs": { + "version": "6.9.5", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.5.tgz", + "integrity": "sha512-/JHkVHtx/REVG0VVToGRGH2+23hsYLHdyG+GrvoUGlGAd0ErauXDyvHtRI/7H7mzLm+tBCKA7pfcpkQ1lf58iQ==" + }, "@types/range-parser": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.2.tgz", @@ -6458,7 +6462,6 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", - "dev": true, "requires": { "cross-spawn": "^7.0.1" } @@ -6908,6 +6911,11 @@ "is-symbol": "^1.0.2" } }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, "es6-promisify": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", @@ -15176,7 +15184,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/passport-mock-strategy/-/passport-mock-strategy-2.0.0.tgz", "integrity": "sha512-9YUT0sja/7n+HfQ+Jwx4XETERRh1uciRjpHhEZMcYS1FBnMrfrSlKVS42bMU06ewSFiPhXztazAE6XwiZdZQ/g==", - "dev": true, "requires": { "@types/express": "^4.16.1", "@types/passport": "^1.0.0", @@ -15185,21 +15192,25 @@ }, "dependencies": { "@types/express": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.0.tgz", - "integrity": "sha512-CjaMu57cjgjuZbh9DpkloeGxV45CnMGlVd+XpG7Gm9QgVrd7KFq+X4HY0vM+2v0bczS48Wg7bvnMY5TN+Xmcfw==", - "dev": true, + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.11.tgz", + "integrity": "sha512-no+R6rW60JEc59977wIxreQVsIEOAYwgCqldrA/vkpCnbD7MqTefO97lmoBe4WE0F156bC4uLSP1XHDOySnChg==", "requires": { "@types/body-parser": "*", - "@types/express-serve-static-core": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", "@types/serve-static": "*" } }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true + "@types/express-serve-static-core": { + "version": "4.17.18", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.18.tgz", + "integrity": "sha512-m4JTwx5RUBNZvky/JJ8swEJPKFd8si08pPF2PfizYjGZOKr/svUWPcoUmLow6MmPzhasphB7gSTINY67xn3JNA==", + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } } } }, diff --git a/api-server/package.json b/api-server/package.json index a001a054b9..e6b5d1f633 100644 --- a/api-server/package.json +++ b/api-server/package.json @@ -4,11 +4,10 @@ "version": "0.0.1", "repository": "freecodecamp/freecodecamp", "scripts": { - "develop": "cross-env DEBUG=fcc* node development-start.js", - "babel-dev-server": "babel-node --inspect=0.0.0.0 ./server/index.js", - "build": "babel server --out-dir lib --ignore 'node_modules /**/*','/**/*.test.js' --copy-files", - "ensure-env": "node ../tools/scripts/build/ensure-env.js", - "start": "cross-env DEBUG=fcc* node production-start.js", + "develop": "cross-env DEBUG=fcc* node src/development-start.js", + "babel-dev-server": "babel-node --inspect=0.0.0.0 ./src/server/index.js", + "build": "babel src --out-dir lib --ignore 'node_modules /**/*','/**/*.test.js' --copy-files", + "start": "cross-env DEBUG=fcc* node lib/production-start.js", "test": "jest" }, "license": "BSD-3-Clause", @@ -23,6 +22,7 @@ "connect-mongo": "^3.2.0", "cookie-parser": "^1.4.5", "cors": "^2.8.5", + "cross-env": "^7.0.3", "csurf": "^1.11.0", "d3": "~3.5.17", "date-fns": "^1.30.1", @@ -51,6 +51,7 @@ "passport-auth0": "^1.4.0", "passport-local": "^1.0.0", "query-string": "^6.14.0", + "passport-mock-strategy": "^2.0.0", "rx": "^4.1.0", "stripe": "^6.36.0", "uuid": "^3.4.0", @@ -69,11 +70,9 @@ "babel-jest": "^24.9.0", "babel-plugin-transform-function-bind": "^6.22.0", "babel-plugin-transform-imports": "^1.5.1", - "cross-env": "^7.0.3", "jest": "^26.6.3", "loopback-component-explorer": "^6.4.0", "nodemon": "^2.0.7", - "passport-mock-strategy": "^2.0.0", "smee-client": "^1.2.2" }, "resolutions": { diff --git a/api-server/server/utils/get-curriculum.js b/api-server/server/utils/get-curriculum.js deleted file mode 100644 index ed1deabbc3..0000000000 --- a/api-server/server/utils/get-curriculum.js +++ /dev/null @@ -1,30 +0,0 @@ -import { flatten } from 'lodash'; - -import { getChallengesForLang } from '../../../curriculum/getChallenges'; - -// TODO: this caching is handy if we want to field requests that need to 'query' -// the curriculum, but if we force the client to handle -// redirectToCurrentChallenge and, instead, only report the current challenge -// id via the user object, then we should *not* store this so it can be garbage -// collected. - -let curriculum; -export async function getCurriculum() { - // NOTE: this is always 'english' because we are only interested in the slugs - // and those should not change between the languages. - curriculum = curriculum ? curriculum : getChallengesForLang('english'); - return curriculum; -} - -export async function getChallenges() { - return getCurriculum().then(curriculum => { - return Object.keys(curriculum) - .map(key => curriculum[key].blocks) - .reduce((challengeArray, superBlock) => { - const challengesForBlock = Object.keys(superBlock).map( - key => superBlock[key].challenges - ); - return [...challengeArray, ...flatten(challengesForBlock)]; - }, []); - }); -} diff --git a/api-server/common/config.global.js b/api-server/src/common/config.global.js similarity index 100% rename from api-server/common/config.global.js rename to api-server/src/common/config.global.js diff --git a/api-server/common/index.less b/api-server/src/common/index.less similarity index 100% rename from api-server/common/index.less rename to api-server/src/common/index.less diff --git a/api-server/common/models/User-Credential.js b/api-server/src/common/models/User-Credential.js similarity index 100% rename from api-server/common/models/User-Credential.js rename to api-server/src/common/models/User-Credential.js diff --git a/api-server/common/models/User-Credential.json b/api-server/src/common/models/User-Credential.json similarity index 100% rename from api-server/common/models/User-Credential.json rename to api-server/src/common/models/User-Credential.json diff --git a/api-server/common/models/User-Identity.js b/api-server/src/common/models/User-Identity.js similarity index 100% rename from api-server/common/models/User-Identity.js rename to api-server/src/common/models/User-Identity.js diff --git a/api-server/common/models/User-Identity.json b/api-server/src/common/models/User-Identity.json similarity index 100% rename from api-server/common/models/User-Identity.json rename to api-server/src/common/models/User-Identity.json diff --git a/api-server/common/models/User-Identity.test.js b/api-server/src/common/models/User-Identity.test.js similarity index 100% rename from api-server/common/models/User-Identity.test.js rename to api-server/src/common/models/User-Identity.test.js diff --git a/api-server/common/models/article.js b/api-server/src/common/models/article.js similarity index 100% rename from api-server/common/models/article.js rename to api-server/src/common/models/article.js diff --git a/api-server/common/models/article.json b/api-server/src/common/models/article.json similarity index 100% rename from api-server/common/models/article.json rename to api-server/src/common/models/article.json diff --git a/api-server/common/models/block.js b/api-server/src/common/models/block.js similarity index 100% rename from api-server/common/models/block.js rename to api-server/src/common/models/block.js diff --git a/api-server/common/models/block.json b/api-server/src/common/models/block.json similarity index 100% rename from api-server/common/models/block.json rename to api-server/src/common/models/block.json diff --git a/api-server/common/models/challenge.json b/api-server/src/common/models/challenge.json similarity index 100% rename from api-server/common/models/challenge.json rename to api-server/src/common/models/challenge.json diff --git a/api-server/common/models/nonprofit.json b/api-server/src/common/models/nonprofit.json similarity index 100% rename from api-server/common/models/nonprofit.json rename to api-server/src/common/models/nonprofit.json diff --git a/api-server/common/models/pledge.json b/api-server/src/common/models/pledge.json similarity index 100% rename from api-server/common/models/pledge.json rename to api-server/src/common/models/pledge.json diff --git a/api-server/common/models/popularity.js b/api-server/src/common/models/popularity.js similarity index 100% rename from api-server/common/models/popularity.js rename to api-server/src/common/models/popularity.js diff --git a/api-server/common/models/popularity.json b/api-server/src/common/models/popularity.json similarity index 100% rename from api-server/common/models/popularity.json rename to api-server/src/common/models/popularity.json diff --git a/api-server/common/models/user.js b/api-server/src/common/models/user.js similarity index 99% rename from api-server/common/models/user.js rename to api-server/src/common/models/user.js index 9a4fd059f6..162643049d 100644 --- a/api-server/common/models/user.js +++ b/api-server/src/common/models/user.js @@ -15,7 +15,7 @@ import _ from 'lodash'; import generate from 'nanoid/generate'; import badwordFilter from 'bad-words'; -import { apiLocation } from '../../../config/env'; +import { apiLocation } from '../../../../config/env'; import { fixCompletedChallengeItem, diff --git a/api-server/common/models/user.json b/api-server/src/common/models/user.json similarity index 100% rename from api-server/common/models/user.json rename to api-server/src/common/models/user.json diff --git a/api-server/common/utils/auth.js b/api-server/src/common/utils/auth.js similarity index 100% rename from api-server/common/utils/auth.js rename to api-server/src/common/utils/auth.js diff --git a/api-server/common/utils/constantStrings.json b/api-server/src/common/utils/constantStrings.json similarity index 100% rename from api-server/common/utils/constantStrings.json rename to api-server/src/common/utils/constantStrings.json diff --git a/api-server/common/utils/empty-protector.js b/api-server/src/common/utils/empty-protector.js similarity index 100% rename from api-server/common/utils/empty-protector.js rename to api-server/src/common/utils/empty-protector.js diff --git a/api-server/common/utils/flash.js b/api-server/src/common/utils/flash.js similarity index 100% rename from api-server/common/utils/flash.js rename to api-server/src/common/utils/flash.js diff --git a/api-server/common/utils/index.js b/api-server/src/common/utils/index.js similarity index 100% rename from api-server/common/utils/index.js rename to api-server/src/common/utils/index.js diff --git a/api-server/common/utils/legacyProjectData.js b/api-server/src/common/utils/legacyProjectData.js similarity index 100% rename from api-server/common/utils/legacyProjectData.js rename to api-server/src/common/utils/legacyProjectData.js diff --git a/api-server/common/utils/themes.js b/api-server/src/common/utils/themes.js similarity index 100% rename from api-server/common/utils/themes.js rename to api-server/src/common/utils/themes.js diff --git a/api-server/development-start.js b/api-server/src/development-start.js similarity index 93% rename from api-server/development-start.js rename to api-server/src/development-start.js index e2fc41f0d8..dbae1cd766 100644 --- a/api-server/development-start.js +++ b/api-server/src/development-start.js @@ -1,5 +1,5 @@ const path = require('path'); -require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); +require('dotenv').config({ path: path.resolve(__dirname, '../../.env') }); const nodemon = require('nodemon'); const SmeeClient = require('smee-client'); diff --git a/api-server/production-start.js b/api-server/src/production-start.js similarity index 96% rename from api-server/production-start.js rename to api-server/src/production-start.js index a1d27e974c..6d05d65c1a 100644 --- a/api-server/production-start.js +++ b/api-server/src/production-start.js @@ -1,5 +1,4 @@ // this ensures node understands the future -require('@babel/register'); const _ = require('lodash'); const createDebugger = require('debug'); diff --git a/api-server/public/browserconfig.xml b/api-server/src/public/browserconfig.xml similarity index 96% rename from api-server/public/browserconfig.xml rename to api-server/src/public/browserconfig.xml index 761c736987..481e166ce8 100644 --- a/api-server/public/browserconfig.xml +++ b/api-server/src/public/browserconfig.xml @@ -1,12 +1,12 @@ - - - - - - - - - #492c14 - - - + + + + + + + + + #492c14 + + + diff --git a/api-server/public/favicon.ico b/api-server/src/public/favicon.ico similarity index 100% rename from api-server/public/favicon.ico rename to api-server/src/public/favicon.ico diff --git a/api-server/public/fonts/Lato-Bold.ttf b/api-server/src/public/fonts/Lato-Bold.ttf similarity index 100% rename from api-server/public/fonts/Lato-Bold.ttf rename to api-server/src/public/fonts/Lato-Bold.ttf diff --git a/api-server/public/fonts/Lato-Light.ttf b/api-server/src/public/fonts/Lato-Light.ttf similarity index 100% rename from api-server/public/fonts/Lato-Light.ttf rename to api-server/src/public/fonts/Lato-Light.ttf diff --git a/api-server/public/fonts/Lato-Regular.ttf b/api-server/src/public/fonts/Lato-Regular.ttf similarity index 100% rename from api-server/public/fonts/Lato-Regular.ttf rename to api-server/src/public/fonts/Lato-Regular.ttf diff --git a/api-server/public/fonts/Ubuntu-Regular.ttf b/api-server/src/public/fonts/Ubuntu-Regular.ttf similarity index 100% rename from api-server/public/fonts/Ubuntu-Regular.ttf rename to api-server/src/public/fonts/Ubuntu-Regular.ttf diff --git a/api-server/public/fonts/UbuntuMono-Regular.ttf b/api-server/src/public/fonts/UbuntuMono-Regular.ttf similarity index 100% rename from api-server/public/fonts/UbuntuMono-Regular.ttf rename to api-server/src/public/fonts/UbuntuMono-Regular.ttf diff --git a/api-server/public/fonts/glyphicons-halflings-regular.eot b/api-server/src/public/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from api-server/public/fonts/glyphicons-halflings-regular.eot rename to api-server/src/public/fonts/glyphicons-halflings-regular.eot diff --git a/api-server/public/fonts/saxmono.ttf b/api-server/src/public/fonts/saxmono.ttf similarity index 100% rename from api-server/public/fonts/saxmono.ttf rename to api-server/src/public/fonts/saxmono.ttf diff --git a/api-server/public/images/freeCodeCamp-puck.svg b/api-server/src/public/images/freeCodeCamp-puck.svg similarity index 100% rename from api-server/public/images/freeCodeCamp-puck.svg rename to api-server/src/public/images/freeCodeCamp-puck.svg diff --git a/api-server/public/js/.jshintrc b/api-server/src/public/js/.jshintrc similarity index 100% rename from api-server/public/js/.jshintrc rename to api-server/src/public/js/.jshintrc diff --git a/api-server/public/js/calculator.js b/api-server/src/public/js/calculator.js similarity index 100% rename from api-server/public/js/calculator.js rename to api-server/src/public/js/calculator.js diff --git a/api-server/public/js/lib/fontawesome/fa-brands.js b/api-server/src/public/js/lib/fontawesome/fa-brands.js similarity index 100% rename from api-server/public/js/lib/fontawesome/fa-brands.js rename to api-server/src/public/js/lib/fontawesome/fa-brands.js diff --git a/api-server/public/js/lib/fontawesome/fa-brands.min.js b/api-server/src/public/js/lib/fontawesome/fa-brands.min.js similarity index 100% rename from api-server/public/js/lib/fontawesome/fa-brands.min.js rename to api-server/src/public/js/lib/fontawesome/fa-brands.min.js diff --git a/api-server/public/js/lib/fontawesome/fa-regular.js b/api-server/src/public/js/lib/fontawesome/fa-regular.js similarity index 100% rename from api-server/public/js/lib/fontawesome/fa-regular.js rename to api-server/src/public/js/lib/fontawesome/fa-regular.js diff --git a/api-server/public/js/lib/fontawesome/fa-regular.min.js b/api-server/src/public/js/lib/fontawesome/fa-regular.min.js similarity index 100% rename from api-server/public/js/lib/fontawesome/fa-regular.min.js rename to api-server/src/public/js/lib/fontawesome/fa-regular.min.js diff --git a/api-server/public/js/lib/fontawesome/fa-solid.js b/api-server/src/public/js/lib/fontawesome/fa-solid.js similarity index 100% rename from api-server/public/js/lib/fontawesome/fa-solid.js rename to api-server/src/public/js/lib/fontawesome/fa-solid.js diff --git a/api-server/public/js/lib/fontawesome/fa-solid.min.js b/api-server/src/public/js/lib/fontawesome/fa-solid.min.js similarity index 100% rename from api-server/public/js/lib/fontawesome/fa-solid.min.js rename to api-server/src/public/js/lib/fontawesome/fa-solid.min.js diff --git a/api-server/public/js/lib/fontawesome/fontawesome-all.js b/api-server/src/public/js/lib/fontawesome/fontawesome-all.js similarity index 100% rename from api-server/public/js/lib/fontawesome/fontawesome-all.js rename to api-server/src/public/js/lib/fontawesome/fontawesome-all.js diff --git a/api-server/public/js/lib/fontawesome/fontawesome-all.min.js b/api-server/src/public/js/lib/fontawesome/fontawesome-all.min.js similarity index 100% rename from api-server/public/js/lib/fontawesome/fontawesome-all.min.js rename to api-server/src/public/js/lib/fontawesome/fontawesome-all.min.js diff --git a/api-server/public/js/lib/fontawesome/fontawesome.js b/api-server/src/public/js/lib/fontawesome/fontawesome.js similarity index 100% rename from api-server/public/js/lib/fontawesome/fontawesome.js rename to api-server/src/public/js/lib/fontawesome/fontawesome.js diff --git a/api-server/public/js/lib/fontawesome/fontawesome.min.js b/api-server/src/public/js/lib/fontawesome/fontawesome.min.js similarity index 100% rename from api-server/public/js/lib/fontawesome/fontawesome.min.js rename to api-server/src/public/js/lib/fontawesome/fontawesome.min.js diff --git a/api-server/public/json/bootcamps.json b/api-server/src/public/json/bootcamps.json similarity index 100% rename from api-server/public/json/bootcamps.json rename to api-server/src/public/json/bootcamps.json diff --git a/api-server/public/json/cats.json b/api-server/src/public/json/cats.json similarity index 100% rename from api-server/public/json/cats.json rename to api-server/src/public/json/cats.json diff --git a/api-server/public/robots.txt b/api-server/src/public/robots.txt similarity index 100% rename from api-server/public/robots.txt rename to api-server/src/public/robots.txt diff --git a/api-server/server/README.md b/api-server/src/server/README.md similarity index 100% rename from api-server/server/README.md rename to api-server/src/server/README.md diff --git a/api-server/server/boot/a-extend-built-ins.js b/api-server/src/server/boot/a-extend-built-ins.js similarity index 100% rename from api-server/server/boot/a-extend-built-ins.js rename to api-server/src/server/boot/a-extend-built-ins.js diff --git a/api-server/server/boot/a-increase-listeners.js b/api-server/src/server/boot/a-increase-listeners.js similarity index 100% rename from api-server/server/boot/a-increase-listeners.js rename to api-server/src/server/boot/a-increase-listeners.js diff --git a/api-server/server/boot/authentication.js b/api-server/src/server/boot/authentication.js similarity index 99% rename from api-server/server/boot/authentication.js rename to api-server/src/server/boot/authentication.js index 8e8c65aa40..e407cd4646 100644 --- a/api-server/server/boot/authentication.js +++ b/api-server/src/server/boot/authentication.js @@ -4,7 +4,7 @@ import { check } from 'express-validator'; import { isEmail } from 'validator'; import jwt from 'jsonwebtoken'; -import { jwtSecret } from '../../../config/secrets'; +import { jwtSecret } from '../../../../config/secrets'; import { createPassportCallbackAuthenticator, diff --git a/api-server/server/boot/certificate.js b/api-server/src/server/boot/certificate.js similarity index 96% rename from api-server/server/boot/certificate.js rename to api-server/src/server/boot/certificate.js index 47f042ee83..48e5bac58c 100644 --- a/api-server/server/boot/certificate.js +++ b/api-server/src/server/boot/certificate.js @@ -20,7 +20,7 @@ import { certTypeIdMap, certIds, oldDataVizId -} from '../../../config/certification-settings'; +} from '../../../../config/certification-settings'; const { legacyFrontEndChallengeId, @@ -42,21 +42,18 @@ const { const log = debug('fcc:certification'); -export default function bootCertificate(app, done) { +export default function bootCertificate(app) { const api = app.loopback.Router(); // TODO: rather than getting all the challenges, then grabbing the certs, // consider just getting the certs. - getChallenges().then(allChallenges => { - const certTypeIds = createCertTypeIds(allChallenges); - const showCert = createShowCert(app); - const verifyCert = createVerifyCert(certTypeIds, app); + const certTypeIds = createCertTypeIds(getChallenges()); + const showCert = createShowCert(app); + const verifyCert = createVerifyCert(certTypeIds, app); - api.put('/certificate/verify', ifNoUser401, ifNoSuperBlock404, verifyCert); - api.get('/certificate/showCert/:username/:cert', showCert); + api.put('/certificate/verify', ifNoUser401, ifNoSuperBlock404, verifyCert); + api.get('/certificate/showCert/:username/:cert', showCert); - app.use(api); - done(); - }); + app.use(api); } export function getFallbackFrontEndDate(completedChallenges, completedDate) { diff --git a/api-server/server/boot/challenge.js b/api-server/src/server/boot/challenge.js similarity index 99% rename from api-server/server/boot/challenge.js rename to api-server/src/server/boot/challenge.js index 16b930a7a3..a0bdcc5602 100644 --- a/api-server/server/boot/challenge.js +++ b/api-server/src/server/boot/challenge.js @@ -28,7 +28,7 @@ export default async function bootChallenge(app, done) { const api = app.loopback.Router(); const router = app.loopback.Router(); const challengeUrlResolver = await createChallengeUrlResolver( - await getChallenges() + getChallenges() ); const redirectToCurrentChallenge = createRedirectToCurrentChallenge( challengeUrlResolver, diff --git a/api-server/server/boot/donate.js b/api-server/src/server/boot/donate.js similarity index 98% rename from api-server/server/boot/donate.js rename to api-server/src/server/boot/donate.js index a3788bca81..46c9bb1c66 100644 --- a/api-server/server/boot/donate.js +++ b/api-server/src/server/boot/donate.js @@ -12,8 +12,8 @@ import { durationKeysConfig, donationOneTimeConfig, donationSubscriptionConfig -} from '../../../config/donation-settings'; -import keys from '../../../config/secrets'; +} from '../../../../config/donation-settings'; +import keys from '../../../../config/secrets'; const log = debug('fcc:boot:donate'); diff --git a/api-server/server/boot/explorer.js b/api-server/src/server/boot/explorer.js similarity index 100% rename from api-server/server/boot/explorer.js rename to api-server/src/server/boot/explorer.js diff --git a/api-server/server/boot/news.js b/api-server/src/server/boot/news.js similarity index 100% rename from api-server/server/boot/news.js rename to api-server/src/server/boot/news.js diff --git a/api-server/server/boot/randomAPIs.js b/api-server/src/server/boot/randomAPIs.js similarity index 98% rename from api-server/server/boot/randomAPIs.js rename to api-server/src/server/boot/randomAPIs.js index ed6e4ae2a3..13bbbbe71c 100644 --- a/api-server/server/boot/randomAPIs.js +++ b/api-server/src/server/boot/randomAPIs.js @@ -1,6 +1,6 @@ import request from 'request'; -import { gitHubUserAgent } from '../../../config/misc'; +import { gitHubUserAgent } from '../../../../config/misc'; import { getRedirectParams } from '../utils/redirection'; const githubClient = process.env.GITHUB_ID; diff --git a/api-server/server/boot/restApi.js b/api-server/src/server/boot/restApi.js similarity index 100% rename from api-server/server/boot/restApi.js rename to api-server/src/server/boot/restApi.js diff --git a/api-server/server/boot/sentry-debug.js b/api-server/src/server/boot/sentry-debug.js similarity index 100% rename from api-server/server/boot/sentry-debug.js rename to api-server/src/server/boot/sentry-debug.js diff --git a/api-server/server/boot/settings.js b/api-server/src/server/boot/settings.js similarity index 99% rename from api-server/server/boot/settings.js rename to api-server/src/server/boot/settings.js index c844d3b183..7b051464db 100644 --- a/api-server/server/boot/settings.js +++ b/api-server/src/server/boot/settings.js @@ -4,7 +4,7 @@ import { check } from 'express-validator'; import { ifNoUser401, createValidatorErrorHandler } from '../utils/middleware'; import { themes } from '../../common/utils/themes.js'; import { alertTypes } from '../../common/utils/flash.js'; -import { isValidUsername } from '../../../utils/validate'; +import { isValidUsername } from '../../../../utils/validate'; const log = debug('fcc:boot:settings'); diff --git a/api-server/server/boot/status.js b/api-server/src/server/boot/status.js similarity index 100% rename from api-server/server/boot/status.js rename to api-server/src/server/boot/status.js diff --git a/api-server/server/boot/t-wiki.js b/api-server/src/server/boot/t-wiki.js similarity index 100% rename from api-server/server/boot/t-wiki.js rename to api-server/src/server/boot/t-wiki.js diff --git a/api-server/server/boot/user.js b/api-server/src/server/boot/user.js similarity index 100% rename from api-server/server/boot/user.js rename to api-server/src/server/boot/user.js diff --git a/api-server/server/boot/z-not-found.js b/api-server/src/server/boot/z-not-found.js similarity index 100% rename from api-server/server/boot/z-not-found.js rename to api-server/src/server/boot/z-not-found.js diff --git a/api-server/server/boot_tests/README.md b/api-server/src/server/boot_tests/README.md similarity index 100% rename from api-server/server/boot_tests/README.md rename to api-server/src/server/boot_tests/README.md diff --git a/api-server/server/boot_tests/certificate.test.js b/api-server/src/server/boot_tests/certificate.test.js similarity index 100% rename from api-server/server/boot_tests/certificate.test.js rename to api-server/src/server/boot_tests/certificate.test.js diff --git a/api-server/server/boot_tests/challenge.test.js b/api-server/src/server/boot_tests/challenge.test.js similarity index 100% rename from api-server/server/boot_tests/challenge.test.js rename to api-server/src/server/boot_tests/challenge.test.js diff --git a/api-server/server/boot_tests/fixtures.js b/api-server/src/server/boot_tests/fixtures.js similarity index 100% rename from api-server/server/boot_tests/fixtures.js rename to api-server/src/server/boot_tests/fixtures.js diff --git a/api-server/server/component-passport.js b/api-server/src/server/component-passport.js similarity index 98% rename from api-server/server/component-passport.js rename to api-server/src/server/component-passport.js index 891592b3e8..8634024501 100644 --- a/api-server/server/component-passport.js +++ b/api-server/src/server/component-passport.js @@ -9,13 +9,13 @@ import dedent from 'dedent'; import { getUserById } from './utils/user-stats'; import passportProviders from './passport-providers'; import { setAccessTokenToResponse } from './utils/getSetAccessToken'; -import { jwtSecret } from '../../config/secrets'; import { getReturnTo, getRedirectBase, getRedirectParams, isRootPath } from './utils/redirection'; +import { jwtSecret } from '../../../config/secrets'; const passportOptions = { emailOptional: true, diff --git a/api-server/server/config.development.js b/api-server/src/server/config.development.js similarity index 100% rename from api-server/server/config.development.js rename to api-server/src/server/config.development.js diff --git a/api-server/server/config.json b/api-server/src/server/config.json similarity index 100% rename from api-server/server/config.json rename to api-server/src/server/config.json diff --git a/api-server/server/config.local.js b/api-server/src/server/config.local.js similarity index 100% rename from api-server/server/config.local.js rename to api-server/src/server/config.local.js diff --git a/api-server/server/config.production.js b/api-server/src/server/config.production.js similarity index 100% rename from api-server/server/config.production.js rename to api-server/src/server/config.production.js diff --git a/api-server/server/datasources.development.js b/api-server/src/server/datasources.development.js similarity index 100% rename from api-server/server/datasources.development.js rename to api-server/src/server/datasources.development.js diff --git a/api-server/server/datasources.json b/api-server/src/server/datasources.json similarity index 100% rename from api-server/server/datasources.json rename to api-server/src/server/datasources.json diff --git a/api-server/server/datasources.production.js b/api-server/src/server/datasources.production.js similarity index 87% rename from api-server/server/datasources.production.js rename to api-server/src/server/datasources.production.js index 45688d85ac..8888a70ba6 100644 --- a/api-server/server/datasources.production.js +++ b/api-server/src/server/datasources.production.js @@ -1,4 +1,4 @@ -var secrets = require('../../config/secrets'); +var secrets = require('../../../config/secrets'); module.exports = { db: { diff --git a/api-server/server/index.js b/api-server/src/server/index.js similarity index 97% rename from api-server/server/index.js rename to api-server/src/server/index.js index bb309d28e9..01ac88bb6d 100755 --- a/api-server/server/index.js +++ b/api-server/src/server/index.js @@ -1,5 +1,5 @@ const path = require('path'); -require('dotenv').config({ path: path.resolve(__dirname, '../../.env') }); +require('dotenv').config({ path: path.resolve(__dirname, '../../../.env') }); const _ = require('lodash'); const Rx = require('rx'); @@ -9,7 +9,7 @@ const createDebugger = require('debug'); const morgan = require('morgan'); const Sentry = require('@sentry/node'); -const { sentry } = require('../../config/secrets'); +const { sentry } = require('../../../config/secrets'); const { setupPassport } = require('./component-passport'); const log = createDebugger('fcc:server'); diff --git a/api-server/server/manifests/README.md b/api-server/src/server/manifests/README.md similarity index 100% rename from api-server/server/manifests/README.md rename to api-server/src/server/manifests/README.md diff --git a/api-server/server/middleware.json b/api-server/src/server/middleware.json similarity index 100% rename from api-server/server/middleware.json rename to api-server/src/server/middleware.json diff --git a/api-server/server/middlewares/constant-headers.js b/api-server/src/server/middlewares/constant-headers.js similarity index 81% rename from api-server/server/middlewares/constant-headers.js rename to api-server/src/server/middlewares/constant-headers.js index 4f77b0d9cf..05fb1cfe05 100644 --- a/api-server/server/middlewares/constant-headers.js +++ b/api-server/src/server/middlewares/constant-headers.js @@ -1,5 +1,5 @@ -import { homeLocation } from '../../../config/env'; -import { allowedOrigins } from '../../../config/cors-settings'; +import { homeLocation } from '../../../../config/env'; +import { allowedOrigins } from '../../../../config/cors-settings'; export default function constantHeaders() { return function(req, res, next) { diff --git a/api-server/server/middlewares/cookie-parser.js b/api-server/src/server/middlewares/cookie-parser.js similarity index 100% rename from api-server/server/middlewares/cookie-parser.js rename to api-server/src/server/middlewares/cookie-parser.js diff --git a/api-server/server/middlewares/csp.js b/api-server/src/server/middlewares/csp.js similarity index 97% rename from api-server/server/middlewares/csp.js rename to api-server/src/server/middlewares/csp.js index a8ce8dae5f..f32cb2ed1f 100644 --- a/api-server/server/middlewares/csp.js +++ b/api-server/src/server/middlewares/csp.js @@ -1,6 +1,6 @@ import helmet from 'helmet'; -import { homeLocation } from '../../../config/env'; +import { homeLocation } from '../../../../config/env'; let trusted = [ "'self'", diff --git a/api-server/server/middlewares/csurf.js b/api-server/src/server/middlewares/csurf.js similarity index 100% rename from api-server/server/middlewares/csurf.js rename to api-server/src/server/middlewares/csurf.js diff --git a/api-server/server/middlewares/error-handlers.js b/api-server/src/server/middlewares/error-handlers.js similarity index 100% rename from api-server/server/middlewares/error-handlers.js rename to api-server/src/server/middlewares/error-handlers.js diff --git a/api-server/server/middlewares/express-extensions.js b/api-server/src/server/middlewares/express-extensions.js similarity index 100% rename from api-server/server/middlewares/express-extensions.js rename to api-server/src/server/middlewares/express-extensions.js diff --git a/api-server/server/middlewares/flash-cheaters.js b/api-server/src/server/middlewares/flash-cheaters.js similarity index 100% rename from api-server/server/middlewares/flash-cheaters.js rename to api-server/src/server/middlewares/flash-cheaters.js diff --git a/api-server/server/middlewares/passport-login.js b/api-server/src/server/middlewares/passport-login.js similarity index 100% rename from api-server/server/middlewares/passport-login.js rename to api-server/src/server/middlewares/passport-login.js diff --git a/api-server/server/middlewares/request-authorization.js b/api-server/src/server/middlewares/request-authorization.js similarity index 97% rename from api-server/server/middlewares/request-authorization.js rename to api-server/src/server/middlewares/request-authorization.js index 9674a9765c..dea99d9423 100644 --- a/api-server/server/middlewares/request-authorization.js +++ b/api-server/src/server/middlewares/request-authorization.js @@ -6,7 +6,7 @@ import { errorTypes, authHeaderNS } from '../utils/getSetAccessToken'; -import { jwtSecret as _jwtSecret } from '../../../config/secrets'; +import { jwtSecret as _jwtSecret } from '../../../../config/secrets'; import { wrapHandledError } from '../utils/create-handled-error'; import { getRedirectParams } from '../utils/redirection'; diff --git a/api-server/server/middlewares/request-authorization.test.js b/api-server/src/server/middlewares/request-authorization.test.js similarity index 99% rename from api-server/server/middlewares/request-authorization.test.js rename to api-server/src/server/middlewares/request-authorization.test.js index 22962a8f45..f71c43ccfa 100644 --- a/api-server/server/middlewares/request-authorization.test.js +++ b/api-server/src/server/middlewares/request-authorization.test.js @@ -3,7 +3,7 @@ import sinon from 'sinon'; import { mockReq as mockRequest, mockRes } from 'sinon-express-mock'; import jwt from 'jsonwebtoken'; -import { homeLocation } from '../../../config/env.json'; +import { homeLocation } from '../../../../config/env'; import createRequestAuthorization, { isAllowedPath } from './request-authorization'; diff --git a/api-server/server/middlewares/sentry-error-handler.js b/api-server/src/server/middlewares/sentry-error-handler.js similarity index 93% rename from api-server/server/middlewares/sentry-error-handler.js rename to api-server/src/server/middlewares/sentry-error-handler.js index 6a5c5b64d5..1a28433128 100644 --- a/api-server/server/middlewares/sentry-error-handler.js +++ b/api-server/src/server/middlewares/sentry-error-handler.js @@ -1,5 +1,5 @@ import { Handlers, captureException } from '@sentry/node'; -import { sentry } from '../../../config/secrets'; +import { sentry } from '../../../../config/secrets'; import { isHandledError } from '../utils/create-handled-error'; // sends directly to Sentry diff --git a/api-server/server/middlewares/sentry-request-handler.js b/api-server/src/server/middlewares/sentry-request-handler.js similarity index 79% rename from api-server/server/middlewares/sentry-request-handler.js rename to api-server/src/server/middlewares/sentry-request-handler.js index e9bd7551bf..a7a77bba3a 100644 --- a/api-server/server/middlewares/sentry-request-handler.js +++ b/api-server/src/server/middlewares/sentry-request-handler.js @@ -1,5 +1,5 @@ import { Handlers } from '@sentry/node'; -import { sentry } from '../../../config/secrets'; +import { sentry } from '../../../../config/secrets'; export default function sentryRequestHandler() { return sentry.dns === 'dsn_from_sentry_dashboard' diff --git a/api-server/server/middlewares/sessions.js b/api-server/src/server/middlewares/sessions.js similarity index 100% rename from api-server/server/middlewares/sessions.js rename to api-server/src/server/middlewares/sessions.js diff --git a/api-server/server/model-config.json b/api-server/src/server/model-config.json similarity index 100% rename from api-server/server/model-config.json rename to api-server/src/server/model-config.json diff --git a/api-server/server/models/about.js b/api-server/src/server/models/about.js similarity index 100% rename from api-server/server/models/about.js rename to api-server/src/server/models/about.js diff --git a/api-server/server/models/about.json b/api-server/src/server/models/about.json similarity index 100% rename from api-server/server/models/about.json rename to api-server/src/server/models/about.json diff --git a/api-server/server/models/auth-token.js b/api-server/src/server/models/auth-token.js similarity index 100% rename from api-server/server/models/auth-token.js rename to api-server/src/server/models/auth-token.js diff --git a/api-server/server/models/auth-token.json b/api-server/src/server/models/auth-token.json similarity index 100% rename from api-server/server/models/auth-token.json rename to api-server/src/server/models/auth-token.json diff --git a/api-server/server/models/donation.js b/api-server/src/server/models/donation.js similarity index 100% rename from api-server/server/models/donation.js rename to api-server/src/server/models/donation.js diff --git a/api-server/server/models/donation.json b/api-server/src/server/models/donation.json similarity index 100% rename from api-server/server/models/donation.json rename to api-server/src/server/models/donation.json diff --git a/api-server/server/passport-providers.js b/api-server/src/server/passport-providers.js similarity index 81% rename from api-server/server/passport-providers.js rename to api-server/src/server/passport-providers.js index 7ac4ffb0f3..403a1b463c 100644 --- a/api-server/server/passport-providers.js +++ b/api-server/src/server/passport-providers.js @@ -1,5 +1,5 @@ -import { auth0 } from '../../config/secrets'; -import { homeLocation, apiLocation } from '../../config/env'; +import { auth0 } from '../../../config/secrets'; +import { homeLocation, apiLocation } from '../../../config/env'; const { clientID, clientSecret, domain } = auth0; @@ -7,6 +7,8 @@ const { clientID, clientSecret, domain } = auth0; const successRedirect = `${homeLocation}/learn`; const failureRedirect = `${homeLocation}/signin`; +// TODO: can we remove passport-mock-strategy entirely in prod? That would let +// us make passport-mock-strategy a dev dep, as it should be. export default { devlogin: { authScheme: 'mock', diff --git a/api-server/server/rss/index.js b/api-server/src/server/rss/index.js similarity index 100% rename from api-server/server/rss/index.js rename to api-server/src/server/rss/index.js diff --git a/api-server/server/rss/lybsyn.js b/api-server/src/server/rss/lybsyn.js similarity index 100% rename from api-server/server/rss/lybsyn.js rename to api-server/src/server/rss/lybsyn.js diff --git a/api-server/server/utils/__mocks__/donation.js b/api-server/src/server/utils/__mocks__/donation.js similarity index 100% rename from api-server/server/utils/__mocks__/donation.js rename to api-server/src/server/utils/__mocks__/donation.js diff --git a/api-server/server/utils/about.js b/api-server/src/server/utils/about.js similarity index 100% rename from api-server/server/utils/about.js rename to api-server/src/server/utils/about.js diff --git a/api-server/server/utils/auth.js b/api-server/src/server/utils/auth.js similarity index 100% rename from api-server/server/utils/auth.js rename to api-server/src/server/utils/auth.js diff --git a/api-server/server/utils/bad-id-map.js b/api-server/src/server/utils/bad-id-map.js similarity index 100% rename from api-server/server/utils/bad-id-map.js rename to api-server/src/server/utils/bad-id-map.js diff --git a/api-server/server/utils/cast-to-observable.js b/api-server/src/server/utils/cast-to-observable.js similarity index 100% rename from api-server/server/utils/cast-to-observable.js rename to api-server/src/server/utils/cast-to-observable.js diff --git a/api-server/server/utils/certTypes.json b/api-server/src/server/utils/certTypes.json similarity index 100% rename from api-server/server/utils/certTypes.json rename to api-server/src/server/utils/certTypes.json diff --git a/api-server/server/utils/constants.js b/api-server/src/server/utils/constants.js similarity index 100% rename from api-server/server/utils/constants.js rename to api-server/src/server/utils/constants.js diff --git a/api-server/server/utils/cookieConfig.js b/api-server/src/server/utils/cookieConfig.js similarity index 100% rename from api-server/server/utils/cookieConfig.js rename to api-server/src/server/utils/cookieConfig.js diff --git a/api-server/server/utils/create-handled-error.js b/api-server/src/server/utils/create-handled-error.js similarity index 100% rename from api-server/server/utils/create-handled-error.js rename to api-server/src/server/utils/create-handled-error.js diff --git a/api-server/server/utils/date-utils.js b/api-server/src/server/utils/date-utils.js similarity index 100% rename from api-server/server/utils/date-utils.js rename to api-server/src/server/utils/date-utils.js diff --git a/api-server/server/utils/date-utils.test.js b/api-server/src/server/utils/date-utils.test.js similarity index 100% rename from api-server/server/utils/date-utils.test.js rename to api-server/src/server/utils/date-utils.test.js diff --git a/api-server/server/utils/donation.js b/api-server/src/server/utils/donation.js similarity index 98% rename from api-server/server/utils/donation.js rename to api-server/src/server/utils/donation.js index c8d0103e8a..fb31254483 100644 --- a/api-server/server/utils/donation.js +++ b/api-server/src/server/utils/donation.js @@ -1,7 +1,7 @@ /* eslint-disable camelcase */ import axios from 'axios'; import debug from 'debug'; -import keys from '../../../config/secrets'; +import keys from '../../../../config/secrets'; const log = debug('fcc:boot:donate'); diff --git a/api-server/server/utils/donation.test.js b/api-server/src/server/utils/donation.test.js similarity index 99% rename from api-server/server/utils/donation.test.js rename to api-server/src/server/utils/donation.test.js index 28949a39c2..86b3332cfd 100644 --- a/api-server/server/utils/donation.test.js +++ b/api-server/src/server/utils/donation.test.js @@ -3,7 +3,7 @@ /* global jest*/ import axios from 'axios'; -import keys from '../../../config/secrets'; +import keys from '../../../../config/secrets'; import { getAsyncPaypalToken, verifyWebHook, diff --git a/api-server/src/server/utils/get-curriculum.js b/api-server/src/server/utils/get-curriculum.js new file mode 100644 index 0000000000..e9968deedd --- /dev/null +++ b/api-server/src/server/utils/get-curriculum.js @@ -0,0 +1,20 @@ +import { flatten } from 'lodash'; + +// TODO: keeping curriculum in memory is handy if we want to field requests that +// need to 'query' the curriculum, but if we force the client to handle +// redirectToCurrentChallenge and, instead, only report the current challenge id +// via the user object, then we should *not* store this so it can be garbage +// collected. + +import curriculum from '../../../../config/curriculum.json'; + +export function getChallenges() { + return Object.keys(curriculum) + .map(key => curriculum[key].blocks) + .reduce((challengeArray, superBlock) => { + const challengesForBlock = Object.keys(superBlock).map( + key => superBlock[key].challenges + ); + return [...challengeArray, ...flatten(challengesForBlock)]; + }, []); +} diff --git a/api-server/server/utils/getDynamicPropsForUser.js b/api-server/src/server/utils/getDynamicPropsForUser.js similarity index 100% rename from api-server/server/utils/getDynamicPropsForUser.js rename to api-server/src/server/utils/getDynamicPropsForUser.js diff --git a/api-server/server/utils/getSetAccessToken.js b/api-server/src/server/utils/getSetAccessToken.js similarity index 96% rename from api-server/server/utils/getSetAccessToken.js rename to api-server/src/server/utils/getSetAccessToken.js index 82b5b681cd..866a69710b 100644 --- a/api-server/server/utils/getSetAccessToken.js +++ b/api-server/src/server/utils/getSetAccessToken.js @@ -1,7 +1,7 @@ import jwt from 'jsonwebtoken'; import { isBefore } from 'date-fns'; -import { jwtSecret as _jwtSecret } from '../../../config/secrets'; +import { jwtSecret as _jwtSecret } from '../../../../config/secrets'; export const authHeaderNS = 'X-fcc-access-token'; export const jwtCookieNS = 'jwt_access_token'; diff --git a/api-server/server/utils/getSetAccessToken.test.js b/api-server/src/server/utils/getSetAccessToken.test.js similarity index 100% rename from api-server/server/utils/getSetAccessToken.test.js rename to api-server/src/server/utils/getSetAccessToken.test.js diff --git a/api-server/server/utils/in-memory-cache.js b/api-server/src/server/utils/in-memory-cache.js similarity index 100% rename from api-server/server/utils/in-memory-cache.js rename to api-server/src/server/utils/in-memory-cache.js diff --git a/api-server/server/utils/in-memory-cache.test.js b/api-server/src/server/utils/in-memory-cache.test.js similarity index 100% rename from api-server/server/utils/in-memory-cache.test.js rename to api-server/src/server/utils/in-memory-cache.test.js diff --git a/api-server/server/utils/index.js b/api-server/src/server/utils/index.js similarity index 100% rename from api-server/server/utils/index.js rename to api-server/src/server/utils/index.js diff --git a/api-server/server/utils/lang-passthrough-urls.js b/api-server/src/server/utils/lang-passthrough-urls.js similarity index 100% rename from api-server/server/utils/lang-passthrough-urls.js rename to api-server/src/server/utils/lang-passthrough-urls.js diff --git a/api-server/server/utils/middleware.js b/api-server/src/server/utils/middleware.js similarity index 99% rename from api-server/server/utils/middleware.js rename to api-server/src/server/utils/middleware.js index aa9824bf8b..883b6e82c6 100644 --- a/api-server/server/utils/middleware.js +++ b/api-server/src/server/utils/middleware.js @@ -2,6 +2,7 @@ import dedent from 'dedent'; import { validationResult } from 'express-validator'; import { createValidatorErrorFormatter } from './create-handled-error.js'; + import { getAccessTokenFromRequest, removeCookies diff --git a/api-server/server/utils/publicUserProps.js b/api-server/src/server/utils/publicUserProps.js similarity index 100% rename from api-server/server/utils/publicUserProps.js rename to api-server/src/server/utils/publicUserProps.js diff --git a/api-server/server/utils/react.js b/api-server/src/server/utils/react.js similarity index 100% rename from api-server/server/utils/react.js rename to api-server/src/server/utils/react.js diff --git a/api-server/server/utils/redirection.js b/api-server/src/server/utils/redirection.js similarity index 93% rename from api-server/server/utils/redirection.js rename to api-server/src/server/utils/redirection.js index 7125c72acd..26d12cc6ba 100644 --- a/api-server/server/utils/redirection.js +++ b/api-server/src/server/utils/redirection.js @@ -1,9 +1,9 @@ const jwt = require('jsonwebtoken'); -const { availableLangs } = require('../../../client/i18n/allLangs'); -const { allowedOrigins } = require('../../../config/cors-settings'); +const { availableLangs } = require('../../../../config/i18n/all-langs'); +const { allowedOrigins } = require('../../../../config/cors-settings'); // homeLocation is being used as a fallback here. If the one provided by the // client is invalid we default to this. -const { homeLocation } = require('../../../config/env.json'); +const { homeLocation } = require('../../../../config/env'); function getReturnTo(encryptedParams, secret, _homeLocation = homeLocation) { let params; diff --git a/api-server/server/utils/redirection.test.js b/api-server/src/server/utils/redirection.test.js similarity index 100% rename from api-server/server/utils/redirection.test.js rename to api-server/src/server/utils/redirection.test.js diff --git a/api-server/server/utils/rx.js b/api-server/src/server/utils/rx.js similarity index 100% rename from api-server/server/utils/rx.js rename to api-server/src/server/utils/rx.js diff --git a/api-server/server/utils/url-utils.js b/api-server/src/server/utils/url-utils.js similarity index 100% rename from api-server/server/utils/url-utils.js rename to api-server/src/server/utils/url-utils.js diff --git a/api-server/server/utils/user-stats.js b/api-server/src/server/utils/user-stats.js similarity index 100% rename from api-server/server/utils/user-stats.js rename to api-server/src/server/utils/user-stats.js diff --git a/api-server/server/utils/user-stats.test.js b/api-server/src/server/utils/user-stats.test.js similarity index 100% rename from api-server/server/utils/user-stats.test.js rename to api-server/src/server/utils/user-stats.test.js diff --git a/api-server/server/utils/validators.js b/api-server/src/server/utils/validators.js similarity index 100% rename from api-server/server/utils/validators.js rename to api-server/src/server/utils/validators.js diff --git a/api-server/server/views/emails/a-new-user.ejs b/api-server/src/server/views/emails/a-new-user.ejs similarity index 100% rename from api-server/server/views/emails/a-new-user.ejs rename to api-server/src/server/views/emails/a-new-user.ejs diff --git a/api-server/server/views/emails/certified.ejs b/api-server/src/server/views/emails/certified.ejs similarity index 100% rename from api-server/server/views/emails/certified.ejs rename to api-server/src/server/views/emails/certified.ejs diff --git a/api-server/server/views/emails/user-request-sign-in.ejs b/api-server/src/server/views/emails/user-request-sign-in.ejs similarity index 100% rename from api-server/server/views/emails/user-request-sign-in.ejs rename to api-server/src/server/views/emails/user-request-sign-in.ejs diff --git a/api-server/server/views/emails/user-request-sign-up.ejs b/api-server/src/server/views/emails/user-request-sign-up.ejs similarity index 100% rename from api-server/server/views/emails/user-request-sign-up.ejs rename to api-server/src/server/views/emails/user-request-sign-up.ejs diff --git a/api-server/server/views/emails/user-request-update-email.ejs b/api-server/src/server/views/emails/user-request-update-email.ejs similarity index 100% rename from api-server/server/views/emails/user-request-update-email.ejs rename to api-server/src/server/views/emails/user-request-update-email.ejs diff --git a/api-server/server/views/resources/calculator.jade b/api-server/src/server/views/resources/calculator.jade similarity index 100% rename from api-server/server/views/resources/calculator.jade rename to api-server/src/server/views/resources/calculator.jade diff --git a/api-server/server/views/resources/the-fastest-web-page-on-the-internet.jade b/api-server/src/server/views/resources/the-fastest-web-page-on-the-internet.jade similarity index 100% rename from api-server/server/views/resources/the-fastest-web-page-on-the-internet.jade rename to api-server/src/server/views/resources/the-fastest-web-page-on-the-internet.jade diff --git a/client/i18n/config.js b/client/i18n/config.js index 3fd2831d44..1b603e5ebf 100644 --- a/client/i18n/config.js +++ b/client/i18n/config.js @@ -1,8 +1,8 @@ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; -import { clientLocale } from '../../config/env.json'; -import { i18nextCodes } from './allLangs'; +const { clientLocale } = require('../../config/env.json'); +const { i18nextCodes } = require('../../config/i18n/all-langs'); const i18nextCode = i18nextCodes[clientLocale]; diff --git a/client/i18n/locales.test.js b/client/i18n/locales.test.js index 88cf15046d..a4d24b6014 100644 --- a/client/i18n/locales.test.js +++ b/client/i18n/locales.test.js @@ -4,7 +4,7 @@ import { i18nextCodes, langDisplayNames, langCodes -} from './allLangs'; +} from '../../config/i18n/all-langs'; const fs = require('fs'); const { setup } = require('jest-json-schema-extended'); diff --git a/client/i18n/schema-validation.js b/client/i18n/schema-validation.js index 141b575e53..c64a5f4af3 100644 --- a/client/i18n/schema-validation.js +++ b/client/i18n/schema-validation.js @@ -1,5 +1,5 @@ const path = require('path'); -const { availableLangs } = require('./allLangs'); +const { availableLangs } = require('../../config/i18n/all-langs'); const translationsSchema = require('./locales/english/translations.json'); const trendingSchema = require('./locales/english/trending.json'); const motivationSchema = require('./locales/english/motivation.json'); diff --git a/client/src/client-only-routes/ShowCertification.js b/client/src/client-only-routes/ShowCertification.js index cdd0deb27b..91a02fdee3 100644 --- a/client/src/client-only-routes/ShowCertification.js +++ b/client/src/client-only-routes/ShowCertification.js @@ -27,7 +27,7 @@ import { certMap } from '../../src/resources/certAndProjectMap'; import { createFlashMessage } from '../components/Flash/redux'; import standardErrorMessage from '../utils/standardErrorMessage'; import reallyWeirdErrorMessage from '../utils/reallyWeirdErrorMessage'; -import { langCodes } from '../../i18n/allLangs'; +import { langCodes } from '../../../config/i18n/all-langs'; import { clientLocale } from '../../../config/env.json'; import RedirectHome from '../components/RedirectHome'; diff --git a/client/src/components/Header/components/NavLinks.js b/client/src/components/Header/components/NavLinks.js index a288569be7..47efd8966a 100644 --- a/client/src/components/Header/components/NavLinks.js +++ b/client/src/components/Header/components/NavLinks.js @@ -24,7 +24,7 @@ const { availableLangs, i18nextCodes, langDisplayNames -} = require('../../../../i18n/allLangs'); +} = require('../../../../../config/i18n/all-langs'); const locales = availableLangs.client; diff --git a/client/src/components/profile/components/Camper.js b/client/src/components/profile/components/Camper.js index c346e73e92..77ac294601 100644 --- a/client/src/components/profile/components/Camper.js +++ b/client/src/components/profile/components/Camper.js @@ -15,7 +15,7 @@ import Link from '../../helpers/Link'; import './camper.css'; -import { langCodes } from '../../../../i18n/allLangs'; +import { langCodes } from '../../../../../config/i18n/all-langs'; import { clientLocale } from '../../../../../config/env.json'; const localeCode = langCodes[clientLocale]; diff --git a/client/src/components/profile/components/HeatMap.js b/client/src/components/profile/components/HeatMap.js index 21243d862d..77ad426ff2 100644 --- a/client/src/components/profile/components/HeatMap.js +++ b/client/src/components/profile/components/HeatMap.js @@ -15,7 +15,7 @@ import Spacer from '../../helpers/Spacer'; import '@freecodecamp/react-calendar-heatmap/dist/styles.css'; import './heatmap.css'; -import { langCodes } from '../../../../i18n/allLangs'; +import { langCodes } from '../../../../../config/i18n/all-langs'; import { clientLocale } from '../../../../../config/env.json'; const localeCode = langCodes[clientLocale]; diff --git a/client/src/components/profile/components/TimeLine.js b/client/src/components/profile/components/TimeLine.js index eaca8e2074..1b49baab5c 100644 --- a/client/src/components/profile/components/TimeLine.js +++ b/client/src/components/profile/components/TimeLine.js @@ -24,7 +24,7 @@ import { import { maybeUrlRE } from '../../../utils'; import CertificationIcon from '../../../assets/icons/CertificationIcon'; -import { langCodes } from '../../../../i18n/allLangs'; +import { langCodes } from '../../../../../config/i18n/all-langs'; import { clientLocale } from '../../../../../config/env.json'; const localeCode = langCodes[clientLocale]; diff --git a/client/i18n/allLangs.js b/config/i18n/all-langs.js similarity index 100% rename from client/i18n/allLangs.js rename to config/i18n/all-langs.js diff --git a/curriculum/getChallenges.js b/curriculum/getChallenges.js index e14ab8f6dd..d5a07c6f41 100644 --- a/curriculum/getChallenges.js +++ b/curriculum/getChallenges.js @@ -17,7 +17,7 @@ const { createPoly } = require('../utils/polyvinyl'); const { helpCategoryMap } = require('../client/utils/challengeTypes'); const { curriculum: curriculumLangs -} = require('../client/i18n/allLangs').availableLangs; +} = require('../config/i18n/all-langs').availableLangs; const access = util.promisify(fs.access); diff --git a/curriculum/gulpfile.js b/curriculum/gulpfile.js index 2dab9f0eee..3224606020 100644 --- a/curriculum/gulpfile.js +++ b/curriculum/gulpfile.js @@ -1,9 +1,6 @@ -const fs = require('fs-extra'); const gulp = require('gulp'); const through2 = require('through2'); -const { curriculumLocale } = require('../config/env.json'); -const { getChallengesForLang } = require('./getChallenges'); const { testedLang } = require('./utils'); const lintMarkdown = require('../tools/scripts/lint'); @@ -11,22 +8,6 @@ const lintMarkdown = require('../tools/scripts/lint'); * Tasks **/ -function generateCurriculum(done) { - return getChallengesForLang(curriculumLocale) - .then(curriculum => { - fs.ensureFileSync(`./build/curriculum-${curriculumLocale}.json`); - fs.writeFile( - `./build/curriculum-${curriculumLocale}.json`, - JSON.stringify(curriculum) - ); - }) - .then(done); -} - -function watchFiles() { - return gulp.watch('./challenges/**/*.md', generateCurriculum); -} - function lint() { return gulp.src(globLang(testedLang()), { read: false }).pipe( through2.obj(function obj(file, enc, next) { @@ -35,8 +16,6 @@ function lint() { ); } -const defaultTask = gulp.series(generateCurriculum, watchFiles); - /** * Helper functions **/ @@ -45,6 +24,4 @@ function globLang(lang) { return `./challenges/${lang}/**/*.md`; } -gulp.task('default', defaultTask); -gulp.task('build', generateCurriculum); gulp.task('lint', lint); diff --git a/curriculum/package.json b/curriculum/package.json index 536c5ec085..c42004b0bd 100644 --- a/curriculum/package.json +++ b/curriculum/package.json @@ -13,12 +13,12 @@ }, "version": "0.0.0-next.4", "scripts": { + "build": "node ../tools/scripts/build/build-curriculum.js", "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", "delete-step": "cross-env CALLING_DIR=$INIT_CWD node ../tools/challenge-helper-scripts/delete-step", "reorder-steps": "cross-env CALLING_DIR=$INIT_CWD node ../tools/challenge-helper-scripts/reorder-steps", - "develop": "gulp", "lint": "gulp lint", "pretest": "cd ../client && npm run build:workers", "pretest:full-output": "npm run pretest", diff --git a/curriculum/utils.js b/curriculum/utils.js index a6ed8b9b3e..65d338b3fd 100644 --- a/curriculum/utils.js +++ b/curriculum/utils.js @@ -3,7 +3,7 @@ require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); const { curriculum: curriculumLangs -} = require('../client/i18n/allLangs').availableLangs; +} = require('../config/i18n/all-langs').availableLangs; exports.testedLang = function testedLang() { if (process.env.CURRICULUM_LOCALE) { diff --git a/docs/devops.md b/docs/devops.md index 8b85bfcbd4..dea82e7634 100644 --- a/docs/devops.md +++ b/docs/devops.md @@ -581,14 +581,13 @@ Provisioning VMs with the Code 7. Build the server ```console - npm run ensure-env && npm run build:server + npm run ensure-env && npm run build:curriculum && npm run build:server ``` 8. Start Instances ```console - cd api-server - pm2 start production-start.js -i max --max-memory-restart 600M --name org + pm2 start api-server/lib/production-start.js -i max --max-memory-restart 600M --name org ``` ### Logging and Monitoring @@ -627,7 +626,7 @@ npm ci 3. Build the server ```console -npm run ensure-env && npm run build:server +npm run ensure-env && npm run build:curriculum && npm run build:server ``` 4. Start Instances diff --git a/docs/how-to-translate-the-website.md b/docs/how-to-translate-the-website.md index a0ec1252b8..6ce0c5dc60 100644 --- a/docs/how-to-translate-the-website.md +++ b/docs/how-to-translate-the-website.md @@ -21,7 +21,7 @@ The `meta-tags.json` file contains the information for our website's meta tag in To add a new language, create a folder with the language name as the title next to the other languages and copy the JSON files from another language into your new folder. -In the `allLangs.js` file, add the language to the `client` array in the first variable. Then, follow the instructions in the comments to add the rest of the necessary variables. +In the `all-langs.js` file, add the language to the `client` array in the first variable. Then, follow the instructions in the comments to add the rest of the necessary variables. ## How to Translate @@ -34,7 +34,7 @@ Modifications to the `trending.json`, `meta-tags.json`, and `motivation.json` fi Set the `CLIENT_LOCALE` variable in your `.env` file to the locale you want to build. > [!NOTE] -> The value needs to be one of the client languages available in `client/i18n/allLangs.js` +> The value needs to be one of the client languages available in `config/i18n/all-langs.js` ## How to Structure Components diff --git a/package-lock.json b/package-lock.json index 36f9de5a22..203f20b699 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,42 +14,41 @@ } }, "@babel/core": { - "version": "7.11.4", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.4.tgz", - "integrity": "sha512-5deljj5HlqRXN+5oJTY7Zs37iH3z3b++KjiKtIsJy1NrjOOVSEaJHEetLBhyu0aQOSNNZ/0IuEAan9GzRuDXHg==", + "version": "7.12.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.10.tgz", + "integrity": "sha512-eTAlQKq65zHfkHZV0sIVODCPGVgoo1HdBlbSLi9CqOzuZanMv2ihzY+4paiKr1mH+XmYESMAmJ/dpZ68eN6d8w==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.11.4", - "@babel/helper-module-transforms": "^7.11.0", - "@babel/helpers": "^7.10.4", - "@babel/parser": "^7.11.4", - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.11.0", - "@babel/types": "^7.11.0", + "@babel/generator": "^7.12.10", + "@babel/helper-module-transforms": "^7.12.1", + "@babel/helpers": "^7.12.5", + "@babel/parser": "^7.12.10", + "@babel/template": "^7.12.7", + "@babel/traverse": "^7.12.10", + "@babel/types": "^7.12.10", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.1", "json5": "^2.1.2", "lodash": "^4.17.19", - "resolve": "^1.3.2", "semver": "^5.4.1", "source-map": "^0.5.0" }, "dependencies": { "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", "dev": true, "requires": { "@babel/highlight": "^7.10.4" } }, "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", "dev": true }, "@babel/highlight": { @@ -72,76 +71,86 @@ } }, "@babel/generator": { - "version": "7.11.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.4.tgz", - "integrity": "sha512-Rn26vueFx0eOoz7iifCN2UHT6rGtnkSGWSoDRIy8jZN3B91PzeSULbswfLoOWuTuAcNwpG/mxy+uCTDnZ9Mp1g==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.11.tgz", + "integrity": "sha512-Ggg6WPOJtSi8yYQvLVjG8F/TlpWDlKx0OpS4Kt+xMQPs5OaGYWy+v1A+1TvxI6sAMGZpKWWoAQ1DaeQbImlItA==", "dev": true, "requires": { - "@babel/types": "^7.11.0", + "@babel/types": "^7.12.11", "jsesc": "^2.5.1", "source-map": "^0.5.0" } }, "@babel/helper-function-name": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz", - "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.12.11.tgz", + "integrity": "sha512-AtQKjtYNolKNi6nNNVLQ27CP6D9oFR6bq/HPYSizlzbp7uC1M59XJe8L+0uXjbIaZaUJF99ruHqVGiKXU/7ybA==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4" + "@babel/helper-get-function-arity": "^7.12.10", + "@babel/template": "^7.12.7", + "@babel/types": "^7.12.11" } }, "@babel/helper-get-function-arity": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz", - "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==", + "version": "7.12.10", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.10.tgz", + "integrity": "sha512-mm0n5BPjR06wh9mPQaDdXWDoll/j5UpCAPl1x8fS71GHm7HA6Ua2V4ylG1Ju8lvcTOietbPNNPaSilKj+pj+Ag==", "dev": true, "requires": { - "@babel/types": "^7.10.4" + "@babel/types": "^7.12.10" } }, "@babel/helper-member-expression-to-functions": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.11.0.tgz", - "integrity": "sha512-JbFlKHFntRV5qKw3YC0CvQnDZ4XMwgzzBbld7Ly4Mj4cbFy3KywcR8NtNctRToMWJOVvLINJv525Gd6wwVEx/Q==", + "version": "7.12.7", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.7.tgz", + "integrity": "sha512-DCsuPyeWxeHgh1Dus7APn7iza42i/qXqiFPWyBDdOFtvS581JQePsc1F/nD+fHrcswhLlRc2UpYS1NwERxZhHw==", "dev": true, "requires": { - "@babel/types": "^7.11.0" + "@babel/types": "^7.12.7" } }, "@babel/helper-module-imports": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz", - "integrity": "sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw==", + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.5.tgz", + "integrity": "sha512-SR713Ogqg6++uexFRORf/+nPXMmWIn80TALu0uaFb+iQIUoR7bOC7zBWyzBs5b3tBBJXuyD0cRu1F15GyzjOWA==", "dev": true, "requires": { - "@babel/types": "^7.10.4" + "@babel/types": "^7.12.5" } }, "@babel/helper-module-transforms": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz", - "integrity": "sha512-02EVu8COMuTRO1TAzdMtpBPbe6aQ1w/8fePD2YgQmxZU4gpNWaL9gK3Jp7dxlkUlUCJOTaSeA+Hrm1BRQwqIhg==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz", + "integrity": "sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==", "dev": true, "requires": { - "@babel/helper-module-imports": "^7.10.4", - "@babel/helper-replace-supers": "^7.10.4", - "@babel/helper-simple-access": "^7.10.4", + "@babel/helper-module-imports": "^7.12.1", + "@babel/helper-replace-supers": "^7.12.1", + "@babel/helper-simple-access": "^7.12.1", "@babel/helper-split-export-declaration": "^7.11.0", + "@babel/helper-validator-identifier": "^7.10.4", "@babel/template": "^7.10.4", - "@babel/types": "^7.11.0", + "@babel/traverse": "^7.12.1", + "@babel/types": "^7.12.1", "lodash": "^4.17.19" + }, + "dependencies": { + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true + } } }, "@babel/helper-optimise-call-expression": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz", - "integrity": "sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg==", + "version": "7.12.10", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.10.tgz", + "integrity": "sha512-4tpbU0SrSTjjt65UMWSrUOPZTsgvPgGG4S8QSTNHacKzpS51IVWGDj0yCwyeZND/i+LSN2g/O63jEXEWm49sYQ==", "dev": true, "requires": { - "@babel/types": "^7.10.4" + "@babel/types": "^7.12.10" } }, "@babel/helper-plugin-utils": { @@ -151,34 +160,33 @@ "dev": true }, "@babel/helper-replace-supers": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz", - "integrity": "sha512-sPxZfFXocEymYTdVK1UNmFPBN+Hv5mJkLPsYWwGBxZAxaWfFu+xqp7b6qWD0yjNuNL2VKc6L5M18tOXUP7NU0A==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.11.tgz", + "integrity": "sha512-q+w1cqmhL7R0FNzth/PLLp2N+scXEK/L2AHbXUyydxp828F4FEa5WcVoqui9vFRiHDQErj9Zof8azP32uGVTRA==", "dev": true, "requires": { - "@babel/helper-member-expression-to-functions": "^7.10.4", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/traverse": "^7.10.4", - "@babel/types": "^7.10.4" + "@babel/helper-member-expression-to-functions": "^7.12.7", + "@babel/helper-optimise-call-expression": "^7.12.10", + "@babel/traverse": "^7.12.10", + "@babel/types": "^7.12.11" } }, "@babel/helper-simple-access": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz", - "integrity": "sha512-0fMy72ej/VEvF8ULmX6yb5MtHG4uH4Dbd6I/aHDb/JVg0bbivwt9Wg+h3uMvX+QSFtwr5MeItvazbrc4jtRAXw==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz", + "integrity": "sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==", "dev": true, "requires": { - "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4" + "@babel/types": "^7.12.1" } }, "@babel/helper-split-export-declaration": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", - "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.11.tgz", + "integrity": "sha512-LsIVN8j48gHgwzfocYUSkO/hjYAOJqlpJEc7tGXcIm4cubjVUf8LGW6eWRyxEu7gA25q02p0rQUWoCI33HNS5g==", "dev": true, "requires": { - "@babel/types": "^7.11.0" + "@babel/types": "^7.12.11" } }, "@babel/helper-validator-identifier": { @@ -188,14 +196,14 @@ "dev": true }, "@babel/helpers": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.10.4.tgz", - "integrity": "sha512-L2gX/XeUONeEbI78dXSrJzGdz4GQ+ZTA/aazfUsFaWjSe95kiCuOZ5HsXvkiw3iwF+mFHSRUfJU8t6YavocdXA==", + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.12.5.tgz", + "integrity": "sha512-lgKGMQlKqA8meJqKsW6rUnc4MdUk35Ln0ATDqdM1a/UpARODdI4j5Y5lVfUScnSNkJcdCRAaWkspykNoFg9sJA==", "dev": true, "requires": { "@babel/template": "^7.10.4", - "@babel/traverse": "^7.10.4", - "@babel/types": "^7.10.4" + "@babel/traverse": "^7.12.5", + "@babel/types": "^7.12.5" } }, "@babel/highlight": { @@ -218,9 +226,9 @@ } }, "@babel/parser": { - "version": "7.11.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.4.tgz", - "integrity": "sha512-MggwidiH+E9j5Sh8pbrX5sJvMcsqS5o+7iB42M9/k0CD63MjYbdP4nhSh7uB5wnv2/RVzTZFTxzF/kIa5mrCqA==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.11.tgz", + "integrity": "sha512-N3UxG+uuF4CMYoNj8AhnbAcJF0PiuJ9KHuy1lQmkYsxTer/MAH9UBNHsBoAX/4s6NvlDD047No8mYVGGzLL4hg==", "dev": true }, "@babel/plugin-syntax-object-rest-spread": { @@ -260,29 +268,29 @@ } }, "@babel/template": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.4.tgz", - "integrity": "sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA==", + "version": "7.12.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.7.tgz", + "integrity": "sha512-GkDzmHS6GV7ZeXfJZ0tLRBhZcMcY0/Lnb+eEbXDBfCAcZCjrZKe6p3J4we/D24O9Y8enxWAg1cWwof59yLh2ow==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", - "@babel/parser": "^7.10.4", - "@babel/types": "^7.10.4" + "@babel/parser": "^7.12.7", + "@babel/types": "^7.12.7" }, "dependencies": { "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", "dev": true, "requires": { "@babel/highlight": "^7.10.4" } }, "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", "dev": true }, "@babel/highlight": { @@ -305,35 +313,35 @@ } }, "@babel/traverse": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.11.0.tgz", - "integrity": "sha512-ZB2V+LskoWKNpMq6E5UUCrjtDUh5IOTAyIl0dTjIEoXum/iKWkoIEKIRDnUucO6f+2FzNkE0oD4RLKoPIufDtg==", + "version": "7.12.12", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.12.tgz", + "integrity": "sha512-s88i0X0lPy45RrLM8b9mz8RPH5FqO9G9p7ti59cToE44xFm1Q+Pjh5Gq4SXBbtb88X7Uy7pexeqRIQDDMNkL0w==", "dev": true, "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.11.0", - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.11.0", - "@babel/parser": "^7.11.0", - "@babel/types": "^7.11.0", + "@babel/code-frame": "^7.12.11", + "@babel/generator": "^7.12.11", + "@babel/helper-function-name": "^7.12.11", + "@babel/helper-split-export-declaration": "^7.12.11", + "@babel/parser": "^7.12.11", + "@babel/types": "^7.12.12", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.19" }, "dependencies": { "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", "dev": true, "requires": { "@babel/highlight": "^7.10.4" } }, "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", "dev": true }, "@babel/highlight": { @@ -356,20 +364,20 @@ } }, "@babel/types": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", - "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", + "version": "7.12.12", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.12.tgz", + "integrity": "sha512-lnIX7piTxOH22xE7fDXDbSHg9MM1/6ORnafpJmov5rs0kX5g4BZxeXNJLXsMRiO0U5Rb8/FvMS6xlTnTHvxonQ==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.10.4", + "@babel/helper-validator-identifier": "^7.12.11", "lodash": "^4.17.19", "to-fast-properties": "^2.0.0" }, "dependencies": { "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", "dev": true } } @@ -2559,9 +2567,9 @@ "dev": true }, "@types/babel__core": { - "version": "7.1.9", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.9.tgz", - "integrity": "sha512-sY2RsIJ5rpER1u3/aQ8OFSI7qGIy8o1NEEbgb2UaJcvOtXOMpd39ko723NBpjQFg9SIX7TXtjejZVGeIMLhoOw==", + "version": "7.1.12", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.12.tgz", + "integrity": "sha512-wMTHiiTiBAAPebqaPiPDLFA4LYPKr6Ph0Xq/6rq1Ur3v66HXyG+clfR9CNETkD7MQS8ZHvpQOtA53DLws5WAEQ==", "dev": true, "requires": { "@babel/parser": "^7.1.0", @@ -2572,18 +2580,18 @@ } }, "@types/babel__generator": { - "version": "7.6.1", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.1.tgz", - "integrity": "sha512-bBKm+2VPJcMRVwNhxKu8W+5/zT7pwNEqeokFOmbvVSqGzFneNxYcEBro9Ac7/N9tlsaPYnZLK8J1LWKkMsLAew==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.2.tgz", + "integrity": "sha512-MdSJnBjl+bdwkLskZ3NGFp9YcXGx5ggLpQQPqtgakVhsWK0hTtNYhjpZLlWQTviGTvF8at+Bvli3jV7faPdgeQ==", "dev": true, "requires": { "@babel/types": "^7.0.0" } }, "@types/babel__template": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.2.tgz", - "integrity": "sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.0.tgz", + "integrity": "sha512-NTPErx4/FiPCGScH7foPyr+/1Dkzkni+rHiYHHoTjvwou7AQzJkNeD60A9CXRy+ZEN2B1bggmkTMCDb+Mv5k+A==", "dev": true, "requires": { "@babel/parser": "^7.1.0", @@ -2591,9 +2599,9 @@ } }, "@types/babel__traverse": { - "version": "7.0.13", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.13.tgz", - "integrity": "sha512-i+zS7t6/s9cdQvbqKDARrcbrPvtJGlbYsMkazo03nTAK3RX9FNrLllXys22uiTGJapPOTZTQ35nHh4ISph4SLQ==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.11.0.tgz", + "integrity": "sha512-kSjgDMZONiIfSH1Nxcr5JIRMwUetDki63FSQfpTCz8ogF3Ulqm8+mr5f78dUYs6vMiB6gBusQqfQmBvHZj/lwg==", "dev": true, "requires": { "@babel/types": "^7.3.0" @@ -2683,9 +2691,9 @@ "dev": true }, "@types/yargs": { - "version": "13.0.10", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.10.tgz", - "integrity": "sha512-MU10TSgzNABgdzKvQVW1nuuT+sgBMWeXNc3XOs5YXV5SDAK+PPja2eUuBNB9iqElu03xyEDqlnGw0jgl4nbqGQ==", + "version": "13.0.11", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.11.tgz", + "integrity": "sha512-NRqD6T4gktUrDi1o1wLH3EKC1o2caCr7/wR87ODcbVITQF106OM3sFN92ysZ++wqelOd1CTzatnOBRDYYG6wGQ==", "dev": true, "requires": { "@types/yargs-parser": "*" @@ -2719,9 +2727,9 @@ } }, "abab": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.4.tgz", - "integrity": "sha512-Eu9ELJWCz/c1e9gTiCY+FceWxcqzjYEbqMgtndnuSqZSUCOL73TWNK2mHfIj4Cw2E/ongOp+JISVNCmovt2KYQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz", + "integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==", "dev": true }, "abbrev": { @@ -2747,9 +2755,9 @@ }, "dependencies": { "acorn": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", - "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", + "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", "dev": true } } @@ -3669,12 +3677,6 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true } } }, @@ -5901,10 +5903,9 @@ } }, "dotenv": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.2.0.tgz", - "integrity": "sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==", - "dev": true + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", + "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" }, "duplexer": { "version": "0.1.2", @@ -7155,6 +7156,15 @@ } } }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -7354,9 +7364,9 @@ "dev": true }, "gensync": { - "version": "1.0.0-beta.1", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", - "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true }, "get-caller-file": { @@ -9337,12 +9347,6 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -9799,12 +9803,6 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -11357,9 +11355,9 @@ } }, "nan": { - "version": "2.14.1", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", - "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==", + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", "dev": true, "optional": true }, @@ -12860,13 +12858,13 @@ } }, "prompts": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", - "integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.0.tgz", + "integrity": "sha512-awZAKrk3vN6CroQukBL+R9051a4R3zCZBlJm/HBfrSZ8iTpYix3VX1vU4mveiLpiwmOJT4wokTF9m6HUk4KqWQ==", "dev": true, "requires": { "kleur": "^3.0.3", - "sisteransi": "^1.0.4" + "sisteransi": "^1.0.5" } }, "promzard": { @@ -13421,21 +13419,21 @@ } }, "request-promise-core": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", - "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", + "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", "dev": true, "requires": { - "lodash": "^4.17.15" + "lodash": "^4.17.19" } }, "request-promise-native": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", - "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", + "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", "dev": true, "requires": { - "request-promise-core": "1.1.3", + "request-promise-core": "1.1.4", "stealthy-require": "^1.1.1", "tough-cookie": "^2.3.3" } @@ -14321,10 +14319,21 @@ } }, "stack-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", - "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", - "dev": true + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.4.tgz", + "integrity": "sha512-IPDJfugEGbfizBwBZRZ3xpccMdRyP5lqsBWXGQWimVjua/ccLCeMOAVjlc1R7LxFjo5sEDhyNIXd8mo/AiDS9w==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + } + } }, "staged-git-files": { "version": "1.1.2", @@ -15073,12 +15082,6 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, "read-pkg-up": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", @@ -15650,32 +15653,34 @@ } }, "util.promisify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", - "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.1.1.tgz", + "integrity": "sha512-/s3UsZUrIfa6xDhr7zZhnE9SLQ5RIXyYfiVnMMyMDzOc8WhWN4Nbh36H842OyurKbCDAesZOJaVyvmSl6fhGQw==", "dev": true, "requires": { + "call-bind": "^1.0.0", "define-properties": "^1.1.3", - "es-abstract": "^1.17.2", + "for-each": "^0.3.3", "has-symbols": "^1.0.1", - "object.getownpropertydescriptors": "^2.1.0" + "object.getownpropertydescriptors": "^2.1.1" }, "dependencies": { "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", "object-keys": "^1.1.1", - "object.assign": "^4.1.0", + "object.assign": "^4.1.1", "string.prototype.trimend": "^1.0.1", "string.prototype.trimstart": "^1.0.1" } @@ -15698,9 +15703,9 @@ "dev": true }, "is-callable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", - "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", + "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", "dev": true }, "is-regex": { @@ -15721,11 +15726,40 @@ "has-symbols": "^1.0.1" } }, + "object-inspect": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", + "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "dev": true + }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.getownpropertydescriptors": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.1.tgz", + "integrity": "sha512-6DtXgZ/lIZ9hqx4GtZETobXLR/ZLaa0aqV0kzbn80Rf8Z2e/XFnhA0I7p07N2wH8bBBltr2xQPi6sbKWAY2Eng==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1" + } } } }, diff --git a/package.json b/package.json index 07f6485777..f19f551942 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "build": "npm-run-all -p build:*", "build:client": "cd ./client && npm run build", "build:server": "cd ./api-server && npm run build", + "build:curriculum": "cd ./curriculum && npm run build", "bootstrap": "lerna bootstrap --ci", "clean": "npm-run-all clean:client clean:server clean:packages clean:root-deps", "clean-and-develop": "npm run clean && npm ci && npm run develop", @@ -16,6 +17,7 @@ "clean:packages": "lerna clean -y", "clean:server": "shx rm -rf ./api-server/lib", "clean:client": "cd ./client && npm run clean", + "clean:curriculum": "shx rm ./config/curriculum.json", "clean:gatsby-site": "npm run clean:client", "precypress": "node ./cypress-install.js", "cypress": "cypress", @@ -25,7 +27,8 @@ "cypress:dev:watch": "npm run cypress -- open", "cypress:prd:run": "npm run cypress -- run", "cypress:prd:watch": "npm run cypress -- open", - "develop": "npm-run-all ensure-env -p develop:*", + "predevelop": "npm run ensure-env", + "develop": "npm-run-all build:curriculum -p develop:*", "develop:client": "cd ./client && npm run develop", "develop:server": "cd ./api-server && npm run develop", "docs:serve": "docsify serve ./docs -o --port 3200", @@ -50,7 +53,9 @@ "seed:certified-user": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser certUser", "serve:client": "cd ./client && npm run serve", "start": "npm-run-all ensure-env -p develop:server serve:client", - "test": "npm-run-all ensure-env -p test:*", + "start-ci": "npm-run-all ensure-env -p start:server serve:client", + "start:server": "cd ./api-server && npm start", + "test": "npm-run-all ensure-env build:curriculum -p test:*", "test:client": "cd ./client && npm test", "test:curriculum": "cd ./curriculum && npm test", "test-curriculum-full-output": "cd ./curriculum && npm run test:full-output", @@ -66,7 +71,6 @@ "cypress": "^6.1.0", "debug": "^4.3.1", "docsify-cli": "^4.4.2", - "dotenv": "^6.2.0", "eslint": "^5.16.0", "eslint-config-prettier": "^6.12.0", "eslint-plugin-babel": "^5.3.1", @@ -114,5 +118,7 @@ "pre-commit": "lint-staged" } }, - "dependencies": {} + "dependencies": { + "dotenv": "^8.2.0" + } } diff --git a/tools/scripts/build/build-curriculum.js b/tools/scripts/build/build-curriculum.js new file mode 100644 index 0000000000..cc0b1a4c45 --- /dev/null +++ b/tools/scripts/build/build-curriculum.js @@ -0,0 +1,12 @@ +const path = require('path'); +const fs = require('fs'); + +const { getChallengesForLang } = require('../../../curriculum/getChallenges'); + +const globalConfigPath = path.resolve(__dirname, '../../../config'); + +// We are defaulting to English because the ids for the challenges are same +// accross all languages. +getChallengesForLang('english') + .then(JSON.stringify) + .then(x => fs.writeFileSync(`${globalConfigPath}/curriculum.json`, x)); diff --git a/tools/scripts/build/ensure-env.js b/tools/scripts/build/ensure-env.js index 75198fd010..bcd1b44e19 100644 --- a/tools/scripts/build/ensure-env.js +++ b/tools/scripts/build/ensure-env.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const env = require('../../../config/env'); -const { availableLangs } = require('../../../client/i18n/allLangs'); +const { availableLangs } = require('../../../config/i18n/all-langs'); const globalConfigPath = path.resolve(__dirname, '../../../config'); @@ -12,7 +12,7 @@ function checkClientLocale() { if (!availableLangs.client.includes(process.env.CLIENT_LOCALE)) { throw Error(` - CLIENT_LOCALE, ${process.env.CLIENT_LOCALE}, is not an available language in client/i18n/allLangs.js + CLIENT_LOCALE, ${process.env.CLIENT_LOCALE}, is not an available language in config/i18n/all-langs.js `); } @@ -22,7 +22,7 @@ function checkCurriculumLocale() { if (!availableLangs.curriculum.includes(process.env.CURRICULUM_LOCALE)) { throw Error(` - CURRICULUM_LOCALE, ${process.env.CURRICULUM_LOCALE}, is not an available language in client/i18n/allLangs.js + CURRICULUM_LOCALE, ${process.env.CURRICULUM_LOCALE}, is not an available language in config/i18n/all-langs.js `); }