Skip to content

Commit

Permalink
fix: found the option to generate types for build 🫠
Browse files Browse the repository at this point in the history
  • Loading branch information
trevormunoz committed Jul 30, 2024
1 parent 38df0fc commit 821af09
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 49 deletions.
1 change: 0 additions & 1 deletion .github/workflows/run-typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
- name: Install dependencies and build
run: |
npm ci
npm run build:types
- name: Check for gatsby-types.d.ts
run: |
ls -l src/gatsby-types.d.ts
Expand Down
84 changes: 37 additions & 47 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import "dotenv/config";
import type { GatsbyConfig } from "gatsby";
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

const config: GatsbyConfig = {
pathPrefix: basePath,
graphqlTypegen: true,
graphqlTypegen: {
generateOnBuild: true,
},
siteMetadata: {
title: `MITH`,
siteUrl: "https://mith.umd.edu",
Expand Down Expand Up @@ -79,7 +80,7 @@ const config: GatsbyConfig = {
tableView: `All Research Items`,
queryName: `ResearchItems`,
separateNodeType: true,
mapping: {
mapping: {
image: `fileNode`,
description: `text/markdown`,
excerpt: `text/markdown`,
Expand All @@ -101,19 +102,19 @@ const config: GatsbyConfig = {
`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 @@ -129,42 +130,39 @@ const config: GatsbyConfig = {
`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 @@ -175,7 +173,7 @@ const config: GatsbyConfig = {
`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 @@ -186,7 +184,7 @@ const config: GatsbyConfig = {
tableView: `All Identities`,
queryName: `Identities`,
separateNodeType: true,
mapping: {
mapping: {
linked_person_bio: `text/markdown`,
person_bio: `text/markdown`,
},
Expand All @@ -198,19 +196,16 @@ const config: GatsbyConfig = {
`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 @@ -223,30 +218,24 @@ const config: GatsbyConfig = {
`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 @@ -258,8 +247,8 @@ const config: GatsbyConfig = {
`linked_research`,
`linked_events`,
`methods`,
`disciplines`
]
`disciplines`,
],
},
{
baseId,
Expand All @@ -273,17 +262,17 @@ const config: GatsbyConfig = {
`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 @@ -323,7 +312,7 @@ const config: GatsbyConfig = {
},
},
],
pedantic: false
pedantic: false,
},
},
{
Expand Down Expand Up @@ -442,4 +431,5 @@ const config: GatsbyConfig = {
],
}

export default config;
export default config

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"scripts": {
"start": "npm run develop",
"build": "gatsby build",
"build:types": "tsc --emitDeclarationOnly --declaration --outDir src/gatsby-types.d.ts",
"build-pages": "BASEPATH=/mith-static gatsby build --prefix-paths",
"develop": "gatsby develop",
"test": "playwright test",
Expand Down

0 comments on commit 821af09

Please sign in to comment.