Skip to content

Commit

Permalink
cleaned up package.json, added basepath for staging
Browse files Browse the repository at this point in the history
  • Loading branch information
raffazizzi committed Jul 10, 2024
1 parent ca6f4c5 commit 7b42000
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
AIRTABLE_MITH_BASE_ID: appMWsw8HKjjokBg2
run: |
npm install
npm run build
npm run build-pages
- uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
require("dotenv").config();

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

module.exports = {
pathPrefix: `mith-static`,
pathPrefix: basePath,
siteMetadata: {
title: `MITH`,
siteUrl: "https://mith.umd.edu",
Expand Down
30 changes: 15 additions & 15 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const path = require('path')
const {createRemoteFileNode} = require('gatsby-source-filesystem')

exports.createPages = async ({ actions: { createPage }, graphql, pathPrefix }) => {
await makePeople(createPage, graphql, pathPrefix)
await makePosts(createPage, graphql, pathPrefix)
await makePostIndex(createPage, graphql, pathPrefix)
await makeResearch(createPage, graphql, pathPrefix)
await makeResearchIndex(createPage, graphql, pathPrefix)
await makeEvents(createPage, graphql, pathPrefix)
await makeEventIndex(createPage, graphql, pathPrefix)
await makeDialogues(createPage, graphql, pathPrefix)
await makeDialogueIndex(createPage, graphql, pathPrefix)
exports.createPages = async ({ actions: { createPage }, graphql }) => {
await makePeople(createPage, graphql)
await makePosts(createPage, graphql)
await makePostIndex(createPage, graphql)
await makeResearch(createPage, graphql)
await makeResearchIndex(createPage, graphql)
await makeEvents(createPage, graphql)
await makeEventIndex(createPage, graphql)
await makeDialogues(createPage, graphql)
await makeDialogueIndex(createPage, graphql)
}

async function makePeople(createPage, graphql) {
Expand Down Expand Up @@ -75,7 +75,7 @@ async function makePeople(createPage, graphql) {
}
}

async function makePosts(createPage, graphql, pathPrefix) {
async function makePosts(createPage, graphql) {
const results = await graphql(`
query {
allFile(filter: {sourceInstanceName: {eq: "news"}}) {
Expand Down Expand Up @@ -103,7 +103,7 @@ async function makePosts(createPage, graphql, pathPrefix) {
}
}

async function makePostIndex(createPage, graphql, pathPrefix) {
async function makePostIndex(createPage, graphql) {
console.log(`making post index`)
const results = await graphql(`
query {
Expand Down Expand Up @@ -133,7 +133,7 @@ async function makePostIndex(createPage, graphql, pathPrefix) {
})
}

async function makeResearchIndex(createPage, graphql, pathPrefix) {
async function makeResearchIndex(createPage, graphql) {
const results = await graphql(`
query {
allAirtableResearchItems {
Expand Down Expand Up @@ -392,7 +392,7 @@ async function makeResearch(createPage, graphql) {
}


async function makeEventIndex(createPage, graphql, pathPrefix) {
async function makeEventIndex(createPage, graphql) {
const results = await graphql(`
query {
allAirtableEvents {
Expand Down Expand Up @@ -696,7 +696,7 @@ async function makeEvents(createPage, graphql) {
}


async function makeDialogueIndex(createPage, graphql, pathPrefix) {
async function makeDialogueIndex(createPage, graphql) {
const results = await graphql(`
query {
allAirtableEvents {
Expand Down
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@
"scripts": {
"start": "npm run develop",
"build": "gatsby build",
"build-pages": "BASEPATH=/mith-static gatsby build --prefix-paths",
"develop": "gatsby develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"persist": "node scripts/persist.js",
"compose": "node scripts/compose.js",
"release": "node scripts/release.js",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"publish": "gatsby clean && gatsby build && npm run rsync",
"rsync": "rsync --archive --recursive --delete public/ [email protected]:/var/www/mith.umd.edu",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\""
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 7b42000

Please sign in to comment.