-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: improve ESM/CJS compatibility, drop support for node 12 #5
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,3 @@ | ||
{ | ||
"path": "cz-conventional-changelog" | ||
} |
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,22 +1,57 @@ | ||
name: test | ||
name: CI & Release | ||
|
||
on: | ||
- push | ||
- pull_request | ||
push: | ||
pull_request: | ||
branches: | ||
- alpha | ||
- beta | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: Node.js ${{ matrix.node-version }} | ||
runs-on: ubuntu-latest | ||
runs-on: ${{ matrix.platform }} | ||
name: Node.js ${{ matrix.node-version }} / ${{ matrix.platform }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: | ||
- 16 | ||
- 14 | ||
- 12 | ||
platform: [ubuntu-latest, macos-latest] | ||
node-version: [lts/*, current] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 | ||
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm install | ||
- run: npm test | ||
- run: npm i pnpm@latest -g | ||
- run: pnpm install | ||
- run: pnpm test | ||
- run: pnpm lint | ||
|
||
release: | ||
name: 'Semantic release' | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3 | ||
with: | ||
# Need to fetch entire commit history to | ||
# analyze every commit since last release | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3 | ||
with: | ||
node-version: lts/* | ||
- run: npm i pnpm@latest -g | ||
- run: pnpm install | ||
# Branches that will release new versions are defined in .releaserc.json | ||
- run: pnpm exec semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
# Build docs | ||
- run: npm run docs:build | ||
# Deploy docs | ||
- uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./docs |
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 |
---|---|---|
|
@@ -51,4 +51,4 @@ package-lock.json | |
|
||
# Compiled portable text library + demo | ||
/dist | ||
/demo/dist | ||
/docs |
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
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,18 @@ | ||
import {defineConfig} from '@sanity/pkg-utils' | ||
|
||
export default defineConfig({ | ||
extract: { | ||
rules: { | ||
'ae-missing-release-tag': 'off', | ||
'tsdoc-undefined-tag': 'off', | ||
}, | ||
}, | ||
|
||
legacyExports: true, | ||
|
||
tsconfig: 'tsconfig.dist.json', | ||
|
||
babel: { | ||
plugins: ['@babel/plugin-proposal-object-rest-spread'], | ||
}, | ||
}) |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen us use this pattern in other repos and in practice we have far fewer
macos-latest
runners available and it frequently results in long wait times when you have multiple PRs on multiple repos that need merging. I recommend following the pattern we use on repos like sanity client instead, where you have exactly one run ofmacos-latest and
windows-latestand have the rest be strictly
ubuntu-latest` 🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I think it's (almost) pointless to run tests on windows/mac for modules that do not even use node APIs. There's bound to be differences and pitfalls when doing things like command spawning, file system operations and such - but for pure JS modules it's hard to see where it could fail cross-platform.
Running tests on linux is faster (more availability) and also uncovers any incorrectly cased files, which can sometimes happen when authoring on mac but testing on linux.