mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
refactor: create shared workspace (#51454)
This commit is contained in:
committed by
GitHub
parent
3c0c14b427
commit
391fc2e34d
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user