Skip to content

Commit

Permalink
chore: move to pnpm, turbo, modernize (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
mscolnick authored Mar 21, 2024
1 parent 2a2c385 commit 3292f6d
Show file tree
Hide file tree
Showing 1,996 changed files with 16,948 additions and 74,018 deletions.
32 changes: 16 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:
steps:
- checkout
- node/install-packages:
pkg-manager: yarn
pkg-manager: pnpm
- run:
name: Generate Fern SDKs
command: |
npm install -g fern-api
fern generate --local --group local --log-level debug
- run:
name: Build
command: yarn build
command: pnpm build
- persist_to_workspace:
root: /home/circleci
paths: [project]
Expand All @@ -28,13 +28,13 @@ jobs:
steps:
- attach_workspace: { at: /home/circleci }
- run:
command: yarn lint
command: pnpm lint
name: Lint
- run:
command: yarn test
command: pnpm test
name: Test
- run:
command: yarn test-db
command: pnpm test-db
name: Test DB

ete-test:
Expand All @@ -44,10 +44,10 @@ jobs:
- attach_workspace: { at: /home/circleci }
- run:
name: Dockerize Local
command: yarn run docker:local
command: pnpm run docker:local
- run:
name: Test ETE
command: yarn run test-ete
command: pnpm run test-ete

migrate-dev2:
circleci_ip_ranges: true
Expand All @@ -58,7 +58,7 @@ jobs:
- attach_workspace: { at: /home/circleci }
- run:
name: prisma deploy
command: yarn run db:migrate:dev
command: pnpm run db:migrate:dev

deploy-dev2:
machine:
Expand All @@ -70,10 +70,10 @@ jobs:
name: cdk deploy
command: |
git_version="$(scripts/git-version.sh)"
yarn run docker:dev "${git_version}"
pnpm run docker:dev "${git_version}"
npm install -g aws-cdk
yarn install
VERSION="${git_version}" yarn workspace fdr-deploy deploy:dev
pnpm install
VERSION="${git_version}" pnpm --filter=@fern-platform=fdr-deploy deploy:dev
migrate-prod:
circleci_ip_ranges: true
Expand All @@ -83,7 +83,7 @@ jobs:
steps:
- attach_workspace: { at: /home/circleci }
- run:
command: yarn run db:migrate:prod
command: pnpm run db:migrate:prod
name: prisma deploy

deploy-prod:
Expand All @@ -96,11 +96,11 @@ jobs:
name: cdk deploy
command: |
git_version="$(scripts/git-version.sh)"
yarn run docker:prod "${git_version}"
pnpm run docker:prod "${git_version}"
npm install -g aws-cdk
yarn install
pnpm install
cd apps/fdr-deploy
VERSION="${git_version}" yarn workspace fdr-deploy deploy:prod
VERSION="${git_version}" pnpm --filter=@fern-platform=fdr-deploy deploy:prod
publish-sdks:
machine:
Expand All @@ -116,7 +116,7 @@ jobs:
version_replace="s/0.0.0/${git_version}/"
cat package.json.tmp| sed "${version_replace}" > package.json
rm -rf package.json.tmp
echo "//registry.npmjs.org/:_authToken=${YARN_NPM_AUTH_TOKEN}" > ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${pnpm_NPM_AUTH_TOKEN}" > ~/.npmrc
npm publish --access public
- run:
name: Publish FDR Fiddle SDK
Expand Down
21 changes: 21 additions & 0 deletions .github/actions/install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Install Repo
description: Install the ts toolchain and dependencies

runs:
using: "composite"

steps:
- name: ⎔ Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm

- name: 📥 Install dependencies
shell: bash
run: pnpm install
78 changes: 26 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,57 @@
name: CI

# Controls when the workflow will run
on:
push:
branches:
- "**"

jobs:
# Jobs go here
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
fetch-depth: 5 # This helps turbo resolve changes faster

- name: Install dependencies
run: yarn install --immutable
- name: Install
uses: ./.github/actions/install

- name: Compile
run: yarn compile
run: pnpm compile

- name: Check dependencies
run: yarn depcheck
run: pnpm depcheck

- name: Check format
run: yarn format:check
run: pnpm format:check

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --immutable
- name: Install
uses: ./.github/actions/install

- name: Lint monorepo
run: yarn lint:monorepo
run: pnpm lint:monorepo

- name: Lint style
run: yarn lint:style

- name: Lint typescript
run: yarn lint:eslint
- name: Lint style and eslint
run: pnpm turbo lint:style lint:eslint format:check

organize-imports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --immutable
- name: Install
uses: ./.github/actions/install

- name: Organize imports
# not using --list-different because sometimes this removes a trailing
# comma that prettier adds back
run: |
yarn organize-imports
pnpm organize-imports
git --no-pager diff --exit-code
test:
Expand All @@ -79,31 +61,28 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --immutable
- name: Install
uses: ./.github/actions/install

- name: Codegen
run: |
npm install -g fern-api
fern generate --local
yarn workspace fdr run build:prisma
pnpm turbo --filter=@fern-platform/fdr codegen
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}

- name: Setup database
# TODO: re-enable when moving to turbo
# yarn workspace fdr run docker:local
# pnpm turbo --filter= docker:local
run: |
yarn workspace fdr run test-db
yarn workspace fdr run test-ete
pnpm --filter=@fern-platform/fdr test-db
pnpm --filter=@fern-platform/fdr test-ete
- name: Run tests
run: yarn test --ci
run: pnpm test
env:
CI: true

- name: Ensure no changes to git-tracked files
run: git --no-pager diff --exit-code
Expand All @@ -113,13 +92,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --immutable
- name: Install
uses: ./.github/actions/install

- name: Check release blockers
run: yarn check-docs-release-blockers
run: pnpm check-docs-release-blockers
21 changes: 12 additions & 9 deletions .github/workflows/local-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ jobs:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- run: yarn install
- name: Install
uses: ./.github/actions/install
- name: Build local preview bundle
run: yarn workspace @fern-ui/local-preview-bundle run build
run: pnpm turbo --filter=@fern-ui/local-preview-bundle build
- name: Synthesize local preview bundle
run: yarn workspace @fern-ui/cdk run synth:dev
run: pnpm --filter=@fern-ui/cdk run synth:dev

deploy-local-preview-dev:
needs: [dryrun-deploy-local-preview-dev]
Expand All @@ -32,11 +33,12 @@ jobs:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- run: yarn install
- name: Install
uses: ./.github/actions/install
- name: Build local preview bundle
run: yarn workspace @fern-ui/local-preview-bundle run build
run: pnpm turbo --filter=@fern-ui/local-preview-bundle build
- name: Deploy local preview bundle
run: yarn workspace @fern-ui/cdk run deploy:dev
run: pnpm --filter=@fern-ui/cdk run deploy:dev

deploy-local-preview-prod:
needs: [deploy-local-preview-dev]
Expand All @@ -51,8 +53,9 @@ jobs:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- run: yarn install
- name: Install
uses: ./.github/actions/install
- name: Build local preview bundle
run: yarn workspace @fern-ui/local-preview-bundle run build
run: pnpm turbo --filter=@fern-ui/local-preview-bundle build
- name: Deploy local preview bundle
run: yarn workspace @fern-ui/cdk run deploy:prod
run: pnpm --filter=@fern-ui/cdk run deploy:prod
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ packages/**/lib
packages/**/dist
packages/**/tsconfig*tsbuildinfo
packages/**/out
servers/**/build
servers/**/lib
servers/**/dist
servers/**/tsconfig*tsbuildinfo
servers/**/out

# next
.next
Expand Down Expand Up @@ -39,3 +44,6 @@ packages/**/generated
# environments
.env*.local
.vercel

# turbo
.turbo
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
pnpm lint-staged
5 changes: 5 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@fern-fern:registry=https://npm.buildwithfern.com/

@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=D7102FD6-02A5-4221-A23B-20231EA5288D
//npm.fontawesome.com/:always-auth=true
Loading

0 comments on commit 3292f6d

Please sign in to comment.