chore: use constants for superblocks (#43886)
* chore: use constants for superblocks * add prettier ts dec to challenge-helper-scripts * config/ to ts. broken * typescripterise tools/ and config/ * create global tsconfig, remove alternate configs * delete temp ts->js, add to gitignore * fix gitignore * re-import SuperBlocks in super-block-intro.tsx * remove renamed files added again * fix config * remove accidental files * remove snap * delete built files * adjust eslintrc for enums * add node types to root * ignore build files in lint and prettier * fix tools/ in tsconfig * ignore annoying ts warnings * prettierise Map/index.tsx * fix enum to match lint rule * rejig Map to render RWD superblock * 'pretty minor' - implicitly tsc within root Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * fix client/package.json for Gitpod * broken: migrate @types to root * fix: use typeRoots to prevent duplication * fix show.tsx, try typeroots in root * silly fix for duplicate node_modules types * remove typeRoots from root * fix: tsconfig or not tsconfig, that is the... * fix: ...question: Whether 'tis nobler in the mind to suffer the slings and arrows of outrageous configs... * fix: Or to take Arms against a Sea of lint errors And by opposing end them Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@ -4,25 +4,10 @@ import path from 'path';
|
||||
import { prompt } from 'inquirer';
|
||||
import { format } from 'prettier';
|
||||
|
||||
import { SuperBlocks } from '../../config/certification-settings';
|
||||
import { blockNameify } from '../../utils/block-nameify';
|
||||
import { createStepFile } from './utils.js';
|
||||
|
||||
const superBlocks = [
|
||||
'responsive-web-design',
|
||||
'javascript-algorithms-and-data-structures',
|
||||
'front-end-development-libraries',
|
||||
'data-visualization',
|
||||
'back-end-development-and-apis',
|
||||
'quality-assurance',
|
||||
'scientific-computing-with-python',
|
||||
'data-analysis-with-python',
|
||||
'information-security',
|
||||
'machine-learning-with-python',
|
||||
'coding-interview-prep'
|
||||
] as const;
|
||||
|
||||
type SuperBlock = typeof superBlocks[number];
|
||||
|
||||
const helpCategories = ['HTML-CSS', 'JavaScript', 'Python'] as const;
|
||||
|
||||
type BlockInfo = {
|
||||
@ -34,7 +19,7 @@ type SuperBlockInfo = {
|
||||
blocks: Record<string, BlockInfo>;
|
||||
};
|
||||
|
||||
type IntroJson = Record<SuperBlock, SuperBlockInfo>;
|
||||
type IntroJson = Record<SuperBlocks, SuperBlockInfo>;
|
||||
|
||||
type Meta = {
|
||||
name: string;
|
||||
@ -51,7 +36,7 @@ type Meta = {
|
||||
};
|
||||
|
||||
async function createProject(
|
||||
superBlock: SuperBlock,
|
||||
superBlock: SuperBlocks,
|
||||
block: string,
|
||||
helpCategory: string,
|
||||
order: number,
|
||||
@ -86,7 +71,7 @@ async function createProject(
|
||||
}
|
||||
|
||||
async function updateIntroJson(
|
||||
superBlock: SuperBlock,
|
||||
superBlock: SuperBlocks,
|
||||
block: string,
|
||||
title: string
|
||||
) {
|
||||
@ -138,7 +123,7 @@ async function updateBlockNames(block: string, title: string) {
|
||||
}
|
||||
|
||||
async function createMetaJson(
|
||||
superBlock: SuperBlock,
|
||||
superBlock: SuperBlocks,
|
||||
block: string,
|
||||
title: string,
|
||||
order: number,
|
||||
@ -149,7 +134,7 @@ async function createMetaJson(
|
||||
newMeta.name = title;
|
||||
newMeta.dashedName = block;
|
||||
newMeta.order = order;
|
||||
newMeta.superOrder = superBlocks.indexOf(superBlock) + 1;
|
||||
newMeta.superOrder = Object.values(SuperBlocks).indexOf(superBlock) + 1;
|
||||
newMeta.superBlock = superBlock;
|
||||
newMeta.challengeOrder = [[challengeId, 'Step 1']];
|
||||
const newMetaDir = path.resolve(metaDir, block);
|
||||
@ -190,10 +175,10 @@ This is a test for the new project-based curriculum.
|
||||
}
|
||||
|
||||
async function createFirstChallenge(
|
||||
superBlock: SuperBlock,
|
||||
superBlock: SuperBlocks,
|
||||
block: string
|
||||
): Promise<string> {
|
||||
const superBlockId = (superBlocks.indexOf(superBlock) + 1)
|
||||
const superBlockId = (Object.values(SuperBlocks).indexOf(superBlock) + 1)
|
||||
.toString()
|
||||
.padStart(2, '0');
|
||||
const newChallengeDir = path.resolve(
|
||||
@ -234,9 +219,9 @@ prompt([
|
||||
{
|
||||
name: 'superBlock',
|
||||
message: 'Which certification does this belong to?',
|
||||
default: 'responsive-web-design',
|
||||
default: SuperBlocks.RespWebDesign,
|
||||
type: 'list',
|
||||
choices: superBlocks
|
||||
choices: SuperBlocks
|
||||
},
|
||||
{
|
||||
name: 'block',
|
||||
|
Reference in New Issue
Block a user