Skip to content

Commit

Permalink
chore: refactor to monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard committed Oct 10, 2023
1 parent 2b021bd commit 15bde7a
Show file tree
Hide file tree
Showing 61 changed files with 794 additions and 277 deletions.
3 changes: 0 additions & 3 deletions .czrc

This file was deleted.

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @sanity-io/ecosystem
14 changes: 14 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>sanity-io/renovate-config"],
"ignorePresets": [
":ignoreModulesAndTests",
"github>sanity-io/renovate-config:group-non-major"
],
"packageRules": [
{
"matchDepTypes": ["dependencies"],
"rangeStrategy": "bump"
}
]
}
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: CI

on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main
- alpha
- beta

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # for checkout

jobs:
build:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: lts/*
- run: corepack enable && pnpm --version
- run: pnpm install --ignore-scripts
- run: pnpm build --filter=./packages/*
- run: pnpm lint
- run: pnpm test

test:
needs: build
timeout-minutes: 15
strategy:
# A test failing on windows doesn't mean it'll fail on macos. It's useful to let all tests run to its completion to get the full picture
fail-fast: false
matrix:
# https://nodejs.org/en/about/releases/
# https://pnpm.io/installation#compatibility
# @TODO re-enable `current` once it recovers
# node: [lts/-1, lts/*, current]
node: [lts/-1, lts/*]
os: [ubuntu-latest]
# Also test the LTS on mac and windows
include:
- os: macos-latest
node: lts/*
# - os: windows-latest
# node: lts/*
runs-on: ${{ matrix.os }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
# It's only necessary to do this for windows, as mac and ubuntu are sane OS's that already use LF
- if: matrix.os == 'windows-latest'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: ${{ matrix.node }}
- run: corepack enable && pnpm --version
- run: pnpm install --loglevel=error --ignore-scripts
- run: pnpm test
46 changes: 46 additions & 0 deletions .github/workflows/lint-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Fix linting issues

on:
push:
branches:
- main
- alpha
- beta
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # for checkout

jobs:
run:
name: Are there issues that linters can fix? 🤔
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: lts/*
- run: pnpm install --ignore-scripts
- run: git restore pnpm-lock.yaml
- run: pnpm lint:fix
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
id: generate-token
with:
app_id: ${{ secrets.ECOSPARK_APP_ID }}
private_key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }}
- uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5
with:
author: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
body: I ran `pnpm lint:fix` 🧑‍💻
branch: actions/lint-fix
commit-message: 'chore(lint): --fix 🤖 ✨'
labels: 🤖 bot
title: 'chore(lint): --fix 🤖 ✨'
token: ${{ steps.generate-token.outputs.token }}
28 changes: 28 additions & 0 deletions .github/workflows/lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Lock Threads

on:
issues:
types: [closed]
pull_request:
types: [closed]
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

permissions:
issues: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@be8aa5be94131386884a6da4189effda9b14aa21 # v4
with:
issue-inactive-days: 0
pr-inactive-days: 7
51 changes: 0 additions & 51 deletions .github/workflows/main.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: Prettier

on:
push:
branches:
- main
- alpha
- beta
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # for checkout

jobs:
run:
name: Can the code be prettier? 🤔
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: lts/*
- run: pnpm install --dev --ignore-scripts
- uses: actions/cache@v3
with:
path: node_modules/.cache/prettier/.prettier-cache
key: prettier-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('.prettierignore') }}-${{ hashFiles('package.json') }}
- run: pnpm format
- run: git restore .github/workflows pnpm-lock.yaml
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
id: generate-token
with:
app_id: ${{ secrets.ECOSPARK_APP_ID }}
private_key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }}
- uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5
with:
author: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
body: I ran `pnpm format` 🧑‍💻
branch: actions/prettier
commit-message: 'chore(prettier): 🤖 ✨'
labels: 🤖 bot
title: 'chore(prettier): 🤖 ✨'
token: ${{ steps.generate-token.outputs.token }}
52 changes: 52 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Release Please

on:
push:
branches:
- main
- alpha
- beta

permissions:
contents: read

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
id: generate-token
with:
app_id: ${{ secrets.ECOSPARK_APP_ID }}
private_key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }}
# This action will create a release PR when regular conventional commits are pushed to main, it'll also detect if a release PR is merged and npm publish should happen
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
command: manifest
token: ${{ steps.generate-token.outputs.token }}

# Publish to NPM on new releases
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.releases_created }}
- uses: pnpm/action-setup@v2
if: ${{ steps.release.outputs.releases_created }}
- uses: actions/setup-node@v3
if: ${{ steps.release.outputs.releases_created }}
with:
cache: pnpm
node-version: lts/*
- name: install deps & build
run: corepack enable && pnpm --version && pnpm install --ignore-scripts
if: ${{ steps.release.outputs.releases_created }}
- name: Set publishing config
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
# Release Please has already incremented versions and published tags, so we just
# need to publish all unpublished versions to NPM here
- run: pnpm -r publish
if: ${{ steps.release.outputs.releases_created }}
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
*.log
*.tgz

.DS_Store
.turbo
.vercel
.workshop
dist
node_modules

/*.log
/*.tgz
/.workshop
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"packages/@sanity/color": "3.0.0-beta.2"}
Loading

0 comments on commit 15bde7a

Please sign in to comment.