Skip to content

Commit

Permalink
Merge pull request #24 from umd-mith/full-typescript
Browse files Browse the repository at this point in the history
Initial migration to TypeScript
  • Loading branch information
raffazizzi authored Jul 31, 2024
2 parents ba6d8f4 + 8da52b1 commit 7257d1d
Show file tree
Hide file tree
Showing 58 changed files with 2,950 additions and 1,891 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/run-typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run Typescript Checks

on:
pull_request:
branches: [main]
workflow_dispatch:
secrets:
AIRTABLE_TOKEN:
required: true

jobs:
typescript-check:
runs-on: ubuntu-latest
env:
AIRTABLE_TOKEN: ${{ secrets.AIRTABLE_TOKEN }}
AIRTABLE_PEOPLE_BASE_ID: appk2btw36qEO3vFo
AIRTABLE_RESEARCH_BASE_ID: appTv9J1zxqaNgBHi
AIRTABLE_EVENTS_BASE_ID: tbl6CURONRn8ML6le
AIRTABLE_POSTS_BASE_ID: appsY0VXF7pbv3mKR
AIRTABLE_MITH_BASE_ID: appMWsw8HKjjokBg2

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies and build
run: |
npm ci
npm run build
- name: Check for gatsby-types.d.ts
run: |
ls -l src/gatsby-types.d.ts
cat src/gatsby-types.d.ts | head -n 20
- name: Run TypeScript check
run: npm run check
5 changes: 4 additions & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ jobs:
secrets:
AIRTABLE_TOKEN: ${{ secrets.AIRTABLE_TOKEN }}

typescript-check:
uses: ./.github/workflows/run-typescript.yml

build:
needs: test
needs: [test, typescript-check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
gatsby-types.d.ts

# Logs
logs
*.log
Expand Down
7 changes: 0 additions & 7 deletions gatsby-browser.js

This file was deleted.

83 changes: 39 additions & 44 deletions gatsby-config.js → gatsby-config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
require("dotenv").config();
import "dotenv/config"
import type { GatsbyConfig } from "gatsby"

const baseId = process.env.AIRTABLE_MITH_BASE_ID;
const baseId = process.env.AIRTABLE_MITH_BASE_ID
const basePath = process.env.BASEPATH

module.exports = {
const config: GatsbyConfig = {
pathPrefix: basePath,
graphqlTypegen: {
generateOnBuild: true,
},
siteMetadata: {
title: `MITH`,
siteUrl: "https://mith.umd.edu",
Expand Down Expand Up @@ -76,7 +80,7 @@ module.exports = {
tableView: `All Research Items`,
queryName: `ResearchItems`,
separateNodeType: true,
mapping: {
mapping: {
image: `fileNode`,
description: `text/markdown`,
excerpt: `text/markdown`,
Expand All @@ -98,19 +102,19 @@ module.exports = {
`linked_sponsors`,
`linked_posts`,
`linked_events`,
`related_research`
]
`related_research`,
],
},
{
baseId,
tableName: `Events`,
tableView: `All Events`,
queryName: `Events`,
separateNodeType: true,
mapping: {
mapping: {
excerpt: `text/markdown`,
description: `text/markdown`,
image: `fileNode`
image: `fileNode`,
},
tableLinks: [
`linked_research_item`,
Expand All @@ -126,42 +130,39 @@ module.exports = {
`methods`,
`disciplines`,
`tags`,
`event_types`
]
`event_types`,
],
},
{
baseId,
tableName: `Links`,
tableView: `All Links`,
queryName: `Links`,
separateNodeType: true,
tableLinks: [
`linked_research_items`,
`linked_events`
]
tableLinks: [`linked_research_items`, `linked_events`],
},
{
baseId,
tableName: `Partners_Sponsors`,
tableView: `All Partners & Sponsors`,
queryName: `PartnersSponsors`,
separateNodeType: true,
mapping: {
mapping: {
logo: `fileNode`,
},
tableLinks: [
`linked_research_items_as_partner`,
`linked_events_as_partner`,
`linked_research_items_as_sponsor`,
`linked_events_as_sponsor`
]
`linked_events_as_sponsor`,
],
},
{
baseId,
tableName: `People`,
tableView: `All People`,
queryName: `People`, // optionally default is false - makes all records in this table a separate node type, based on your tableView, or if not present, tableName, e.g. a table called "Fruit" would become "allAirtableFruit". Useful when pulling many airtables with similar structures or fields that have different types. See https://github.com/jbolda/gatsby-source-airtable/pull/52.
mapping: {
mapping: {
headshot: `fileNode`,
bio: `text/markdown`,
}, // optional, e.g. "text/markdown", "fileNode"
Expand All @@ -172,7 +173,7 @@ module.exports = {
`linked_featured_research`,
`linked_research_as_participant`,
`events_as_participant`,
`events_as_speaker`
`events_as_speaker`,
], // optional, for deep linking to records across tables.
separateNodeType: true, // boolean, default is false, see the documentation on naming conflicts for more information
// separateMapType: false, // boolean, default is false, see the documentation on using markdown and attachments for more information
Expand All @@ -183,7 +184,7 @@ module.exports = {
tableView: `All Identities`,
queryName: `Identities`,
separateNodeType: true,
mapping: {
mapping: {
linked_person_bio: `text/markdown`,
person_bio: `text/markdown`,
},
Expand All @@ -195,19 +196,16 @@ module.exports = {
`linked_research_as_internal`,
`linked_research_as_external`,
`linked_events_as_speaker`,
`linked_events_as_participant`
]
`linked_events_as_participant`,
],
},
{
baseId,
tableName: `Groups`,
tableView: `All Groups`,
queryName: `Groups`,
separateNodeType: true,
tableLinks: [
`linked_people`,
`linked_affiliations`
]
tableLinks: [`linked_people`, `linked_affiliations`],
},
{
baseId,
Expand All @@ -220,30 +218,24 @@ module.exports = {
`linked_events`,
`linked_people`,
`disciplines`,
`methods`
]
`methods`,
],
},
{
baseId,
tableName: `Tags`,
tableView: `All Tags`,
queryName: `Tags`,
separateNodeType: true,
tableLinks: [
`linked_research`,
`linked_events`
]
tableLinks: [`linked_research`, `linked_events`],
},
{
baseId,
tableName: `Types`,
tableView: `All Research Types`,
queryName: `ResearchTypes`,
separateNodeType: true,
tableLinks: [
`linked_research`,
`linked_events`
]
tableLinks: [`linked_research`, `linked_events`],
},
{
baseId,
Expand All @@ -255,8 +247,8 @@ module.exports = {
`linked_research`,
`linked_events`,
`methods`,
`disciplines`
]
`disciplines`,
],
},
{
baseId,
Expand All @@ -270,17 +262,17 @@ module.exports = {
`linked_events_methods`,
`linked_events_disciplines`,
`linked_posts_methods`,
`linked_posts_disciplines`
]
`linked_posts_disciplines`,
],
},
]
}
],
},
},
{
resolve: `gatsby-plugin-plausible`,
options: {
domain: `mith.umd.edu`,
excludePaths: ["/mith-static/*"]
excludePaths: ["/mith-static/*"],
},
},
{
Expand Down Expand Up @@ -320,7 +312,7 @@ module.exports = {
},
},
],
pedantic: false
pedantic: false,
},
},
{
Expand Down Expand Up @@ -438,3 +430,6 @@ module.exports = {
},
],
}

export default config

Loading

0 comments on commit 7257d1d

Please sign in to comment.