From 92cb276175599003cade91159fc8a58615fb78f7 Mon Sep 17 00:00:00 2001 From: Kevin Hermawan Date: Tue, 16 Jul 2024 16:26:55 +0700 Subject: [PATCH 1/2] docs: adds development guide --- .github/workflows/code-quality.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- README.md | 16 ++++++++++++++++ apps/example-nextjs/src/components/navbar.tsx | 2 +- apps/example-nextjs/src/pages/_app.tsx | 2 +- package.json | 3 ++- 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index be00fdb..3b371b5 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -51,5 +51,5 @@ jobs: - name: Install dependencies run: npm install - - name: Build package - run: npm run build + - name: Build packages + run: npm run build:packages diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b44882e..5409433 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,8 +23,8 @@ jobs: - name: Install dependencies run: npm install - - name: Build package - run: npm run build + - name: Build packages + run: npm run build:packages - name: Release @hyperjumptech/react-next-pathname run: npm publish --provenance --access public diff --git a/README.md b/README.md index 6667168..c9cc46c 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,22 @@ const Sidebar = () => { Currently, the `@hyperjumptech/react-next-pathname-nextjs` package only supports the Page Router. If you are using the App Router, you can use the `@hyperjumptech/react-next-pathname` package. However, please note that it is not fully optimized for the App Router. +## Development Guide + +If this is the first time you have cloned the repository, run the following commands: + +```bash +npm install +npm run build:packages +``` + +If you want to run the example, navigate to the example app directory and run the development server: + +```bash +cd apps/example-nextjs +npm run dev +``` + ## License [MIT License](/LICENSE) diff --git a/apps/example-nextjs/src/components/navbar.tsx b/apps/example-nextjs/src/components/navbar.tsx index 897f892..080a34d 100644 --- a/apps/example-nextjs/src/components/navbar.tsx +++ b/apps/example-nextjs/src/components/navbar.tsx @@ -1,4 +1,4 @@ -import { useNextPathname } from "../../../../packages/react-next-pathname-nextjs/dist/index.mjs"; +import { useNextPathname } from "@hyperjumptech/react-next-pathname-nextjs"; import Link from "next/link"; const tabs = [ diff --git a/apps/example-nextjs/src/pages/_app.tsx b/apps/example-nextjs/src/pages/_app.tsx index 80fc287..76dd947 100644 --- a/apps/example-nextjs/src/pages/_app.tsx +++ b/apps/example-nextjs/src/pages/_app.tsx @@ -1,7 +1,7 @@ import "~/styles/globals.css"; import type { AppProps } from "next/app"; -import { NextPathnameProvider } from "../../../../packages/react-next-pathname-nextjs/dist/index.mjs"; +import { NextPathnameProvider } from "@hyperjumptech/react-next-pathname-nextjs"; import Navbar from "~/components/navbar"; export default function App({ Component, pageProps }: AppProps) { diff --git a/package.json b/package.json index 4a4becf..6c2ddd0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "react-next-pathname", "private": true, "scripts": { - "build": "turbo build", + "build:packages": "turbo run build --filter=@hyperjumptech/*", + "build:apps": "turbo run build --filter=example-*", "lint": "turbo lint", "test": "turbo test", "test:coverage": "turbo test:coverage" From 299ddd4f86663605cd0bfcb393ff92403e2b564f Mon Sep 17 00:00:00 2001 From: Kevin Hermawan Date: Tue, 16 Jul 2024 16:36:14 +0700 Subject: [PATCH 2/2] docs: adds a note --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index c9cc46c..fa022d2 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,12 @@ cd apps/example-nextjs npm run dev ``` +Every time you make changes in packages and want to see them in the example app, you need to run: + +```bash +npm run build:packages +``` + ## License [MIT License](/LICENSE)