From 391fc2e34d5c7038348baa114f4dbbd162871eab Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Thu, 7 Sep 2023 19:36:01 +0200 Subject: [PATCH] refactor: create shared workspace (#51454) --- .eslintignore | 9 +++---- .eslintrc.json | 3 +-- .github/labeler.yml | 2 +- .../workflows/crowdin-download.curriculum.yml | 2 +- .github/workflows/e2e-mobile.yml | 2 +- .github/workflows/e2e-playwright.yml | 2 +- .github/workflows/e2e-web.yml | 2 +- .github/workflows/node.js-tests.yml | 10 +++---- .../workflows/temporary-container-checks.yml | 2 +- .gitignore | 23 +++++----------- .prettierignore | 16 ++++++------ api-server/src/common/models/user.js | 2 +- api-server/src/server/boot/certificate.js | 2 +- api-server/src/server/boot/challenge.js | 2 +- api-server/src/server/boot/donate.js | 2 +- api-server/src/server/boot/settings.js | 2 +- api-server/src/server/component-passport.js | 2 +- api-server/src/server/utils/donation.js | 2 +- api-server/src/server/utils/get-curriculum.js | 2 +- api-server/src/server/utils/redirection.js | 2 +- api-server/src/server/utils/stripeHelpers.js | 2 +- api/src/routes/challenge.test.ts | 2 +- api/src/routes/challenge.ts | 2 +- api/src/routes/settings.ts | 4 +-- api/src/utils/common-challenge-functions.ts | 2 +- api/src/utils/get-challenges.ts | 4 +-- client/.gitignore | 4 +++ client/config/cert-and-project-map.test.ts | 2 +- client/config/cert-and-project-map.ts | 4 +-- client/gatsby-config.js | 2 +- client/gatsby-node.js | 2 +- client/i18n/config.js | 14 +++++----- client/i18n/locales.test.ts | 4 +-- client/i18n/schema-validation.ts | 2 +- client/package.json | 2 +- client/src/__mocks__/gatsby.ts | 2 +- client/src/analytics/index.ts | 2 +- client/src/assets/icons/index.tsx | 2 +- .../client-only-routes/show-certification.tsx | 8 +++--- .../client-only-routes/show-project-links.tsx | 2 +- .../client-only-routes/show-settings.test.tsx | 2 +- .../src/client-only-routes/show-settings.tsx | 2 +- .../client-only-routes/show-unsubscribed.tsx | 2 +- .../src/components/Donation/donate-form.tsx | 2 +- .../components/Donation/donation-modal.tsx | 2 +- .../components/Donation/patreon-button.tsx | 4 +-- .../src/components/Donation/paypal-button.tsx | 4 +-- .../components/Donation/stripe-card-form.tsx | 4 +-- .../components/Donation/wallets-button.tsx | 4 +-- .../Header/components/language-list.tsx | 4 +-- .../components/Header/components/login.tsx | 2 +- .../Header/components/nav-links.tsx | 2 +- .../Intro/components/intro-description.tsx | 2 +- client/src/components/Map/index.tsx | 4 +-- .../components/app-mount-notifier.test.tsx | 2 +- .../growth-book/growth-book-wrapper.tsx | 2 +- .../landing/components/landing-top.tsx | 2 +- client/src/components/layouts/default.tsx | 2 +- .../components/profile/components/camper.tsx | 4 +-- .../profile/components/heat-map.tsx | 4 +-- .../profile/components/time-line.tsx | 6 ++--- .../components/search/with-instant-search.tsx | 2 +- client/src/components/seo/index.tsx | 2 +- .../src/components/settings/certification.tsx | 6 ++--- client/src/components/settings/username.tsx | 2 +- client/src/components/signout-modal/index.tsx | 2 +- client/src/html.tsx | 4 +-- client/src/pages/donate.tsx | 2 +- client/src/pages/email-sign-up.tsx | 2 +- client/src/pages/learn.tsx | 2 +- client/src/redux/create-store.js | 2 +- client/src/redux/donation-saga.js | 2 +- client/src/redux/failed-updates-epic.js | 2 +- client/src/redux/prop-types.ts | 2 +- client/src/redux/save-challenge-saga.js | 2 +- client/src/redux/selectors.js | 2 +- client/src/redux/settings/settings-sagas.js | 2 +- .../Challenges/classic/desktop-layout.tsx | 2 +- .../templates/Challenges/classic/editor.tsx | 2 +- .../Challenges/classic/lower-jaw.tsx | 2 +- .../src/templates/Challenges/classic/show.tsx | 2 +- .../templates/Challenges/codeally/show.tsx | 4 +-- .../Challenges/components/help-modal.tsx | 2 +- .../Challenges/components/hotkeys.tsx | 2 +- .../Challenges/components/tool-panel.tsx | 2 +- .../Challenges/components/video-player.tsx | 2 +- .../Challenges/ms-trophy/link-ms-user.tsx | 2 +- .../Challenges/projects/solution-form.tsx | 2 +- .../Challenges/rechallenge/transformers.js | 2 +- .../src/templates/Challenges/redux/actions.js | 2 +- .../Challenges/redux/code-storage-epic.js | 2 +- .../Challenges/redux/completion-epic.js | 2 +- .../Challenges/redux/create-question-epic.js | 2 +- .../redux/execute-challenge-saga.js | 2 +- .../src/templates/Challenges/redux/index.js | 2 +- .../templates/Challenges/redux/selectors.js | 2 +- .../src/templates/Challenges/utils/build.ts | 2 +- .../templates/Challenges/utils/index.test.ts | 2 +- .../src/templates/Challenges/utils/index.ts | 2 +- .../src/templates/Challenges/video/show.tsx | 2 +- .../Introduction/components/block.test.tsx | 6 ++--- .../Introduction/components/block.tsx | 8 +++--- .../components/cert-challenge.tsx | 4 +-- .../Introduction/components/challenges.tsx | 2 +- .../Introduction/components/legacy-links.tsx | 4 +-- .../components/super-block-intro.tsx | 2 +- .../Introduction/super-block-intro.tsx | 2 +- client/src/utils/ajax.ts | 2 +- client/src/utils/algolia-locale-setup.ts | 2 +- client/src/utils/get-completion-percentage.ts | 2 +- client/src/utils/get-words.ts | 2 +- client/src/utils/is-a-cert.ts | 2 +- client/src/utils/path-parsers.ts | 2 +- client/src/utils/solution-display-type.ts | 2 +- client/src/utils/superblock-map-titles.ts | 2 +- client/tools/create-env.ts | 14 +++++----- client/utils/build-challenges.js | 2 +- client/utils/gatsby/challenge-page-creator.js | 2 +- client/utils/index.ts | 2 +- config/tsconfig.json | 8 ------ curriculum-server/source-curriculum.ts | 2 +- curriculum/get-challenges.js | 6 ++--- curriculum/schema/challenge-schema.js | 2 +- curriculum/test/test-challenges.js | 4 +-- curriculum/utils.js | 4 +-- curriculum/utils.test.ts | 2 +- cypress.config.js | 2 +- .../e2e/default/learn/challenges/projects.ts | 6 ++--- .../e2e/default/learn/header/lang-selector.ts | 2 +- .../show-cert-from-superblock.ts | 2 +- cypress/e2e/mobile-learn/test-challenges.js | 2 +- cypress/plugins/index.js | 2 +- docker/web/Dockerfile | 2 +- docs/curriculum-file-structure.md | 6 ++--- docs/how-to-add-cypress-tests.md | 2 +- docs/how-to-add-playwright-tests.md | 4 +-- docs/how-to-enable-new-languages.md | 8 +++--- docs/how-to-setup-freecodecamp-locally.md | 2 +- ...o-setup-freecodecamp-mobile-app-locally.md | 4 +-- .../how-to-work-on-localized-client-webapp.md | 4 +-- docs/language-lead-handbook.md | 2 +- package.json | 26 +++++++++---------- pnpm-lock.yaml | 9 ++++--- pnpm-workspace.yaml | 1 + .../config}/certification-settings.ts | 2 +- {config => shared/config}/challenge-types.ts | 0 {config => shared/config}/constants.test.ts | 0 {config => shared/config}/constants.ts | 0 .../config}/donation-settings.ts | 0 {config => shared/config}/i18n.ts | 0 {config => shared/config}/superblocks.test.ts | 0 {config => shared/config}/superblocks.ts | 2 +- shared/package.json | 23 ++++++++++++++++ {utils => shared}/tsconfig.json | 1 - {utils => shared/utils}/get-lines.test.ts | 0 {utils => shared/utils}/get-lines.ts | 0 {utils => shared/utils}/is-audited.ts | 5 +++- {utils => shared/utils}/polyvinyl.js | 0 {utils => shared/utils}/validate.test.ts | 0 {utils => shared/utils}/validate.ts | 0 tools/challenge-auditor/index.ts | 7 +++-- .../create-project.ts | 2 +- .../challenge-helper-scripts/fs-utils.test.ts | 2 +- tools/challenge-helper-scripts/fs-utils.ts | 2 +- .../helpers/new-challenge-prompts.ts | 2 +- tools/scripts/build/build-curriculum.ts | 2 +- .../build-external-curricula-data.test.ts | 2 +- .../build/build-external-curricula-data.ts | 4 +-- 168 files changed, 278 insertions(+), 263 deletions(-) delete mode 100644 config/tsconfig.json rename {config => shared/config}/certification-settings.ts (99%) rename {config => shared/config}/challenge-types.ts (100%) rename {config => shared/config}/constants.test.ts (100%) rename {config => shared/config}/constants.ts (100%) rename {config => shared/config}/donation-settings.ts (100%) rename {config => shared/config}/i18n.ts (100%) rename {config => shared/config}/superblocks.test.ts (100%) rename {config => shared/config}/superblocks.ts (99%) create mode 100644 shared/package.json rename {utils => shared}/tsconfig.json (82%) rename {utils => shared/utils}/get-lines.test.ts (100%) rename {utils => shared/utils}/get-lines.ts (100%) rename {utils => shared/utils}/is-audited.ts (85%) rename {utils => shared/utils}/polyvinyl.js (100%) rename {utils => shared/utils}/validate.test.ts (100%) rename {utils => shared/utils}/validate.ts (100%) diff --git a/.eslintignore b/.eslintignore index 22928b0b72c..618c1279ba1 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,11 +3,10 @@ client/.cache/** client/public/** api-server/src/public/** api-server/lib/** -config/i18n.js -config/misc.js -config/certification-settings.js -config/donation-settings.js -config/superblocks.js +shared/config/i18n.js +shared/config/certification-settings.js +shared/config/donation-settings.js +shared/config/superblocks.js web/** docs/**/*.md tools/ui-components/dist/** diff --git a/.eslintrc.json b/.eslintrc.json index d1c44a732ce..46a4f99388f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -68,10 +68,9 @@ "./client/tsconfig.json", "./tsconfig.json", "./api/tsconfig.json", - "./config/tsconfig.json", + "./shared/tsconfig.json", "./tools/ui-components/tsconfig.json", "./tools/client-plugins/browser-scripts/tsconfig.json", - "./utils/tsconfig.json", "./web/tsconfig.json", "./curriculum-server/tsconfig.json", "./cypress/tsconfig.json", diff --git a/.github/labeler.yml b/.github/labeler.yml index a313eb25369..0562e1f2f79 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -22,4 +22,4 @@ - docs/i18n/**/* - client/i18n/**/* - config/crowdin/**/* - - config/i18n/**/* + - shared/config/i18n/**/* diff --git a/.github/workflows/crowdin-download.curriculum.yml b/.github/workflows/crowdin-download.curriculum.yml index 4a348abae80..e787237f299 100644 --- a/.github/workflows/crowdin-download.curriculum.yml +++ b/.github/workflows/crowdin-download.curriculum.yml @@ -327,7 +327,7 @@ jobs: run: | echo pnpm version $(pnpm -v) pnpm install - pnpm run create:config + pnpm run create:shared pnpm run build:curriculum pnpm run build:server diff --git a/.github/workflows/e2e-mobile.yml b/.github/workflows/e2e-mobile.yml index 1f3ebe286c1..f57dbf4c2e9 100644 --- a/.github/workflows/e2e-mobile.yml +++ b/.github/workflows/e2e-mobile.yml @@ -47,7 +47,7 @@ jobs: - name: Install and Build run: | pnpm install - pnpm run create:config + pnpm run create:shared pnpm run build:curriculum - name: Generate mobile test files diff --git a/.github/workflows/e2e-playwright.yml b/.github/workflows/e2e-playwright.yml index 5e0e2607f56..1f96cd2818f 100644 --- a/.github/workflows/e2e-playwright.yml +++ b/.github/workflows/e2e-playwright.yml @@ -124,7 +124,7 @@ jobs: - name: Install and Build run: | pnpm install - pnpm run create:config + pnpm run create:shared pnpm run build:curriculum pnpm run build:server diff --git a/.github/workflows/e2e-web.yml b/.github/workflows/e2e-web.yml index c4e6d5b9134..fc7e6e78bc1 100644 --- a/.github/workflows/e2e-web.yml +++ b/.github/workflows/e2e-web.yml @@ -130,7 +130,7 @@ jobs: - name: Install and Build run: | pnpm install - pnpm run create:config + pnpm run create:shared pnpm run build:curriculum pnpm run build:server diff --git a/.github/workflows/node.js-tests.yml b/.github/workflows/node.js-tests.yml index 5b1d7365f27..4d17b52d4ef 100644 --- a/.github/workflows/node.js-tests.yml +++ b/.github/workflows/node.js-tests.yml @@ -64,7 +64,7 @@ jobs: run: | echo pnpm version $(pnpm -v) pnpm install - pnpm run create:config + pnpm run create:shared npm i --prefix=curriculum-server npm i --prefix=web pnpm run build:curriculum @@ -144,7 +144,7 @@ jobs: run: | echo pnpm version $(pnpm -v) pnpm install - pnpm run create:config + pnpm run create:shared pnpm run build:curriculum - name: Run Tests @@ -192,7 +192,7 @@ jobs: run: | echo pnpm version $(pnpm -v) pnpm install - pnpm run create:config + pnpm run create:shared pnpm run build:curriculum - name: Run Tests @@ -241,7 +241,7 @@ jobs: run: | echo pnpm version $(pnpm -v) pnpm install - pnpm run create:config + pnpm run create:shared pnpm run build:curriculum - name: Run Tests @@ -292,7 +292,7 @@ jobs: run: | echo pnpm version $(pnpm -v) pnpm install - pnpm run create:config + pnpm run create:shared # DONT REMOVE THIS STEP. # TODO: Refactor and use re-usable workflow and shared artifacts diff --git a/.github/workflows/temporary-container-checks.yml b/.github/workflows/temporary-container-checks.yml index 4779560a8a9..ebcc4f4acc4 100644 --- a/.github/workflows/temporary-container-checks.yml +++ b/.github/workflows/temporary-container-checks.yml @@ -145,7 +145,7 @@ jobs: - name: Install and Build run: | pnpm install - pnpm run create:config + pnpm run create:shared pnpm run build:curriculum pnpm run build:server diff --git a/.gitignore b/.gitignore index ad98481ff3a..1eebfc76a04 100644 --- a/.gitignore +++ b/.gitignore @@ -157,24 +157,15 @@ jspm_packages/ .netlify ### Generated config files ### -config/env.json -config/curriculum.json -config/i18n.js -config/misc.js -config/certification-settings.js -config/donation-settings.js -config/superblocks.js -config/superblocks.test.js -config/challenge-types.js -config/constants.js +shared/config/curriculum.json +shared/config/*.js ### Generated utils files ### -utils/index.js -utils/get-lines.js -utils/get-lines.test.js -utils/validate.js -utils/validate.test.js -utils/is-audited.js +shared/utils/get-lines.js +shared/utils/get-lines.test.js +shared/utils/validate.js +shared/utils/validate.test.js +shared/utils/is-audited.js ### Old Generated files ### # These files are no longer generated by the client, but can diff --git a/.prettierignore b/.prettierignore index 2f5120e38b5..d02212ce052 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,14 +6,14 @@ client/config/browser-scripts/*.json **/*fixtures* curriculum/challenges/_meta/*/* curriculum/challenges/**/* -config/**/*.json -config/*.js -utils/index.js -utils/get-lines.js -utils/get-lines.test.js -utils/validate.js -utils/validate.test.js -utils/is-audited.js +client/config/*.json +shared/config/*.js +shared/config/curriculum.json +shared/utils/get-lines.js +shared/utils/get-lines.test.js +shared/utils/validate.js +shared/utils/validate.test.js +shared/utils/is-audited.js pnpm-lock.yaml web/.next curriculum-server/data/curriculum.json diff --git a/api-server/src/common/models/user.js b/api-server/src/common/models/user.js index 9d5901017e6..5268cef5e05 100644 --- a/api-server/src/common/models/user.js +++ b/api-server/src/common/models/user.js @@ -15,7 +15,7 @@ import uuid from 'uuid/v4'; import { isEmail } from 'validator'; import { isProfane } from 'no-profanity'; -import { blocklistedUsernames } from '../../../../config/constants'; +import { blocklistedUsernames } from '../../../../shared/config/constants'; import { wrapHandledError } from '../../server/utils/create-handled-error.js'; import { diff --git a/api-server/src/server/boot/certificate.js b/api-server/src/server/boot/certificate.js index c3046741f50..8dcc4f6a4ce 100644 --- a/api-server/src/server/boot/certificate.js +++ b/api-server/src/server/boot/certificate.js @@ -15,7 +15,7 @@ import { oldDataVizId, currentCertifications, upcomingCertifications -} from '../../../../config/certification-settings'; +} from '../../../../shared/config/certification-settings'; import { reportError } from '../middlewares/sentry-error-handler.js'; import { deprecatedEndpoint } from '../utils/disabled-endpoints'; diff --git a/api-server/src/server/boot/challenge.js b/api-server/src/server/boot/challenge.js index 674fcd4ac31..6891a9db15c 100644 --- a/api-server/src/server/boot/challenge.js +++ b/api-server/src/server/boot/challenge.js @@ -17,7 +17,7 @@ import fetch from 'node-fetch'; import jwt from 'jsonwebtoken'; import { jwtSecret } from '../../../config/secrets'; -import { challengeTypes } from '../../../../config/challenge-types'; +import { challengeTypes } from '../../../../shared/config/challenge-types'; import { fixPartiallyCompletedChallengeItem, diff --git a/api-server/src/server/boot/donate.js b/api-server/src/server/boot/donate.js index cc4620c1815..a0ea4d89c24 100644 --- a/api-server/src/server/boot/donate.js +++ b/api-server/src/server/boot/donate.js @@ -1,7 +1,7 @@ import debug from 'debug'; import Stripe from 'stripe'; -import { donationSubscriptionConfig } from '../../../../config/donation-settings'; +import { donationSubscriptionConfig } from '../../../../shared/config/donation-settings'; import keys from '../../../config/secrets'; import { getAsyncPaypalToken, diff --git a/api-server/src/server/boot/settings.js b/api-server/src/server/boot/settings.js index 3fadb488a8e..4e64238058b 100644 --- a/api-server/src/server/boot/settings.js +++ b/api-server/src/server/boot/settings.js @@ -3,7 +3,7 @@ import { check } from 'express-validator'; import _ from 'lodash'; import isURL from 'validator/lib/isURL'; -import { isValidUsername } from '../../../../utils/validate'; +import { isValidUsername } from '../../../../shared/utils/validate'; import { alertTypes } from '../../common/utils/flash.js'; import { deprecatedEndpoint, diff --git a/api-server/src/server/component-passport.js b/api-server/src/server/component-passport.js index a85d4bcf7fc..3a8f38de971 100644 --- a/api-server/src/server/component-passport.js +++ b/api-server/src/server/component-passport.js @@ -2,7 +2,7 @@ import { PassportConfigurator } from '@freecodecamp/loopback-component-passport' import dedent from 'dedent'; import passport from 'passport'; -import { availableLangs } from '../../../config/i18n'; +import { availableLangs } from '../../../shared/config/i18n'; import { jwtSecret } from '../../config/secrets'; import passportProviders from './passport-providers'; import { setAccessTokenToResponse } from './utils/getSetAccessToken'; diff --git a/api-server/src/server/utils/donation.js b/api-server/src/server/utils/donation.js index b2a11225a41..27d5f82a281 100644 --- a/api-server/src/server/utils/donation.js +++ b/api-server/src/server/utils/donation.js @@ -2,7 +2,7 @@ import axios from 'axios'; import debug from 'debug'; import isEmail from 'validator/lib/isEmail'; -import { donationSubscriptionConfig } from '../../../../config/donation-settings'; +import { donationSubscriptionConfig } from '../../../../shared/config/donation-settings'; import keys from '../../../config/secrets'; const log = debug('fcc:boot:donate'); diff --git a/api-server/src/server/utils/get-curriculum.js b/api-server/src/server/utils/get-curriculum.js index ef58ca84ceb..576933898ef 100644 --- a/api-server/src/server/utils/get-curriculum.js +++ b/api-server/src/server/utils/get-curriculum.js @@ -7,7 +7,7 @@ import { flatten } from 'lodash'; // collected. // eslint-disable-next-line import/no-unresolved -import curriculum from '../../../../config/curriculum.json'; +import curriculum from '../../../../shared/config/curriculum.json'; export function getChallenges() { return Object.keys(curriculum) diff --git a/api-server/src/server/utils/redirection.js b/api-server/src/server/utils/redirection.js index 0ded5b7aeff..93cb37cdfc3 100644 --- a/api-server/src/server/utils/redirection.js +++ b/api-server/src/server/utils/redirection.js @@ -2,7 +2,7 @@ const jwt = require('jsonwebtoken'); const { allowedOrigins } = require('../../../config/cors-settings'); // process.env.HOME_LOCATION is being used as a fallback here. If the one // provided by the client is invalid we default to this. -const { availableLangs } = require('../../../../config/i18n'); +const { availableLangs } = require('../../../../shared/config/i18n'); function getReturnTo( encryptedParams, diff --git a/api-server/src/server/utils/stripeHelpers.js b/api-server/src/server/utils/stripeHelpers.js index ae0938d4145..b8494cb60ff 100644 --- a/api-server/src/server/utils/stripeHelpers.js +++ b/api-server/src/server/utils/stripeHelpers.js @@ -3,7 +3,7 @@ import { durationKeysConfig, donationOneTimeConfig, donationSubscriptionConfig -} from '../../../../config/donation-settings'; +} from '../../../../shared/config/donation-settings'; export function validStripeForm(amount, duration, email) { return isEmail('' + email) && diff --git a/api/src/routes/challenge.test.ts b/api/src/routes/challenge.test.ts index 03b3cad10a2..a9be6c470bc 100644 --- a/api/src/routes/challenge.test.ts +++ b/api/src/routes/challenge.test.ts @@ -2,7 +2,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { omit } from 'lodash'; -import { challengeTypes } from '../../../config/challenge-types'; +import { challengeTypes } from '../../../shared/config/challenge-types'; import { devLogin, setupServer, superRequest } from '../../jest.utils'; const isValidChallengeCompletionErrorMsg = { diff --git a/api/src/routes/challenge.ts b/api/src/routes/challenge.ts index 2bc84d9f893..af91ee06829 100644 --- a/api/src/routes/challenge.ts +++ b/api/src/routes/challenge.ts @@ -1,7 +1,7 @@ import { type FastifyPluginCallbackTypebox } from '@fastify/type-provider-typebox'; import jwt from 'jsonwebtoken'; import { uniqBy } from 'lodash'; -import { challengeTypes } from '../../../config/challenge-types'; +import { challengeTypes } from '../../../shared/config/challenge-types'; import { schemas } from '../schemas'; import { jsCertProjectIds, diff --git a/api/src/routes/settings.ts b/api/src/routes/settings.ts index 7c4a3e5b2b4..02228a1b1a8 100644 --- a/api/src/routes/settings.ts +++ b/api/src/routes/settings.ts @@ -1,7 +1,7 @@ import { type FastifyPluginCallbackTypebox } from '@fastify/type-provider-typebox'; import { isProfane } from 'no-profanity'; -import { isValidUsername } from '../../../utils/validate'; -import { blocklistedUsernames } from '../../../config/constants'; +import { isValidUsername } from '../../../shared/utils/validate'; +import { blocklistedUsernames } from '../../../shared/config/constants'; import { schemas } from '../schemas'; /** diff --git a/api/src/utils/common-challenge-functions.ts b/api/src/utils/common-challenge-functions.ts index b615beaa9cf..a219452c941 100644 --- a/api/src/utils/common-challenge-functions.ts +++ b/api/src/utils/common-challenge-functions.ts @@ -1,7 +1,7 @@ import { user } from '@prisma/client'; import { FastifyInstance } from 'fastify'; import { omit, pick } from 'lodash'; -import { challengeTypes } from '../../../config/challenge-types'; +import { challengeTypes } from '../../../shared/config/challenge-types'; import { getChallenges } from './get-challenges'; export const jsCertProjectIds = [ diff --git a/api/src/utils/get-challenges.ts b/api/src/utils/get-challenges.ts index ed690439a63..c7a8d40a4be 100644 --- a/api/src/utils/get-challenges.ts +++ b/api/src/utils/get-challenges.ts @@ -3,8 +3,8 @@ // 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'; -import { SuperBlocks } from '../../../config/superblocks'; +import curriculum from '../../../shared/config/curriculum.json'; +import { SuperBlocks } from '../../../shared/config/superblocks'; type Curriculum = { [keyValue in SuperBlocks]?: CurriculumProps }; diff --git a/client/.gitignore b/client/.gitignore index 5c557d03425..c96998dd164 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -18,3 +18,7 @@ i18n/locales/**/trending.json # TODO: Remove once you've figured out why it's generated. # JS that probably should not be generated src/components/Donation/types.js + +# Config + +config/env.json diff --git a/client/config/cert-and-project-map.test.ts b/client/config/cert-and-project-map.test.ts index e43b48d0984..3ab2883918d 100644 --- a/client/config/cert-and-project-map.test.ts +++ b/client/config/cert-and-project-map.test.ts @@ -3,7 +3,7 @@ import { currentCertifications, upcomingCertifications, legacyCertifications -} from '../../config/certification-settings'; +} from '../../shared/config/certification-settings'; import { currentCertTitles, upcomingCertTitles, diff --git a/client/config/cert-and-project-map.ts b/client/config/cert-and-project-map.ts index 7c9b7593e45..d01c5036950 100644 --- a/client/config/cert-and-project-map.ts +++ b/client/config/cert-and-project-map.ts @@ -3,8 +3,8 @@ import { legacyCertifications, upcomingCertifications, currentCertifications -} from '../../config/certification-settings'; -import config from '../../config/env.json'; +} from '../../shared/config/certification-settings'; +import config from '../config/env.json'; const { showUpcomingChanges } = config; diff --git a/client/gatsby-config.js b/client/gatsby-config.js index 5bae6180867..123d3a4d9f1 100644 --- a/client/gatsby-config.js +++ b/client/gatsby-config.js @@ -1,5 +1,5 @@ const path = require('path'); -const envData = require('../config/env.json'); +const envData = require('./config/env.json'); const { buildChallenges, replaceChallengeNode, diff --git a/client/gatsby-node.js b/client/gatsby-node.js index be4bedf1dca..db1765d8936 100644 --- a/client/gatsby-node.js +++ b/client/gatsby-node.js @@ -4,7 +4,7 @@ const { createFilePath } = require('gatsby-source-filesystem'); const uniq = require('lodash/uniq'); const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); const webpack = require('webpack'); -const env = require('../config/env.json'); +const env = require('./config/env.json'); const { createChallengePages, diff --git a/client/i18n/config.js b/client/i18n/config.js index 355c8e200ac..e52f23b6c5e 100644 --- a/client/i18n/config.js +++ b/client/i18n/config.js @@ -3,8 +3,8 @@ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; -const envData = require('../../config/env.json'); -const { i18nextCodes } = require('../../config/i18n'); +const envData = require('../config/env.json'); +const { i18nextCodes } = require('../../shared/config/i18n'); const { clientLocale } = envData; @@ -20,35 +20,35 @@ i18n.use(initReactI18next).init({ resources: { [i18nextCode]: { translations: preval` - const envData = require('../../config/env.json'); + const envData = require('../config/env.json'); const { clientLocale } = envData; if (clientLocale !== 'english') { module.exports = require('./locales/' + clientLocale + '/translations.json'); } `, trending: preval` - const envData = require('../../config/env.json'); + const envData = require('../config/env.json'); const { clientLocale } = envData; if (clientLocale !== 'english') { module.exports = require('./locales/' + clientLocale + '/trending.json'); } `, intro: preval` - const envData = require('../../config/env.json'); + const envData = require('../config/env.json'); const { clientLocale } = envData; if (clientLocale !== 'english') { module.exports = require('./locales/' + clientLocale + '/intro.json'); } `, metaTags: preval` - const envData = require('../../config/env.json'); + const envData = require('../config/env.json'); const { clientLocale } = envData; if (clientLocale !== 'english') { module.exports = require('./locales/' + clientLocale + '/meta-tags.json'); } `, links: preval` - const envData = require('../../config/env.json'); + const envData = require('../config/env.json'); const { clientLocale } = envData; if (clientLocale !== 'english') { module.exports = require('./locales/' + clientLocale + '/links.json'); diff --git a/client/i18n/locales.test.ts b/client/i18n/locales.test.ts index f8f7239b502..6af5a87d443 100644 --- a/client/i18n/locales.test.ts +++ b/client/i18n/locales.test.ts @@ -1,7 +1,7 @@ import fs from 'fs'; import { setup } from 'jest-json-schema-extended'; -import { availableLangs, LangNames, LangCodes } from '../../config/i18n'; -import { SuperBlocks } from '../../config/superblocks'; +import { availableLangs, LangNames, LangCodes } from '../../shared/config/i18n'; +import { SuperBlocks } from '../../shared/config/superblocks'; import intro from './locales/english/intro.json'; setup(); diff --git a/client/i18n/schema-validation.ts b/client/i18n/schema-validation.ts index d9ccd807d23..d2163e55612 100644 --- a/client/i18n/schema-validation.ts +++ b/client/i18n/schema-validation.ts @@ -1,6 +1,6 @@ import path from 'path'; import { readFile } from 'fs/promises'; -import { availableLangs } from '../../config/i18n'; +import { availableLangs } from '../../shared/config/i18n'; import introSchema from './locales/english/intro.json'; import linksSchema from './locales/english/links.json'; import metaTagsSchema from './locales/english/meta-tags.json'; diff --git a/client/package.json b/client/package.json index 53803f58d4b..28ff260c625 100644 --- a/client/package.json +++ b/client/package.json @@ -23,7 +23,7 @@ "build": "cross-env NODE_OPTIONS=\"--max-old-space-size=7168\" gatsby build --prefix-paths", "build:scripts": "pnpm run -F=browser-scripts build", "clean": "gatsby clean", - "common-setup": "pnpm -w run create:config && pnpm -w run create:utils && pnpm run create:env && pnpm run create:trending && pnpm run build:components-library", + "common-setup": "pnpm -w run create:shared && pnpm run create:env && pnpm run create:trending && pnpm run build:components-library", "create:env": "cross-env DEBUG=fcc:* ts-node ./tools/create-env.ts", "create:trending": "ts-node ./tools/download-trending.ts", "predevelop": "pnpm run common-setup && pnpm run build:scripts --env development", diff --git a/client/src/__mocks__/gatsby.ts b/client/src/__mocks__/gatsby.ts index 5881cd6ffa6..362d802fad2 100644 --- a/client/src/__mocks__/gatsby.ts +++ b/client/src/__mocks__/gatsby.ts @@ -2,7 +2,7 @@ import React from 'react'; import { GatsbyLinkProps } from 'gatsby'; const gatsby: NodeModule = jest.requireActual('gatsby'); -import envData from '../../../config/env.json'; +import envData from '../../config/env.json'; const { clientLocale } = envData; diff --git a/client/src/analytics/index.ts b/client/src/analytics/index.ts index e679595f094..27b6e75ef74 100644 --- a/client/src/analytics/index.ts +++ b/client/src/analytics/index.ts @@ -6,7 +6,7 @@ import { prodAnalyticsESId } from '../../config/analytics-settings'; -import envData from '../../../config/env.json'; +import envData from '../../config/env.json'; const { deploymentEnv, clientLocale } = envData; diff --git a/client/src/assets/icons/index.tsx b/client/src/assets/icons/index.tsx index b3f7ef33273..a685b366718 100644 --- a/client/src/assets/icons/index.tsx +++ b/client/src/assets/icons/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { SuperBlocks } from '../../../../config/superblocks'; +import { SuperBlocks } from '../../../../shared/config/superblocks'; import APIIcon from './api'; import D3Icon from './d3'; import DatabaseIcon from './database'; diff --git a/client/src/client-only-routes/show-certification.tsx b/client/src/client-only-routes/show-certification.tsx index b22c2c41f21..e4e9483d911 100644 --- a/client/src/client-only-routes/show-certification.tsx +++ b/client/src/client-only-routes/show-certification.tsx @@ -8,8 +8,8 @@ import { bindActionCreators, Dispatch } from 'redux'; import { createSelector } from 'reselect'; import { Container } from '@freecodecamp/ui'; -import envData from '../../../config/env.json'; -import { getLangCode } from '../../../config/i18n'; +import envData from '../../config/env.json'; +import { getLangCode } from '../../../shared/config/i18n'; import FreeCodeCampLogo from '../assets/icons/freecodecamp'; import MicrosoftLogo from '../assets/icons/microsoft-logo'; import DonateForm from '../components/Donation/donate-form'; @@ -35,12 +35,12 @@ import { standardErrorMessage } from '../utils/error-messages'; -import { PaymentContext } from '../../../config/donation-settings'; +import { PaymentContext } from '../../../shared/config/donation-settings'; import ribbon from '../assets/images/ribbon.svg'; import { certTypes, certTypeTitleMap -} from '../../../config/certification-settings'; +} from '../../../shared/config/certification-settings'; import ShowProjectLinks from './show-project-links'; const { clientLocale } = envData; diff --git a/client/src/client-only-routes/show-project-links.tsx b/client/src/client-only-routes/show-project-links.tsx index 71b92f757c6..276e312df03 100644 --- a/client/src/client-only-routes/show-project-links.tsx +++ b/client/src/client-only-routes/show-project-links.tsx @@ -18,7 +18,7 @@ import ExamResultsModal from '../components/SolutionViewer/exam-results-modal'; import { openModal } from '../templates/Challenges/redux/actions'; -import { regeneratePathAndHistory } from '../../../utils/polyvinyl'; +import { regeneratePathAndHistory } from '../../../shared/utils/polyvinyl'; import '../components/layouts/project-links.css'; interface ShowProjectLinksProps { certName: string; diff --git a/client/src/client-only-routes/show-settings.test.tsx b/client/src/client-only-routes/show-settings.test.tsx index ce422698aef..301e3d27c5d 100644 --- a/client/src/client-only-routes/show-settings.test.tsx +++ b/client/src/client-only-routes/show-settings.test.tsx @@ -2,7 +2,7 @@ // @ts-nocheck Likely need to not use ShallowRenderer import React from 'react'; import ShallowRenderer from 'react-test-renderer/shallow'; -import envData from '../../../config/env.json'; +import envData from '../../config/env.json'; import { ShowSettings } from './show-settings'; diff --git a/client/src/client-only-routes/show-settings.tsx b/client/src/client-only-routes/show-settings.tsx index df658732e5a..b9f52e36439 100644 --- a/client/src/client-only-routes/show-settings.tsx +++ b/client/src/client-only-routes/show-settings.tsx @@ -5,7 +5,7 @@ import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { Container } from '@freecodecamp/ui'; -import envData from '../../../config/env.json'; +import envData from '../../config/env.json'; import { createFlashMessage } from '../components/Flash/redux'; import { Loader, Spacer } from '../components/helpers'; import Certification from '../components/settings/certification'; diff --git a/client/src/client-only-routes/show-unsubscribed.tsx b/client/src/client-only-routes/show-unsubscribed.tsx index 999965a0c02..670c9b64d6a 100644 --- a/client/src/client-only-routes/show-unsubscribed.tsx +++ b/client/src/client-only-routes/show-unsubscribed.tsx @@ -5,7 +5,7 @@ import Helmet from 'react-helmet'; import { useTranslation } from 'react-i18next'; import { Container } from '@freecodecamp/ui'; -import envData from '../../../config/env.json'; +import envData from '../../config/env.json'; import { Spacer } from '../components/helpers'; import FullWidthRow from '../components/helpers/full-width-row'; diff --git a/client/src/components/Donation/donate-form.tsx b/client/src/components/Donation/donate-form.tsx index c9168e9bd1e..0ba25ddcb34 100644 --- a/client/src/components/Donation/donate-form.tsx +++ b/client/src/components/Donation/donate-form.tsx @@ -13,7 +13,7 @@ import { defaultDonation, modalDefaultDonation, type DonationConfig -} from '../../../../config/donation-settings'; +} from '../../../../shared/config/donation-settings'; import { defaultDonationFormState } from '../../redux'; import { updateDonationFormState, postCharge } from '../../redux/actions'; import { diff --git a/client/src/components/Donation/donation-modal.tsx b/client/src/components/Donation/donation-modal.tsx index 63893197e16..6702437dad8 100644 --- a/client/src/components/Donation/donation-modal.tsx +++ b/client/src/components/Donation/donation-modal.tsx @@ -7,7 +7,7 @@ import { useFeature } from '@growthbook/growthbook-react'; import { goToAnchor } from 'react-scrollable-anchor'; import { bindActionCreators, Dispatch, AnyAction } from 'redux'; import { createSelector } from 'reselect'; -import { PaymentContext } from '../../../../config/donation-settings'; +import { PaymentContext } from '../../../../shared/config/donation-settings'; import BearProgressModal from '../../assets/images/components/bear-progress-modal'; import BearBlockCompletion from '../../assets/images/components/bear-block-completion-modal'; diff --git a/client/src/components/Donation/patreon-button.tsx b/client/src/components/Donation/patreon-button.tsx index d40b355e1c3..8507cd777c3 100644 --- a/client/src/components/Donation/patreon-button.tsx +++ b/client/src/components/Donation/patreon-button.tsx @@ -3,8 +3,8 @@ import { donationUrls, patreonDefaultPledgeAmount, PaymentProvider -} from '../../../../config/donation-settings'; -import envData from '../../../../config/env.json'; +} from '../../../../shared/config/donation-settings'; +import envData from '../../../config/env.json'; import PatreonLogo from '../../assets/images/components/patreon-logo'; import { PostPayment } from './types'; diff --git a/client/src/components/Donation/paypal-button.tsx b/client/src/components/Donation/paypal-button.tsx index 4cd8bb0fb8e..89852f17218 100644 --- a/client/src/components/Donation/paypal-button.tsx +++ b/client/src/components/Donation/paypal-button.tsx @@ -9,8 +9,8 @@ import { PaymentProvider, type DonationDuration, type DonationAmount -} from '../../../../config/donation-settings'; -import envData from '../../../../config/env.json'; +} from '../../../../shared/config/donation-settings'; +import envData from '../../../config/env.json'; import { userSelector, signInLoadingSelector } from '../../redux/selectors'; import { Themes } from '../settings/theme'; import { DonationApprovalData, PostPayment } from './types'; diff --git a/client/src/components/Donation/stripe-card-form.tsx b/client/src/components/Donation/stripe-card-form.tsx index 5abaed584e6..6e25b505b1b 100644 --- a/client/src/components/Donation/stripe-card-form.tsx +++ b/client/src/components/Donation/stripe-card-form.tsx @@ -13,8 +13,8 @@ import type { } from '@stripe/stripe-js'; import React, { useState } from 'react'; -import { PaymentProvider } from '../../../../config/donation-settings'; -import envData from '../../../../config/env.json'; +import { PaymentProvider } from '../../../../shared/config/donation-settings'; +import envData from '../../../config/env.json'; import { Themes } from '../settings/theme'; import { DonationApprovalData, PostPayment } from './types'; diff --git a/client/src/components/Donation/wallets-button.tsx b/client/src/components/Donation/wallets-button.tsx index 668b279ee60..1d5860a9b0b 100644 --- a/client/src/components/Donation/wallets-button.tsx +++ b/client/src/components/Donation/wallets-button.tsx @@ -6,9 +6,9 @@ import { import { Stripe, loadStripe } from '@stripe/stripe-js'; import type { Token, PaymentRequest } from '@stripe/stripe-js'; import React, { useState, useEffect } from 'react'; -import envData from '../../../../config/env.json'; +import envData from '../../../config/env.json'; import { Themes } from '../settings/theme'; -import { PaymentProvider } from '../../../../config/donation-settings'; +import { PaymentProvider } from '../../../../shared/config/donation-settings'; import { DonationApprovalData, PostPayment } from './types'; const { stripePublicKey }: { stripePublicKey: string | null } = envData; diff --git a/client/src/components/Header/components/language-list.tsx b/client/src/components/Header/components/language-list.tsx index b6ada30fa7a..96dbf592606 100644 --- a/client/src/components/Header/components/language-list.tsx +++ b/client/src/components/Header/components/language-list.tsx @@ -2,13 +2,13 @@ import React, { useState, useRef, useEffect } from 'react'; import type { TFunction } from 'i18next'; import { connect } from 'react-redux'; import { withTranslation } from 'react-i18next'; -import { clientLocale } from '../../../../../config/env.json'; +import { clientLocale } from '../../../../config/env.json'; import { availableLangs, LangNames, LangCodes, hiddenLangs -} from '../../../../../config/i18n'; +} from '../../../../../shared/config/i18n'; import { hardGoTo as navigate } from '../../../redux/actions'; import createLanguageRedirect from '../../create-language-redirect'; import LanguageGlobe from '../../../assets/icons/language-globe'; diff --git a/client/src/components/Header/components/login.tsx b/client/src/components/Header/components/login.tsx index d5a5b954847..1fae7609671 100644 --- a/client/src/components/Header/components/login.tsx +++ b/client/src/components/Header/components/login.tsx @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; -import envData from '../../../../../config/env.json'; +import envData from '../../../../config/env.json'; import { isSignedInSelector } from '../../../redux/selectors'; const { apiLocation, homeLocation } = envData; diff --git a/client/src/components/Header/components/nav-links.tsx b/client/src/components/Header/components/nav-links.tsx index bd42e27773b..653d9948f74 100644 --- a/client/src/components/Header/components/nav-links.tsx +++ b/client/src/components/Header/components/nav-links.tsx @@ -8,7 +8,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { Fragment } from 'react'; import { useTranslation, withTranslation } from 'react-i18next'; import { connect } from 'react-redux'; -import { radioLocation } from '../../../../../config/env.json'; +import { radioLocation } from '../../../../config/env.json'; import { openSignoutModal } from '../../../redux/actions'; import { updateMyTheme } from '../../../redux/settings/actions'; import { Link } from '../../helpers'; diff --git a/client/src/components/Intro/components/intro-description.tsx b/client/src/components/Intro/components/intro-description.tsx index 06ac91f8b3b..76ca2f6b25e 100644 --- a/client/src/components/Intro/components/intro-description.tsx +++ b/client/src/components/Intro/components/intro-description.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Trans, useTranslation } from 'react-i18next'; -import envData from '../../../../../config/env.json'; +import envData from '../../../../config/env.json'; import { Link, Spacer } from '../../helpers'; import '../intro.css'; diff --git a/client/src/components/Map/index.tsx b/client/src/components/Map/index.tsx index 68c084900b1..7e4efb5bb7e 100644 --- a/client/src/components/Map/index.tsx +++ b/client/src/components/Map/index.tsx @@ -7,7 +7,7 @@ import { SuperBlocks, getFirstNotAuditedSuperBlock, superBlockOrder -} from '../../../../config/superblocks'; +} from '../../../../shared/config/superblocks'; import { generateIconComponent } from '../../assets/icons'; import LinkButton from '../../assets/icons/link-button'; import { Link, Spacer } from '../helpers'; @@ -16,7 +16,7 @@ import { curriculumLocale, showUpcomingChanges, showNewCurriculum -} from '../../../../config/env.json'; +} from '../../../config/env.json'; import './map.css'; diff --git a/client/src/components/app-mount-notifier.test.tsx b/client/src/components/app-mount-notifier.test.tsx index 215d99c94c0..bb2dbec8396 100644 --- a/client/src/components/app-mount-notifier.test.tsx +++ b/client/src/components/app-mount-notifier.test.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { I18nextProvider } from 'react-i18next'; import { Provider } from 'react-redux'; -import { i18nextCodes } from '../../../config/i18n'; +import { i18nextCodes } from '../../../shared/config/i18n'; import i18nTestConfig from '../../i18n/config-for-tests'; import { createStore } from '../redux/create-store'; import AppMountNotifier from './app-mount-notifier'; diff --git a/client/src/components/growth-book/growth-book-wrapper.tsx b/client/src/components/growth-book/growth-book-wrapper.tsx index b8d4f9362fc..cd8f03c91a3 100644 --- a/client/src/components/growth-book/growth-book-wrapper.tsx +++ b/client/src/components/growth-book/growth-book-wrapper.tsx @@ -9,7 +9,7 @@ import { import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { isSignedInSelector, userSelector } from '../../redux/selectors'; -import envData from '../../../../config/env.json'; +import envData from '../../../config/env.json'; import { User } from '../../redux/prop-types'; import GrowthBookReduxConnector from './growth-book-redux-connector'; diff --git a/client/src/components/landing/components/landing-top.tsx b/client/src/components/landing/components/landing-top.tsx index 8a721f9fb6a..cf5a3611b8c 100644 --- a/client/src/components/landing/components/landing-top.tsx +++ b/client/src/components/landing/components/landing-top.tsx @@ -2,7 +2,7 @@ import { Col, Row } from '@freecodecamp/react-bootstrap'; import React from 'react'; import { useTranslation } from 'react-i18next'; import { Container } from '@freecodecamp/ui'; -import { clientLocale } from '../../../../../config/env.json'; +import { clientLocale } from '../../../../config/env.json'; import { AmazonLogo, AppleLogo, diff --git a/client/src/components/layouts/default.tsx b/client/src/components/layouts/default.tsx index 661a7ed8f39..23aa5be611f 100644 --- a/client/src/components/layouts/default.tsx +++ b/client/src/components/layouts/default.tsx @@ -45,7 +45,7 @@ import Footer from '../Footer'; import Header from '../Header'; import OfflineWarning from '../OfflineWarning'; import { Loader } from '../helpers'; -import envData from '../../../../config/env.json'; +import envData from '../../../config/env.json'; // preload common fonts import './fonts.css'; diff --git a/client/src/components/profile/components/camper.tsx b/client/src/components/profile/components/camper.tsx index 734928fdda0..9e070464962 100644 --- a/client/src/components/profile/components/camper.tsx +++ b/client/src/components/profile/components/camper.tsx @@ -10,8 +10,8 @@ import type { TFunction } from 'i18next'; import { useTranslation } from 'react-i18next'; import type { User } from '../../../redux/prop-types'; -import envData from '../../../../../config/env.json'; -import { getLangCode } from '../../../../../config/i18n'; +import envData from '../../../../config/env.json'; +import { getLangCode } from '../../../../../shared/config/i18n'; import { AvatarRenderer } from '../../helpers'; import Link from '../../helpers/link'; import SocialIcons from './social-icons'; diff --git a/client/src/components/profile/components/heat-map.tsx b/client/src/components/profile/components/heat-map.tsx index 28fd6fc8d94..b22f38e84e0 100644 --- a/client/src/components/profile/components/heat-map.tsx +++ b/client/src/components/profile/components/heat-map.tsx @@ -16,8 +16,8 @@ import './heatmap.css'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore -import envData from '../../../../../config/env.json'; -import { getLangCode } from '../../../../../config/i18n'; +import envData from '../../../../config/env.json'; +import { getLangCode } from '../../../../../shared/config/i18n'; import { User } from '../../../redux/prop-types'; import FullWidthRow from '../../helpers/full-width-row'; import Spacer from '../../helpers/spacer'; diff --git a/client/src/components/profile/components/time-line.tsx b/client/src/components/profile/components/time-line.tsx index ea8444893b9..d94e5558c7e 100644 --- a/client/src/components/profile/components/time-line.tsx +++ b/client/src/components/profile/components/time-line.tsx @@ -7,10 +7,10 @@ import type { TFunction } from 'i18next'; import { withTranslation } from 'react-i18next'; import { connect } from 'react-redux'; -import envData from '../../../../../config/env.json'; -import { getLangCode } from '../../../../../config/i18n'; +import envData from '../../../../config/env.json'; +import { getLangCode } from '../../../../../shared/config/i18n'; import { getCertIds, getPathFromID } from '../../../../utils'; -import { regeneratePathAndHistory } from '../../../../../utils/polyvinyl'; +import { regeneratePathAndHistory } from '../../../../../shared/utils/polyvinyl'; import CertificationIcon from '../../../assets/icons/certification'; import { CompletedChallenge } from '../../../redux/prop-types'; import ProjectPreviewModal from '../../../templates/Challenges/components/project-preview-modal'; diff --git a/client/src/components/search/with-instant-search.tsx b/client/src/components/search/with-instant-search.tsx index 744d4607db1..d3a0c74158e 100644 --- a/client/src/components/search/with-instant-search.tsx +++ b/client/src/components/search/with-instant-search.tsx @@ -7,7 +7,7 @@ import { InstantSearch, Configure } from 'react-instantsearch-dom'; import { connect } from 'react-redux'; import { useMediaQuery } from 'react-responsive'; import { createSelector } from 'reselect'; -import { algoliaAppId, algoliaAPIKey } from '../../../../config/env.json'; +import { algoliaAppId, algoliaAPIKey } from '../../../config/env.json'; import { newsIndex } from '../../utils/algolia-locale-setup'; import { diff --git a/client/src/components/seo/index.tsx b/client/src/components/seo/index.tsx index 9238c7bba49..fee48bc7b8b 100644 --- a/client/src/components/seo/index.tsx +++ b/client/src/components/seo/index.tsx @@ -2,7 +2,7 @@ import { useStaticQuery, graphql } from 'gatsby'; import React from 'react'; import Helmet from 'react-helmet'; import { useTranslation } from 'react-i18next'; -import { SuperBlocks } from '../../../../config/superblocks'; +import { SuperBlocks } from '../../../../shared/config/superblocks'; interface SEOProps { title?: string; diff --git a/client/src/components/settings/certification.tsx b/client/src/components/settings/certification.tsx index 49ee33097d0..5b7ff358cc4 100644 --- a/client/src/components/settings/certification.tsx +++ b/client/src/components/settings/certification.tsx @@ -8,7 +8,7 @@ import { createSelector } from 'reselect'; import ScrollableAnchor, { configureAnchors } from 'react-scrollable-anchor'; import { connect } from 'react-redux'; -import { regeneratePathAndHistory } from '../../../../utils/polyvinyl'; +import { regeneratePathAndHistory } from '../../../../shared/utils/polyvinyl'; import ProjectPreviewModal from '../../templates/Challenges/components/project-preview-modal'; import ExamResultsModal from '../SolutionViewer/exam-results-modal'; import { openModal } from '../../templates/Challenges/redux/actions'; @@ -26,8 +26,8 @@ import { SolutionDisplayWidget } from '../solution-display-widget'; import { Certification, certSlugTypeMap -} from '../../../../config/certification-settings'; -import env from '../../../../config/env.json'; +} from '../../../../shared/config/certification-settings'; +import env from '../../../config/env.json'; import { ClaimedCertifications, diff --git a/client/src/components/settings/username.tsx b/client/src/components/settings/username.tsx index df5d9c9c8fe..211649f0fea 100644 --- a/client/src/components/settings/username.tsx +++ b/client/src/components/settings/username.tsx @@ -13,7 +13,7 @@ import { bindActionCreators } from 'redux'; import type { Dispatch } from 'redux'; import { createSelector } from 'reselect'; -import { isValidUsername } from '../../../../utils/validate'; +import { isValidUsername } from '../../../../shared/utils/validate'; import { usernameValidationSelector } from '../../redux/settings/selectors'; import { validateUsername, diff --git a/client/src/components/signout-modal/index.tsx b/client/src/components/signout-modal/index.tsx index abad3be8ab0..8ae2818f359 100644 --- a/client/src/components/signout-modal/index.tsx +++ b/client/src/components/signout-modal/index.tsx @@ -8,7 +8,7 @@ import { useTranslation } from 'react-i18next'; import { Spacer } from '../helpers'; import { hardGoTo as navigate, closeSignoutModal } from '../../redux/actions'; import { isSignoutModalOpenSelector } from '../../redux/selectors'; -import { apiLocation } from '../../../../config/env.json'; +import { apiLocation } from '../../../config/env.json'; import './signout-modal.css'; diff --git a/client/src/html.tsx b/client/src/html.tsx index cef622ec6be..dd40fad2e07 100644 --- a/client/src/html.tsx +++ b/client/src/html.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { clientLocale } from '../../config/env.json'; -import { rtlLangs } from '../../config/i18n'; +import { clientLocale } from '../config/env.json'; +import { rtlLangs } from '../../shared/config/i18n'; interface HTMLProps { body: string; diff --git a/client/src/pages/donate.tsx b/client/src/pages/donate.tsx index 9c31a33d19e..0c4ffb28aca 100644 --- a/client/src/pages/donate.tsx +++ b/client/src/pages/donate.tsx @@ -20,7 +20,7 @@ import { Spacer, Loader } from '../components/helpers'; import CampersImage from '../components/landing/components/campers-image'; import { executeGA } from '../redux/actions'; import { signInLoadingSelector, userSelector } from '../redux/selectors'; -import { PaymentContext } from '../../../config/donation-settings'; +import { PaymentContext } from '../../../shared/config/donation-settings'; export interface ExecuteGaArg { event: string; diff --git a/client/src/pages/email-sign-up.tsx b/client/src/pages/email-sign-up.tsx index c1a5126b663..7a22fbf3418 100644 --- a/client/src/pages/email-sign-up.tsx +++ b/client/src/pages/email-sign-up.tsx @@ -10,7 +10,7 @@ import { Container } from '@freecodecamp/ui'; import IntroDescription from '../components/Intro/components/intro-description'; import createRedirect from '../components/create-redirect'; import { Spacer, Loader, Link } from '../components/helpers'; -import { apiLocation } from '../../../config/env.json'; +import { apiLocation } from '../../config/env.json'; import { acceptTerms } from '../redux/actions'; import { diff --git a/client/src/pages/learn.tsx b/client/src/pages/learn.tsx index e8fc74557a7..b00690ae90f 100644 --- a/client/src/pages/learn.tsx +++ b/client/src/pages/learn.tsx @@ -12,7 +12,7 @@ import Intro from '../components/Intro'; import Map from '../components/Map'; import { Spacer } from '../components/helpers'; import LearnLayout from '../components/layouts/learn'; -import { defaultDonation } from '../../../config/donation-settings'; +import { defaultDonation } from '../../../shared/config/donation-settings'; import { isSignedInSelector, userSelector, diff --git a/client/src/redux/create-store.js b/client/src/redux/create-store.js index 93918f35dea..b890f4bc8ec 100644 --- a/client/src/redux/create-store.js +++ b/client/src/redux/create-store.js @@ -3,7 +3,7 @@ import { composeWithDevTools } from 'redux-devtools-extension/logOnlyInProductio import { createEpicMiddleware } from 'redux-observable'; import createSagaMiddleware from 'redux-saga'; -import envData from '../../../config/env.json'; +import envData from '../../config/env.json'; import { isBrowser } from '../../utils'; import rootEpic from './root-epic'; import rootReducer from './root-reducer'; diff --git a/client/src/redux/donation-saga.js b/client/src/redux/donation-saga.js index 525165fc733..6a69b69321a 100644 --- a/client/src/redux/donation-saga.js +++ b/client/src/redux/donation-saga.js @@ -15,7 +15,7 @@ import { postChargeStripeCard } from '../utils/ajax'; import { stringifyDonationEvents } from '../utils/analytics-strings'; -import { PaymentProvider } from '../../../config/donation-settings'; +import { PaymentProvider } from '../../../shared/config/donation-settings'; import { actionTypes as appTypes } from './action-types'; import { openDonationModal, diff --git a/client/src/redux/failed-updates-epic.js b/client/src/redux/failed-updates-epic.js index 385fc38bce5..91c95f3e277 100644 --- a/client/src/redux/failed-updates-epic.js +++ b/client/src/redux/failed-updates-epic.js @@ -11,7 +11,7 @@ import { import store from 'store'; import { v4 as uuid } from 'uuid'; -import { challengeTypes } from '../../../config/challenge-types'; +import { challengeTypes } from '../../../shared/config/challenge-types'; import { isGoodXHRStatus } from '../templates/Challenges/utils'; import postUpdate$ from '../templates/Challenges/utils/post-update'; import { actionTypes } from './action-types'; diff --git a/client/src/redux/prop-types.ts b/client/src/redux/prop-types.ts index bea27f5674f..c8291ee9fcc 100644 --- a/client/src/redux/prop-types.ts +++ b/client/src/redux/prop-types.ts @@ -1,5 +1,5 @@ import { HandlerProps } from 'react-reflex'; -import { SuperBlocks } from '../../../config/superblocks'; +import { SuperBlocks } from '../../../shared/config/superblocks'; import { Themes } from '../components/settings/theme'; import { type CertTitle } from '../../config/cert-and-project-map'; diff --git a/client/src/redux/save-challenge-saga.js b/client/src/redux/save-challenge-saga.js index 4fddd95b3c2..f2208ac5b53 100644 --- a/client/src/redux/save-challenge-saga.js +++ b/client/src/redux/save-challenge-saga.js @@ -1,6 +1,6 @@ import { call, put, select, takeEvery } from 'redux-saga/effects'; -import { challengeTypes } from '../../../config/challenge-types'; +import { challengeTypes } from '../../../shared/config/challenge-types'; import { createFlashMessage } from '../components/Flash/redux'; import { FlashMessages } from '../components/Flash/redux/flash-messages'; import { diff --git a/client/src/redux/selectors.js b/client/src/redux/selectors.js index 28e5152cd6b..3acefc44814 100644 --- a/client/src/redux/selectors.js +++ b/client/src/redux/selectors.js @@ -1,4 +1,4 @@ -import { Certification } from '../../../config/certification-settings'; +import { Certification } from '../../../shared/config/certification-settings'; import { ns as MainApp } from './action-types'; export const savedChallengesSelector = state => diff --git a/client/src/redux/settings/settings-sagas.js b/client/src/redux/settings/settings-sagas.js index 918b8dd303c..32b95b108a7 100644 --- a/client/src/redux/settings/settings-sagas.js +++ b/client/src/redux/settings/settings-sagas.js @@ -12,7 +12,7 @@ import store from 'store'; import { certTypeIdMap, certTypes -} from '../../../../config/certification-settings'; +} from '../../../../shared/config/certification-settings'; import { createFlashMessage } from '../../components/Flash/redux'; import { liveCerts } from '../../../config/cert-and-project-map'; import { diff --git a/client/src/templates/Challenges/classic/desktop-layout.tsx b/client/src/templates/Challenges/classic/desktop-layout.tsx index 888c55aea67..b0552662e2c 100644 --- a/client/src/templates/Challenges/classic/desktop-layout.tsx +++ b/client/src/templates/Challenges/classic/desktop-layout.tsx @@ -4,7 +4,7 @@ import { ReflexContainer, ReflexSplitter, ReflexElement } from 'react-reflex'; import { createSelector } from 'reselect'; import { connect } from 'react-redux'; import { sortChallengeFiles } from '../../../../utils/sort-challengefiles'; -import { challengeTypes } from '../../../../../config/challenge-types'; +import { challengeTypes } from '../../../../../shared/config/challenge-types'; import { ChallengeFile, ChallengeFiles, diff --git a/client/src/templates/Challenges/classic/editor.tsx b/client/src/templates/Challenges/classic/editor.tsx index 633360b6d85..3ad00581a13 100644 --- a/client/src/templates/Challenges/classic/editor.tsx +++ b/client/src/templates/Challenges/classic/editor.tsx @@ -37,7 +37,7 @@ import { editorNotes } from '../../../utils/tone/editor-notes'; import { challengeTypes, isFinalProject -} from '../../../../../config/challenge-types'; +} from '../../../../../shared/config/challenge-types'; import { executeChallenge, saveEditorContent, diff --git a/client/src/templates/Challenges/classic/lower-jaw.tsx b/client/src/templates/Challenges/classic/lower-jaw.tsx index 7f4b3ee1c51..e241f0adee1 100644 --- a/client/src/templates/Challenges/classic/lower-jaw.tsx +++ b/client/src/templates/Challenges/classic/lower-jaw.tsx @@ -11,7 +11,7 @@ import { randomCompliment } from '../../../../src/utils/get-words'; import Help from '../../../assets/icons/help'; import Reset from '../../../assets/icons/reset'; import { MAX_MOBILE_WIDTH } from '../../../../config/misc'; -import { apiLocation } from '../../../../../config/env.json'; +import { apiLocation } from '../../../../config/env.json'; import { ChallengeMeta } from '../../../redux/prop-types'; import { Share } from '../../../components/share'; import { ShareProps } from '../../../components/share/types'; diff --git a/client/src/templates/Challenges/classic/show.tsx b/client/src/templates/Challenges/classic/show.tsx index f7c63af8b2f..d9461704538 100644 --- a/client/src/templates/Challenges/classic/show.tsx +++ b/client/src/templates/Challenges/classic/show.tsx @@ -9,7 +9,7 @@ import { bindActionCreators, Dispatch } from 'redux'; import { createStructuredSelector } from 'reselect'; import store from 'store'; import { editor } from 'monaco-editor'; -import { challengeTypes } from '../../../../../config/challenge-types'; +import { challengeTypes } from '../../../../../shared/config/challenge-types'; import LearnLayout from '../../../components/layouts/learn'; import { MAX_MOBILE_WIDTH } from '../../../../config/misc'; diff --git a/client/src/templates/Challenges/codeally/show.tsx b/client/src/templates/Challenges/codeally/show.tsx index a37474df38d..3ecfd8f0104 100644 --- a/client/src/templates/Challenges/codeally/show.tsx +++ b/client/src/templates/Challenges/codeally/show.tsx @@ -16,7 +16,7 @@ import Spacer from '../../../components/helpers/spacer'; import LearnLayout from '../../../components/layouts/learn'; import ChallengeTitle from '../components/challenge-title'; import PrismFormatted from '../components/prism-formatted'; -import { challengeTypes } from '../../../../../config/challenge-types'; +import { challengeTypes } from '../../../../../shared/config/challenge-types'; import CompletionModal from '../components/completion-modal'; import GreenPass from '../../../assets/icons/green-pass'; import HelpModal from '../components/help-modal'; @@ -45,7 +45,7 @@ import { import ProjectToolPanel from '../projects/tool-panel'; import SolutionForm from '../projects/solution-form'; import { FlashMessages } from '../../../components/Flash/redux/flash-messages'; -import { SuperBlocks } from '../../../../../config/superblocks'; +import { SuperBlocks } from '../../../../../shared/config/superblocks'; import { CodeAllyDown } from '../../../components/growth-book/codeally-down'; import './codeally.css'; diff --git a/client/src/templates/Challenges/components/help-modal.tsx b/client/src/templates/Challenges/components/help-modal.tsx index 15cd27ea7ff..7527b37cda0 100644 --- a/client/src/templates/Challenges/components/help-modal.tsx +++ b/client/src/templates/Challenges/components/help-modal.tsx @@ -6,7 +6,7 @@ import { Trans, withTranslation } from 'react-i18next'; import { connect } from 'react-redux'; import { bindActionCreators, Dispatch } from 'redux'; -import envData from '../../../../../config/env.json'; +import envData from '../../../../config/env.json'; import { executeGA } from '../../../redux/actions'; import { createQuestion, closeModal } from '../redux/actions'; import { isHelpModalOpenSelector } from '../redux/selectors'; diff --git a/client/src/templates/Challenges/components/hotkeys.tsx b/client/src/templates/Challenges/components/hotkeys.tsx index c809e206afc..4f97b914905 100644 --- a/client/src/templates/Challenges/components/hotkeys.tsx +++ b/client/src/templates/Challenges/components/hotkeys.tsx @@ -24,7 +24,7 @@ import { challengeTestsSelector } from '../redux/selectors'; import './hotkeys.css'; -import { isFinalProject } from '../../../../../config/challenge-types'; +import { isFinalProject } from '../../../../../shared/config/challenge-types'; const mapStateToProps = createSelector( canFocusEditorSelector, diff --git a/client/src/templates/Challenges/components/tool-panel.tsx b/client/src/templates/Challenges/components/tool-panel.tsx index 2f55410129e..d5ccb517a3b 100644 --- a/client/src/templates/Challenges/components/tool-panel.tsx +++ b/client/src/templates/Challenges/components/tool-panel.tsx @@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next'; import { connect } from 'react-redux'; import { bindActionCreators, Dispatch } from 'redux'; import { createSelector } from 'reselect'; -import { challengeTypes } from '../../../../../config/challenge-types'; +import { challengeTypes } from '../../../../../shared/config/challenge-types'; import './tool-panel.css'; import { openModal, executeChallenge } from '../redux/actions'; diff --git a/client/src/templates/Challenges/components/video-player.tsx b/client/src/templates/Challenges/components/video-player.tsx index 498671db3fd..a875175eb53 100644 --- a/client/src/templates/Challenges/components/video-player.tsx +++ b/client/src/templates/Challenges/components/video-player.tsx @@ -1,6 +1,6 @@ import React from 'react'; import YouTube from 'react-youtube'; -import envData from '../../../../../config/env.json'; +import envData from '../../../../config/env.json'; import type { BilibiliIds, VideoLocaleIds } from '../../../redux/prop-types'; // TODO: pull these types from all-langs diff --git a/client/src/templates/Challenges/ms-trophy/link-ms-user.tsx b/client/src/templates/Challenges/ms-trophy/link-ms-user.tsx index e3570078059..d31d7ee930d 100644 --- a/client/src/templates/Challenges/ms-trophy/link-ms-user.tsx +++ b/client/src/templates/Challenges/ms-trophy/link-ms-user.tsx @@ -13,7 +13,7 @@ import { createSelector } from 'reselect'; import { Trans, useTranslation } from 'react-i18next'; import { Spacer } from '../../../components/helpers'; -import { isMicrosoftTranscriptLink } from '../../../../../utils/validate'; +import { isMicrosoftTranscriptLink } from '../../../../../shared/utils/validate'; import { linkMsUsername, unlinkMsUsername, diff --git a/client/src/templates/Challenges/projects/solution-form.tsx b/client/src/templates/Challenges/projects/solution-form.tsx index 50979e35774..fd5c1d4f1f6 100644 --- a/client/src/templates/Challenges/projects/solution-form.tsx +++ b/client/src/templates/Challenges/projects/solution-form.tsx @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { withTranslation } from 'react-i18next'; import type { WithTranslation } from 'react-i18next'; -import { challengeTypes } from '../../../../../config/challenge-types'; +import { challengeTypes } from '../../../../../shared/config/challenge-types'; import { StrictSolutionForm, ValidatedValues diff --git a/client/src/templates/Challenges/rechallenge/transformers.js b/client/src/templates/Challenges/rechallenge/transformers.js index f8861221805..451f320732b 100644 --- a/client/src/templates/Challenges/rechallenge/transformers.js +++ b/client/src/templates/Challenges/rechallenge/transformers.js @@ -17,7 +17,7 @@ import { transformHeadTailAndContents, setExt, compileHeadTail -} from '../../../../../utils/polyvinyl'; +} from '../../../../../shared/utils/polyvinyl'; import createWorker from '../utils/worker-executor'; import { makeCancellable, makeInputAwaitable } from './transform-python'; diff --git a/client/src/templates/Challenges/redux/actions.js b/client/src/templates/Challenges/redux/actions.js index 41dd9104e4e..e2b3093651f 100644 --- a/client/src/templates/Challenges/redux/actions.js +++ b/client/src/templates/Challenges/redux/actions.js @@ -1,6 +1,6 @@ import { createAction } from 'redux-actions'; -import { getLines } from '../../../../../utils/get-lines'; +import { getLines } from '../../../../../shared/utils/get-lines'; import { actionTypes } from './action-types'; export const createFiles = createAction( diff --git a/client/src/templates/Challenges/redux/code-storage-epic.js b/client/src/templates/Challenges/redux/code-storage-epic.js index 0e0ce9f3b1e..ecff5ba8c05 100644 --- a/client/src/templates/Challenges/redux/code-storage-epic.js +++ b/client/src/templates/Challenges/redux/code-storage-epic.js @@ -3,7 +3,7 @@ import { of } from 'rxjs'; import { filter, ignoreElements, map, switchMap, tap } from 'rxjs/operators'; import store from 'store'; -import { isPoly, setContent } from '../../../../../utils/polyvinyl'; +import { isPoly, setContent } from '../../../../../shared/utils/polyvinyl'; import { createFlashMessage } from '../../../components/Flash/redux'; import { FlashMessages } from '../../../components/Flash/redux/flash-messages'; import { savedChallengesSelector } from '../../../redux/selectors'; diff --git a/client/src/templates/Challenges/redux/completion-epic.js b/client/src/templates/Challenges/redux/completion-epic.js index da73bbedb89..d51ee00db17 100644 --- a/client/src/templates/Challenges/redux/completion-epic.js +++ b/client/src/templates/Challenges/redux/completion-epic.js @@ -20,7 +20,7 @@ import { challengeTypes, hasNoTests, submitTypes -} from '../../../../../config/challenge-types'; +} from '../../../../../shared/config/challenge-types'; import { actionTypes as submitActionTypes } from '../../../redux/action-types'; import { allowBlockDonationRequests, diff --git a/client/src/templates/Challenges/redux/create-question-epic.js b/client/src/templates/Challenges/redux/create-question-epic.js index 51b11eed151..6f84266f10d 100644 --- a/client/src/templates/Challenges/redux/create-question-epic.js +++ b/client/src/templates/Challenges/redux/create-question-epic.js @@ -2,7 +2,7 @@ import i18next from 'i18next'; import { ofType } from 'redux-observable'; import { mapTo, tap } from 'rxjs/operators'; -import envData from '../../../../../config/env.json'; +import envData from '../../../../config/env.json'; import { transformEditorLink } from '../utils'; import { actionTypes } from './action-types'; import { closeModal } from './actions'; diff --git a/client/src/templates/Challenges/redux/execute-challenge-saga.js b/client/src/templates/Challenges/redux/execute-challenge-saga.js index 6b47007f523..a81058ac502 100644 --- a/client/src/templates/Challenges/redux/execute-challenge-saga.js +++ b/client/src/templates/Challenges/redux/execute-challenge-saga.js @@ -14,7 +14,7 @@ import { takeLatest } from 'redux-saga/effects'; -import { challengeTypes } from '../../../../../config/challenge-types'; +import { challengeTypes } from '../../../../../shared/config/challenge-types'; import { createFlashMessage } from '../../../components/Flash/redux'; import { FlashMessages } from '../../../components/Flash/redux/flash-messages'; import { diff --git a/client/src/templates/Challenges/redux/index.js b/client/src/templates/Challenges/redux/index.js index 7471b0226e3..160cc806987 100644 --- a/client/src/templates/Challenges/redux/index.js +++ b/client/src/templates/Challenges/redux/index.js @@ -1,7 +1,7 @@ import { isEmpty } from 'lodash-es'; import { handleActions } from 'redux-actions'; -import { getLines } from '../../../../../utils/get-lines'; +import { getLines } from '../../../../../shared/utils/get-lines'; import { getTargetEditor } from '../utils/get-target-editor'; import { actionTypes, ns } from './action-types'; import codeStorageEpic from './code-storage-epic'; diff --git a/client/src/templates/Challenges/redux/selectors.js b/client/src/templates/Challenges/redux/selectors.js index 0369b90802d..45785181ebb 100644 --- a/client/src/templates/Challenges/redux/selectors.js +++ b/client/src/templates/Challenges/redux/selectors.js @@ -1,4 +1,4 @@ -import { challengeTypes } from '../../../../../config/challenge-types'; +import { challengeTypes } from '../../../../../shared/config/challenge-types'; import { completedChallengesSelector, allChallengesInfoSelector, diff --git a/client/src/templates/Challenges/utils/build.ts b/client/src/templates/Challenges/utils/build.ts index 25ec63c5d07..bb848c5acf1 100644 --- a/client/src/templates/Challenges/utils/build.ts +++ b/client/src/templates/Challenges/utils/build.ts @@ -1,4 +1,4 @@ -import { challengeTypes } from '../../../../../config/challenge-types'; +import { challengeTypes } from '../../../../../shared/config/challenge-types'; import frameRunnerData from '../../../../../client/config/browser-scripts/frame-runner.json'; import testEvaluatorData from '../../../../../client/config/browser-scripts/test-evaluator.json'; import pythonRunnerData from '../../../../../client/config/browser-scripts/python-runner.json'; diff --git a/client/src/templates/Challenges/utils/index.test.ts b/client/src/templates/Challenges/utils/index.test.ts index 14051715f82..7a59547cb3b 100644 --- a/client/src/templates/Challenges/utils/index.test.ts +++ b/client/src/templates/Challenges/utils/index.test.ts @@ -1,4 +1,4 @@ -import envData from '../../../../../config/env.json'; +import envData from '../../../../config/env.json'; import { getGuideUrl } from './index'; const { forumLocation } = envData; diff --git a/client/src/templates/Challenges/utils/index.ts b/client/src/templates/Challenges/utils/index.ts index f4e3a5aa511..6cf220ca713 100644 --- a/client/src/templates/Challenges/utils/index.ts +++ b/client/src/templates/Challenges/utils/index.ts @@ -1,5 +1,5 @@ import i18next from 'i18next'; -import envData from '../../../../../config/env.json'; +import envData from '../../../../config/env.json'; const { forumLocation } = envData; diff --git a/client/src/templates/Challenges/video/show.tsx b/client/src/templates/Challenges/video/show.tsx index 9f188f3cddc..9e5a7531a94 100644 --- a/client/src/templates/Challenges/video/show.tsx +++ b/client/src/templates/Challenges/video/show.tsx @@ -17,7 +17,7 @@ import Loader from '../../../components/helpers/loader'; import Spacer from '../../../components/helpers/spacer'; import LearnLayout from '../../../components/layouts/learn'; import { ChallengeNode, ChallengeMeta } from '../../../redux/prop-types'; -import { challengeTypes } from '../../../../../config/challenge-types'; +import { challengeTypes } from '../../../../../shared/config/challenge-types'; import ChallengeDescription from '../components/challenge-description'; import Hotkeys from '../components/hotkeys'; import VideoPlayer from '../components/video-player'; diff --git a/client/src/templates/Introduction/components/block.test.tsx b/client/src/templates/Introduction/components/block.test.tsx index 78345bccd28..3050cbbc551 100644 --- a/client/src/templates/Introduction/components/block.test.tsx +++ b/client/src/templates/Introduction/components/block.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import { Provider } from 'react-redux'; -import { SuperBlocks } from '../../../../../config/superblocks'; +import { SuperBlocks } from '../../../../../shared/config/superblocks'; import { createStore } from '../../../redux/create-store'; import { ChallengeFiles, @@ -12,10 +12,10 @@ import { FileKeyChallenge, BilibiliIds } from '../../../redux/prop-types'; -import { isAuditedSuperBlock } from '../../../../../utils/is-audited'; +import { isAuditedSuperBlock } from '../../../../../shared/utils/is-audited'; import Block from './block'; -jest.mock('../../../../../utils/is-audited', () => ({ +jest.mock('../../../../../shared/utils/is-audited', () => ({ isAuditedSuperBlock: jest.fn().mockReturnValueOnce(true) })); diff --git a/client/src/templates/Introduction/components/block.tsx b/client/src/templates/Introduction/components/block.tsx index b6143f537b6..dea63e6d466 100644 --- a/client/src/templates/Introduction/components/block.tsx +++ b/client/src/templates/Introduction/components/block.tsx @@ -6,9 +6,9 @@ import { connect } from 'react-redux'; import ScrollableAnchor from 'react-scrollable-anchor'; import { bindActionCreators, Dispatch } from 'redux'; import { createSelector } from 'reselect'; -import { SuperBlocks } from '../../../../../config/superblocks'; -import envData from '../../../../../config/env.json'; -import { isAuditedSuperBlock } from '../../../../../utils/is-audited'; +import { SuperBlocks } from '../../../../../shared/config/superblocks'; +import envData from '../../../../config/env.json'; +import { isAuditedSuperBlock } from '../../../../../shared/utils/is-audited'; import Caret from '../../../assets/icons/caret'; import DropDown from '../../../assets/icons/dropdown'; import GreenNotCompleted from '../../../assets/icons/green-not-completed'; @@ -26,7 +26,7 @@ import { import { isCodeAllyPractice, isFinalProject -} from '../../../../../config/challenge-types'; +} from '../../../../../shared/config/challenge-types'; import Challenges from './challenges'; import '../intro.css'; diff --git a/client/src/templates/Introduction/components/cert-challenge.tsx b/client/src/templates/Introduction/components/cert-challenge.tsx index 644c1d0a14e..4ade1f78ab0 100644 --- a/client/src/templates/Introduction/components/cert-challenge.tsx +++ b/client/src/templates/Introduction/components/cert-challenge.tsx @@ -7,8 +7,8 @@ import { createSelector } from 'reselect'; import { certSlugTypeMap, superBlockCertTypeMap -} from '../../../../../config/certification-settings'; -import { SuperBlocks } from '../../../../../config/superblocks'; +} from '../../../../../shared/config/certification-settings'; +import { SuperBlocks } from '../../../../../shared/config/superblocks'; import { createFlashMessage } from '../../../components/Flash/redux'; import { FlashMessages } from '../../../components/Flash/redux/flash-messages'; diff --git a/client/src/templates/Introduction/components/challenges.tsx b/client/src/templates/Introduction/components/challenges.tsx index 42f0033855f..b78e7a535b2 100644 --- a/client/src/templates/Introduction/components/challenges.tsx +++ b/client/src/templates/Introduction/components/challenges.tsx @@ -8,7 +8,7 @@ import type { Dispatch } from 'redux'; import GreenNotCompleted from '../../../assets/icons/green-not-completed'; import GreenPass from '../../../assets/icons/green-pass'; import { executeGA } from '../../../redux/actions'; -import { SuperBlocks } from '../../../../../config/superblocks'; +import { SuperBlocks } from '../../../../../shared/config/superblocks'; import { ChallengeWithCompletedNode } from '../../../redux/prop-types'; import { isNewJsCert, isNewRespCert } from '../../../utils/is-a-cert'; diff --git a/client/src/templates/Introduction/components/legacy-links.tsx b/client/src/templates/Introduction/components/legacy-links.tsx index ba5dfb2e629..de3018fdf90 100644 --- a/client/src/templates/Introduction/components/legacy-links.tsx +++ b/client/src/templates/Introduction/components/legacy-links.tsx @@ -1,12 +1,12 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { Alert } from '@freecodecamp/react-bootstrap'; -import { SuperBlocks } from '../../../../../config/superblocks'; +import { SuperBlocks } from '../../../../../shared/config/superblocks'; import { isOldRespCert, isRelationalDbCert } from '../../../utils/is-a-cert'; import { Link } from '../../../components/helpers'; import { CodeAllyDown } from '../../../components/growth-book/codeally-down'; -import envData from '../../../../../config/env.json'; +import envData from '../../../../config/env.json'; const { clientLocale } = envData; diff --git a/client/src/templates/Introduction/components/super-block-intro.tsx b/client/src/templates/Introduction/components/super-block-intro.tsx index 9fc7ad052b2..e6977e2357d 100644 --- a/client/src/templates/Introduction/components/super-block-intro.tsx +++ b/client/src/templates/Introduction/components/super-block-intro.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; -import { SuperBlocks } from '../../../../../config/superblocks'; +import { SuperBlocks } from '../../../../../shared/config/superblocks'; import { generateIconComponent } from '../../../assets/icons'; import { Spacer } from '../../../components/helpers'; diff --git a/client/src/templates/Introduction/super-block-intro.tsx b/client/src/templates/Introduction/super-block-intro.tsx index 8ecf71d6629..0f273d06dd0 100644 --- a/client/src/templates/Introduction/super-block-intro.tsx +++ b/client/src/templates/Introduction/super-block-intro.tsx @@ -11,7 +11,7 @@ import { bindActionCreators, Dispatch } from 'redux'; import { createSelector } from 'reselect'; import { Container } from '@freecodecamp/ui'; -import { SuperBlocks } from '../../../../config/superblocks'; +import { SuperBlocks } from '../../../../shared/config/superblocks'; import { getSuperBlockTitleForMap } from '../../utils/superblock-map-titles'; import DonateModal from '../../components/Donation/donation-modal'; import Login from '../../components/Header/components/login'; diff --git a/client/src/utils/ajax.ts b/client/src/utils/ajax.ts index 314a986bba9..6ddca6c4f5a 100644 --- a/client/src/utils/ajax.ts +++ b/client/src/utils/ajax.ts @@ -1,5 +1,5 @@ import cookies from 'browser-cookies'; -import envData from '../../../config/env.json'; +import envData from '../../config/env.json'; import type { ChallengeFile, diff --git a/client/src/utils/algolia-locale-setup.ts b/client/src/utils/algolia-locale-setup.ts index ebabf14c904..e3a97ca5c27 100644 --- a/client/src/utils/algolia-locale-setup.ts +++ b/client/src/utils/algolia-locale-setup.ts @@ -1,4 +1,4 @@ -import envData from '../../../config/env.json'; +import envData from '../../config/env.json'; const { clientLocale } = envData as { clientLocale: keyof typeof algoliaIndices; diff --git a/client/src/utils/get-completion-percentage.ts b/client/src/utils/get-completion-percentage.ts index 2a048f2b439..1131a054f57 100644 --- a/client/src/utils/get-completion-percentage.ts +++ b/client/src/utils/get-completion-percentage.ts @@ -1,5 +1,5 @@ import { AllChallengesInfo } from '../redux/prop-types'; -import { isFinalProject } from '../../../config/challenge-types'; +import { isFinalProject } from '../../../shared/config/challenge-types'; export function getCompletedPercentage( completedChallengesIds: string[] = [], diff --git a/client/src/utils/get-words.ts b/client/src/utils/get-words.ts index befc6a3132b..5b20da6bf1a 100644 --- a/client/src/utils/get-words.ts +++ b/client/src/utils/get-words.ts @@ -14,7 +14,7 @@ interface Motivation { declare const preval: (s: TemplateStringsArray) => Motivation; const words = preval` - const config = require('../../../config/env.json'); + const config = require('../../config/env.json'); const { clientLocale } = config; const target = '../../i18n/locales/' + clientLocale + '/motivation.json'; const words = require(target); diff --git a/client/src/utils/is-a-cert.ts b/client/src/utils/is-a-cert.ts index e5057c98401..6e6f6307671 100644 --- a/client/src/utils/is-a-cert.ts +++ b/client/src/utils/is-a-cert.ts @@ -1,4 +1,4 @@ -import { SuperBlocks } from '../../../config/superblocks'; +import { SuperBlocks } from '../../../shared/config/superblocks'; export function isNewRespCert(superBlock: string): boolean { return superBlock === SuperBlocks.RespWebDesignNew; diff --git a/client/src/utils/path-parsers.ts b/client/src/utils/path-parsers.ts index ac112846793..e7d807a8983 100644 --- a/client/src/utils/path-parsers.ts +++ b/client/src/utils/path-parsers.ts @@ -1,5 +1,5 @@ import { WindowLocation } from '@reach/router'; -import { i18nConstants } from '../../../config/constants'; +import { i18nConstants } from '../../../shared/config/constants'; const splitPath = (pathname: string): string[] => pathname.split('/').filter(x => x); diff --git a/client/src/utils/solution-display-type.ts b/client/src/utils/solution-display-type.ts index 543642e02dc..9f9e53ddabe 100644 --- a/client/src/utils/solution-display-type.ts +++ b/client/src/utils/solution-display-type.ts @@ -1,5 +1,5 @@ import type { CompletedChallenge } from '../redux/prop-types'; -import { challengeTypes } from '../../../config/challenge-types'; +import { challengeTypes } from '../../../shared/config/challenge-types'; import { maybeUrlRE } from '.'; // eslint-disable-next-line @typescript-eslint/naming-convention diff --git a/client/src/utils/superblock-map-titles.ts b/client/src/utils/superblock-map-titles.ts index 25e82b4b2f1..499c0761a9a 100644 --- a/client/src/utils/superblock-map-titles.ts +++ b/client/src/utils/superblock-map-titles.ts @@ -1,5 +1,5 @@ import i18next from 'i18next'; -import { SuperBlocks } from '../../../config/superblocks'; +import { SuperBlocks } from '../../../shared/config/superblocks'; // these are keys from i18n translations.json files enum SuperBlockI18nKeys { diff --git a/client/tools/create-env.ts b/client/tools/create-env.ts index ef647ad2a61..010a8a6dcb9 100644 --- a/client/tools/create-env.ts +++ b/client/tools/create-env.ts @@ -2,10 +2,10 @@ import { spawn } from 'child_process'; import * as fs from 'fs'; import * as path from 'path'; -import { availableLangs, Languages } from '../../config/i18n'; +import { availableLangs, Languages } from '../../shared/config/i18n'; import env from './read-env'; -const globalConfigPath = path.resolve(__dirname, '../../config'); +const configPath = path.resolve(__dirname, '../config'); const { FREECODECAMP_NODE_ENV } = process.env; @@ -14,7 +14,7 @@ function checkClientLocale() { if (!availableLangs.client.includes(process.env.CLIENT_LOCALE as Languages)) { throw Error(` - CLIENT_LOCALE, ${process.env.CLIENT_LOCALE}, is not an available language in config/i18n.ts + CLIENT_LOCALE, ${process.env.CLIENT_LOCALE}, is not an available language in shared/config/i18n.ts `); } @@ -30,7 +30,7 @@ function checkCurriculumLocale() { ) { throw Error(` - CURRICULUM_LOCALE, ${process.env.CURRICULUM_LOCALE}, is not an available language in config/i18n.ts + CURRICULUM_LOCALE, ${process.env.CURRICULUM_LOCALE}, is not an available language in shared/config/i18n.ts `); } @@ -113,12 +113,12 @@ if (FREECODECAMP_NODE_ENV !== 'development') { } else { checkClientLocale(); checkCurriculumLocale(); - if (fs.existsSync(`${globalConfigPath}/env.json`)) { + if (fs.existsSync(`${configPath}/env.json`)) { /* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment */ const { showNewCurriculum, showUpcomingChanges - } = require(`${globalConfigPath}/env.json`); + } = require(`${configPath}/env.json`); /* eslint-enable @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment */ if ( env['showUpcomingChanges'] !== showUpcomingChanges || @@ -138,4 +138,4 @@ if (FREECODECAMP_NODE_ENV !== 'development') { } } -fs.writeFileSync(`${globalConfigPath}/env.json`, JSON.stringify(env)); +fs.writeFileSync(`${configPath}/env.json`, JSON.stringify(env)); diff --git a/client/utils/build-challenges.js b/client/utils/build-challenges.js index fc091383c64..df5c5c4d762 100644 --- a/client/utils/build-challenges.js +++ b/client/utils/build-challenges.js @@ -2,7 +2,7 @@ const path = require('path'); const _ = require('lodash'); -const envData = require('../../config/env.json'); +const envData = require('../config/env.json'); const { getChallengesForLang, generateChallengeCreator, diff --git a/client/utils/gatsby/challenge-page-creator.js b/client/utils/gatsby/challenge-page-creator.js index 8e8f5bc37ce..6c153acc890 100644 --- a/client/utils/gatsby/challenge-page-creator.js +++ b/client/utils/gatsby/challenge-page-creator.js @@ -3,7 +3,7 @@ const { sortChallengeFiles } = require('../sort-challengefiles'); const { challengeTypes, viewTypes -} = require('../../../config/challenge-types'); +} = require('../../../shared/config/challenge-types'); const backend = path.resolve( __dirname, diff --git a/client/utils/index.ts b/client/utils/index.ts index 807674f9e83..76587d22d3a 100644 --- a/client/utils/index.ts +++ b/client/utils/index.ts @@ -1,4 +1,4 @@ -import { Certification } from '../../config/certification-settings'; +import { Certification } from '../../shared/config/certification-settings'; const idToPath = new Map( Object.entries({ diff --git a/config/tsconfig.json b/config/tsconfig.json deleted file mode 100644 index 53e88acb824..00000000000 --- a/config/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "include": ["**/*.ts"], - "extends": "../tsconfig-base.json", - "compilerOptions": { - "noEmit": false, - "module": "CommonJS" - } -} diff --git a/curriculum-server/source-curriculum.ts b/curriculum-server/source-curriculum.ts index e9c249eaaf2..48d0eebef2d 100644 --- a/curriculum-server/source-curriculum.ts +++ b/curriculum-server/source-curriculum.ts @@ -1,6 +1,6 @@ import fs from 'fs/promises'; -import curriculum from '../config/curriculum.json'; +import curriculum from '../shared/config/curriculum.json'; interface Curriculum { [key: string]: unknown; diff --git a/curriculum/get-challenges.js b/curriculum/get-challenges.js index ab4bad4e31e..05fb381e040 100644 --- a/curriculum/get-challenges.js +++ b/curriculum/get-challenges.js @@ -6,7 +6,7 @@ const { findIndex } = require('lodash'); const readDirP = require('readdirp'); const { curriculum: curriculumLangs } = - require('../config/i18n').availableLangs; + require('../shared/config/i18n').availableLangs; const { parseMD } = require('../tools/challenge-parser/parser'); /* eslint-disable max-len */ const { @@ -14,8 +14,8 @@ const { } = require('../tools/challenge-parser/translation-parser'); /* eslint-enable max-len*/ -const { isAuditedSuperBlock } = require('../utils/is-audited'); -const { createPoly } = require('../utils/polyvinyl'); +const { isAuditedSuperBlock } = require('../shared/utils/is-audited'); +const { createPoly } = require('../shared/utils/polyvinyl'); const { getSuperOrder, getSuperBlockFromDir } = require('./utils'); const access = util.promisify(fs.access); diff --git a/curriculum/schema/challenge-schema.js b/curriculum/schema/challenge-schema.js index ee9ee91ad92..e72ca583afd 100644 --- a/curriculum/schema/challenge-schema.js +++ b/curriculum/schema/challenge-schema.js @@ -1,7 +1,7 @@ const Joi = require('joi'); Joi.objectId = require('joi-objectid')(Joi); -const { challengeTypes } = require('../../config/challenge-types'); +const { challengeTypes } = require('../../shared/config/challenge-types'); const slugRE = new RegExp('^[a-z0-9-]+$'); const slugWithSlashRE = new RegExp('^[a-z0-9-/]+$'); diff --git a/curriculum/test/test-challenges.js b/curriculum/test/test-challenges.js index f2be5b02105..9293d29d24f 100644 --- a/curriculum/test/test-challenges.js +++ b/curriculum/test/test-challenges.js @@ -31,12 +31,12 @@ const { const { default: createWorker } = require('../../client/src/templates/Challenges/utils/worker-executor'); -const { challengeTypes } = require('../../config/challenge-types'); +const { challengeTypes } = require('../../shared/config/challenge-types'); // the config files are created during the build, but not before linting const testEvaluator = require('../../client/config/browser-scripts/test-evaluator.json').filename; -const { getLines } = require('../../utils/get-lines'); +const { getLines } = require('../../shared/utils/get-lines'); const { getChallengesForLang, getMetaForBlock } = require('../get-challenges'); const { challengeSchemaValidator } = require('../schema/challenge-schema'); diff --git a/curriculum/utils.js b/curriculum/utils.js index 2dcc3601931..957703f660b 100644 --- a/curriculum/utils.js +++ b/curriculum/utils.js @@ -2,11 +2,11 @@ const path = require('path'); const { createFlatSuperBlockMap, SuperBlocks -} = require('../config/superblocks'); +} = require('../shared/config/superblocks'); require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); -const { availableLangs } = require('../config/i18n'); +const { availableLangs } = require('../shared/config/i18n'); const curriculumLangs = availableLangs.curriculum; // checks that the CURRICULUM_LOCALE exists and is an available language diff --git a/curriculum/utils.test.ts b/curriculum/utils.test.ts index be9e0d913bd..efb9fe3880b 100644 --- a/curriculum/utils.test.ts +++ b/curriculum/utils.test.ts @@ -4,7 +4,7 @@ import fs from 'fs'; import path from 'path'; import { config } from 'dotenv'; -import { SuperBlocks } from '../config/superblocks'; +import { SuperBlocks } from '../shared/config/superblocks'; import { createSuperOrder, getSuperOrder, getSuperBlockFromDir } from './utils'; config({ path: path.resolve(__dirname, '../.env') }); diff --git a/cypress.config.js b/cypress.config.js index b424019708a..840bbbe22ec 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -31,7 +31,7 @@ module.exports = defineConfig({ setupNodeEvents(on, config) { config.env = config.env || {}; on('before:run', () => { - if (!existsSync('./config/curriculum.json')) { + if (!existsSync('./shared/config/curriculum.json')) { execSync('pnpm run build:curriculum'); } }); diff --git a/cypress/e2e/default/learn/challenges/projects.ts b/cypress/e2e/default/learn/challenges/projects.ts index aaabeb5edac..61d258ca1bb 100644 --- a/cypress/e2e/default/learn/challenges/projects.ts +++ b/cypress/e2e/default/learn/challenges/projects.ts @@ -1,4 +1,4 @@ -import { SuperBlocks } from '../../../../../config/superblocks'; +import { SuperBlocks } from '../../../../../shared/config/superblocks'; interface Meta { challengeOrder: { id: string; title: string }[]; @@ -93,7 +93,7 @@ describe('project submission', () => { 'JavaScript projects can be submitted and then viewed in /settings and on the certifications', { browser: 'electron' }, () => { - cy.fixture('../../config/curriculum.json').then( + cy.fixture('../../shared/config/curriculum.json').then( (curriculum: Curriculum) => { const targetBlock = 'javascript-algorithms-and-data-structures-projects'; @@ -178,7 +178,7 @@ describe('project submission', () => { 'Ctrl + enter triggers the completion modal on multifile projects', { browser: 'electron' }, () => { - cy.fixture('../../config/curriculum.json').then( + cy.fixture('../../shared/config/curriculum.json').then( (curriculum: Curriculum) => { const targetBlock = 'build-a-personal-portfolio-webpage-project'; const portfolioBlock = Object.values(curriculum).filter( diff --git a/cypress/e2e/default/learn/header/lang-selector.ts b/cypress/e2e/default/learn/header/lang-selector.ts index d4472770016..70c48439109 100644 --- a/cypress/e2e/default/learn/header/lang-selector.ts +++ b/cypress/e2e/default/learn/header/lang-selector.ts @@ -1,4 +1,4 @@ -import { availableLangs, hiddenLangs } from '../../../../../config/i18n'; +import { availableLangs, hiddenLangs } from '../../../../../shared/config/i18n'; const buttonSelector = '#toggle-lang-button'; const toLangSelector = (lang: string) => `[data-value="${lang}"]`; diff --git a/cypress/e2e/default/learn/responsive-web-design/show-cert-from-superblock.ts b/cypress/e2e/default/learn/responsive-web-design/show-cert-from-superblock.ts index d806349f772..acb30b89d7e 100644 --- a/cypress/e2e/default/learn/responsive-web-design/show-cert-from-superblock.ts +++ b/cypress/e2e/default/learn/responsive-web-design/show-cert-from-superblock.ts @@ -1,4 +1,4 @@ -import { SuperBlocks } from '../../../../../config/superblocks'; +import { SuperBlocks } from '../../../../../shared/config/superblocks'; const projects = { superBlock: SuperBlocks.FrontEndDevLibs, diff --git a/cypress/e2e/mobile-learn/test-challenges.js b/cypress/e2e/mobile-learn/test-challenges.js index 2077d0223ff..fa1db577a2c 100644 --- a/cypress/e2e/mobile-learn/test-challenges.js +++ b/cypress/e2e/mobile-learn/test-challenges.js @@ -1,4 +1,4 @@ -import currData from '../../../config/curriculum.json'; +import currData from '../../../shared/config/curriculum.json'; import { orderedSuperBlockInfo } from '../../../tools/scripts/build/build-external-curricula-data'; const nonEditorSB = [ diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 1e15e557844..8c281d87ab3 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -21,7 +21,7 @@ module.exports = (on, config) => { // `config` is the resolved Cypress config config.env = config.env || {}; on('before:run', () => { - if (!existsSync('../../config/curriculum.json')) { + if (!existsSync('../../shared/config/curriculum.json')) { execSync('pnpm run build:curriculum'); } }); diff --git a/docker/web/Dockerfile b/docker/web/Dockerfile index 7bc67130cdb..b2a267ea856 100644 --- a/docker/web/Dockerfile +++ b/docker/web/Dockerfile @@ -34,7 +34,7 @@ ARG FREECODECAMP_NODE_ENV RUN pnpm config set dedupe-peer-dependents false # Scripts need to be run at this stage (--ignore-scripts cannot be used) because # without them, Gatsby will not install sharp. -RUN pnpm install -w -F=client -F=ui -F=browser-scripts -F=challenge-parser \ +RUN pnpm install -F=shared -F=client -F=ui -F=browser-scripts -F=challenge-parser \ --frozen-lockfile RUN pnpm build:client diff --git a/docs/curriculum-file-structure.md b/docs/curriculum-file-structure.md index 52b87a9aefa..4a45e4421d8 100644 --- a/docs/curriculum-file-structure.md +++ b/docs/curriculum-file-structure.md @@ -52,7 +52,7 @@ When renaming a certification, you will likely want to rename the associated sup 1. Optionally, update the `certSlug` for the superblock in the same file. **Note** that renaming a `certSlug` will change the URL for certifications and should only be done with careful consideration. 1. Update the `title` in `client/src/resources/cert-and-project-map.ts` to the new value. **Note** that changing the `title` here **will break** the superBlock page for the associated certification. It relies on the superBlock title to match the certification title. You will likely want to rename the superBlock at the same time. 1. If you renamed the `certSlug` in step 7, change it here for the cert and all the nested `projects` values. -1. In `config/certification-settings.js`, update the value of `certTypeTitleMap` to the new name. +1. In `shared/config/certification-settings.js`, update the value of `certTypeTitleMap` to the new name. 1. If you renamed the `certSlug` in step 7, update the key of `certSlugTypeMap` in the same file. 1. Update the certificate name in the `legacyCerts` array of the `client/src/client-only-routes/show-project-links.tsx` if needed. 1. Update the main `README.md` file to the new name. @@ -71,10 +71,10 @@ Also, you will likely want to rename the certificate and the `{superBlock}-proje 1. Update the `index.md` file in the above folder, changing the `title` and `superBlock` values to the new name. 1. For each block folder within the above, update the `index.md` to use the correct `superBlock` value. 1. In the `client/src/resources/cert-and-project-map.ts` file, update the path for the cert at the top of the file, and the `title` value for that superBlock. **Note** that changing the `title` here **will break** the ability to view the actual certification for this superBlock. It relies on the superBlock title to match the certification title. You will likely want to rename the certification at the same time. -1. Update the `superBlockCertTypeMap` key in `config/certification-settings.js` to the new superBlock name. +1. Update the `superBlockCertTypeMap` key in `shared/config/certification-settings.js` to the new superBlock name. 1. Update the path value in `client/src/assets/icons/index.tsx`. 1. For each language in `client/i18n/locales`, update the `intro.json` file to use the new superBlock `dashedName`. In the English file, also update the `title`. -1. Check the `config/i18n/all-langs.js` file to see if the superBlock is enabled in i18n builds. Update all the values where it is used. +1. Check the `shared/config/i18n/all-langs.js` file to see if the superBlock is enabled in i18n builds. Update all the values where it is used. 1. Update the main `README.md` file to the new name. ### Renaming a Block diff --git a/docs/how-to-add-cypress-tests.md b/docs/how-to-add-cypress-tests.md index 3c87d580c69..ac5bf85e5a9 100644 --- a/docs/how-to-add-cypress-tests.md +++ b/docs/how-to-add-cypress-tests.md @@ -59,7 +59,7 @@ If starting the Gitpod environment did not automatically develop the environment - Create a config file. ```console -pnpm run create:config +pnpm run create:shared ``` - Seed the database diff --git a/docs/how-to-add-playwright-tests.md b/docs/how-to-add-playwright-tests.md index 73d73f4af35..0dda063b1a6 100644 --- a/docs/how-to-add-playwright-tests.md +++ b/docs/how-to-add-playwright-tests.md @@ -163,7 +163,7 @@ If starting the Gitpod environment did not automatically develop the environment - Create a config file. ```console - pnpm run create:config + pnpm run create:shared ``` - Seed the database @@ -191,4 +191,4 @@ To run all Playwright tests, run the following command: ```console npx playwright test -``` \ No newline at end of file +``` diff --git a/docs/how-to-enable-new-languages.md b/docs/how-to-enable-new-languages.md index 09e83494c01..28baab64007 100644 --- a/docs/how-to-enable-new-languages.md +++ b/docs/how-to-enable-new-languages.md @@ -72,7 +72,7 @@ Note that the `download_language` key needs to be set to the language code displ There are a few steps to take in order to allow the codebase to build in your desired language. -First, visit the [`config/i18n.ts`](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/config/i18n.ts) file to add the language to the list of available languages and configure the values. There are several objects here. +First, visit the [`shared/config/i18n.ts`](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/config/i18n.ts) file to add the language to the list of available languages and configure the values. There are several objects here. - `Languages`: Add the new language to `Languages` enum, similar to the others. The string value here will be used in the `.env` file to set a build language later. - `availableLangs`: Add the new property from the `Languages` enum to both the `client` and `curriculum` arrays. @@ -144,7 +144,7 @@ export const rtlLangs = ['']; ### Set Translated SuperBlocks -In the [config/superblocks.ts](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/config/superblocks.ts) file, add the new language to the `notAuditedSuperBlocks` object. This lists all the superblocks which are not fully translated. Add an array of superblocks which have not been fully translated to it. For example: +In the [shared/config/superblocks.ts](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/shared/config/superblocks.ts) file, add the new language to the `notAuditedSuperBlocks` object. This lists all the superblocks which are not fully translated. Add an array of superblocks which have not been fully translated to it. For example: ```js export const notAuditedSuperBlocks: NotAuditedSuperBlocks = { @@ -324,7 +324,7 @@ Once these are in place, you should be able to run `pnpm run develop` to view yo When your prior PR is merged and the VM for your language is ready, make another PR to show your language in the navigation menu. -In [`config/i18n.ts`](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/config/i18n.ts) file, you have included your language in `hiddenLangs` array in the prior PR. Remove it from the array now. +In [`shared/config/i18n.ts`](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/config/i18n.ts) file, you have included your language in `hiddenLangs` array in the prior PR. Remove it from the array now. ```js export const hiddenLangs = []; // Remove your language from the array @@ -446,7 +446,7 @@ const algoliaIndices = { ### Add the i18next JSON Files for the New Language -Next, go to the `config/i18n/locales` directory, create a new folder, and give it the name of the new language you're adding. For example, if you're launching Dothraki News, create a new folder named `dothraki`. +Next, go to the `shared/config/i18n/locales` directory, create a new folder, and give it the name of the new language you're adding. For example, if you're launching Dothraki News, create a new folder named `dothraki`. Then copy the JSON files from the `english` directory to your new folder. diff --git a/docs/how-to-setup-freecodecamp-locally.md b/docs/how-to-setup-freecodecamp-locally.md index 233e4ecdaa3..127d362e5da 100644 --- a/docs/how-to-setup-freecodecamp-locally.md +++ b/docs/how-to-setup-freecodecamp-locally.md @@ -240,7 +240,7 @@ The keys in the `.env` file are _not_ required to be changed to run the app loca This step will install the dependencies required for the application to run: ```console -pnpm install && pnpm run create:config +pnpm install && pnpm run create:shared ``` #### Step 3: Start MongoDB and Seed the Database diff --git a/docs/how-to-setup-freecodecamp-mobile-app-locally.md b/docs/how-to-setup-freecodecamp-mobile-app-locally.md index 284868bbfd3..c143eb88045 100644 --- a/docs/how-to-setup-freecodecamp-mobile-app-locally.md +++ b/docs/how-to-setup-freecodecamp-mobile-app-locally.md @@ -406,7 +406,7 @@ copy sample.env .env 4. Install the dependencies for the freeCodeCamp repo: ```console - pnpm install && pnpm run create:config + pnpm install && pnpm run create:shared ``` 5. Generate the challenge data JSON file: @@ -422,7 +422,7 @@ copy sample.env .env #### **macOS/Linux** ```console -cp ./config/curriculum.json ../mobile/mobile-app/curriculum.json +cp ./shared/config/curriculum.json ../mobile/mobile-app/curriculum.json ``` #### **Windows** diff --git a/docs/how-to-work-on-localized-client-webapp.md b/docs/how-to-work-on-localized-client-webapp.md index b3de9ce9e13..fde3b75614a 100644 --- a/docs/how-to-work-on-localized-client-webapp.md +++ b/docs/how-to-work-on-localized-client-webapp.md @@ -76,7 +76,7 @@ Some of these files are translated on our translation platform (Crowdin) and som ## Testing the Client App in a World Language -You can test the client app in any language available in the [list of `availableLangs` here](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/config/i18n.ts). +You can test the client app in any language available in the [list of `availableLangs` here](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/shared/config/i18n.ts). ```js export const availableLangs = { @@ -98,7 +98,7 @@ export const availableLangs = { If you are testing 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. -Add the new language to the `Languages` enum and the `client` array at the top of the [`config/i18n.ts`](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/config/i18n.ts) file. +Add the new language to the `Languages` enum and the `client` array at the top of the [`shared/config/i18n.ts`](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/shared/config/i18n.ts) file. Next, follow the instructions in the comments in the same file to add/update the rest of the variables as needed. diff --git a/docs/language-lead-handbook.md b/docs/language-lead-handbook.md index 9c47cd711cb..38b2bbdd5e0 100644 --- a/docs/language-lead-handbook.md +++ b/docs/language-lead-handbook.md @@ -68,7 +68,7 @@ You will want to [build the translated client locally](how-to-enable-new-languag 1. Update your `.env` file to use your language for `CLIENT_LOCALE` and `CURRICULUM_LOCALE`. -2. Run `pnpm run create:config`. This will automatically generate the `trending.json` file for your language under the `/client/i18n/locales/` directory. +2. Run `pnpm run create:shared`. This will automatically generate the `trending.json` file for your language under the `/client/i18n/locales/` directory. 3. Start the server by running `pnpm run develop:server` in one terminal window. diff --git a/package.json b/package.json index 5b60026dfb2..699f09c5b8c 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,9 @@ "author": "freeCodeCamp ", "main": "none", "scripts": { - "audit-challenges": "pnpm run create:config && ts-node tools/challenge-auditor/index.ts", + "audit-challenges": "pnpm run create:shared && ts-node tools/challenge-auditor/index.ts", "analyze-bundle": "webpack-bundle-analyzer", - "prebuild": "npm-run-all create:*", + "prebuild": "npm-run-all create:shared", "build": "npm-run-all -p build:*", "build-workers": "cd ./client && pnpm run prebuild", "build:client": "cd ./client && pnpm run build", @@ -34,18 +34,17 @@ "clean-and-develop": "pnpm run clean && pnpm install && pnpm run develop", "clean:api": "cd api && pnpm clean", "clean:client": "cd ./client && pnpm run clean", - "clean:curriculum": "rm -rf ./config/curriculum.json", + "clean:curriculum": "rm -rf ./shared/config/curriculum.json", "clean:packages": "rm -rf ./node_modules ./**/node_modules", "clean:server": "rm -rf ./api-server/lib", - "create:config": "tsc -p config", - "create:utils": "tsc -p utils", + "create:shared": "tsc -p shared", "precypress": "node ./cypress-install.js", "cypress": "cypress", "cypress:dev:run": "pnpm run cypress run", "cypress:dev:watch": "pnpm run cypress open", "cypress:install": "cypress install && echo 'for use with ./cypress-install.js'", "cypress:install-build-tools": "sh ./cypress-install.sh", - "predevelop": "npm-run-all -p create:* -s build:curriculum", + "predevelop": "npm-run-all -p create:shared -s build:curriculum", "develop": "npm-run-all -p develop:*", "develop:client": "cd ./client && pnpm run develop", "develop:server": "cd ./api-server && pnpm run develop", @@ -61,13 +60,13 @@ "knip": "pnpm dlx knip@1 --include files", "knip:all": "pnpm dlx knip@1", "prelint": "pnpm run -F=client predevelop", - "lint": "npm-run-all create:* -p lint:*", + "lint": "npm-run-all create:shared -p lint:*", "lint:challenges": "cd ./curriculum && pnpm run lint", "lint:js": "eslint --cache --max-warnings 0 .", - "lint:ts": "tsc && tsc -p config && tsc -p tools/ui-components && tsc -p utils && tsc -p api", + "lint:ts": "tsc && tsc -p shared && tsc -p tools/ui-components && tsc -p api", "lint:prettier": "prettier --list-different .", "reload:server": "pm2 reload api-server/ecosystem.config.js", - "preseed": "npm-run-all create:*", + "preseed": "npm-run-all create:shared", "playwright:install-build-tools": "cd ./e2e && npm i && npx playwright install && npx playwright install-deps", "playwright:install-build-tools-linux": "sh ./playwright-install.sh", "seed": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seed-demo-user", @@ -75,11 +74,11 @@ "seed:exams": "cd tools/scripts/seed-exams && cross-env node ./create-exams.js", "serve:client": "cd ./client && pnpm run serve", "serve:client-ci": "cd ./client && pnpm run serve-ci", - "start": "npm-run-all create:* -p develop:server serve:client", - "start-ci": "npm-run-all create:* -p start:server serve:client-ci", + "start": "npm-run-all create:shared -p develop:server serve:client", + "start-ci": "npm-run-all create:shared -p start:server serve:client-ci", "start:server": "pm2 start api-server/ecosystem.config.js", "storybook": "cd ./tools/ui-components && pnpm run storybook", - "test": "run-s create:* build:curriculum build-workers test:*", + "test": "run-s create:shared build:curriculum build-workers test:*", "test:source": "jest", "test:api": "cd api && jest --force-exit", "test:curriculum": "cd ./curriculum && pnpm test", @@ -95,8 +94,7 @@ "prepare": "husky install" }, "dependencies": { - "dotenv": "16.3.1", - "invariant": "2.2.4" + "dotenv": "16.3.1" }, "devDependencies": { "@babel/eslint-parser": "7.22.11", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f49750592a8..a000d17009b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,9 +11,6 @@ importers: dotenv: specifier: 16.3.1 version: 16.3.1 - invariant: - specifier: 2.2.4 - version: 2.2.4 devDependencies: '@babel/eslint-parser': specifier: 7.22.11 @@ -1024,6 +1021,12 @@ importers: specifier: 2.0.3 version: 2.0.3 + shared: + dependencies: + invariant: + specifier: 2.2.4 + version: 2.2.4 + tools/challenge-editor/api: dependencies: cors: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 81b6f71e01e..68fbfd8a231 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -3,6 +3,7 @@ packages: - 'api-server' - 'client' - 'curriculum' + - 'shared' - 'tools/challenge-editor/api' - 'tools/challenge-editor/client' - 'tools/challenge-helper-scripts' diff --git a/config/certification-settings.ts b/shared/config/certification-settings.ts similarity index 99% rename from config/certification-settings.ts rename to shared/config/certification-settings.ts index 5ba1526a022..0d5ecbf3925 100644 --- a/config/certification-settings.ts +++ b/shared/config/certification-settings.ts @@ -1,4 +1,4 @@ -import { SuperBlocks } from './superblocks'; +import { SuperBlocks } from '../../shared/config/superblocks'; /** * Certifications are not equivalent to superblocks. Each superblock corresponds diff --git a/config/challenge-types.ts b/shared/config/challenge-types.ts similarity index 100% rename from config/challenge-types.ts rename to shared/config/challenge-types.ts diff --git a/config/constants.test.ts b/shared/config/constants.test.ts similarity index 100% rename from config/constants.test.ts rename to shared/config/constants.test.ts diff --git a/config/constants.ts b/shared/config/constants.ts similarity index 100% rename from config/constants.ts rename to shared/config/constants.ts diff --git a/config/donation-settings.ts b/shared/config/donation-settings.ts similarity index 100% rename from config/donation-settings.ts rename to shared/config/donation-settings.ts diff --git a/config/i18n.ts b/shared/config/i18n.ts similarity index 100% rename from config/i18n.ts rename to shared/config/i18n.ts diff --git a/config/superblocks.test.ts b/shared/config/superblocks.test.ts similarity index 100% rename from config/superblocks.test.ts rename to shared/config/superblocks.test.ts diff --git a/config/superblocks.ts b/shared/config/superblocks.ts similarity index 99% rename from config/superblocks.ts rename to shared/config/superblocks.ts index b5fd34b1f5f..c462e3baeb4 100644 --- a/config/superblocks.ts +++ b/shared/config/superblocks.ts @@ -1,4 +1,4 @@ -import { Languages } from './i18n'; +import { Languages } from '../config/i18n'; // all superblocks export enum SuperBlocks { diff --git a/shared/package.json b/shared/package.json new file mode 100644 index 00000000000..b9f3d46adee --- /dev/null +++ b/shared/package.json @@ -0,0 +1,23 @@ +{ + "name": "@freecodecamp/shared", + "version": "0.0.1", + "author": "freeCodeCamp ", + "license": "BSD-3-Clause", + "description": "Config and utils used in multiple workspaces", + "private": false, + "engines": { + "node": ">=16", + "pnpm": "8" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/freeCodeCamp/freeCodeCamp.git" + }, + "bugs": { + "url": "https://github.com/freeCodeCamp/freeCodeCamp/issues" + }, + "homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme", + "dependencies": { + "invariant": "2.2.4" + } +} diff --git a/utils/tsconfig.json b/shared/tsconfig.json similarity index 82% rename from utils/tsconfig.json rename to shared/tsconfig.json index 70c136a33a0..e80c67a8f20 100644 --- a/utils/tsconfig.json +++ b/shared/tsconfig.json @@ -1,6 +1,5 @@ { "include": ["**/*.ts", "**/*.test.ts"], - "exclude": ["./__fixtures__"], "extends": "../tsconfig-base.json", "compilerOptions": { "noEmit": false, diff --git a/utils/get-lines.test.ts b/shared/utils/get-lines.test.ts similarity index 100% rename from utils/get-lines.test.ts rename to shared/utils/get-lines.test.ts diff --git a/utils/get-lines.ts b/shared/utils/get-lines.ts similarity index 100% rename from utils/get-lines.ts rename to shared/utils/get-lines.ts diff --git a/utils/is-audited.ts b/shared/utils/is-audited.ts similarity index 85% rename from utils/is-audited.ts rename to shared/utils/is-audited.ts index a56a8c80013..ddd3fb7f718 100644 --- a/utils/is-audited.ts +++ b/shared/utils/is-audited.ts @@ -1,4 +1,7 @@ -import { type SuperBlocks, getAuditedSuperBlocks } from '../config/superblocks'; +import { + type SuperBlocks, + getAuditedSuperBlocks +} from '../../shared/config/superblocks'; export function isAuditedSuperBlock( language: string, diff --git a/utils/polyvinyl.js b/shared/utils/polyvinyl.js similarity index 100% rename from utils/polyvinyl.js rename to shared/utils/polyvinyl.js diff --git a/utils/validate.test.ts b/shared/utils/validate.test.ts similarity index 100% rename from utils/validate.test.ts rename to shared/utils/validate.test.ts diff --git a/utils/validate.ts b/shared/utils/validate.ts similarity index 100% rename from utils/validate.ts rename to shared/utils/validate.ts diff --git a/tools/challenge-auditor/index.ts b/tools/challenge-auditor/index.ts index 21b30452063..ff3d38c36e5 100644 --- a/tools/challenge-auditor/index.ts +++ b/tools/challenge-auditor/index.ts @@ -7,9 +7,12 @@ import { config } from 'dotenv'; const envPath = resolve(__dirname, '../../.env'); config({ path: envPath }); -import { availableLangs } from '../../config/i18n'; +import { availableLangs } from '../../shared/config/i18n'; import { getChallengesForLang } from '../../curriculum/get-challenges'; -import { SuperBlocks, getAuditedSuperBlocks } from '../../config/superblocks'; +import { + SuperBlocks, + getAuditedSuperBlocks +} from '../../shared/config/superblocks'; // TODO: re-organise the types to a common 'types' folder that can be shared // between the workspaces so we don't have to declare ChallengeNode here and in diff --git a/tools/challenge-helper-scripts/create-project.ts b/tools/challenge-helper-scripts/create-project.ts index 9801ef601d9..cf487a4f792 100644 --- a/tools/challenge-helper-scripts/create-project.ts +++ b/tools/challenge-helper-scripts/create-project.ts @@ -5,7 +5,7 @@ import { prompt } from 'inquirer'; import { format } from 'prettier'; import ObjectID from 'bson-objectid'; -import { SuperBlocks } from '../../config/superblocks'; +import { SuperBlocks } from '../../shared/config/superblocks'; import { createStepFile } from './utils'; import { getSuperBlockSubPath } from './fs-utils'; import { Meta } from './helpers/project-metadata'; diff --git a/tools/challenge-helper-scripts/fs-utils.test.ts b/tools/challenge-helper-scripts/fs-utils.test.ts index 4f82c2a823f..178af2761ee 100644 --- a/tools/challenge-helper-scripts/fs-utils.test.ts +++ b/tools/challenge-helper-scripts/fs-utils.test.ts @@ -1,6 +1,6 @@ import fs from 'fs/promises'; import path from 'path'; -import { SuperBlocks } from '../../config/superblocks'; +import { SuperBlocks } from '../../shared/config/superblocks'; import { getSuperBlockSubPath } from './fs-utils'; describe('getSuperBlockSubPath', () => { diff --git a/tools/challenge-helper-scripts/fs-utils.ts b/tools/challenge-helper-scripts/fs-utils.ts index f59a5daeb42..0fe8ebe68b1 100644 --- a/tools/challenge-helper-scripts/fs-utils.ts +++ b/tools/challenge-helper-scripts/fs-utils.ts @@ -1,4 +1,4 @@ -import { SuperBlocks } from '../../config/superblocks'; +import { SuperBlocks } from '../../shared/config/superblocks'; export function getSuperBlockSubPath(superBlock: SuperBlocks): string { const pathMap = { diff --git a/tools/challenge-helper-scripts/helpers/new-challenge-prompts.ts b/tools/challenge-helper-scripts/helpers/new-challenge-prompts.ts index 1c42df51fb2..c595c69c379 100644 --- a/tools/challenge-helper-scripts/helpers/new-challenge-prompts.ts +++ b/tools/challenge-helper-scripts/helpers/new-challenge-prompts.ts @@ -1,5 +1,5 @@ import { prompt } from 'inquirer'; -import { challengeTypes } from '../../../config/challenge-types'; +import { challengeTypes } from '../../../shared/config/challenge-types'; export const newChallengePrompts = async (): Promise<{ title: string; diff --git a/tools/scripts/build/build-curriculum.ts b/tools/scripts/build/build-curriculum.ts index 8e26bfaa82f..287e288d481 100644 --- a/tools/scripts/build/build-curriculum.ts +++ b/tools/scripts/build/build-curriculum.ts @@ -8,7 +8,7 @@ import { CurriculumProps } from './build-external-curricula-data'; -const globalConfigPath = path.resolve(__dirname, '../../../config'); +const globalConfigPath = path.resolve(__dirname, '../../../shared/config'); // We are defaulting to English because the ids for the challenges are same // across all languages. diff --git a/tools/scripts/build/build-external-curricula-data.test.ts b/tools/scripts/build/build-external-curricula-data.test.ts index b4929afdcd4..34d21dbe48c 100644 --- a/tools/scripts/build/build-external-curricula-data.test.ts +++ b/tools/scripts/build/build-external-curricula-data.test.ts @@ -4,7 +4,7 @@ import fs from 'fs'; import readdirp from 'readdirp'; // TODO: remove chai and use jest's assertion errors import { AssertionError } from 'chai'; -import { SuperBlocks } from '../../../config/superblocks'; +import { SuperBlocks } from '../../../shared/config/superblocks'; import { superblockSchemaValidator, availableSuperBlocksValidator diff --git a/tools/scripts/build/build-external-curricula-data.ts b/tools/scripts/build/build-external-curricula-data.ts index 54bf58b7992..7269b7351d9 100644 --- a/tools/scripts/build/build-external-curricula-data.ts +++ b/tools/scripts/build/build-external-curricula-data.ts @@ -1,8 +1,8 @@ import { mkdirSync, writeFileSync, readFileSync } from 'fs'; import { resolve, dirname } from 'path'; -import { submitTypes } from '../../../config/challenge-types'; +import { submitTypes } from '../../../shared/config/challenge-types'; import { type ChallengeNode } from '../../../client/src/redux/prop-types'; -import { SuperBlocks } from '../../../config/superblocks'; +import { SuperBlocks } from '../../../shared/config/superblocks'; type Intro = { [keyValue in SuperBlocks]: IntroProps }; export type Curriculum = {