From eee548819d086790035945ee8b5599662dbd5b17 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 16:06:53 -0500 Subject: [PATCH 01/20] add prettier ignore --- .prettierignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..01f86141 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +src/server/db/migrations/* From b5216767f4c74c5b8c65d31427eb6d4504da24c4 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 16:09:23 -0500 Subject: [PATCH 02/20] run: formatting check --- src/app/event/[id]/page.tsx | 21 +++++++++++------ src/app/events/eventView.tsx | 16 ++++++------- src/app/feedback/Form.tsx | 1 - src/app/feedback/FormPopUp.tsx | 1 - src/app/feedback/page.tsx | 9 +++---- src/components/EventLikeButton.tsx | 4 ++-- src/components/RegisterButton.tsx | 1 - src/server/api/routers/form.ts | 38 +++++++++++++++--------------- src/server/db/schema/forms.ts | 24 +++++++++---------- src/utils/formSchemas.ts | 2 +- 10 files changed, 59 insertions(+), 58 deletions(-) diff --git a/src/app/event/[id]/page.tsx b/src/app/event/[id]/page.tsx index cdaf902c..405c6452 100644 --- a/src/app/event/[id]/page.tsx +++ b/src/app/event/[id]/page.tsx @@ -23,12 +23,16 @@ export default async function EventsPage({ params }: Params) { const { club, ...event } = res; - const isRegistered = (session && await db.query.userMetadataToEvents.findFirst({ - where: (userMetadataToEvents) => and( - eq(userMetadataToEvents.eventId, event.id), - eq(userMetadataToEvents.userId, session.user.id) - ) - }) !== undefined) || false; + const isRegistered = + (session && + (await db.query.userMetadataToEvents.findFirst({ + where: (userMetadataToEvents) => + and( + eq(userMetadataToEvents.eventId, event.id), + eq(userMetadataToEvents.userId, session.user.id), + ), + })) !== undefined) || + false; const clubDescription = ['Club', 'Location', 'Multi-Day']; const clubDetails = [club.name, event.location, 'No']; @@ -52,7 +56,10 @@ export default async function EventsPage({ params }: Params) {
{session && ( - + )}
diff --git a/src/app/events/eventView.tsx b/src/app/events/eventView.tsx index 86d97c5a..dfaed368 100644 --- a/src/app/events/eventView.tsx +++ b/src/app/events/eventView.tsx @@ -14,13 +14,13 @@ const EventView = ({ events, params }: Props) => { return (
-
+

Events

{
-

List view

+

List view

{
-

Grid view

+

Grid view

-
+
{events.map((event) => { diff --git a/src/app/feedback/Form.tsx b/src/app/feedback/Form.tsx index 9dc02c4f..65f075c6 100644 --- a/src/app/feedback/Form.tsx +++ b/src/app/feedback/Form.tsx @@ -126,4 +126,3 @@ const Form = () => { }; export default Form; - diff --git a/src/app/feedback/FormPopUp.tsx b/src/app/feedback/FormPopUp.tsx index 44040b46..6b882ac8 100644 --- a/src/app/feedback/FormPopUp.tsx +++ b/src/app/feedback/FormPopUp.tsx @@ -43,4 +43,3 @@ const FormPopUp: React.FC = ({ onClose, isOpen }) => { }; export default FormPopUp; - diff --git a/src/app/feedback/page.tsx b/src/app/feedback/page.tsx index 62a9e111..38feaa5d 100644 --- a/src/app/feedback/page.tsx +++ b/src/app/feedback/page.tsx @@ -1,8 +1,7 @@ import React from 'react'; import Header from '@src/components/BaseHeader'; import { type Metadata } from 'next'; -import Form from '@src/app/feedback/Form'; - +import Form from '@src/app/feedback/Form'; export const metadata: Metadata = { title: 'Feedback - Jupiter', @@ -16,15 +15,13 @@ export const metadata: Metadata = { }, }; - const Feedback = () => { - return (
-
-
+
+
diff --git a/src/components/EventLikeButton.tsx b/src/components/EventLikeButton.tsx index 5edd118b..59588782 100644 --- a/src/components/EventLikeButton.tsx +++ b/src/components/EventLikeButton.tsx @@ -29,9 +29,9 @@ const EventLikeButton = ({ eventId, liked }: buttonProps) => { }} > {liked ? ( - + ) : ( - + )} ); diff --git a/src/components/RegisterButton.tsx b/src/components/RegisterButton.tsx index 905cafb0..58b9b5fb 100644 --- a/src/components/RegisterButton.tsx +++ b/src/components/RegisterButton.tsx @@ -38,4 +38,3 @@ const RegisterButton: FC = ({ eventId, isRegistered }) => { }; export default RegisterButton; - diff --git a/src/server/api/routers/form.ts b/src/server/api/routers/form.ts index 457f6d5d..af42934d 100644 --- a/src/server/api/routers/form.ts +++ b/src/server/api/routers/form.ts @@ -2,24 +2,24 @@ import { createTRPCRouter, publicProcedure } from '../trpc'; import { forms } from '@src/server/db/schema/forms'; import { feedbackFormSchema } from '@src/utils/formSchemas'; - export const formRouter = createTRPCRouter({ - sendForm: publicProcedure. - input(feedbackFormSchema). - mutation( async ( {input, ctx}) => { - const { rating, likes, dislikes, features, submit_on } = input; + sendForm: publicProcedure + .input(feedbackFormSchema) + .mutation(async ({ input, ctx }) => { + const { rating, likes, dislikes, features, submit_on } = input; - await ctx.db - .insert(forms) - .values({ - rating: rating, - likes : likes, - dislikes: dislikes, - features: features, - submit_on: submit_on, - }).catch ((e) => { - console.error(e); - throw e; - }) - } ) - }) \ No newline at end of file + await ctx.db + .insert(forms) + .values({ + rating: rating, + likes: likes, + dislikes: dislikes, + features: features, + submit_on: submit_on, + }) + .catch((e) => { + console.error(e); + throw e; + }); + }), +}); diff --git a/src/server/db/schema/forms.ts b/src/server/db/schema/forms.ts index dd5fd9da..cdfd092c 100644 --- a/src/server/db/schema/forms.ts +++ b/src/server/db/schema/forms.ts @@ -1,13 +1,13 @@ -import { sql } from "drizzle-orm"; -import { pgTable, text, timestamp, integer } from "drizzle-orm/pg-core" +import { sql } from 'drizzle-orm'; +import { pgTable, text, timestamp, integer } from 'drizzle-orm/pg-core'; -export const forms = pgTable("feedback_form", { - id: text("id") - .default(sql`nanoid(20)`) - .primaryKey(), - rating: integer('rating').notNull(), - likes: text('likes').default(''), - dislikes: text('dislikes').default(''), - features: text('features').default(''), - submit_on: timestamp('submit_on', { withTimezone: true }).notNull(), -}) \ No newline at end of file +export const forms = pgTable('feedback_form', { + id: text('id') + .default(sql`nanoid(20)`) + .primaryKey(), + rating: integer('rating').notNull(), + likes: text('likes').default(''), + dislikes: text('dislikes').default(''), + features: text('features').default(''), + submit_on: timestamp('submit_on', { withTimezone: true }).notNull(), +}); diff --git a/src/utils/formSchemas.ts b/src/utils/formSchemas.ts index c58c9a0b..7c008671 100644 --- a/src/utils/formSchemas.ts +++ b/src/utils/formSchemas.ts @@ -48,4 +48,4 @@ export const feedbackFormSchema = z.object({ dislikes: z.string().default(''), features: z.string().default(''), submit_on: z.date().default(new Date()), -}) \ No newline at end of file +}); From 810a9a10beb7de97fae3f4d106bf66e6a2fd4001 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 16:55:19 -0500 Subject: [PATCH 03/20] add prettier github action --- .github/workflows/generateCheck.sh | 11 +++++++++++ .github/workflows/prettierCheck.yml | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/generateCheck.sh create mode 100644 .github/workflows/prettierCheck.yml diff --git a/.github/workflows/generateCheck.sh b/.github/workflows/generateCheck.sh new file mode 100644 index 00000000..aabe6fc1 --- /dev/null +++ b/.github/workflows/generateCheck.sh @@ -0,0 +1,11 @@ +if [ $status == 0]; then + echo "## Formatting Check passed 🥳" >>$GITHUB_STEP_SUMMARY + echo "All files are formatted correctly" >>$GITHUB_STEP_SUMMARY +else + echo "## Formatting Check Failed" >>$GITHUB_STEP_SUMMARY + echo "Please run prettier using \`npx prettier . --write\` in order to format your code" >>$GITHUB_STEP_SUMMARY + echo "### Files with bad formatting:" >>$GITHUB_STEP_SUMMARY + for file in $files; do + echo "- $file" >>$GITHUB_STEP_SUMMARY + done +fi diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml new file mode 100644 index 00000000..494a6a86 --- /dev/null +++ b/.github/workflows/prettierCheck.yml @@ -0,0 +1,14 @@ +name: Prettier Formatting Check +run-name: Running formatting check +on: [push] +jobs: + check-formatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Prettier check + run: | + echo files=`npx prettier . --check`>> "$GITHUB_ENV" + echo status=`echo $?`>>"$GITHUB_ENV" + - name: generate github check message + run: .github/workflows/generateCheck.sh From 8f3764e5ff144c389079ce2aad2c1c0e54cac7f6 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 17:01:31 -0500 Subject: [PATCH 04/20] fix permissions for script actually fix --- .github/workflows/generateCheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 .github/workflows/generateCheck.sh diff --git a/.github/workflows/generateCheck.sh b/.github/workflows/generateCheck.sh old mode 100644 new mode 100755 index aabe6fc1..28010895 --- a/.github/workflows/generateCheck.sh +++ b/.github/workflows/generateCheck.sh @@ -2,7 +2,7 @@ if [ $status == 0]; then echo "## Formatting Check passed 🥳" >>$GITHUB_STEP_SUMMARY echo "All files are formatted correctly" >>$GITHUB_STEP_SUMMARY else - echo "## Formatting Check Failed" >>$GITHUB_STEP_SUMMARY + echo "## Formatting Check Failed 😅" >>$GITHUB_STEP_SUMMARY echo "Please run prettier using \`npx prettier . --write\` in order to format your code" >>$GITHUB_STEP_SUMMARY echo "### Files with bad formatting:" >>$GITHUB_STEP_SUMMARY for file in $files; do From 859813b0e4e7a4c2f4fc174ba3d484c0418fdec6 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 17:06:51 -0500 Subject: [PATCH 05/20] fix tailwind plugin error --- .github/workflows/generateCheck.sh | 2 +- .github/workflows/prettierCheck.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generateCheck.sh b/.github/workflows/generateCheck.sh index 28010895..848c9345 100755 --- a/.github/workflows/generateCheck.sh +++ b/.github/workflows/generateCheck.sh @@ -1,4 +1,4 @@ -if [ $status == 0]; then +if [ $status == 0 ]; then echo "## Formatting Check passed 🥳" >>$GITHUB_STEP_SUMMARY echo "All files are formatted correctly" >>$GITHUB_STEP_SUMMARY else diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index 494a6a86..90af5a33 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -8,6 +8,7 @@ jobs: - uses: actions/checkout@v4 - name: Prettier check run: | + npm i -g prettier-plugin-tailwindcss echo files=`npx prettier . --check`>> "$GITHUB_ENV" echo status=`echo $?`>>"$GITHUB_ENV" - name: generate github check message From 169406af8c1ead6508747b9e08b36534df021a72 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 17:10:31 -0500 Subject: [PATCH 06/20] installs without changing dependencies --- .github/workflows/prettierCheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index 90af5a33..22325de8 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -8,7 +8,7 @@ jobs: - uses: actions/checkout@v4 - name: Prettier check run: | - npm i -g prettier-plugin-tailwindcss + npm i --no-save prettier-plugin-tailwindcss prettier echo files=`npx prettier . --check`>> "$GITHUB_ENV" echo status=`echo $?`>>"$GITHUB_ENV" - name: generate github check message From f037a64a3de82578b3b70b1c517980f67dcf712c Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 17:28:11 -0500 Subject: [PATCH 07/20] update prettier --- package-lock.json | 8 ++++---- package.json | 2 +- src/components/admin/OrgTable.tsx | 4 ++-- src/server/api/routers/event.ts | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2a5f0c36..708e29ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,7 +63,7 @@ "jest": "^29.7.0", "lint-staged": "^12.4.0", "postcss": "^8.4.27", - "prettier": "^3.0.0", + "prettier": "^3.2.5", "prettier-plugin-tailwindcss": "^0.5.1", "tailwindcss": "^3.3.3", "ts-jest": "^29.1.1", @@ -9823,9 +9823,9 @@ } }, "node_modules/prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/package.json b/package.json index e6fb51ae..3deca13e 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "jest": "^29.7.0", "lint-staged": "^12.4.0", "postcss": "^8.4.27", - "prettier": "^3.0.0", + "prettier": "^3.2.5", "prettier-plugin-tailwindcss": "^0.5.1", "tailwindcss": "^3.3.3", "ts-jest": "^29.1.1", diff --git a/src/components/admin/OrgTable.tsx b/src/components/admin/OrgTable.tsx index 2998727c..c94fd9e7 100644 --- a/src/components/admin/OrgTable.tsx +++ b/src/components/admin/OrgTable.tsx @@ -92,8 +92,8 @@ export default function OrgTable({ clubs }: { clubs: Club[] }) { approved === 'pending' ? 'bg-yellow-500' : approved === 'approved' - ? 'bg-green-500' - : 'bg-red-500'; + ? 'bg-green-500' + : 'bg-red-500'; return (
diff --git a/src/server/api/routers/event.ts b/src/server/api/routers/event.ts index 6f14cca3..9ce25f09 100644 --- a/src/server/api/routers/event.ts +++ b/src/server/api/routers/event.ts @@ -114,16 +114,16 @@ export const eventRouter = createTRPCRouter({ input.startTime.type === 'now' ? new Date() : input.startTime.type === 'distance' - ? add(new Date(), input.startTime.options) - : input.startTime.options.from ?? new Date(); + ? add(new Date(), input.startTime.options) + : input.startTime.options.from ?? new Date(); const endTime = input.startTime.type === 'distance' ? new Date() : input.startTime.type === 'range' - ? input.startTime.options.to - ? add(input.startTime.options.to, { days: 1 }) - : add(startTime, { days: 1 }) - : undefined; + ? input.startTime.options.to + ? add(input.startTime.options.to, { days: 1 }) + : add(startTime, { days: 1 }) + : undefined; const events = await ctx.db.query.events.findMany({ where: (event) => { const whereElements: Array | undefined> = []; From 0d79db794039ff1ced06cb46d311332e2cb9abc0 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 17:34:09 -0500 Subject: [PATCH 08/20] update formatting runner to use npm cache --- .github/workflows/prettierCheck.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index 22325de8..62e5765c 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -6,9 +6,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + - run: npm ci - name: Prettier check run: | - npm i --no-save prettier-plugin-tailwindcss prettier echo files=`npx prettier . --check`>> "$GITHUB_ENV" echo status=`echo $?`>>"$GITHUB_ENV" - name: generate github check message From edb34cb39fbc86f61f6ee9d49fd220e3ec53f259 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 17:36:58 -0500 Subject: [PATCH 09/20] switch from check to list files for better diagnostics --- .github/workflows/prettierCheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index 62e5765c..a6bb546b 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -13,7 +13,7 @@ jobs: - run: npm ci - name: Prettier check run: | - echo files=`npx prettier . --check`>> "$GITHUB_ENV" + echo files=`npx prettier . -l`>> "$GITHUB_ENV" echo status=`echo $?`>>"$GITHUB_ENV" - name: generate github check message run: .github/workflows/generateCheck.sh From 913fe6854b8553fe9699460f42229e167396b54b Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 17:37:57 -0500 Subject: [PATCH 10/20] test bad formatting --- src/app/layout.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 0d2c40ec..3b6bc92a 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -50,3 +50,5 @@ export default function RootLayout({ ); } + + From f61c7beed1bc37ba7b8f82fb50f92c4b1d163443 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 17:41:27 -0500 Subject: [PATCH 11/20] fix variables --- .github/workflows/prettierCheck.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index a6bb546b..6d7bab82 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -13,7 +13,8 @@ jobs: - run: npm ci - name: Prettier check run: | - echo files=`npx prettier . -l`>> "$GITHUB_ENV" + files=npx prettier . -l echo status=`echo $?`>>"$GITHUB_ENV" + echo files=`echo $files`>> "$GITHUB_ENV" - name: generate github check message run: .github/workflows/generateCheck.sh From 547ad4c97b96930bcd97d7f2dcf0576791945d37 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 17:43:05 -0500 Subject: [PATCH 12/20] fix: missing grave marks --- .github/workflows/prettierCheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index 6d7bab82..f26e5873 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -13,7 +13,7 @@ jobs: - run: npm ci - name: Prettier check run: | - files=npx prettier . -l + files=`npx prettier . -l` echo status=`echo $?`>>"$GITHUB_ENV" echo files=`echo $files`>> "$GITHUB_ENV" - name: generate github check message From 042aad95a498b594860c908c4a3a1d8bf56b7b72 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 17:59:26 -0500 Subject: [PATCH 13/20] fix: error out on failed formatting before error message --- .github/workflows/generateCheck.sh | 2 ++ .github/workflows/prettierCheck.yml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generateCheck.sh b/.github/workflows/generateCheck.sh index 848c9345..646a5121 100755 --- a/.github/workflows/generateCheck.sh +++ b/.github/workflows/generateCheck.sh @@ -1,6 +1,7 @@ if [ $status == 0 ]; then echo "## Formatting Check passed 🥳" >>$GITHUB_STEP_SUMMARY echo "All files are formatted correctly" >>$GITHUB_STEP_SUMMARY + exit 0 else echo "## Formatting Check Failed 😅" >>$GITHUB_STEP_SUMMARY echo "Please run prettier using \`npx prettier . --write\` in order to format your code" >>$GITHUB_STEP_SUMMARY @@ -8,4 +9,5 @@ else for file in $files; do echo "- $file" >>$GITHUB_STEP_SUMMARY done + exit 1 fi diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index f26e5873..a49a7259 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -13,8 +13,8 @@ jobs: - run: npm ci - name: Prettier check run: | - files=`npx prettier . -l` - echo status=`echo $?`>>"$GITHUB_ENV" + files=`npx prettier . -l` || st=$? + echo status=`echo $st`>>"$GITHUB_ENV" echo files=`echo $files`>> "$GITHUB_ENV" - name: generate github check message run: .github/workflows/generateCheck.sh From 62d9fbc3ba1fd87c55b92b5029d12045c64dbcb1 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 18:10:53 -0500 Subject: [PATCH 14/20] proper errors --- .github/workflows/generateCheck.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/generateCheck.sh b/.github/workflows/generateCheck.sh index 646a5121..187ae0cb 100755 --- a/.github/workflows/generateCheck.sh +++ b/.github/workflows/generateCheck.sh @@ -1,13 +1,12 @@ if [ $status == 0 ]; then echo "## Formatting Check passed 🥳" >>$GITHUB_STEP_SUMMARY echo "All files are formatted correctly" >>$GITHUB_STEP_SUMMARY - exit 0 else echo "## Formatting Check Failed 😅" >>$GITHUB_STEP_SUMMARY echo "Please run prettier using \`npx prettier . --write\` in order to format your code" >>$GITHUB_STEP_SUMMARY echo "### Files with bad formatting:" >>$GITHUB_STEP_SUMMARY for file in $files; do echo "- $file" >>$GITHUB_STEP_SUMMARY + echo "::error file={$file},title=File Not Formatted correctly" done - exit 1 fi From 2c1672973ac20d88e0d379a6d4b8a4635ffde123 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 18:12:26 -0500 Subject: [PATCH 15/20] try and reduce action run time --- .github/workflows/prettierCheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index a49a7259..800dddc0 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -10,7 +10,7 @@ jobs: with: node-version: 18 cache: 'npm' - - run: npm ci + - run: npm i -g prettier prettier-plugin-tailwindcss - name: Prettier check run: | files=`npx prettier . -l` || st=$? From b4a59d03c2460fdc4c48f87f1575a7cc45a1f9e9 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 18:13:38 -0500 Subject: [PATCH 16/20] Revert "try and reduce action run time" This reverts commit 2c1672973ac20d88e0d379a6d4b8a4635ffde123. --- .github/workflows/prettierCheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index 800dddc0..a49a7259 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -10,7 +10,7 @@ jobs: with: node-version: 18 cache: 'npm' - - run: npm i -g prettier prettier-plugin-tailwindcss + - run: npm ci - name: Prettier check run: | files=`npx prettier . -l` || st=$? From cb2d9c173544f83f0114c77d158c247c17c1af92 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 18:18:36 -0500 Subject: [PATCH 17/20] fix error message --- .github/workflows/generateCheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generateCheck.sh b/.github/workflows/generateCheck.sh index 187ae0cb..cdebd8e3 100755 --- a/.github/workflows/generateCheck.sh +++ b/.github/workflows/generateCheck.sh @@ -7,6 +7,6 @@ else echo "### Files with bad formatting:" >>$GITHUB_STEP_SUMMARY for file in $files; do echo "- $file" >>$GITHUB_STEP_SUMMARY - echo "::error file={$file},title=File Not Formatted correctly" + echo "::error file=$file::File Not Formatted correctly" done fi From 7f6c7f02236e5a2e327d99526574916a3558d77e Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 18:21:01 -0500 Subject: [PATCH 18/20] make check fail --- .github/workflows/generateCheck.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generateCheck.sh b/.github/workflows/generateCheck.sh index cdebd8e3..cd6a277c 100755 --- a/.github/workflows/generateCheck.sh +++ b/.github/workflows/generateCheck.sh @@ -1,12 +1,14 @@ if [ $status == 0 ]; then echo "## Formatting Check passed 🥳" >>$GITHUB_STEP_SUMMARY echo "All files are formatted correctly" >>$GITHUB_STEP_SUMMARY + exit 0 else echo "## Formatting Check Failed 😅" >>$GITHUB_STEP_SUMMARY echo "Please run prettier using \`npx prettier . --write\` in order to format your code" >>$GITHUB_STEP_SUMMARY echo "### Files with bad formatting:" >>$GITHUB_STEP_SUMMARY for file in $files; do echo "- $file" >>$GITHUB_STEP_SUMMARY - echo "::error file=$file::File Not Formatted correctly" + echo "::error file=$file::$file Not Formatted correctly" done + exit 1 fi From c9ee95181e726b8ff9ba034fd42e4271274f15da Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 18:29:47 -0500 Subject: [PATCH 19/20] workaround to only install prettier --- .github/workflows/generateCheck.sh | 2 +- .github/workflows/prettierCheck.yml | 12 ++++++++---- src/app/layout.tsx | 2 -- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/generateCheck.sh b/.github/workflows/generateCheck.sh index cd6a277c..0f98e9cb 100755 --- a/.github/workflows/generateCheck.sh +++ b/.github/workflows/generateCheck.sh @@ -8,7 +8,7 @@ else echo "### Files with bad formatting:" >>$GITHUB_STEP_SUMMARY for file in $files; do echo "- $file" >>$GITHUB_STEP_SUMMARY - echo "::error file=$file::$file Not Formatted correctly" + echo "::error file=$file::$file not formatted correctly" done exit 1 fi diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index a49a7259..f5242c1a 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -1,4 +1,4 @@ -name: Prettier Formatting Check +name: Formatting Check run-name: Running formatting check on: [push] jobs: @@ -10,11 +10,15 @@ jobs: with: node-version: 18 cache: 'npm' - - run: npm ci - - name: Prettier check + - name: Run npm install + run: | + mv package.json package.json.bak + npm i --no-save prettier prettier-plugin-tailwindcss + mv package.json.bak package.json + - name: Run prettier run: | files=`npx prettier . -l` || st=$? echo status=`echo $st`>>"$GITHUB_ENV" echo files=`echo $files`>> "$GITHUB_ENV" - - name: generate github check message + - name: generate errors/summary run: .github/workflows/generateCheck.sh diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 3b6bc92a..0d2c40ec 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -50,5 +50,3 @@ export default function RootLayout({ ); } - - From cc00f76de945d1dc50c154a4df02ff2aefacc296 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 18:39:08 -0500 Subject: [PATCH 20/20] fix status for successful check --- .github/workflows/prettierCheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml index f5242c1a..e642ea75 100644 --- a/.github/workflows/prettierCheck.yml +++ b/.github/workflows/prettierCheck.yml @@ -17,7 +17,7 @@ jobs: mv package.json.bak package.json - name: Run prettier run: | - files=`npx prettier . -l` || st=$? + files=`npx prettier . -l` || st=$? && st=$? echo status=`echo $st`>>"$GITHUB_ENV" echo files=`echo $files`>> "$GITHUB_ENV" - name: generate errors/summary