feat: Use prettier-eslint to format code
This commit is contained in:
committed by
mrugesh mohapatra
parent
1ba67c4e2b
commit
b13e5fb41a
@ -36,9 +36,7 @@ describe('createRedirects', () => {
|
||||
const { api, forum } = testLocations;
|
||||
expect(redirects.includes(`${api}/internal/:splat`)).toBe(true);
|
||||
expect(
|
||||
redirects.includes(
|
||||
`${forum}/t/free-code-camp-privacy-policy/19545 301`
|
||||
)
|
||||
redirects.includes(`${forum}/t/free-code-camp-privacy-policy/19545 301`)
|
||||
).toBe(true);
|
||||
expect(redirects.includes(`${forum}`)).toBe(true);
|
||||
});
|
||||
|
@ -22,80 +22,77 @@ function handleError(err, client) {
|
||||
}
|
||||
}
|
||||
|
||||
MongoClient.connect(
|
||||
MONGOHQ_URL,
|
||||
{ useNewUrlParser: true },
|
||||
function(err, client) {
|
||||
MongoClient.connect(MONGOHQ_URL, { useNewUrlParser: true }, function(
|
||||
err,
|
||||
client
|
||||
) {
|
||||
handleError(err, client);
|
||||
|
||||
log('Connected successfully to mongo');
|
||||
|
||||
const db = client.db('freecodecamp');
|
||||
const user = db.collection('user');
|
||||
|
||||
user.deleteOne({ _id: ObjectId('5bd30e0f1caf6ac3ddddddb5') }, err => {
|
||||
handleError(err, client);
|
||||
|
||||
log('Connected successfully to mongo');
|
||||
|
||||
const db = client.db('freecodecamp');
|
||||
const user = db.collection('user');
|
||||
|
||||
user.deleteOne({_id: ObjectId('5bd30e0f1caf6ac3ddddddb5') }, (err) => {
|
||||
handleError(err, client);
|
||||
|
||||
try {
|
||||
user.insertOne(
|
||||
{
|
||||
_id: ObjectId('5bd30e0f1caf6ac3ddddddb5'),
|
||||
email: 'foo@bar.com',
|
||||
emailVerified: true,
|
||||
progressTimestamps: [],
|
||||
isBanned: false,
|
||||
isCheater: false,
|
||||
username: 'DevelopmentUser',
|
||||
about: '',
|
||||
name: 'Development User',
|
||||
location: '',
|
||||
picture: 'https://identicon.org/?t=dev&s=256',
|
||||
acceptedPrivacyTerms: true,
|
||||
sendQuincyEmail: false,
|
||||
currentChallengeId: '',
|
||||
isHonest: false,
|
||||
isFrontEndCert: false,
|
||||
isDataVisCert: false,
|
||||
isBackEndCert: false,
|
||||
isFullStackCert: false,
|
||||
isRespWebDesignCert: false,
|
||||
is2018DataVisCert: false,
|
||||
isFrontEndLibsCert: false,
|
||||
isJsAlgoDataStructCert: false,
|
||||
isApisMicroservicesCert: false,
|
||||
isInfosecQaCert: false,
|
||||
is2018FullStackCert: false,
|
||||
completedChallenges: [],
|
||||
portfolio: [],
|
||||
yearsTopContributor: [],
|
||||
rand: 0.6126749173148205,
|
||||
theme: 'default',
|
||||
profileUI: {
|
||||
isLocked: true,
|
||||
showAbout: false,
|
||||
showCerts: false,
|
||||
showDonation: false,
|
||||
showHeatMap: false,
|
||||
showLocation: false,
|
||||
showName: false,
|
||||
showPoints: false,
|
||||
showPortfolio: false,
|
||||
showTimeLine: false
|
||||
},
|
||||
badges: {
|
||||
coreTeam: []
|
||||
},
|
||||
isDonating: false,
|
||||
emailAuthLinkTTL: null,
|
||||
emailVerifyTTL: null
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
handleError(e, client);
|
||||
} finally {
|
||||
log('local auth user seed complete');
|
||||
client.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
try {
|
||||
user.insertOne({
|
||||
_id: ObjectId('5bd30e0f1caf6ac3ddddddb5'),
|
||||
email: 'foo@bar.com',
|
||||
emailVerified: true,
|
||||
progressTimestamps: [],
|
||||
isBanned: false,
|
||||
isCheater: false,
|
||||
username: 'DevelopmentUser',
|
||||
about: '',
|
||||
name: 'Development User',
|
||||
location: '',
|
||||
picture: 'https://identicon.org/?t=dev&s=256',
|
||||
acceptedPrivacyTerms: true,
|
||||
sendQuincyEmail: false,
|
||||
currentChallengeId: '',
|
||||
isHonest: false,
|
||||
isFrontEndCert: false,
|
||||
isDataVisCert: false,
|
||||
isBackEndCert: false,
|
||||
isFullStackCert: false,
|
||||
isRespWebDesignCert: false,
|
||||
is2018DataVisCert: false,
|
||||
isFrontEndLibsCert: false,
|
||||
isJsAlgoDataStructCert: false,
|
||||
isApisMicroservicesCert: false,
|
||||
isInfosecQaCert: false,
|
||||
is2018FullStackCert: false,
|
||||
completedChallenges: [],
|
||||
portfolio: [],
|
||||
yearsTopContributor: [],
|
||||
rand: 0.6126749173148205,
|
||||
theme: 'default',
|
||||
profileUI: {
|
||||
isLocked: true,
|
||||
showAbout: false,
|
||||
showCerts: false,
|
||||
showDonation: false,
|
||||
showHeatMap: false,
|
||||
showLocation: false,
|
||||
showName: false,
|
||||
showPoints: false,
|
||||
showPortfolio: false,
|
||||
showTimeLine: false
|
||||
},
|
||||
badges: {
|
||||
coreTeam: []
|
||||
},
|
||||
isDonating: false,
|
||||
emailAuthLinkTTL: null,
|
||||
emailVerifyTTL: null
|
||||
});
|
||||
} catch (e) {
|
||||
handleError(e, client);
|
||||
} finally {
|
||||
log('local auth user seed complete');
|
||||
client.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -26,66 +26,61 @@ function handleError(err, client) {
|
||||
}
|
||||
}
|
||||
|
||||
MongoClient.connect(
|
||||
MONGOHQ_URL,
|
||||
{ useNewUrlParser: true },
|
||||
function(err, client) {
|
||||
MongoClient.connect(MONGOHQ_URL, { useNewUrlParser: true }, function(
|
||||
err,
|
||||
client
|
||||
) {
|
||||
handleError(err, client);
|
||||
|
||||
log('Connected successfully to mongo at %s', MONGOHQ_URL);
|
||||
|
||||
const db = client.db('freecodecamp');
|
||||
const challengeCollection = db.collection('challenge');
|
||||
|
||||
challengeCollection.deleteMany({}, async err => {
|
||||
handleError(err, client);
|
||||
|
||||
log('Connected successfully to mongo at %s', MONGOHQ_URL);
|
||||
log('deleted all the challenges');
|
||||
|
||||
const db = client.db('freecodecamp');
|
||||
const challengeCollection = db.collection('challenge');
|
||||
const curriculum = await getChallengesForLang(lang);
|
||||
|
||||
challengeCollection.deleteMany({}, async err => {
|
||||
handleError(err, client);
|
||||
|
||||
log('deleted all the challenges');
|
||||
|
||||
const curriculum = await getChallengesForLang(lang);
|
||||
|
||||
const allChallenges = Object.keys(curriculum)
|
||||
.map(key => curriculum[key].blocks)
|
||||
.reduce((challengeArray, superBlock) => {
|
||||
const challengesForBlock = Object.keys(superBlock).map(
|
||||
key => superBlock[key].challenges
|
||||
);
|
||||
return [...challengeArray, ...flatten(challengesForBlock)];
|
||||
}, [])
|
||||
.map(challenge => {
|
||||
const currentId = challenge.id.slice(0);
|
||||
challenge._id = ObjectID(currentId);
|
||||
delete challenge.id;
|
||||
return challenge;
|
||||
});
|
||||
|
||||
try {
|
||||
challengeCollection.insertMany(
|
||||
allChallenges,
|
||||
{ ordered: false },
|
||||
err => {
|
||||
handleError(err, client);
|
||||
log('challenge seed complete');
|
||||
client.close();
|
||||
}
|
||||
const allChallenges = Object.keys(curriculum)
|
||||
.map(key => curriculum[key].blocks)
|
||||
.reduce((challengeArray, superBlock) => {
|
||||
const challengesForBlock = Object.keys(superBlock).map(
|
||||
key => superBlock[key].challenges
|
||||
);
|
||||
} catch (e) {
|
||||
handleError(e, client);
|
||||
} finally {
|
||||
log('generating path migration map');
|
||||
const pathMap = createPathMigrationMap(curriculum);
|
||||
const outputDir = path.resolve(
|
||||
__dirname,
|
||||
'../../../api-server/server/resources/pathMigration.json'
|
||||
);
|
||||
fs.writeFile(outputDir, JSON.stringify(pathMap), err => {
|
||||
if (err) {
|
||||
console.error('Oh noes!!');
|
||||
console.error(err);
|
||||
}
|
||||
log('path migration map generated');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
return [...challengeArray, ...flatten(challengesForBlock)];
|
||||
}, [])
|
||||
.map(challenge => {
|
||||
const currentId = challenge.id.slice(0);
|
||||
challenge._id = ObjectID(currentId);
|
||||
delete challenge.id;
|
||||
return challenge;
|
||||
});
|
||||
|
||||
try {
|
||||
challengeCollection.insertMany(allChallenges, { ordered: false }, err => {
|
||||
handleError(err, client);
|
||||
log('challenge seed complete');
|
||||
client.close();
|
||||
});
|
||||
} catch (e) {
|
||||
handleError(e, client);
|
||||
} finally {
|
||||
log('generating path migration map');
|
||||
const pathMap = createPathMigrationMap(curriculum);
|
||||
const outputDir = path.resolve(
|
||||
__dirname,
|
||||
'../../../api-server/server/resources/pathMigration.json'
|
||||
);
|
||||
fs.writeFile(outputDir, JSON.stringify(pathMap), err => {
|
||||
if (err) {
|
||||
console.error('Oh noes!!');
|
||||
console.error(err);
|
||||
}
|
||||
log('path migration map generated');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user