Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit d1eaf07

Browse files
author
Ray Arayilakath
committed
Enable Experimental Features, Patch Config Bug
1 parent cb79a33 commit d1eaf07

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

src/utils/constants.js

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
11
import fs from 'fs';
22
import path from 'path';
33

4-
const initVariables = JSON.parse(fs.readFileSync(path.join(process.cwd(), '.replapirc.json'))) || {
5-
username: undefined,
6-
captcha: {
7-
token: undefined,
8-
},
9-
endpoints: {
10-
gql: undefined,
11-
restful: undefined,
12-
login: undefined,
13-
},
14-
markdown: {
15-
length: undefined,
16-
removeMarkdown: undefined,
17-
},
18-
previewCount: {
19-
comments: undefined,
20-
},
21-
};
4+
let initVariables;
5+
if (fs.existsSync(path.join(process.cwd(), '.replapirc.json'))) {
6+
initVariables = JSON.parse(fs.readFileSync(path.join(process.cwd(), '.replapirc.json')));
7+
} else {
8+
initVariables = {
9+
username: undefined,
10+
captcha: {
11+
token: undefined,
12+
},
13+
endpoints: {
14+
gql: undefined,
15+
restful: undefined,
16+
login: undefined,
17+
},
18+
markdown: {
19+
length: undefined,
20+
removeMarkdown: undefined,
21+
},
22+
previewCount: {
23+
comments: undefined,
24+
},
25+
};
26+
}
2227

2328
export default {
24-
roleAttributes: 'id, name, key, tagline',
25-
languageAttributes: 'id, displayName, key, category, tagline, icon, isNew',
26-
organizationAttributes: 'id, name, country, postalCode, state, city, googlePlaceId, timeCreated, timeUpdated, timeDeleted, time_created',
27-
subscriptionAttributes: 'id, userId, customerId, planId, timeUpdated, timeCreated, timeDeleted',
28-
userAttributes: 'id, username, firstName, lastName, bio, isVerified, displayName, fullName, url, isLoggedIn, isSubscribed, timeCreated, isBannedFromBoards, karma, isHacker, image',
29-
boardAttributes: 'id, name, description, slug, cta, titleCta, bodyCta, template, buttonCta, color, replRequired, isLocked, isAnswerable, isPrivate, timeCreated, timeUpdated, url, canPost',
30-
replAttributes: 'id, language, isProject, isPrivate, isStarred, title, slug, description, folderId, isRenamed, url, timeCreated, timeUpdated, isOwner, tags { id }, pinnedToProfile, files, hostedUrl, terminalUrl, reactions { id, count }',
31-
commentAttributes: `id, body, voteCount, timeCreated, timeUpdated, url, isAuthor, canEdit, canVote, canComment, hasVoted, canReport, hasReported, isAnswer, canSelectAsAnswer, canUnselectAsAnswer, preview(length: ${initVariables.markdown.length || 150}, removeMarkdown: ${initVariables.markdown.removeMarkdown || true})`,
32-
postAttributes: `id, title, body, showHosted, voteCount, commentCount, isPinned, isLocked, timeCreated, timeUpdated, url, isAnnouncement, isAuthor, canEdit, canComment, canVote, canPin, canSetType, canChangeBoard, canLock, hasVoted, canReport, hasReported, isAnswerable, tutorialPages, preview(length: ${initVariables.markdown.length || 150}, removeMarkdown: ${initVariables.markdown.removeMarkdown || true})`,
33-
graphql: `${initVariables.endpoints.gql || 'https://staging.replit.com/graphql'}`,
34-
login: `${initVariables.endpoints.login || 'https://staging.replit.com/login'}`,
35-
restful: `${initVariables.endpoints.restful || 'https://staging.replit.com'}`,
29+
roleAttributes: 'id, name, key, tagline',
30+
languageAttributes: 'id, displayName, key, category, tagline, icon, isNew',
31+
organizationAttributes: 'id, name, country, postalCode, state, city, googlePlaceId, timeCreated, timeUpdated, timeDeleted, time_created',
32+
subscriptionAttributes: 'id, userId, customerId, planId, timeUpdated, timeCreated, timeDeleted',
33+
userAttributes: 'id, username, firstName, lastName, bio, isVerified, displayName, fullName, url, isLoggedIn, isSubscribed, timeCreated, isBannedFromBoards, karma, isHacker, image',
34+
boardAttributes: 'id, name, description, slug, cta, titleCta, bodyCta, template, buttonCta, color, replRequired, isLocked, isAnswerable, isPrivate, timeCreated, timeUpdated, url, canPost',
35+
replAttributes: 'id, language, isProject, isPrivate, isStarred, title, slug, description, folderId, isRenamed, url, timeCreated, timeUpdated, isOwner, tags { id }, pinnedToProfile, files, hostedUrl, terminalUrl, reactions { id, count }',
36+
commentAttributes: `id, body, voteCount, timeCreated, timeUpdated, url, isAuthor, canEdit, canVote, canComment, hasVoted, canReport, hasReported, isAnswer, canSelectAsAnswer, canUnselectAsAnswer, preview(length: ${initVariables.markdown.length || 150}, removeMarkdown: ${initVariables.markdown.removeMarkdown || true})`,
37+
postAttributes: `id, title, body, showHosted, voteCount, commentCount, isPinned, isLocked, timeCreated, timeUpdated, url, isAnnouncement, isAuthor, canEdit, canComment, canVote, canPin, canSetType, canChangeBoard, canLock, hasVoted, canReport, hasReported, isAnswerable, tutorialPages, preview(length: ${initVariables.markdown.length || 150}, removeMarkdown: ${initVariables.markdown.removeMarkdown || true})`,
38+
graphql: `${initVariables.endpoints.gql || 'https://staging.replit.com/graphql'}`,
39+
login: `${initVariables.endpoints.login || 'https://staging.replit.com/login'}`,
40+
restful: `${initVariables.endpoints.restful || 'https://staging.replit.com'}`,
3641
};

0 commit comments

Comments
 (0)