forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
18 lines (16 loc) · 645 Bytes
/
Copy pathutils.js
File metadata and controls
18 lines (16 loc) · 645 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const path = require('path');
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
const { curriculum: curriculumLangs } =
require('../config/i18n/all-langs').availableLangs;
exports.testedLang = function testedLang() {
if (process.env.CURRICULUM_LOCALE) {
if (curriculumLangs.includes(process.env.CURRICULUM_LOCALE)) {
return process.env.CURRICULUM_LOCALE;
} else {
throw Error(`${process.env.CURRICULUM_LOCALE} is not a supported language.
Before the site can be built, this language needs to be manually approved`);
}
} else {
throw Error('LOCALE must be set for testing');
}
};