-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrating to turborepo & tsup continued
- Loading branch information
Showing
54 changed files
with
3,487 additions
and
1,869 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
This file was deleted.
Oops, something went wrong.
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,68 @@ | ||
# https://github.com/actions/starter-workflows/blob/main/pages/nextjs.yml | ||
# Sample workflow for building and deploying a Next.js site to GitHub Pages | ||
# | ||
# To get started with Next.js see: https://nextjs.org/docs/getting-started | ||
# | ||
name: Deploy Next.js site to Pages | ||
|
||
on: | ||
# Runs when `Quality` workflow gets completed on `main` branch | ||
workflow_run: | ||
branches: ['main'] | ||
workflows: ['Quality'] | ||
types: | ||
- completed | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: 'pages' | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
# Since `workflow_run` only has 3 activity types (`completed`, `requested` and `in_progress`), | ||
# even if `Quality` workflow gets completed by failing, this workflow starts to run. | ||
# To prevent this, we add a condition here. | ||
# https://github.com/orgs/community/discussions/26238#discussioncomment-3250901 | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- name: Install | ||
uses: ./.github/composite-actions/install | ||
- name: Build with Next.js | ||
run: npm run build -- --filter=demo | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./apps/demo/out | ||
|
||
# Deployment job | ||
deploy: | ||
# Since `workflow_run` only has 3 activity types (`completed`, `requested` and `in_progress`), | ||
# even if `Quality` workflow gets completed by failing, this workflow starts to run. | ||
# To prevent this, we add a condition here. | ||
# https://github.com/orgs/community/discussions/26238#discussioncomment-3250901 | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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 |
---|---|---|
|
@@ -27,7 +27,6 @@ out/ | |
build | ||
dist | ||
|
||
|
||
# Debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
|
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,2 +1,2 @@ | ||
npx lint-staged | ||
npm run typecheck | ||
npm run types:check |
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 @@ | ||
20 |
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,136 @@ | ||
# Contributing | ||
|
||
This repository is created by using [Turborepo](https://turbo.build/repo). To understand the repository structure better, please check its [documentation](https://turbo.build/repo/docs). | ||
|
||
## Local Development | ||
|
||
After cloning the repository, we need to install the dependencies. | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
To start the demo Next.js app which uses the local version of `react-infinite-scroll-hook`, we can run `dev` script. | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
After this, we can open `http://localhost:3000` in the browser to display the app. | ||
|
||
## Code Quality Checks | ||
|
||
We use automated checks by using [ESLint](https://eslint.org/), [Prettier](https://prettier.io/) and [TypeScript](https://www.typescriptlang.org/) to provide the highest quality code as it can be. | ||
|
||
All checks are run automatically before committing by using [husky](https://github.com/typicode/husky) and [lint-staged](https://github.com/lint-staged/lint-staged). | ||
|
||
The checks can be run manually by running the below command too. | ||
|
||
```bash | ||
npm run codequality:check | ||
``` | ||
|
||
And the same checks can be run also by enabling fixes for auto-fixable issues. | ||
|
||
```bash | ||
npm run codequality:fix | ||
``` | ||
|
||
`codequality` scripts run underlying ESLint (`lint`), Prettier (`format`) and TypeScript (`types`) scripts. To run these tools individually, we can also use the below scripts. | ||
|
||
```bash | ||
# ESLint checks | ||
npm run lint:check | ||
# ESLint fixes | ||
npm run lint:fix | ||
|
||
# Prettier checks | ||
npm run format:check | ||
# Prettier fixes | ||
npm run format:fix | ||
|
||
# TypeScript checks | ||
npm run types:check | ||
# There is no auto-fix script for TypeScript. | ||
``` | ||
|
||
## Updating Dependencies | ||
|
||
We use `npm-check-updates` package to automatically check if there are newer versions of our dependencies. | ||
|
||
To run it, we can use the below command. It starts an interactive CLI to check the dependencies of all the apps and packages, including the root dependencies. | ||
|
||
```bash | ||
npm run updates:check | ||
``` | ||
|
||
## Adding Contributors | ||
|
||
[all-contributors-cli](https://github.com/all-contributors/cli) is used for maintaining the contributors of this repository. | ||
|
||
To add a new contributor, we can run the below command and follow its instructions. | ||
|
||
```bash | ||
npm run contributors:add | ||
``` | ||
|
||
## Prepublish Checks | ||
|
||
To be sure everything is OK with the latest changes, we can use [publint](https://publint.dev/) and [Are the Types Wrong](https://github.com/arethetypeswrong/arethetypeswrong.github.io). | ||
|
||
Firstly, we need to build the bundle with the latest changes. | ||
|
||
```bash | ||
npm run build:bundle | ||
``` | ||
|
||
This command will create (or update) the `packages/react-infinite-scroll-hook/dist` folder, which will be used by the clients of this package. | ||
|
||
To be sure the output is OK for ESM and CJS clients, we can run the below commands and check their outputs. | ||
|
||
```bash | ||
# For `publint` | ||
npm run publint:check -w react-infinite-scroll-hook | ||
|
||
# For `Are the Types Wrong` | ||
npm run attw:check -w react-infinite-scroll-hook | ||
``` | ||
|
||
To see the content of the package which can be uploaded to [npm](https://www.npmjs.com/) can be seen by using the below command. It will create a tarball from `react-infinite-scroll-hook` package. | ||
|
||
```bash | ||
npm pack -w react-infinite-scroll-hook | ||
``` | ||
|
||
Or the below command can be used to only check the tarball contents without creating it. | ||
|
||
```bash | ||
npm pack --dry-run -w react-infinite-scroll-hook | ||
``` | ||
|
||
Lastly, we can run the below command to auto correct common errors in `package.json` of the package to be published. `npm publish` command already does these auto-fixes too. | ||
|
||
```bash | ||
npm pkg fix -w react-infinite-scroll-hook | ||
``` | ||
|
||
## Publishing the Package | ||
|
||
Firstly, we need to bump the package version which can be done by using the below commands. | ||
|
||
```bash | ||
npm version patch -w react-infinite-scroll-hook | ||
# Bumps the patch number like 0.0.0 -> 0.0.1 | ||
|
||
npm version minor -w react-infinite-scroll-hook | ||
# Bumps the patch number like 0.0.x -> 0.1.0 | ||
|
||
npm version major -w react-infinite-scroll-hook | ||
# Bumps the patch number like 0.x.y -> 1.0.0 | ||
``` | ||
|
||
And we can publish the new version now 🚀 | ||
|
||
```bash | ||
npm publish -w react-infinite-scroll-hook | ||
``` |
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.