Skip to content

Commit

Permalink
Convert paypal-js to a monorepo with Changesets and npm workspaces (#453
Browse files Browse the repository at this point in the history
)

* convert to monorepo

* changeset

* ignore prettier for now

* PR comments
  • Loading branch information
wsbrunson authored Feb 9, 2024
1 parent f1e1494 commit 082bd2f
Show file tree
Hide file tree
Showing 57 changed files with 12,505 additions and 8,868 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/sour-impalas-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@paypal/paypal-js": patch
---

move to monorepo
31 changes: 15 additions & 16 deletions .github/workflows/validate.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
name: validate
name: build
on:
# run on push but only for the main branch
push:
branches:
- main
# run for every pull request
pull_request: {}
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: ⬇️ Checkout repo
uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.sha}}
fetch-depth: 0

- name: 🤝 Set Node version from .nvmrc
Expand All @@ -30,14 +24,19 @@ jobs:

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: ▶️ Run validate script
run: npm run validate
- name: 🧾 Check for changeset
# blocks PRs without changesets
run: npx changeset status --since=origin/main

- name: 🚧 Run build script
run: npm run build

- name: 📐 Run format script
run: npm run format

- name: 👕 Lint commit messages
uses: wagoid/commitlint-github-action@v5
- name: 📖 Run lint script
run: npm run lint

- name: ⬆️ Upload coverage report
uses: codecov/codecov-action@v3
- name: 🧪 Run test script
run: npm run test
6 changes: 1 addition & 5 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: playwright
on:
# run on push but only for the main branch
push:
branches:
- main
# run for every pull request
pull_request: {}
jobs:
test:
Expand All @@ -31,8 +29,6 @@ jobs:

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: 🌎 Install Playwright Browsers
run: npx playwright install --with-deps
Expand All @@ -41,7 +37,7 @@ jobs:
run: npm run build

- name: ▶️ Run Playwright tests
run: npx playwright test
run: npm run test:e2e

- uses: actions/upload-artifact@v3
if: always()
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/publish.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: 🤝 Set Node version from .nvmrc
run: echo NVMRC=`cat .nvmrc` >> $GITHUB_ENV

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}

- name: 📥 Download deps
uses: bahmutov/npm-install@v1

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc

- name: 🚢 Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run changeset:release
version: npm run changeset:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

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"

npx --no lint-staged
npx lint-staged
Loading

0 comments on commit 082bd2f

Please sign in to comment.