-
Notifications
You must be signed in to change notification settings - Fork 7
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
48 changed files
with
2,937 additions
and
1,941 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,62 @@ | ||
# 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: | ||
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: | ||
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,14 @@ | ||
{ | ||
// Use the files.associations setting to tell VS Code to always open .css files in Tailwind CSS mode: | ||
// https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss | ||
"files.associations": { | ||
"*.css": "tailwindcss" | ||
}, | ||
// By default VS Code will not trigger completions when editing "string" content, | ||
// for example within JSX attribute values. | ||
// Updating the editor.quickSuggestions setting may improve your experience: | ||
// https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss | ||
"editor.quickSuggestions": { | ||
"strings": "on" | ||
} | ||
} |
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,134 @@ | ||
# 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-intersection-obverser-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-intersection-observer-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-intersection-observer-hook | ||
|
||
# For `Are the Types Wrong` | ||
npm run attw:check -w react-intersection-observer-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-intersection-observer-hook` package. | ||
|
||
```bash | ||
npm pack -w react-intersection-observer-hook | ||
``` | ||
|
||
Or the below command can be used to only check the tarball contents without creating it. | ||
|
||
```bash | ||
npm pack --dry-run -w react-intersection-observer-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-intersection-observer-hook | ||
``` | ||
|
||
## Publish | ||
Firstly, we need to bump the package version which can be done by using the below commands. | ||
|
||
```bash | ||
npm version patch -w react-intersection-observer-hook | ||
# Bumps the patch number like 0.0.0 -> 0.0.1 | ||
|
||
npm version minor -w react-intersection-observer-hook | ||
# Bumps the patch number like 0.0.x -> 0.1.0 | ||
|
||
npm version major -w react-intersection-observer-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-intersection-observer-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.