Skip to content

Commit

Permalink
resolve changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MayankJha014 committed Dec 7, 2024
1 parent e1173ef commit 9f850e6
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 79 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"extends": [
"plugin:react/recommended",
"eslint:recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"eslint-config-prettier",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ jobs:
echo "FULL_Branch_NAME: $FULL_BRANCH_NAME"
# Clone the specified repository using the extracted branch name
git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a
git clone --branch "$FULL_BRANCH_NAME" https://github.com/PalisadoesFoundation/talawa-api && ls -a
- name: Validate Documents
run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql'
Expand Down
2 changes: 1 addition & 1 deletion ISSUE_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

In order to give everyone a chance to submit a issues reports and contribute to the Talawa project, we have put restrictions in place. This section outlines the guidelines that should be imposed upon issue reports in the Talawa project.
To maintain quality and organization, we have established guidelines for submitting issue reports to the Talawa project. This document outlines these guidelines to help you contribute effectively.

---

Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
"serve": "cross-env ESLINT_NO_DEV_ERRORS=true vite --config config/vite.config.ts",
"build": "tsc && vite build --config config/vite.config.ts",
"preview": "vite preview --config config/vite.config.ts",
"test": "cross-env NODE_ENV=test jest --env=./scripts/custom-test-env.js --watchAll --coverage",
"test:vitest": "vitest run",
"test:watch": "vitest watch",
"eject": "react-scripts eject",
Expand All @@ -85,7 +84,6 @@
"check-tsdoc": "node .github/workflows/check-tsdoc.js",
"typecheck": "tsc --project tsconfig.json --noEmit",
"prepare": "husky install",
"jest-preview": "jest-preview",
"update:toc": "node scripts/githooks/update-toc.js",
"lint-staged": "lint-staged --concurrent false",
"setup": "tsx setup.ts",
Expand Down Expand Up @@ -114,11 +112,9 @@
"@babel/preset-env": "^7.25.4",
"@babel/preset-react": "^7.25.7",
"@babel/preset-typescript": "^7.26.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^12.1.10",
"@types/inquirer": "^9.0.7",
"@types/jest": "^26.0.24",
"@types/js-cookie": "^3.0.6",
"@types/node": "^22.5.4",
"@types/node-fetch": "^2.6.10",
Expand All @@ -134,11 +130,9 @@
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.5.0",
"@vitest/coverage-istanbul": "^2.1.8",
"babel-jest": "^29.7.0",
"cross-env": "^7.0.3",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jest": "^28.8.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-tsdoc": "^0.3.0",
Expand Down
67 changes: 14 additions & 53 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1013,11 +1013,23 @@ type Query {
eventVolunteersByEvent(id: ID!): [EventVolunteer]
eventsByOrganization(id: ID, orderBy: EventOrderByInput): [Event]
eventsByOrganizationConnection(
after: String
first: Int
before: String
last: Int
orderBy: EventOrderByInput
skip: Int
where: EventWhereInput
): [Event!]!
): EventConnection!

type EventConnection {
edges: [EventEdge!]!
pageInfo: ConnectionPageInfo!
}

type EventEdge {
cursor: String!
node: Event!
}
advertisementsConnection(
after: String
before: String
Expand Down Expand Up @@ -1206,57 +1218,6 @@ input UpdateOrganizationInput {
visibleInSearch: Boolean
}

input AddressInput {
city: String
countryCode: String
dependentLocality: String
line1: String
line2: String
postalCode: String
sortingCode: String
state: String
}

enum EducationGrade {
GRADE_1
GRADE_2
GRADE_3
GRADE_4
GRADE_5
GRADE_6
GRADE_7
GRADE_8
GRADE_9
GRADE_10
GRADE_11
GRADE_12
GRADUATE
KG
NO_GRADE
PRE_KG
}

enum EmploymentStatus {
FULL_TIME
PART_TIME
UNEMPLOYED
}

enum Gender {
FEMALE
MALE
OTHER
}

enum MaritalStatus {
DIVORCED
ENGAGED
MARRIED
SEPERATED
SINGLE
WIDOWED
}

input UpdateUserInput {
address: AddressInput
birthDate: Date
Expand Down
50 changes: 33 additions & 17 deletions setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export async function main(): Promise<void> {

try {
if (!fs.existsSync('.env')) {
if (!fs.existsSync('.env.example')) {
throw new Error('.env.example file not found');
}
await fs.promises.open('.env', 'w', 0o666);
const config = dotenv.parse(await fs.promises.readFile('.env.example'));
const envContent = Object.entries(config)
Expand Down Expand Up @@ -45,12 +48,15 @@ export async function main(): Promise<void> {

if (shouldSetCustomPort) {
const customPort = await askForCustomPort();

const port = dotenv.parse(fs.readFileSync('.env')).PORT;

const data = await fs.promises.readFile('.env', 'utf8');
const result = data.replace(`PORT=${port}`, `PORT=${customPort}`);
await fs.promises.writeFile('.env', result, 'utf8');
try {
const data = await fs.promises.readFile('.env', 'utf8');
const config = dotenv.parse(data);
const result = data.replace(`PORT=${config.PORT}`, `PORT=${customPort}`);
await fs.promises.writeFile('.env', result, 'utf8');
} catch (error) {
console.error('Failed to update port configuration:', error);
process.exit(1);
}
}

let shouldSetTalawaApiUrl: boolean;
Expand Down Expand Up @@ -117,22 +123,29 @@ export async function main(): Promise<void> {
default: true,
});

if (shouldUseRecaptcha) {
const useRecaptcha = dotenv.parse(
fs.readFileSync('.env'),
).REACT_APP_USE_RECAPTCHA;

async function updateEnvFile(
key: string,
oldValue: string,
newValue: string,
): Promise<void> {
try {
const data = await fs.promises.readFile('.env', 'utf8');
const result = data.replace(
`REACT_APP_USE_RECAPTCHA=${useRecaptcha}`,
`REACT_APP_USE_RECAPTCHA=yes`,
);
const result = data.replace(`${key}=${oldValue}`, `${key}=${newValue}`);
await fs.promises.writeFile('.env', result, 'utf8');
} catch (error) {
console.error('Failed to update ReCAPTCHA configuration:', error);
console.error(`Failed to update ${key}:`, error);
process.exit(1);
}
}

if (shouldUseRecaptcha) {
const data = await fs.promises.readFile('.env', 'utf8');
const config = dotenv.parse(data);
await updateEnvFile(
'REACT_APP_USE_RECAPTCHA',
config.REACT_APP_USE_RECAPTCHA,
'yes',
);

let shouldSetRecaptchaSiteKey: boolean;
if (process.env.REACT_APP_RECAPTCHA_SITE_KEY) {
Expand Down Expand Up @@ -205,4 +218,7 @@ export async function main(): Promise<void> {
);
}

main();
main().catch((error) => {
console.error('Setup failed:', error);
process.exit(1);
});

0 comments on commit 9f850e6

Please sign in to comment.