Skip to content

Commit c6cf5e8

Browse files
authored
Merge pull request #14945 from artsy/damassi/feat/rsbuild-2
feat(compiler): Add RSBuild and remove Webpack, optimize JS bundles, speed up CI
2 parents 3930bbb + 19870a2 commit c6cf5e8

File tree

94 files changed

+3146
-11660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+3146
-11660
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
- run:
6666
name: Run Jest Tests
6767
command: |
68-
yarn jest --reporters=default --maxWorkers 2 --reporters=jest-junit --shard=$(expr $CIRCLE_NODE_INDEX + 1)/$CIRCLE_NODE_TOTAL
68+
yarn jest --reporters=default --maxWorkers 4 --reporters=jest-junit --shard=$(expr $CIRCLE_NODE_INDEX + 1)/$CIRCLE_NODE_TOTAL
6969
environment:
7070
JEST_JUNIT_OUTPUT_DIR: reports/junit
7171
JEST_JUNIT_ADD_FILE_ATTRIBUTE: "true"
@@ -85,7 +85,7 @@ jobs:
8585
- run:
8686
name: Run Legacy Jest Tests
8787
command: |
88-
yarn jest-enzyme --maxWorkers 2 --reporters=default --reporters=jest-junit --shard=$(expr $CIRCLE_NODE_INDEX + 1)/$CIRCLE_NODE_TOTAL
88+
yarn jest-enzyme --maxWorkers 4 --reporters=default --reporters=jest-junit --shard=$(expr $CIRCLE_NODE_INDEX + 1)/$CIRCLE_NODE_TOTAL
8989
environment:
9090
JEST_JUNIT_OUTPUT_DIR: reports/junit
9191
JEST_JUNIT_ADD_FILE_ATTRIBUTE: "true"

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
!.nvmrc
3131
!.prettierignore
3232
!apollo.config.js
33-
!babel.config.js
3433
!dangerfile.ts
3534
!package.json
3635
!relay.config.js

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
parser: "@typescript-eslint/parser",
3-
3+
ignorePatterns: ["src/__generated__/**/*"],
44
plugins: [
55
"react-hooks",
66
"@typescript-eslint",

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ yalc.lock
2929
/node_modules
3030
/public
3131
/src/public/assets
32-
/src/public/assets
3332
/storybook-static
3433
node_modules
3534

.storybook/main.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

.storybook/main.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import path from "path"
2+
import { StorybookConfig } from "storybook-react-rsbuild"
3+
import { mergeRsbuildConfig } from "@rsbuild/core"
4+
5+
const config: StorybookConfig = {
6+
addons: ["@storybook/addon-links", "@storybook/addon-essentials"],
7+
stories: ["../src/**/*.story.tsx"],
8+
typescript: {
9+
// Disable docgeneration due to TypeScript 2.3.x incompatability.
10+
// TODO: Fix this once https://github.com/styleguidist/react-docgen-typescript/issues/356
11+
// is addressed
12+
reactDocgen: false,
13+
},
14+
framework: {
15+
name: "storybook-react-rsbuild",
16+
options: {
17+
builder: {
18+
environment: "client",
19+
},
20+
},
21+
},
22+
23+
rsbuildFinal: config => {
24+
return mergeRsbuildConfig(config, {
25+
tools: {
26+
swc: {
27+
jsc: {
28+
baseUrl: path.resolve(process.cwd(), "src"),
29+
},
30+
},
31+
},
32+
})
33+
},
34+
35+
docs: {},
36+
}
37+
38+
export default config

.storybook/preview.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { MediaContextProvider } from "Utils/Responsive"
33
import { createRelaySSREnvironment } from "System/Relay/createRelaySSREnvironment"
44
import { SystemContextProvider } from "System/Contexts/SystemContext"
55
import { track } from "react-tracking"
6+
import { createBrowserRouter, makeRouteConfig, Route } from "found"
67

78
const { GlobalStyles } = injectGlobalStyles()
89

@@ -15,19 +16,29 @@ export const decorators = [
1516
Story => {
1617
const Tracked = track()(Story)
1718

19+
const BrowserRouter = createBrowserRouter({
20+
routeConfig: makeRouteConfig(
21+
<>
22+
<Route path="*" Component={Tracked} />
23+
</>
24+
),
25+
})
26+
1827
return (
1928
<SystemContextProvider relayEnvironment={relayEnvironment}>
2029
<Theme>
2130
<MediaContextProvider>
2231
<GlobalStyles />
23-
<Tracked />
32+
<BrowserRouter />
2433
</MediaContextProvider>
2534
</Theme>
2635
</SystemContextProvider>
2736
)
2837
},
2938
]
3039

31-
export const parameters = {
32-
actions: { argTypesRegex: "^on[A-Z].*" },
33-
}
40+
// FIXME: Migrate this: https://storybook.js.org/docs/essentials/actions#via-storybooktest-fn-spy-function
41+
// export const parameters = {
42+
// actions: { argTypesRegex: "^on[A-Z].*" },
43+
// }
44+
export const tags = ["autodocs"]

Dockerfile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,16 @@ COPY --chown=deploy:deploy --from=builder-base /opt/node_modules.prod ./node_mod
4747

4848
# Base code
4949
COPY --chown=deploy:deploy --from=builder-base /app/data ./data
50-
COPY --chown=deploy:deploy --from=builder-base /app/package.json .
50+
COPY --chown=deploy:deploy --from=builder-base /app/dist ./dist
51+
COPY --chown=deploy:deploy --from=builder-base /app/src ./src
5152
COPY --chown=deploy:deploy --from=builder-base /app/scripts ./scripts
52-
COPY --chown=deploy:deploy --from=builder-base /app/webpack ./webpack
53+
COPY --chown=deploy:deploy --from=builder-base /app/package.json .
5354
COPY --chown=deploy:deploy --from=builder-base /app/yarn.lock .
5455

55-
# Client assets
56-
COPY --chown=deploy:deploy --from=builder-base /app/manifest.json .
57-
COPY --chown=deploy:deploy --from=builder-base /app/public ./public
58-
COPY --chown=deploy:deploy --from=builder-base /app/src ./src
59-
60-
# Server assets
61-
COPY --chown=deploy:deploy --from=builder-base /app/server.dist.js .
62-
COPY --chown=deploy:deploy --from=builder-base /app/server.dist.js.map .
6356

6457
ENTRYPOINT ["/usr/bin/dumb-init", "./scripts/load_secrets_and_run.sh"]
6558

59+
ENV NODE_PATH=/app/src
60+
6661
# TODO: Reduce production memory, this is not a concern
67-
CMD ["node", "--max_old_space_size=2048", "--heapsnapshot-signal=SIGUSR2", "--no-experimental-fetch", "./server.dist.js"]
62+
CMD ["node", "--max_old_space_size=2048", "--heapsnapshot-signal=SIGUSR2", "--no-experimental-fetch", "-r @swc-node/register", "./src/prod.ts"]

babel.config.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

cypress/e2e/artwork.cy.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
describe("/artwork/:id", () => {
2-
// FIXME: test is being flakey and retries don't work in before hooks
3-
// before(() => {
4-
// cy.visit("/artwork/pablo-picasso-guernica")
5-
// })
6-
72
it("renders metadata", () => {
83
cy.visit("/artwork/pablo-picasso-guernica")
94

0 commit comments

Comments
 (0)