fix: add env var to build language files
This commit is contained in:
@ -1,36 +0,0 @@
|
|||||||
# Javascript Node CircleCI 2.0 configuration file
|
|
||||||
#
|
|
||||||
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
|
|
||||||
#
|
|
||||||
version: 2
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- next
|
|
||||||
docker:
|
|
||||||
# specify the version you desire here
|
|
||||||
- image: circleci/node:8.12.0
|
|
||||||
|
|
||||||
# Specify service dependencies here if necessary
|
|
||||||
# CircleCI maintains a library of pre-built images
|
|
||||||
# documented at https://circleci.com/docs/2.0/circleci-images/
|
|
||||||
# - image: circleci/mongo:3.4.4
|
|
||||||
|
|
||||||
working_directory: ~/repo
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
|
|
||||||
# Download and cache dependencies
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- v1-dependencies-{{ checksum "client/package.json" }}
|
|
||||||
# fallback to using the latest cache if no exact match is found
|
|
||||||
- v1-dependencies-
|
|
||||||
- run: cd ./client && npm install && npm run build
|
|
||||||
|
|
||||||
- save_cache:
|
|
||||||
paths:
|
|
||||||
- client/node_modules
|
|
||||||
key: v1-dependencies-{{ checksum "client/package.json" }}
|
|
@ -2,6 +2,7 @@ const { getChallengesForLang } = require('@freecodecamp/curriculum');
|
|||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
const utils = require('../utils');
|
const utils = require('../utils');
|
||||||
|
const { locale } = require('../config/env.json');
|
||||||
|
|
||||||
const dasherize = utils.dasherize;
|
const dasherize = utils.dasherize;
|
||||||
const nameify = utils.nameify;
|
const nameify = utils.nameify;
|
||||||
@ -10,7 +11,7 @@ const arrToString = arr =>
|
|||||||
Array.isArray(arr) ? arr.join('\n') : _.toString(arr);
|
Array.isArray(arr) ? arr.join('\n') : _.toString(arr);
|
||||||
|
|
||||||
exports.buildChallenges = async function buildChallenges() {
|
exports.buildChallenges = async function buildChallenges() {
|
||||||
const curriculum = await getChallengesForLang('english');
|
const curriculum = await getChallengesForLang( locale );
|
||||||
const superBlocks = Object.keys(curriculum);
|
const superBlocks = Object.keys(curriculum);
|
||||||
const blocks = superBlocks
|
const blocks = superBlocks
|
||||||
.map(superBlock => curriculum[superBlock].blocks)
|
.map(superBlock => curriculum[superBlock].blocks)
|
||||||
|
@ -5,7 +5,6 @@ const debug = require('debug');
|
|||||||
const envPath = path.resolve(__dirname, '../../.env');
|
const envPath = path.resolve(__dirname, '../../.env');
|
||||||
require('dotenv').config({ path: envPath });
|
require('dotenv').config({ path: envPath });
|
||||||
|
|
||||||
const env = require('../../config/env');
|
|
||||||
const { createRedirects } = require('./createRedirects');
|
const { createRedirects } = require('./createRedirects');
|
||||||
|
|
||||||
const log = debug('fcc:tools:ensure-env');
|
const log = debug('fcc:tools:ensure-env');
|
||||||
@ -13,12 +12,23 @@ const {
|
|||||||
HOME_LOCATION: home,
|
HOME_LOCATION: home,
|
||||||
API_LOCATION: api,
|
API_LOCATION: api,
|
||||||
FORUM_LOCATION: forum,
|
FORUM_LOCATION: forum,
|
||||||
FORUM_PROXY_LOCATION: forumProxy
|
FORUM_PROXY_LOCATION: forumProxy,
|
||||||
|
LOCALE: locale
|
||||||
} = process.env;
|
} = process.env;
|
||||||
|
|
||||||
|
const locations = {
|
||||||
|
homeLocation: home,
|
||||||
|
apiLocation: api,
|
||||||
|
forumLocation: forum,
|
||||||
|
forumProxyLocation: forumProxy
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const apiPath = path.resolve(__dirname, '../../api-server');
|
const apiPath = path.resolve(__dirname, '../../api-server');
|
||||||
const clientPath = path.resolve(__dirname, '../../client');
|
const clientPath = path.resolve(__dirname, '../../client');
|
||||||
const clientStaticPath = path.resolve(clientPath, 'static');
|
const clientStaticPath = path.resolve(clientPath, 'static');
|
||||||
|
const globalConfigPath = path.resolve(__dirname, '../../config');
|
||||||
|
const env = Object.assign(locations, {locale});
|
||||||
|
|
||||||
const redirects = createRedirects({ api, home, forum, forumProxy });
|
const redirects = createRedirects({ api, home, forum, forumProxy });
|
||||||
|
|
||||||
@ -30,15 +40,6 @@ fs.writeFile(`${clientStaticPath}/_redirects`, redirects, function(err) {
|
|||||||
log('_redirects written');
|
log('_redirects written');
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.access(`${apiPath}/server/rev-manifest.json`, function(err) {
|
|
||||||
if (err) {
|
|
||||||
log('creating manifest');
|
|
||||||
return fs.writeFileSync(`${apiPath}/server/rev-manifest.json`, '{}');
|
|
||||||
}
|
|
||||||
log('rev-manifest present');
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
fs.access(`${apiPath}/server/resources/pathMigration.json`, err => {
|
fs.access(`${apiPath}/server/resources/pathMigration.json`, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
log('creating pathMigration');
|
log('creating pathMigration');
|
||||||
@ -52,3 +53,4 @@ fs.access(`${apiPath}/server/resources/pathMigration.json`, err => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
fs.writeFileSync(`${clientPath}/config/env.json`, JSON.stringify(env));
|
fs.writeFileSync(`${clientPath}/config/env.json`, JSON.stringify(env));
|
||||||
|
fs.writeFileSync(`${globalConfigPath}/env.json`, JSON.stringify(env));
|
||||||
|
742
tools/scripts/seed/package-lock.json
generated
742
tools/scripts/seed/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user