diff --git a/.eslintrc.json b/.eslintrc.json index 6412f23..101fc96 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,6 +2,9 @@ "extends": ["plugin:@typescript-eslint/recommended", "plugin:react/recommended"], "parser": "@typescript-eslint/parser", "plugins": ["react", "@typescript-eslint"], + "settings": { + "react": { "version": "detect" } + }, "rules": { "comma-spacing": "warn", "react/display-name": "off", diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..499c82e --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,42 @@ +name: Check + +on: + pull_request: + paths: + - 'lib/**' + - 'test/**' + - '.eslintrc.json' + - 'tsconfig.json' + - '.github/workflows/check.yml' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'yarn' + - run: yarn install --immutable + - run: yarn lint + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'yarn' + - run: yarn install --immutable + - run: yarn tsc + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'yarn' + - run: yarn install --immutable + - run: yarn test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3a4780f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release + +on: + push: + branches: ['main'] + paths: + - '**/package.json' + - '.changeset/**' + - '.github/workflows/release.yml' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'yarn' + - run: yarn install --immutable + - uses: changesets/action@v1 + with: + publish: yarn ci:release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/package.json b/package.json index d384614..e6e628a 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "dev": "vite", "build": "tsc && vite build", "test": "vitest", + "lint": "eslint lib test example --max-warnings 0", "ci:release": "yarn build && yarn changeset publish" }, "type": "module",