Skip to content

Commit

Permalink
refactor: rename superblocks.ts to curriculum (freeCodeCamp#55624)
Browse files Browse the repository at this point in the history
  • Loading branch information
ojeytonwilliams authored Jul 23, 2024
1 parent 6d1debe commit 1e25cfd
Show file tree
Hide file tree
Showing 37 changed files with 43 additions and 44 deletions.
2 changes: 1 addition & 1 deletion client/i18n/locales.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import { setup } from 'jest-json-schema-extended';
import { availableLangs, LangNames, LangCodes } from '../../shared/config/i18n';
import { SuperBlocks } from '../../shared/config/superblocks';
import { SuperBlocks } from '../../shared/config/curriculum';
import intro from './locales/english/intro.json';

setup();
Expand Down
2 changes: 1 addition & 1 deletion client/src/assets/icons/superblock-icon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { SuperBlocks } from '../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../shared/config/curriculum';
import APIIcon from './api';
import D3Icon from './d3';
import DatabaseIcon from './database';
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SuperBlockStages,
SuperBlocks,
superBlockOrder
} from '../../../../shared/config/superblocks';
} from '../../../../shared/config/curriculum';
import { SuperBlockIcon } from '../../assets/icons/superblock-icon';
import LinkButton from '../../assets/icons/link-button';
import { Spacer, ButtonLink } from '../helpers';
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/growth-book/gitpod-note.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { Alert } from '@freecodecamp/ui';
import { useFeatureValue } from '@growthbook/growthbook-react';
import { SuperBlocks } from '../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../shared/config/curriculum';
import { Link } from '../helpers';

type GitpodNoteProps = {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/profile/components/time-line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import ExamResultsModal from '../../SolutionViewer/exam-results-modal';
import { openModal } from '../../../templates/Challenges/redux/actions';
import { Link, FullWidthRow, Spacer } from '../../helpers';
import { SolutionDisplayWidget } from '../../solution-display-widget';
import { SuperBlocks } from '../../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../../shared/config/curriculum';
import TimelinePagination from './timeline-pagination';

const SolutionViewer = Loadable(
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/seo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 '../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../shared/config/curriculum';

interface SEOProps {
title?: string;
Expand Down
2 changes: 1 addition & 1 deletion client/src/redux/prop-types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HandlerProps } from 'react-reflex';
import { SuperBlocks } from '../../../shared/config/superblocks';
import { SuperBlocks } from '../../../shared/config/curriculum';
import { Themes } from '../components/settings/theme';
import { type CertTitle } from '../../config/cert-and-project-map';

Expand Down
2 changes: 1 addition & 1 deletion client/src/templates/Challenges/codeally/show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 '../../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../../shared/config/curriculum';
import { CodeAllyDown } from '../../../components/growth-book/codeally-down';
import { postUserToken } from '../../../utils/ajax';

Expand Down
2 changes: 1 addition & 1 deletion client/src/templates/Challenges/components/side-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { Test } from '../../../redux/prop-types';

import { SuperBlocks } from '../../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../../shared/config/curriculum';
import { initializeMathJax } from '../../../utils/math-jax';
import { challengeTestsSelector } from '../redux/selectors';
import TestSuite from './test-suite';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { Provider } from 'react-redux';
import { SuperBlocks } from '../../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../../shared/config/curriculum';
import { createStore } from '../../../redux/create-store';
import {
ChallengeFiles,
Expand Down
2 changes: 1 addition & 1 deletion client/src/templates/Introduction/components/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ScrollableAnchor from 'react-scrollable-anchor';
import { bindActionCreators, Dispatch } from 'redux';
import { createSelector } from 'reselect';

import { SuperBlocks } from '../../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../../shared/config/curriculum';
import envData from '../../../../config/env.json';
import { isAuditedSuperBlock } from '../../../../../shared/utils/is-audited';
import Caret from '../../../assets/icons/caret';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
certSlugTypeMap,
superBlockCertTypeMap
} from '../../../../../shared/config/certification-settings';
import { SuperBlocks } from '../../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../../shared/config/curriculum';

import {
isSignedInSelector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { withTranslation, useTranslation } from 'react-i18next';
import GreenNotCompleted from '../../../assets/icons/green-not-completed';
import GreenPass from '../../../assets/icons/green-pass';
import { ChallengeWithCompletedNode } from '../../../redux/prop-types';
import { SuperBlocks } from '../../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../../shared/config/curriculum';
import { challengeTypes } from '../../../../../shared/config/challenge-types';
import { ButtonLink } from '../../../components/helpers/button-link';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { SuperBlocks } from '../../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../../shared/config/curriculum';
import { isAuditedSuperBlock } from '../../../../../shared/utils/is-audited';
import { Link, Spacer } from '../../../components/helpers';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Alert } from '@freecodecamp/ui';
import { SuperBlocks } from '../../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../../shared/config/curriculum';
import {
isOldRespCert,
isRelationalDbCert,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Alert } from '@freecodecamp/ui';
import { SuperBlocks } from '../../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../../shared/config/curriculum';
import { SuperBlockIcon } from '../../../assets/icons/superblock-icon';
import { Spacer, Link } from '../../../components/helpers';

Expand Down
2 changes: 1 addition & 1 deletion client/src/templates/Introduction/super-block-intro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { bindActionCreators, Dispatch } from 'redux';
import { createSelector } from 'reselect';
import { Container, Col, Row } from '@freecodecamp/ui';

import { SuperBlocks } from '../../../../shared/config/superblocks';
import { SuperBlocks } from '../../../../shared/config/curriculum';
import { getSuperBlockTitleForMap } from '../../utils/superblock-map-titles';
import DonateModal from '../../components/Donation/donation-modal';
import Login from '../../components/Header/components/login';
Expand Down
2 changes: 1 addition & 1 deletion client/src/utils/curriculum-layout.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { challengeTypes } from '../../../shared/config/challenge-types';
import { SuperBlocks } from '../../../shared/config/superblocks';
import { SuperBlocks } from '../../../shared/config/curriculum';

// Show a grid layout on the superblock level

Expand Down
2 changes: 1 addition & 1 deletion client/src/utils/is-a-cert.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SuperBlocks } from '../../../shared/config/superblocks';
import { SuperBlocks } from '../../../shared/config/curriculum';

export function isOldRespCert(superBlock: string): boolean {
return superBlock === String(SuperBlocks.RespWebDesign);
Expand Down
2 changes: 1 addition & 1 deletion client/src/utils/superblock-map-titles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import i18next from 'i18next';
import { SuperBlocks } from '../../../shared/config/superblocks';
import { SuperBlocks } from '../../../shared/config/curriculum';

// these are keys from i18n translations.json files
enum SuperBlockI18nKeys {
Expand Down
2 changes: 1 addition & 1 deletion curriculum/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path');
const {
createFlatSuperBlockMap,
SuperBlocks
} = require('../shared/config/superblocks');
} = require('../shared/config/curriculum');

require('dotenv').config({ path: path.resolve(__dirname, '../.env') });

Expand Down
8 changes: 4 additions & 4 deletions curriculum/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import fs from 'fs';
import path from 'path';
import { config } from 'dotenv';
import { SuperBlocks } from '../shared/config/superblocks';
import { SuperBlocks } from '../shared/config/curriculum';
import { createSuperOrder, getSuperOrder, getSuperBlockFromDir } from './utils';

config({ path: path.resolve(__dirname, '../.env') });
Expand Down Expand Up @@ -70,12 +70,12 @@ describe('createSuperOrder', () => {
});

describe('getSuperOrder', () => {
it('returns a number for valid superblocks', () => {
it('returns a number for valid curriculum', () => {
expect.assertions(1);
expect(typeof getSuperOrder('responsive-web-design')).toBe('number');
});

it('throws for unknown superblocks', () => {
it('throws for unknown curriculum', () => {
expect.assertions(4);
expect(() => getSuperOrder()).toThrow();
expect(() => getSuperOrder(null)).toThrow();
Expand All @@ -88,7 +88,7 @@ describe('getSuperOrder', () => {
expect(() => getSuperOrder('certifications')).toThrow();
});

it.skip('returns unique numbers for all current superblocks', () => {
it.skip('returns unique numbers for all current curriculum', () => {
if (
process.env.SHOW_NEW_CURRICULUM !== 'true' &&
process.env.SHOW_UPCOMING_CHANGES !== 'true'
Expand Down
4 changes: 2 additions & 2 deletions e2e/landing.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, test, type Page } from '@playwright/test';
import intro from '../client/i18n/locales/english/intro.json';
import translations from '../client/i18n/locales/english/translations.json';
import { SuperBlocks } from '../shared/config/superblocks';
import { SuperBlocks } from '../shared/config/curriculum';

const landingPageElements = {
heading: 'landing-header',
Expand Down Expand Up @@ -150,7 +150,7 @@ test('Testimonial endorser people have images, occupation, location and testimon
}
});

test('Has links to all superblocks', async () => {
test('Has links to all curriculum', async () => {
const curriculumBtns = page.getByTestId(landingPageElements.curriculumBtns);
await expect(curriculumBtns).toHaveCount(21);
for (let index = 0; index < superBlocks.length; index++) {
Expand Down
5 changes: 1 addition & 4 deletions e2e/map.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { test, expect } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
import intro from '../client/i18n/locales/english/intro.json';

import {
SuperBlockStages,
superBlockOrder
} from '../shared/config/superblocks';
import { SuperBlockStages, superBlockOrder } from '../shared/config/curriculum';

test.beforeEach(async ({ page }) => {
await page.goto('/learn');
Expand Down
2 changes: 1 addition & 1 deletion e2e/projects.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { execSync } from 'child_process';
import { test, expect, Page } from '@playwright/test';
import { SuperBlocks } from '../shared/config/superblocks';
import { SuperBlocks } from '../shared/config/curriculum';
import tributePageHtml from './fixtures/tribute-page-html.json';
import tributePageCss from './fixtures/tribute-page-css.json';
import curriculum from './fixtures/js-ads-projects.json';
Expand Down
2 changes: 1 addition & 1 deletion e2e/seo.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { SuperBlocks } from '../shared/config/superblocks';
import { SuperBlocks } from '../shared/config/curriculum';
import type { ListItem } from '../client/src/components/seo/';
import metaTags from '../client/i18n/locales/english/meta-tags.json';

Expand Down
2 changes: 1 addition & 1 deletion shared/config/certification-settings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SuperBlocks } from '../../shared/config/superblocks';
import { SuperBlocks } from '../../shared/config/curriculum';

/**
* Certifications are not equivalent to superblocks. Each superblock corresponds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
createSuperBlockMap,
createFlatSuperBlockMap,
getAuditedSuperBlocks
} from './superblocks';
} from './curriculum';

describe('superBlockOrder', () => {
it('should contain all SuperBlocks', () => {
Expand Down
4 changes: 3 additions & 1 deletion shared/config/superblocks.ts → shared/config/curriculum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Languages } from '../config/i18n';
// TODO: eventually this should all flow from the curriculum service, since it
// defines the top-level structure of the curriculum.
import { Languages } from './i18n';

// all superblocks
export enum SuperBlocks {
Expand Down
2 changes: 1 addition & 1 deletion shared/utils/is-audited.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
type SuperBlocks,
getAuditedSuperBlocks
} from '../../shared/config/superblocks';
} from '../../shared/config/curriculum';

export function isAuditedSuperBlock(
language: string,
Expand Down
2 changes: 1 addition & 1 deletion tools/challenge-auditor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getChallengesForLang } from '../../curriculum/get-challenges';
import {
SuperBlocks,
getAuditedSuperBlocks
} from '../../shared/config/superblocks';
} from '../../shared/config/curriculum';

// 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
Expand Down
2 changes: 1 addition & 1 deletion tools/challenge-helper-scripts/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import { SuperBlocks } from '../../shared/config/superblocks';
import { SuperBlocks } from '../../shared/config/curriculum';
import { challengeTypes } from '../../shared/config/challenge-types';
import { getProjectPath } from './helpers/get-project-info';
import { getMetaData, updateMetaData } from './helpers/project-metadata';
Expand Down
2 changes: 1 addition & 1 deletion tools/challenge-helper-scripts/create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { prompt } from 'inquirer';
import { format } from 'prettier';
import ObjectID from 'bson-objectid';

import { SuperBlocks } from '../../shared/config/superblocks';
import { SuperBlocks } from '../../shared/config/curriculum';
import { createStepFile, validateBlockName } from './utils';
import { getSuperBlockSubPath } from './fs-utils';
import { Meta } from './helpers/project-metadata';
Expand Down
2 changes: 1 addition & 1 deletion tools/challenge-helper-scripts/fs-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs/promises';
import path from 'path';
import { SuperBlocks } from '../../shared/config/superblocks';
import { SuperBlocks } from '../../shared/config/curriculum';
import { getSuperBlockSubPath } from './fs-utils';

describe('getSuperBlockSubPath', () => {
Expand Down
2 changes: 1 addition & 1 deletion tools/challenge-helper-scripts/fs-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SuperBlocks } from '../../shared/config/superblocks';
import { SuperBlocks } from '../../shared/config/curriculum';

export function getSuperBlockSubPath(superBlock: SuperBlocks): string {
const pathMap = {
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/build/build-external-curricula-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 '../../../shared/config/superblocks';
import { SuperBlocks } from '../../../shared/config/curriculum';
import {
superblockSchemaValidator,
availableSuperBlocksValidator
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/build/build-external-curricula-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { mkdirSync, writeFileSync, readFileSync } from 'fs';
import { resolve, dirname } from 'path';
import { submitTypes } from '../../../shared/config/challenge-types';
import { type ChallengeNode } from '../../../client/src/redux/prop-types';
import { SuperBlocks } from '../../../shared/config/superblocks';
import { SuperBlocks } from '../../../shared/config/curriculum';

type Intro = { [keyValue in SuperBlocks]: IntroProps };
export type Curriculum<T> = {
Expand Down

0 comments on commit 1e25cfd

Please sign in to comment.