Skip to content

Commit

Permalink
update dependencies (#186)
Browse files Browse the repository at this point in the history
* update dependencies

* sort generated route types

* fix optional-catch-all types

fixes #183

* Add trailingSlash option to route

fix #168

* publish 2.2.0
  • Loading branch information
tatethurston authored May 27, 2024
1 parent 5add8c2 commit 49e3ae3
Show file tree
Hide file tree
Showing 23 changed files with 2,223 additions and 1,958 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ node_modules
tsconfig.tsbuildinfo
.next
.vscode
# copied over durring build
packages/nextjs-routes/LICENSE
packages/nextjs-routes/README.md
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2.2.0

- Add `trailingSlash` option to `route`. See [#168](https://github.com/tatethurston/nextjs-routes/issues/168)
- Fix the generated optional catch all route type. See [#183](https://github.com/tatethurston/nextjs-routes/issues/183)
- Sort the generated route types lexicographically.

## 2.1.0

- Add experimental support for app directory [route handler](https://nextjs.org/docs/app/building-your-application/routing/route-handlers). See [#178](https://github.com/tatethurston/nextjs-routes/issues/178).
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,18 @@ export function getServerSideProps(context: GetServerSidePropsContext) {
}
```

`route` optionally accepts a `trailingSlash`:

```ts
// api/foos/foobar/
fetch(
route(
{ pathname: "/api/foos/[foo]", query: { foo: "foobar" } },
{ trailingSlash: true },
),
);
```

### Internationalization (i18n)

`nextjs-routes` refines `Link` and `useRouter` based on your [Nextjs i18n configuration](https://nextjs.org/docs/advanced-features/i18n-routing).
Expand Down
6 changes: 3 additions & 3 deletions examples/app/@types/nextjs-routes.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
// This file will be automatically regenerated when your Next.js server is running.
// nextjs-routes version: 2.0.1
// nextjs-routes version: 2.2.0
/* eslint-disable */

// prettier-ignore
Expand All @@ -11,8 +11,8 @@ declare module "nextjs-routes" {
} from "next";

export type Route =
| DynamicRoute<"/[store]", { "store": string }>
| StaticRoute<"/">;
| StaticRoute<"/">
| DynamicRoute<"/[store]", { "store": string }>;

interface StaticRoute<Pathname> {
pathname: Pathname;
Expand Down
3 changes: 0 additions & 3 deletions examples/app/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import nextRoutes from "nextjs-routes/config";
const withRoutes = nextRoutes();

const nextConfig = {
experimental: {
appDir: true,
},
reactStrictMode: true,
};

Expand Down
16 changes: 8 additions & 8 deletions examples/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
"start": "next start"
},
"dependencies": {
"next": "^14.0.1",
"react": "18.2.0",
"react-dom": "18.2.0"
"next": "^14.2.3",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/node": "20.8.10",
"@types/react": "18.2.34",
"eslint": "8.53.0",
"eslint-config-next": "14.0.1",
"@types/node": "20.12.12",
"@types/react": "18.3.3",
"eslint": "8.57.0",
"eslint-config-next": "14.2.3",
"nextjs-routes": "workspace:*",
"typescript": "5.2.2"
"typescript": "5.4.5"
}
}
1 change: 1 addition & 0 deletions examples/cjs/__test__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("Home", () => {
it("renders a Link", () => {
render(<Home />);
const link = screen.getByText("Foo");
// @ts-expect-error: https://github.com/testing-library/jest-dom/issues/546
expect(link).toBeInTheDocument();
});
});
22 changes: 10 additions & 12 deletions examples/cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@
"start": "next start"
},
"dependencies": {
"next": "^14.0.1",
"react": "18.2.0",
"react-dom": "18.2.0"
"next": "^14.2.3",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.7",
"@types/node": "20.8.10",
"@types/react": "18.2.34",
"@types/testing-library__jest-dom": "^5.14.8",
"eslint": "8.53.0",
"eslint-config-next": "14.0.1",
"@testing-library/react": "^15.0.7",
"@types/jest": "^29.5.12",
"@types/node": "20.12.12",
"@types/react": "18.3.3",
"eslint": "^8.57.0",
"eslint-config-next": "14.2.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"nextjs-routes": "workspace:*",
"typescript": "5.2.2"
"typescript": "5.4.5"
}
}
6 changes: 3 additions & 3 deletions examples/cjs/types/nextjs-routes.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
// This file will be automatically regenerated when your Next.js server is running.
// nextjs-routes version: 2.0.1
// nextjs-routes version: 2.2.0
/* eslint-disable */

// prettier-ignore
Expand All @@ -11,8 +11,8 @@ declare module "nextjs-routes" {
} from "next";

export type Route =
| DynamicRoute<"/bars/[bar]", { "bar": string }>
| StaticRoute<"/">;
| StaticRoute<"/">
| DynamicRoute<"/bars/[bar]", { "bar": string }>;

interface StaticRoute<Pathname> {
pathname: Pathname;
Expand Down
6 changes: 3 additions & 3 deletions examples/intl/@types/nextjs-routes.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
// This file will be automatically regenerated when your Next.js server is running.
// nextjs-routes version: 2.0.1
// nextjs-routes version: 2.2.0
/* eslint-disable */

// prettier-ignore
Expand All @@ -11,8 +11,8 @@ declare module "nextjs-routes" {
} from "next";

export type Route =
| DynamicRoute<"/[store]", { "store": string }>
| StaticRoute<"/">;
| StaticRoute<"/">
| DynamicRoute<"/[store]", { "store": string }>;

interface StaticRoute<Pathname> {
pathname: Pathname;
Expand Down
16 changes: 8 additions & 8 deletions examples/intl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"start": "next start"
},
"dependencies": {
"next": "^14.0.1",
"react": "18.2.0",
"react-dom": "18.2.0"
"next": "^14.2.3",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/node": "20.8.10",
"@types/react": "18.2.34",
"eslint": "8.53.0",
"eslint-config-next": "14.0.1",
"@types/node": "20.12.12",
"@types/react": "18.3.3",
"eslint": "8.57.0",
"eslint-config-next": "14.2.3",
"nextjs-routes": "workspace:*",
"typescript": "5.2.2"
"typescript": "5.4.5"
}
}
1 change: 1 addition & 0 deletions examples/typescript/__test__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("Home", () => {
it("renders a Link", () => {
render(<Home />);
const link = screen.getByText("Foo");
// @ts-expect-error: https://github.com/testing-library/jest-dom/issues/546
expect(link).toBeInTheDocument();
});
});
22 changes: 10 additions & 12 deletions examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@
"start": "next start"
},
"dependencies": {
"next": "^14.0.1",
"react": "18.2.0",
"react-dom": "18.2.0"
"next": "^14.2.3",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.7",
"@types/node": "20.8.10",
"@types/react": "18.2.34",
"@types/testing-library__jest-dom": "^5.14.8",
"eslint": "8.53.0",
"eslint-config-next": "14.0.1",
"@testing-library/react": "^15.0.7",
"@types/jest": "^29.5.12",
"@types/node": "20.12.12",
"@types/react": "18.3.3",
"eslint": "8.57.0",
"eslint-config-next": "14.2.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"nextjs-routes": "workspace:*",
"typescript": "5.2.2"
"typescript": "5.4.5"
}
}
6 changes: 3 additions & 3 deletions examples/typescript/types/nextjs-routes.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
// This file will be automatically regenerated when your Next.js server is running.
// nextjs-routes version: 2.0.1
// nextjs-routes version: 2.2.0
/* eslint-disable */

// prettier-ignore
Expand All @@ -11,10 +11,10 @@ declare module "nextjs-routes" {
} from "next";

export type Route =
| StaticRoute<"/">
| StaticRoute<"/api/hello">
| DynamicRoute<"/bars/[bar]", { "bar": string }>
| DynamicRoute<"/foos/[foo]", { "foo": string }>
| StaticRoute<"/">;
| DynamicRoute<"/foos/[foo]", { "foo": string }>;

interface StaticRoute<Pathname> {
pathname: Pathname;
Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@
},
"sideEffects": false,
"devDependencies": {
"@babel/preset-env": "^7.23.2",
"@babel/preset-typescript": "^7.23.2",
"@swc/core": "^1.3.95",
"@types/jest": "^29.5.7",
"@types/node": "^20.8.10",
"@types/react": "^18.2.34",
"@types/webpack": "^5.28.4",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@babel/preset-env": "^7.24.6",
"@babel/preset-typescript": "^7.24.6",
"@swc/core": "^1.5.7",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.12",
"@types/react": "^18.3.3",
"@types/webpack": "^5.28.5",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"babel-loader": "^9.1.3",
"codecov": "^3.8.3",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"husky": "^8.0.3",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"husky": "^9.0.11",
"jest": "^29.7.0",
"next": "^14.0.1",
"prettier": "^3.0.3",
"next": "^14.2.3",
"prettier": "^3.2.5",
"prettier-package-json": "^2.8.0",
"swc-loader": "^0.2.3",
"typescript": "^5.2.2",
"webpack": "^5.89.0",
"swc-loader": "^0.2.6",
"typescript": "^5.4.5",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"packageManager": "pnpm@8.10.2"
Expand Down
6 changes: 3 additions & 3 deletions packages/e2e/@types/nextjs-routes.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
// This file will be automatically regenerated when your Next.js server is running.
// nextjs-routes version: 2.0.1
// nextjs-routes version: 2.2.0
/* eslint-disable */

// prettier-ignore
Expand All @@ -11,9 +11,9 @@ declare module "nextjs-routes" {
} from "next";

export type Route =
| StaticRoute<"/">
| DynamicRoute<"/[...slug]", { "slug": string[] }>
| DynamicRoute<"/foos/[foo]", { "foo": string }>
| StaticRoute<"/">;
| DynamicRoute<"/foos/[foo]", { "foo": string }>;

interface StaticRoute<Pathname> {
pathname: Pathname;
Expand Down
8 changes: 4 additions & 4 deletions packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"start": "next start"
},
"dependencies": {
"next": "^14.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "^14.2.3",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"nextjs-routes": "workspace:*",
"typescript": "^5.2.2"
"typescript": "^5.4.5"
}
}
4 changes: 2 additions & 2 deletions packages/nextjs-routes/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nextjs-routes",
"version": "2.1.0",
"version": "2.2.0",
"description": "Type safe routing for Next.js",
"license": "MIT",
"author": "Tate <tatethurston@gmail.com>",
Expand Down Expand Up @@ -31,7 +31,7 @@
},
"sideEffects": false,
"dependencies": {
"chokidar": "^3.5.3"
"chokidar": "^3.6.0"
},
"peerDependencies": {
"next": "*"
Expand Down
Loading

0 comments on commit 49e3ae3

Please sign in to comment.