Skip to content

Commit b828ea7

Browse files
authored
Merge pull request #3 from dimaMachina/gatsby
Gatsby
2 parents c3384a9 + 48ee52c commit b828ea7

File tree

8 files changed

+265288
-9
lines changed

8 files changed

+265288
-9
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
with:
1212
node-version: "18.15.0"
1313

14-
- run: yarn install
14+
- run: yarn
1515

1616
# Verify it compiles
1717
- run: yarn build

.github/workflows/build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- source
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 'latest'
17+
18+
# Install dependencies
19+
- run: yarn
20+
21+
# Build and output bundle stats to webpack-stats.json
22+
- run: yarn build
23+
24+
# Send bundle stats and build information to RelativeCI
25+
- name: Send bundle stats to RelativeCI
26+
uses: relative-ci/agent-action@v2
27+
with:
28+
webpackStatsFile: ./webpack-stats.json
29+
key: ${{ secrets.RELATIVE_CI_KEY }}
30+
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ yarn-error.log
8080
src/__generated__/
8181

8282
.idea/
83+
84+
.next/
85+
out/

gatsby-node.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { glob } from "glob"
66
import { updateCodeData } from "./scripts/update-code-data/update-code-data"
77
import { organizeCodeData } from "./scripts/update-code-data/organize-code-data"
88
import { sortCodeData } from "./scripts/update-code-data/sort-code-data"
9-
import redirects from "./redirects.json"
9+
import { RelativeCiAgentWebpackPlugin } from "@relative-ci/agent"
10+
import { StatsWriterPlugin } from "webpack-stats-plugin"
1011

1112
require("dotenv").config({
1213
path: `.env.${process.env.NODE_ENV}`,
@@ -537,12 +538,26 @@ export const createPages: GatsbyNode["createPages"] = async ({
537538
}
538539

539540
export const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] =
540-
async ({ actions }) => {
541+
async ({ actions, stage }) => {
541542
actions.setWebpackConfig({
542543
resolve: {
543544
fallback: {
544545
assert: "assert/",
545546
},
546547
},
548+
...(stage === "build-javascript" && {
549+
plugins: [
550+
new RelativeCiAgentWebpackPlugin(),
551+
new StatsWriterPlugin({
552+
enabled: true,
553+
filename: "./webpack-stats.json",
554+
stats: {
555+
assets: true,
556+
chunks: true,
557+
modules: true,
558+
},
559+
}),
560+
],
561+
})
547562
})
548563
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
"timeago.js": "4.0.2"
5858
},
5959
"devDependencies": {
60+
"webpack-stats-plugin": "1.1.3",
61+
"@relative-ci/agent": "4.2.8",
6062
"@svgr/webpack": "^8.0.0",
6163
"@tailwindcss/typography": "0.5.9",
6264
"@types/codemirror": "5.60.7",

relativeci.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
// Get current commit message (`git log -1 --pretty=%B`) and send it to RelativeCI as part of the build information
3+
includeCommitMessage: true,
4+
// Save agent payload to disk for debugging
5+
// @example './relative-ci-payload.json',
6+
payloadFilepath: undefined,
7+
webpack: {
8+
// Path to Webpack stats JSON file
9+
stats: "./webpack-stats.json",
10+
},
11+
}

0 commit comments

Comments
 (0)