-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(tooling): add sanity ecosystem automation
- Loading branch information
1 parent
805ce64
commit d167870
Showing
9 changed files
with
10,665 additions
and
4,192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
name: CI | ||
|
||
run-name: ${{inputs.release && 'CI ➤ Release' || ''}} | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
inputs: | ||
release: | ||
description: Release | ||
required: true | ||
default: false | ||
type: boolean | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: pnpm | ||
node-version: lts/* | ||
- run: corepack enable && pnpm --version | ||
- run: pnpm install | ||
- run: pnpm lint | ||
- run: pnpm build | ||
|
||
test: | ||
needs: build | ||
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 | ||
# Includes previous LTS release, the latest and the upcoming version in development | ||
node: [lts/-1, lts/*, current] | ||
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 }} | ||
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@v3 | ||
- uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: pnpm | ||
node-version: ${{ matrix.node }} | ||
- run: corepack enable && pnpm --version | ||
- run: pnpm install --loglevel=error | ||
- run: pnpm test | ||
|
||
release: | ||
needs: [build, test] | ||
# only run if opt-in during workflow_dispatch | ||
if: github.event.inputs.release == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# Need to fetch entire commit history to | ||
# analyze every commit since last release | ||
fetch-depth: 0 | ||
- uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: pnpm | ||
node-version: lts/* | ||
- run: corepack enable && pnpm --version | ||
- run: pnpm install --loglevel=error | ||
- run: pnpm release --dry-run --debug | ||
# Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state | ||
# e.g. git tags were pushed but it exited before `npm publish` | ||
if: always() | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,7 @@ | |
/node_modules | ||
|
||
# Build directory | ||
/dist | ||
/dist | ||
|
||
# Cache files | ||
.eslintcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"endOfLine":"auto", | ||
"endOfLine": "auto", | ||
"printWidth": 100, | ||
"quoteProps": "consistent", | ||
"singleQuote": true, | ||
"tabWidth": 4, | ||
"trailingComma": "none", | ||
"useTabs": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "@sanity/semantic-release-preset", | ||
"branches": ["main"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from '@sanity/pkg-utils'; | ||
|
||
export default defineConfig({ | ||
extract: { | ||
rules: { 'ae-missing-release-tag': 'off' } | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,23 +2,57 @@ | |
"name": "next-sanity-image", | ||
"version": "6.0.0", | ||
"description": "Utility for using responsive images hosted on the Sanity.io CDN with the Next.js image component.", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"author": "Lorenzo de Jong", | ||
"bugs": { | ||
"url": "https://github.com/lorenzodejong/next-sanity-image/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/lorenzodejong/next-sanity-image.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Lorenzo de Jong", | ||
"sideEffects": false, | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"source": "./src/index.ts", | ||
"require": "./dist/index.cjs", | ||
"node": { | ||
"import": "./dist/index.cjs.js", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"import": "./dist/index.js", | ||
"default": "./dist/index.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.js", | ||
"source": "./src/index.ts", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "rollup -c", | ||
"prebuild": "rimraf dist", | ||
"build": "pkg build --strict && pkg --strict", | ||
"lint": "eslint --cache --max-warnings 0 .", | ||
"prepublishOnly": "pnpm run build", | ||
"release": "semantic-release", | ||
"test": "jest" | ||
}, | ||
"browserslist": [ | ||
"> 0.2% and supports es6-module and supports es6-module-dynamic-import and not dead and not IE 11", | ||
"maintained node versions" | ||
], | ||
"dependencies": { | ||
"@sanity/image-url": "^1.0.2" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^8.3.4", | ||
"@sanity/client": "^5.0.0", | ||
"@sanity/pkg-utils": "^2.2.13", | ||
"@sanity/semantic-release-preset": "^4.1.0", | ||
"@testing-library/react-hooks": "^8.0.1", | ||
"@types/jest": "^28.1.6", | ||
"@types/node": "^18.6.5", | ||
|
@@ -32,11 +66,13 @@ | |
"eslint-plugin-react-hooks": "^4.6.0", | ||
"jest": "^28.1.3", | ||
"next": "^13.2.4", | ||
"prettier": "2.7.1", | ||
"prettier": "^2.8.7", | ||
"prettier-plugin-packagejson": "^2.4.3", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-test-renderer": "^18.2.0", | ||
"rollup": "^2.77.2", | ||
"rimraf": "^4.4.1", | ||
"semantic-release": "^21.0.1", | ||
"ts-jest": "^28.0.7", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.7.4" | ||
|
@@ -46,11 +82,5 @@ | |
"next": "^13.0.0", | ||
"react": "^18.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/lorenzodejong/next-sanity-image.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/lorenzodejong/next-sanity-image/issues" | ||
} | ||
"packageManager": "[email protected]" | ||
} |
Oops, something went wrong.