Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Gatsby 3 and fix Heroku caching #2851

Merged
merged 148 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
3750ee3
Add tbd comment to pages/404.tsx
julieg18 Jul 30, 2021
53ace1c
Add comment to 404 page
julieg18 Aug 9, 2021
6863876
Update gatsby 2 to 3
julieg18 Aug 9, 2021
4c7d438
Update gatsby-source-github-api
julieg18 Aug 11, 2021
d4727f1
Merge branch 'master' into test-caching
julieg18 Aug 11, 2021
e674ed3
Take off tbd comment in 404.tsx
julieg18 Aug 11, 2021
860f675
Delete unneeded file in .github/workflows
julieg18 Aug 12, 2021
02e28ef
Fix attempted imported css warnings
julieg18 Aug 30, 2021
386cec9
Add tbd comment to 404.tsx
julieg18 Aug 30, 2021
6e7175e
Rollback [email protected] to 3.6.0
julieg18 Aug 31, 2021
ccd015b
Remove comment in 404 page
julieg18 Aug 31, 2021
e781b51
Move gatsby pkg back to 3.10.2
julieg18 Sep 1, 2021
ae3c67f
Add tbd comment in 404 page
julieg18 Sep 1, 2021
3387acf
Update outdated packages
julieg18 Sep 2, 2021
c93dc11
Delete tbd comment in 404 page
julieg18 Sep 2, 2021
2f7f75f
Place console.log in DefaultSEO
julieg18 Sep 3, 2021
56d81f5
Run 'yarn upgrade'
julieg18 Sep 7, 2021
cb4811f
Delete comment in 404.tsx
julieg18 Sep 7, 2021
3ba0119
Upgrade @reach/portal
julieg18 Sep 7, 2021
51d8cab
Delete console.log in DefaultSeo
julieg18 Sep 7, 2021
f0bcb34
Update @react/portal
julieg18 Sep 7, 2021
7e015ff
Upgrade some packages
julieg18 Sep 8, 2021
c9c17b6
Merge branch 'master' into test-caching
julieg18 Sep 8, 2021
1be35ce
Update some packages
julieg18 Sep 10, 2021
8097ab6
Add tbd comment in 404.tsx
julieg18 Sep 10, 2021
40c137c
Delete tbd comment
julieg18 Sep 14, 2021
51a6012
Test static query
julieg18 Sep 15, 2021
68d9221
Refactor useGlossary hook
julieg18 Sep 17, 2021
3aeb49b
Move gatsby to 3.9.0
julieg18 Sep 19, 2021
79c73c6
Add tbd comment
julieg18 Sep 19, 2021
7ed3594
Update gatsby to 3.8.0
julieg18 Sep 20, 2021
104133d
Delete comment in 404 page
julieg18 Sep 20, 2021
225e23a
Move gatsby to 3.6.0
julieg18 Sep 20, 2021
14fa14f
Add tbd comment
julieg18 Sep 20, 2021
fc9eca5
Move gatsby to 3.4.0
julieg18 Sep 20, 2021
7baf746
Delete comment in 404 page
julieg18 Sep 20, 2021
e8f3abc
Move gatsby to 3.2.0
julieg18 Sep 20, 2021
c8f7206
Add tbd comment in 404 page
julieg18 Sep 20, 2021
bb0a1db
Delete comment in 404 page
julieg18 Sep 20, 2021
c044388
Move gatsby to 3.0.0
julieg18 Sep 21, 2021
9875576
Add tbd comment in 404 page
julieg18 Sep 21, 2021
ed08dea
Update gatsby to 2.32.12
julieg18 Sep 22, 2021
140bd2d
Add tbd comment in 404 page
julieg18 Sep 22, 2021
af79020
Update gatsby to 3.14.0
julieg18 Sep 22, 2021
4b82c90
Move gatsby to 3.10.2
julieg18 Sep 22, 2021
da9cd1c
Delete and recreate yarn.lock
julieg18 Sep 22, 2021
bdbf382
Delete tbd comment
julieg18 Sep 23, 2021
02752d1
Update typescript to 4.4.2
julieg18 Sep 23, 2021
7556490
Update package.json and yarn.lock to match 1be35ce
julieg18 Sep 23, 2021
0f18563
Add tbd comment
julieg18 Sep 23, 2021
9dfd4fe
Delete test query from siteMeta
julieg18 Sep 23, 2021
2db284f
Delete console.log in siteMeta.ts
julieg18 Sep 23, 2021
de0d4f2
Remove resolutions from package.json
julieg18 Sep 27, 2021
ab8bf2b
Delete tbd comment
julieg18 Sep 27, 2021
40ca6d1
Merge branch 'master' of github.com:iterative/dvc.org into test-cachi…
rogermparent Sep 27, 2021
bf9a0da
Upgrade gatsby
rogermparent Sep 27, 2021
a4997b0
Revert "Test static query"
rogermparent Sep 27, 2021
fe5d681
Add PQR flag
rogermparent Sep 27, 2021
f23924d
Upgrade gatsby-*-sharp and add lmdb-store
rogermparent Sep 27, 2021
3a7d057
Remove picture.small
rogermparent Sep 27, 2021
eb4b2ea
Update to node 16
rogermparent Sep 27, 2021
8f5b6a9
Add tbd comment
julieg18 Sep 28, 2021
2b4522d
Move gatsby to ^3.11.0
julieg18 Sep 28, 2021
db3d7df
Delete tbd comment
julieg18 Sep 28, 2021
4800070
Move gatsby to ^3.12.0
julieg18 Sep 28, 2021
840418d
Delete tbd comment
julieg18 Sep 28, 2021
937df1f
Move gatsby to ^3.13.0
julieg18 Sep 28, 2021
7512475
Update some more packages
rogermparent Sep 28, 2021
c461db0
Add dummy post
rogermparent Sep 28, 2021
071ff34
Add ability to disable build retry in DEPLOY_OPTIONS
rogermparent Sep 29, 2021
47971cc
Change content
rogermparent Sep 29, 2021
7fa7d9e
Change content
rogermparent Sep 29, 2021
50727fc
Remove deprecated gatsby-image
rogermparent Sep 29, 2021
557eb74
Try consecutive builds
rogermparent Sep 29, 2021
fc9c31f
Undo consecutive builds experiment
rogermparent Sep 29, 2021
0a35457
Log env
rogermparent Sep 29, 2021
4f00970
Change content even more
rogermparent Sep 29, 2021
5df1fab
Remove dummy page
rogermparent Sep 29, 2021
71ac4dc
Merge branch 'master' of github.com:iterative/dvc.org into test-cachi…
rogermparent Sep 29, 2021
a0d6bb0
Remove env display
rogermparent Sep 29, 2021
1beffea
Add dummy page again
rogermparent Sep 29, 2021
ef75571
Make an interim deploy script
rogermparent Sep 30, 2021
57a62c1
chmod +x
rogermparent Sep 30, 2021
6b2447e
Use vars and add test echos
rogermparent Sep 30, 2021
3a847ca
Remove echos and debug with which
rogermparent Sep 30, 2021
0654d32
More debugging
rogermparent Sep 30, 2021
c71cb9c
Even more debugging
rogermparent Sep 30, 2021
d60ffd5
Remove debug stuff and mkdir that caused issues
rogermparent Sep 30, 2021
dc792c7
update content
rogermparent Sep 30, 2021
7ebf117
Merge branch 'master' of github.com:iterative/dvc.org into test-cachi…
rogermparent Sep 30, 2021
c235488
Remove dummy post
rogermparent Sep 30, 2021
30b9cee
Remove dummy blog post
rogermparent Sep 30, 2021
2a1bf7e
DVCLive User Guide updates (#2814)
daavoo Sep 9, 2021
7b440f7
dvc 2.7.2 (#2813)
github-actions[bot] Sep 9, 2021
3c68213
Fix broken dvc downlaod link check (#2820)
julieg18 Sep 9, 2021
400e544
config: sync local/CI Prettier and Restyled (#2774)
jorgeorpinel Sep 9, 2021
a567e50
Added `Invalid authentication for Git Remote` to troubleshooting (#2731)
daavoo Sep 13, 2021
28f5963
dvc 2.7.3 (#2829)
github-actions[bot] Sep 14, 2021
4970815
gha: update: run every day at 13:00 UTC
efiop Sep 14, 2021
cfb94d2
adding sept heartbeat (#2825)
jendefig Sep 14, 2021
4a39095
Fix broken link to Azure authentication examples (#2830)
josecelano Sep 16, 2021
6991d2f
gha: update download links at 18:00
efiop Sep 18, 2021
dfb28e4
dvc 2.7.4 (#2837)
github-actions[bot] Sep 18, 2021
f22897c
fix: correct argument order (#2842)
GavinMasterson Sep 21, 2021
f0604b2
Rename all references to `get-started-experiments` to `example-dvc-ex…
iesahin Sep 21, 2021
968b5d9
updating events page (#2847)
jendefig Sep 22, 2021
988c58b
Refactor post by Batuhan (#2835)
jendefig Sep 24, 2021
e6d9cac
Add --show-csv flag to dvc exp show (#2740)
karajan1001 Sep 29, 2021
0ab035f
use folded block scalar type (#2871)
shcheklein Sep 30, 2021
8960b5f
Merge branch 'test-caching' of github.com:iterative/dvc.org into test…
rogermparent Sep 30, 2021
2850fc7
Revert some unnecessary changes
rogermparent Sep 30, 2021
3b4cc8d
Some minor/patch package upgrades
rogermparent Oct 4, 2021
07654aa
Merge branch 'master' of github.com:iterative/dvc.org into test-cachi…
rogermparent Oct 4, 2021
53f8af3
Add bug mitigation
rogermparent Oct 5, 2021
32f1423
Disable PQR and bug mitigation
rogermparent Oct 5, 2021
c51badb
Add USE_PRODUCTION_CACHE to deploy script for debugging
rogermparent Oct 5, 2021
f072eeb
Merge branch 'master' of github.com:iterative/dvc.org into test-cachi…
rogermparent Oct 5, 2021
d07b9b9
Revert style import change and undo malformed comment
rogermparent Oct 5, 2021
65bcebe
Allow LayoutAlert to be false in typedef
rogermparent Oct 5, 2021
5e79c19
Remove nonstandard space and use width for spacing for lint-css
rogermparent Oct 5, 2021
edae234
Remove commented-out classnames
rogermparent Oct 5, 2021
f615efc
Upgrade gatsby and some other minor/patch upgrades
rogermparent Oct 5, 2021
21c7e80
Add aptfile
rogermparent Oct 6, 2021
e4a7472
Revert "Remove commented-out classnames"
rogermparent Oct 6, 2021
5b504a4
Gatsby 4 again
rogermparent Oct 6, 2021
b352239
Remove explicit typescript plugin and upgrade some packages
rogermparent Oct 6, 2021
6e3202f
Remove unused wrapper class
rogermparent Oct 6, 2021
5c74094
Upgrade a bunch of packages
rogermparent Oct 6, 2021
8f26292
upgrade plugin-feed, downgrade transformer-remark
rogermparent Oct 6, 2021
e382a69
Update some more packages and try container stack
rogermparent Oct 6, 2021
51f46fa
Update some other packages to trigger a cache clear
rogermparent Oct 7, 2021
ab4c1ea
Revert stack change attempt, async setPageContext, remove Aptfile
rogermparent Oct 7, 2021
e3ec823
Upgrade CircleCI node and un-refactor glossary query
rogermparent Oct 7, 2021
e4b99c1
Resolve ts-lint issues
rogermparent Oct 8, 2021
9d86766
Prettier on content/docs/user-guide/contributing/blog.md
rogermparent Oct 8, 2021
98e18a5
Upgrade packages
rogermparent Oct 12, 2021
f90bb07
Remove composes from
rogermparent Oct 12, 2021
66acf1d
Merge branch 'master' of github.com:iterative/dvc.org into test-cachi…
rogermparent Oct 12, 2021
1ea58e7
Remove source-github-api and other uses of deprecated runQuery
rogermparent Oct 12, 2021
de3c76e
Back to Gatsby 3
rogermparent Oct 12, 2021
804fef3
Remove explicit webpack
rogermparent Oct 12, 2021
e51afa0
Merge branch 'master' of github.com:iterative/dvc.org into test-cachi…
rogermparent Oct 18, 2021
f442dc8
Use blur placeholder by default
rogermparent Oct 18, 2021
880c082
Fix misconfig on blur
rogermparent Oct 18, 2021
6d757fa
Upgrade some packages and remove unused lmdb-store
rogermparent Oct 18, 2021
cefd41d
yarn upgrade (lockfile only)
rogermparent Oct 18, 2021
b9655f2
Re-add typescript plugin definition (but not package.json)
rogermparent Oct 18, 2021
d9c3b4f
Re-add node_modules cacheDirectories
rogermparent Oct 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defaults: &defaults
working_directory: ~/repo
docker:
# Specify the version you desire here.
- image: circleci/node:12
- image: circleci/node:16

# Specify service dependencies here if necessary.
# CircleCI maintains a library of pre-built images,
Expand Down
1 change: 0 additions & 1 deletion content/docs/user-guide/contributing/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ tags:
- Version Control
- AI
---

```

- `title` (**required**) - title of the post.
Expand Down
38 changes: 10 additions & 28 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const plugins = [
path: path.join(__dirname, 'static')
}
},
'gatsby-plugin-image',
'community-page',
{
resolve: 'gatsby-transformer-remark',
Expand Down Expand Up @@ -122,7 +123,14 @@ const plugins = [
}
},
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
{
resolve: 'gatsby-plugin-sharp',
options: {
defaults: {
placeholder: 'blurred'
}
}
},
Comment on lines +126 to +133
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point between our current pinned versions and now, the default placeholder got changed from blur to a "dominant color" strategy. I've changed the default back to blur for parity.

It doesn't seem there's any hit to build time for doing this, my first attempt looked like it but was a false positive.

{
resolve: 'gatsby-plugin-catch-links',
options: {
Expand Down Expand Up @@ -224,28 +232,6 @@ const plugins = [
}
]

if (process.env.GITHUB_TOKEN) {
plugins.push({
resolve: `gatsby-source-github-api`,
options: {
// token: required by the GitHub API
token: process.env.GITHUB_TOKEN,

// GraphQLquery: defaults to a search query
graphQLQuery: `
{
repository(owner: "iterative", name: "dvc") {
stargazers {
totalCount
}
}
}
`,
variables: {}
}
})
}

if (process.env.CONTEXT === 'production') {
plugins.push({
resolve: 'gatsby-plugin-google-analytics',
Expand All @@ -258,11 +244,7 @@ if (process.env.CONTEXT === 'production') {

if (process.env.ANALYZE) {
plugins.push({
resolve: 'gatsby-plugin-webpack-bundle-analyzer',
options: {
analyzerPort: 4000,
production: process.env.NODE_ENV === 'production'
}
resolve: 'gatsby-plugin-webpack-bundle-analyser-v2'
Comment on lines -261 to +247
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newest version of the same thing.

})
}

Expand Down
130 changes: 65 additions & 65 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "LIMIT_BLOG_PAGES=1 SKIP_DOCS=true gatsby develop",
"build": "gatsby build",
"start": "node ./src/server/index.js",
"heroku-postbuild": "./scripts/deploy-with-s3.js",
"heroku-postbuild": "./scripts/heroku-deploy.sh",
"test": "jest",
"format-staged": "pretty-quick --staged --no-restage --bail",
"format-check": "prettier --check '**/*.{js,jsx,md,tsx,ts,json}'",
Expand All @@ -33,50 +33,51 @@
},
"homepage": "https://github.com/iterative/dvc.org#readme",
"engines": {
"node": "<=15.x"
"node": "<=16.x"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the latest sharp means we can use the latest Node

},
"dependencies": {
"@hapi/wreck": "^17.0.0",
"@octokit/graphql": "^4.3.1",
"@reach/portal": "^0.10.0",
"@reach/router": "^1.3.3",
"@reach/tooltip": "^0.10.0",
"@octokit/graphql": "^4.8.0",
"@reach/portal": "^0.16.2",
"@reach/router": "^1.3.4",
"@reach/tooltip": "^0.16.2",
"classnames": "^2.2.6",
"color": "^3.1.2",
"color": "^4.0.1",
"compression": "^1.7.4",
"date-fns": "^2.11.1",
"date-fns": "^2.25.0",
"docsearch.js": "^2.6.3",
"ease-component": "^1.0.0",
"express": "^4.17.1",
"fs-extra": "^9.0.0",
"gatsby": "^2.20.13",
"gatsby-image": "^2.3.1",
"gatsby-link": "^2.3.2",
"fs-extra": "^10.0.0",
"gatsby": "^3.14.3",
"gatsby-link": "^3.14.0",
"gatsby-plugin-image": "^1.14.1",
"gatsby-plugin-parent-resolvers": "^1.0.1",
"gatsby-source-github-api": "^0.2.1",
"github-markdown-css": "^4.0.0",
"iso-url": "^0.4.7",
"isomorphic-fetch": "^2.2.1",
"graphql": "^15.6.1",
"iso-url": "^1.1.5",
"isomorphic-fetch": "^3.0.0",
"lodash": "^4.17.21",
"moment": "^2.25.3",
"nanoid": "^3.0.2",
"nanoid": "^3.1.30",
"node-cache": "^5.1.0",
"perfect-scrollbar": "^1.5.0",
"pretty-quick": "^2.0.1",
"postcss": "^8.3.9",
"pretty-quick": "^3.1.1",
"prismjs": "^1.25.0",
"promise-polyfill": "^8.1.3",
"prop-types": "^15.7.2",
"raf-polyfill": "^1.0.0",
"react": "^16.13.1",
"react": "^17.0.2",
"react-collapse": "^5.0.1",
"react-collapsible": "^2.7.0",
"react-dom": "^16.13.1",
"react-ga": "^2.7.0",
"react-helmet": "^5.2.1",
"react-dom": "^17.0.2",
"react-ga": "^3.3.0",
"react-helmet": "^6.1.0",
"react-popover": "^0.5.10",
"react-slick": "^0.25.2",
"react-slick": "^0.28.1",
"react-use": "^14.0.0",
"rehype-react": "^5.0.1",
"rehype-react": "^6.2.1",
"remark-preset-lint-recommended": "^5.0.0",
"repo-link-check": "^0.7.1",
"reset-css": "^5.0.1",
Expand All @@ -86,10 +87,10 @@
"slick-carousel": "^1.8.1",
"title-case": "^3.0.2",
"unist-util-visit": "2.0.2",
"upath": "^1.2.0"
"upath": "^2.0.1"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/core": "^7.15.8",
"@svgr/webpack": "^5.3.1",
"@types/classnames": "^2.2.10",
"@types/isomorphic-fetch": "^0.0.35",
Expand All @@ -99,66 +100,65 @@
"@types/react-dom": "^16.9.6",
"@types/react-helmet": "^5.0.15",
"@types/react-popover": "^0.5.3",
"@types/react-slick": "^0.23.4",
"@types/react-slick": "^0.23.6",
"@types/rehype-react": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"autoprefixer": "^9.7.6",
"autoprefixer": "^10.3.7",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.0.1",
"babel-plugin-transform-define": "^2.0.0",
"babel-plugin-transform-define": "^2.0.1",
"babel-plugin-transform-object-assign": "^6.22.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-json": "^2.1.1",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"gatsby-plugin-catch-links": "^2.2.1",
"gatsby-plugin-feed": "^2.4.1",
"gatsby-plugin-google-analytics": "^2.2.2",
"gatsby-plugin-manifest": "2.2.23",
"gatsby-plugin-postcss": "^2.2.1",
"gatsby-plugin-react-helmet": "^3.2.1",
"eslint-plugin-react": "^7.26.1",
"gatsby-plugin-catch-links": "^3.14.0",
"gatsby-plugin-feed": "^3.14.0",
"gatsby-plugin-google-analytics": "^3.14.0",
"gatsby-plugin-manifest": "^3.14.0",
"gatsby-plugin-postcss": "^4.14.0",
"gatsby-plugin-react-helmet": "^4.14.0",
"gatsby-plugin-sentry": "^1.0.1",
"gatsby-plugin-sharp": "2.2.32",
"gatsby-plugin-sitemap": "^2.3.1",
"gatsby-plugin-svgr": "^2.0.2",
"gatsby-plugin-twitter": "^2.2.2",
"gatsby-plugin-typescript": "^2.3.1",
"gatsby-plugin-webpack-bundle-analyzer": "^1.0.5",
"gatsby-remark-autolink-headers": "^2.2.1",
"gatsby-remark-copy-linked-files": "^2.2.1",
"gatsby-plugin-sharp": "^3.14.1",
"gatsby-plugin-sitemap": "^4.10.0",
"gatsby-plugin-svgr": "^3.0.0-beta.0",
"gatsby-plugin-twitter": "^3.14.0",
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.25",
"gatsby-remark-autolink-headers": "^4.11.0",
"gatsby-remark-copy-linked-files": "^4.11.0",
"gatsby-remark-embed-gist": "^1.1.9",
"gatsby-remark-embedder": "^2.0.0",
"gatsby-remark-embedder": "^5.0.0",
"gatsby-remark-external-links": "^0.0.4",
"gatsby-remark-images": "^3.2.2",
"gatsby-remark-prismjs": "^3.4.1",
"gatsby-remark-images": "^5.11.0",
"gatsby-remark-prismjs": "^5.11.0",
"gatsby-remark-relative-images": "0.2.3",
"gatsby-remark-responsive-iframe": "^2.3.1",
"gatsby-remark-smartypants": "^2.2.1",
"gatsby-source-filesystem": "^2.2.2",
"gatsby-transformer-remark": "^2.7.1",
"gatsby-transformer-sharp": "2.2.23",
"gatsby-remark-responsive-iframe": "^4.11.0",
"gatsby-remark-smartypants": "^4.11.0",
"gatsby-source-filesystem": "^3.14.0",
"gatsby-transformer-remark": "^4.11.0",
"gatsby-transformer-sharp": "^3.14.0",
"hast-util-select": "^4.0.0",
"husky": "^4.2.3",
"jest": "^26.0.1",
"lint-staged": "^10.1.2",
"jest": "^27.3.0",
"lint-staged": "^11.2.3",
"postcss-color-mod-function": "^3.0.3",
"postcss-custom-media": "^7.0.8",
"postcss-custom-properties": "^9.1.1",
"postcss-mixins": "^6.2.3",
"postcss-nested": "^4.2.1",
"prettier": "^2.2.1",
"rehype-parse": "^6.0.2",
"rehype-stringify": "^7.0.0",
"remark": "^12.0.0",
"remark-html": "^13.0.2",
"postcss-custom-media": "^8.0.0",
"postcss-custom-properties": "^12.0.0",
"postcss-mixins": "^8.1.0",
"postcss-nested": "^5.0.6",
"prettier": "^2.4.1",
"rehype-parse": "^7.0.1",
"rehype-stringify": "^8.0.0",
"remark": "^13.0.0",
"remark-html": "^13.0.1",
"remark-parse": "^8.0.2",
"stylelint": "^13.3.0",
"stylelint-config-standard": "^20.0.0",
"stylelint-config-standard": "^22.0.0",
"typescript": "^3.8.3",
"unist-util-remove-position": "^2.0.1"
"unist-util-remove-position": "^3.0.0"
},
"husky": {
"hooks": {
Expand Down
45 changes: 28 additions & 17 deletions scripts/deploy-with-s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
require('dotenv').config()
const path = require('path')
const PRODUCTION_PREFIX = 'dvc-org-prod'
const { mkdirSync } = require('fs')

const { DEPLOY_OPTIONS } = process.env
const { DEPLOY_OPTIONS, USE_PRODUCTION_CACHE } = process.env
const clearCloudflareCache = require('./clear-cloudflare-cache')

// Generate deploy options from a comma separated string in the DEPLOY_OPTIONS
Expand All @@ -20,6 +21,7 @@ const deployOptions = DEPLOY_OPTIONS
: {
download: true,
build: true,
retry: true,
upload: true,
clean: true,
clearCloudflareCache: true
Expand Down Expand Up @@ -69,9 +71,8 @@ const {
cleanEntry
} = require('./s3-utils')
const { move } = require('fs-extra')
const { downloadAllFromS3, uploadAllToS3, cleanAllLocal } = withEntries(
cacheDirs
)
const { downloadAllFromS3, uploadAllToS3, cleanAllLocal } =
withEntries(cacheDirs)

function run(command) {
execSync(command, {
Expand All @@ -86,32 +87,42 @@ async function main() {
// This greatly speeds up PR initial build time.

if (deployOptions.download) {
if (emptyPrefix) {
if (USE_PRODUCTION_CACHE) {
console.warn('USE_PRODUCTION_CACHE is set, downloading from production')
await downloadAllFromS3(PRODUCTION_PREFIX)
} else if (emptyPrefix) {
console.warn(
`The current prefix "${s3Prefix}" is empty! Attempting to fall back on production cache.`
)
await downloadAllFromS3(PRODUCTION_PREFIX)
} else {
await downloadAllFromS3(s3Prefix)
}
mkdirSync('.cache/json', { recursive: true })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mitigation for gatsbyjs/gatsby#33262, already a PR to fix it in gatsbyjs/gatsby#33431

}

if (deployOptions.build) {
try {
run('yarn build')
} catch (buildError) {
// Sometimes gatsby build fails because of bad cache.
// Clear it and try again.

console.error('------------------------\n\n')
console.error('The first Gatsby build attempt failed!\n')
console.error(buildError)
console.error('\nRetrying with a cleared cache:\n')

// Clear only .cache so we re-use images
await cleanEntry(cacheDirs[1])

run('yarn build')
if (deployOptions.retry) {
// Sometimes gatsby build fails because of bad cache.
// Clear it and try again.

console.error('------------------------\n\n')
console.error('The first Gatsby build attempt failed!\n')
console.error(buildError)
console.error('\nRetrying with a cleared cache:\n')

// Clear only .cache so we re-use images
await cleanEntry(cacheDirs[1])

run('yarn build')
} else {
throw new Error(
'The first Gatsby build attempt failed, and DEPLOY_OPTIONS does not include "retry"'
)
}
Comment on lines +108 to +125
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just here to debug caching without wasting time on the rebuild if it fails.

}
}

Expand Down
6 changes: 6 additions & 0 deletions scripts/heroku-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
NEWPWD="/tmp/gatsby-build"
mv $OLDPWD $NEWPWD
ln -s $NEWPWD $OLDPWD
cd $NEWPWD
./scripts/deploy-with-s3.js
Comment on lines +1 to +6
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moves the unstable Heroku build path (exposed via $OLDPWD, thankfully) to /tmp/gatsby-build so the absolute path of the build is always the same, since changing it will trigger an automatic cache clear.

Loading