|
1 | 1 | import fs from 'fs'; |
2 | 2 | import path from 'path'; |
3 | 3 |
|
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 | +} |
22 | 27 |
|
23 | 28 | 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'}`, |
36 | 41 | }; |
0 commit comments