feat: add curriculum feature flag (#44441)
This commit is contained in:
committed by
GitHub
parent
88524556e7
commit
dd2ff1683c
@ -31,7 +31,8 @@ const {
|
||||
PAYPAL_CLIENT_ID: paypalClientId,
|
||||
PATREON_CLIENT_ID: patreonClientId,
|
||||
DEPLOYMENT_ENV: deploymentEnv,
|
||||
SHOW_UPCOMING_CHANGES: showUpcomingChanges
|
||||
SHOW_UPCOMING_CHANGES: showUpcomingChanges,
|
||||
SHOW_NEW_CURRICULUM: showNewCurriculum
|
||||
} = process.env;
|
||||
|
||||
const locations = {
|
||||
@ -70,5 +71,6 @@ module.exports = Object.assign(locations, {
|
||||
!patreonClientId || patreonClientId === 'id_from_patreon_dashboard'
|
||||
? null
|
||||
: patreonClientId,
|
||||
showUpcomingChanges: showUpcomingChanges === 'true'
|
||||
showUpcomingChanges: showUpcomingChanges === 'true',
|
||||
showNewCurriculum: showNewCurriculum === 'true'
|
||||
});
|
||||
|
@ -57,6 +57,7 @@ CURRICULUM_LOCALE=english
|
||||
|
||||
# Show or hide WIP in progress challenges
|
||||
SHOW_UPCOMING_CHANGES=false
|
||||
SHOW_NEW_CURRICULUM=false
|
||||
|
||||
# Application paths
|
||||
HOME_LOCATION=http://localhost:8000
|
||||
|
@ -49,7 +49,8 @@ if (FREECODECAMP_NODE_ENV !== 'development') {
|
||||
'showLocaleDropdownMenu',
|
||||
'deploymentEnv',
|
||||
'environment',
|
||||
'showUpcomingChanges'
|
||||
'showUpcomingChanges',
|
||||
'showNewCurriculum'
|
||||
];
|
||||
const searchKeys = ['algoliaAppId', 'algoliaAPIKey'];
|
||||
const donationKeys = ['stripePublicKey', 'paypalClientId', 'patreonClientId'];
|
||||
@ -112,13 +113,18 @@ if (FREECODECAMP_NODE_ENV !== 'development') {
|
||||
checkClientLocale();
|
||||
checkCurriculumLocale();
|
||||
if (fs.existsSync(`${globalConfigPath}/env.json`)) {
|
||||
// eslint-disable-next-line
|
||||
const { showUpcomingChanges } = require(`${globalConfigPath}/env.json`);
|
||||
if (env['showUpcomingChanges'] !== showUpcomingChanges) {
|
||||
/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment */
|
||||
const {
|
||||
showNewCurriculum,
|
||||
showUpcomingChanges
|
||||
} = require(`${globalConfigPath}/env.json`);
|
||||
/* eslint-enable @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment */
|
||||
if (
|
||||
env['showUpcomingChanges'] !== showUpcomingChanges ||
|
||||
env['showNewCurriculum'] !== showNewCurriculum
|
||||
) {
|
||||
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
|
||||
console.log(
|
||||
'SHOW_UPCOMING_CHANGES value has changed, cleaning client cache.'
|
||||
);
|
||||
console.log('Feature flags have been changed, cleaning client cache.');
|
||||
const child = spawn('npm', ['run', 'clean:client']);
|
||||
child.stdout.setEncoding('utf8');
|
||||
child.stdout.on('data', function (data) {
|
||||
|
Reference in New Issue
Block a user