Skip to content

Commit

Permalink
Migration for JSR
Browse files Browse the repository at this point in the history
  • Loading branch information
CatChen committed Nov 24, 2024
1 parent d28a0fd commit afbe6b9
Show file tree
Hide file tree
Showing 23 changed files with 3,273 additions and 1,704 deletions.
6 changes: 5 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"plugins": ["transform-flow-strip-types"]
"presets": [
["@babel/preset-env", { "targets": { "node": "current" } }],
"@babel/preset-typescript"
],
"plugins": ["@babel/plugin-transform-typescript"]
}
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[ignore]
<PROJECT_ROOT>/node_modules/jest-resolve/node_modules/resolve/test/resolver/malformed_package_json/
<PROJECT_ROOT>/node_modules/resolve/test/resolver/malformed_package_json/package.json

[include]

Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/deno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow will install Deno then run `deno lint` and `deno test`.
# For more information see: https://github.com/denoland/setup-deno

name: Deno

on:
push:
branches: ['main']
pull_request:
branches: ['main', '[0-9]+-[0-9]+-*']
workflow_call:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: denoland/setup-deno@v2
with:
deno-version: latest

- run: deno install

- run: deno fmt --check --single-quote src

- run: deno lint

- run: |
NPM_VERSION=$(cat package.json | yarn --silent json 'version')
JSR_VERSION=$(cat jsr.json | yarn --silent json 'version')
if [[ "$NPM_VERSION" != "$JSR_VERSION" ]]
then
echo "Version mismatch between package.json and jsr.json"
exit 1
fi
6 changes: 3 additions & 3 deletions .github/workflows/node.js.yml → .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: Node

on:
push:
Expand All @@ -11,7 +11,7 @@ on:
workflow_call:

jobs:
build:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
Expand All @@ -34,6 +34,6 @@ jobs:

- run: yarn flow

- run: yarn test src --coverage --collectCoverageFrom=src/**/*.js
- run: yarn test src --coverage --collectCoverageFrom=src/**/*.ts

- uses: codecov/codecov-action@v5
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ on:
type: boolean

jobs:
build:
uses: ./.github/workflows/node.js.yml
node:
uses: ./.github/workflows/node.yml

codeql:
uses: ./.github/workflows/codeql-analysis.yml

release:
needs: [build, codeql]
needs: [node, codeql]
concurrency: release
runs-on: ubuntu-latest
outputs:
Expand All @@ -68,7 +68,7 @@ jobs:
skip-if-no-diff: ${{ inputs.skip-if-no-diff || true }}
diff-targets: ${{ inputs.diff-targets || '{index.*,lib/**/*,package.json,tsconfig.json,README.md,LICENSE}' }}

publish:
npm-publish:
needs: release
if: ${{ needs.release.outputs.skipped != 'true' }}
uses: ./.github/workflows/npm-publish.yml
Expand Down
1 change: 1 addition & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn install
1 change: 1 addition & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn install
3 changes: 3 additions & 0 deletions .husky/post-rewrite
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if test "$1" = "rebase"; then
yarn install
fi
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
VERSION=$(cat package.json | yarn --silent json 'version')
cat jsr.json | yarn --silent json -e 'this.version = "'"$VERSION"'"' > jsr.sync.json
mv -f jsr.sync.json jsr.json
git add jsr.json
yarn lint-staged
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@
.mergify.yml
.nvmrc
.github
.vscode
.husky
.prettierignore
.prettierrc.json

npm-debug.log*
yarn-debug.log*
yarn-error.log*

jsr.json
eslint.config.js
jest.config.js
Loading

0 comments on commit afbe6b9

Please sign in to comment.