Skip to content

Commit

Permalink
chore(ci): add a circleci config to bundle packages (#6446)
Browse files Browse the repository at this point in the history
* chore(ci): add a circleci config to bundle packages

* fix: store escaped package names in the manifest

* chore: run job only on current
  • Loading branch information
binoy14 authored and ricokahler committed May 14, 2024
1 parent 1d0fd3e commit f4c7cfe
Show file tree
Hide file tree
Showing 5 changed files with 470 additions and 10 deletions.
43 changes: 43 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 2.1

workflows:
version: 2
build-and-deploy:
jobs:
- build:
filters:
branches:
only:
- current

jobs:
build:
docker:
- image: cimg/node:20.12
steps:
- checkout
- restore_cache:
name: Restore pnpm Package Cache
keys:
- pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
- run:
name: Install pnpm package manager
command: |
corepack enable --install-directory ~/bin
corepack prepare pnpm@latest-8 --activate
pnpm config set store-dir .pnpm-store
- run:
name: Install Dependencies
command: |
pnpm install
- save_cache:
name: Save pnpm Package Cache
key: pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
paths:
- .pnpm-store
- run:
name: Build bundle
command: pnpm run build:bundle
- run:
name: Copy to bucket
command: npm run bundle:upload
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"build:e2e": "pnpm e2e:build",
"build:performance-studio": "pnpm perf:studio:build",
"build:test-studio": "pnpm build --filter=sanity-test-studio",
"bundle:upload": "node -r esbuild-register scripts/uploadBundles",
"check": "npm-run-all build --parallel check:*",
"check:deps": "pnpm --recursive --parallel exec depcheck",
"check:format": "prettier . --check",
Expand Down Expand Up @@ -97,6 +98,7 @@
"@babel/preset-react": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@bjoerge/mutiny": "^0.5.3",
"@google-cloud/storage": "^7.11.0",
"@jest/globals": "^29.7.0",
"@playwright/test": "1.41.2",
"@repo/package.config": "workspace:*",
Expand Down
13 changes: 8 additions & 5 deletions packages/@repo/shared-modules.bundle/package.bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ export default defineConfig(() => {
return mergeConfig(defaultConfig, {
build: {
lib: {
// NOTE: IF ANY OF THIS CHANGES MAKE SURE TO UPDATE `scripts/uploadBundles.ts`
entry: {
'react': './node_modules/react/cjs/react.production.min.js',
'react-dom': './node_modules/react-dom/cjs/react-dom.production.min.js',
'react-dom_server':
'react/index': './node_modules/react/cjs/react.production.min.js',
'react-dom/index': './node_modules/react-dom/cjs/react-dom.production.min.js',
'react-dom/client': './node_modules/react-dom/cjs/react-dom.production.min.js',
'react-dom/server':
'./node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js',
'react_jsx-runtime': './node_modules/react/cjs/react-jsx-runtime.production.min.js',
'styled-components': './node_modules/styled-components/dist/styled-components.esm.js',
'react/jsx-runtime': './node_modules/react/cjs/react-jsx-runtime.production.min.js',
'styled-components/index':
'./node_modules/styled-components/dist/styled-components.esm.js',
},
},
},
Expand Down
Loading

0 comments on commit f4c7cfe

Please sign in to comment.