diff --git a/.changeset/tiny-kangaroos-kneel.md b/.changeset/tiny-kangaroos-kneel.md new file mode 100644 index 0000000..92534cb --- /dev/null +++ b/.changeset/tiny-kangaroos-kneel.md @@ -0,0 +1,8 @@ +--- +"next-headers": patch +"@nextheaders/docs": patch +"eslint-config-nextheaders": patch +"@nextheaders/tsconfig": patch +--- + +Make the version starting at 13.4.4 because it didn't work on previous versions diff --git a/README.md b/README.md index 4732bbd..3962a9b 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,9 @@ -# Turborepo Design System starter with Changesets +# next-headers -This is an official React design system starter powered by Turborepo. Versioning and package publishing is handled by [Changesets](https://github.com/changesets/changesets) and fully automated with GitHub Actions. +A (very) tiny wrapper to allow you to use Next.js's `cookies()` and `headers()` functions in your middleware. -## Using this example +![publish size](https://badgen.net/packagephobia/publish/next-headers) ![Tree shaking supported](https://badgen.net/bundlephobia/tree-shaking/next-headers) [](https://www.npmjs.com/package/next-headers) -Run the following command: +## Documentation -```sh -npx create-turbo@latest -e with-changesets -``` - -## What's inside? - -This Turborepo includes the following: - -### Apps and Packages - -- `docs`: A placeholder documentation site powered by [Next.js](https://nextjs.org/) -- `@nextheaders/core`: core React components -- `@nextheaders/tsconfig`: shared `tsconfig.json`s used throughout the monorepo -- `eslint-config-nextheaders`: ESLint preset - -Each package and app is 100% [TypeScript](https://www.typescriptlang.org/). - -### Utilities - -This Turborepo has some additional tools already setup for you: - -- [TypeScript](https://www.typescriptlang.org/) for static type checking -- [ESLint](https://eslint.org/) for code linting -- [Prettier](https://prettier.io) for code formatting - -### Useful commands - -- `yarn build` - Build all packages and the docs site -- `yarn dev` - Develop all packages and the docs site -- `yarn lint` - Lint all packages -- `yarn changeset` - Generate a changeset -- `yarn clean` - Clean up all `node_modules` and `dist` folders (runs each package's clean script) - -## Versioning and Publishing packages - -Package publishing has been configured using [Changesets](https://github.com/changesets/changesets). Please review their [documentation](https://github.com/changesets/changesets#documentation) to familiarize yourself with the workflow. - -This example comes with automated npm releases setup in a [GitHub Action](https://github.com/changesets/action). To get this working, you will need to create an `NPM_TOKEN` and `GITHUB_TOKEN` in your repository settings. You should also install the [Changesets bot](https://github.com/apps/changeset-bot) on your GitHub repository as well. - -For more information about this automation, refer to the official [changesets documentation](https://github.com/changesets/changesets/blob/main/docs/automating-changesets.md) - -### npm - -If you want to publish package to the public npm registry and make them publicly available, this is already setup. - -To publish packages to a private npm organization scope, **remove** the following from each of the `package.json`'s - -```diff -- "publishConfig": { -- "access": "public" -- }, -``` - -### GitHub Package Registry - -See [Working with the npm registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#publishing-a-package-using-publishconfig-in-the-packagejson-file) +Read the [documentation](https://github.com/raphaelbadia/next-headers/blob/main/packages/next-headers/README.md) for more information. diff --git a/apps/example/package.json b/apps/example/package.json index 68f60ea..042e815 100644 --- a/apps/example/package.json +++ b/apps/example/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "next-headers": "*", - "next": "^13.4.1", + "next": "^13.4.4", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/packages/next-headers/README.md b/packages/next-headers/README.md index b9a22af..13a3bed 100644 --- a/packages/next-headers/README.md +++ b/packages/next-headers/README.md @@ -8,6 +8,10 @@ A (very) tiny wrapper to allow you to use Next.js's `cookies()` and `headers()` Next.js's `cookies()` and `headers()` functions are only available in app directory. This means that if you want to use them in your middleware, you need to pass the request object from your middleware to every function down the stream. This can get messy, especially if you have multiple layers of middlewares, or if you have shared logic between your middleware and server code. +## Warning + +This plugin works only from next@13.4.4 ! If you are using an older version, please upgrade. + ## Installation ### npm diff --git a/packages/next-headers/package.json b/packages/next-headers/package.json index b515fe8..414a278 100644 --- a/packages/next-headers/package.json +++ b/packages/next-headers/package.json @@ -23,13 +23,13 @@ "eslint": "^7.32.0", "eslint-config-nextheaders": "*", "jest": "^29.5.0", - "next": "^13.0.0", + "next": "^13.4.4", "ts-jest": "^29.1.1", "tsup": "^5.10.1", "typescript": "^5.1.6" }, "peerDependencies": { - "next": "*" + "next": "^13.4.4" }, "publishConfig": { "access": "public" diff --git a/yarn.lock b/yarn.lock index 0f4b3ff..ceccec2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -819,6 +819,11 @@ globby "^11.0.0" read-yaml-file "^1.1.0" +"@next/env@13.4.4": + version "13.4.4" + resolved "https://registry.yarnpkg.com/@next/env/-/env-13.4.4.tgz#46b620f6bef97fe67a1566bf570dbb791d40c50a" + integrity sha512-q/y7VZj/9YpgzDe64Zi6rY1xPizx80JjlU2BTevlajtaE3w1LqweH1gGgxou2N7hdFosXHjGrI4OUvtFXXhGLg== + "@next/env@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/env/-/env-13.4.7.tgz#ca12d341edb128ca70384635bd2794125ffb1c01" @@ -831,46 +836,91 @@ dependencies: glob "7.1.7" +"@next/swc-darwin-arm64@13.4.4": + version "13.4.4" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.4.tgz#8c14083c2478e2a9a8d140cce5900f76b75667ff" + integrity sha512-xfjgXvp4KalNUKZMHmsFxr1Ug+aGmmO6NWP0uoh4G3WFqP/mJ1xxfww0gMOeMeSq/Jyr5k7DvoZ2Pv+XOITTtw== + "@next/swc-darwin-arm64@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.7.tgz#5e36c26dda5b0bc0ea15d8555d0abd71a1ef4b5d" integrity sha512-VZTxPv1b59KGiv/pZHTO5Gbsdeoxcj2rU2cqJu03btMhHpn3vwzEK0gUSVC/XW96aeGO67X+cMahhwHzef24/w== +"@next/swc-darwin-x64@13.4.4": + version "13.4.4" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.4.tgz#5fe01c65c80fcb833c8789fd70f074ea99893864" + integrity sha512-ZY9Ti1hkIwJsxGus3nlubIkvYyB0gNOYxKrfsOrLEqD0I2iCX8D7w8v6QQZ2H+dDl6UT29oeEUdDUNGk4UEpfg== + "@next/swc-darwin-x64@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.7.tgz#4c14ec14b200373cd602589086cb1253a28cd803" integrity sha512-gO2bw+2Ymmga+QYujjvDz9955xvYGrWofmxTq7m70b9pDPvl7aDFABJOZ2a8SRCuSNB5mXU8eTOmVVwyp/nAew== +"@next/swc-linux-arm64-gnu@13.4.4": + version "13.4.4" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.4.tgz#f2e071f38e8a6cdadf507cc5d28956f73360d064" + integrity sha512-+KZnDeMShYkpkqAvGCEDeqYTRADJXc6SY1jWXz+Uo6qWQO/Jd9CoyhTJwRSxvQA16MoYzvILkGaDqirkRNctyA== + "@next/swc-linux-arm64-gnu@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.7.tgz#e7819167ec876ddac5a959e4c7bce4d001f0e924" integrity sha512-6cqp3vf1eHxjIDhEOc7Mh/s8z1cwc/l5B6ZNkOofmZVyu1zsbEM5Hmx64s12Rd9AYgGoiCz4OJ4M/oRnkE16/Q== +"@next/swc-linux-arm64-musl@13.4.4": + version "13.4.4" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.4.tgz#23bf75c544e54562bc24ec1be036e4bd9cf89e2c" + integrity sha512-evC1twrny2XDT4uOftoubZvW3EG0zs0ZxMwEtu/dDGVRO5n5pT48S8qqEIBGBUZYu/Xx4zzpOkIxx1vpWdE+9A== + "@next/swc-linux-arm64-musl@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.7.tgz#0cac0f01d4e308b439e6c33182bed77835fe383b" integrity sha512-T1kD2FWOEy5WPidOn1si0rYmWORNch4a/NR52Ghyp4q7KyxOCuiOfZzyhVC5tsLIBDH3+cNdB5DkD9afpNDaOw== +"@next/swc-linux-x64-gnu@13.4.4": + version "13.4.4" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.4.tgz#bd42590950a01957952206f89cf5622e7c9e4196" + integrity sha512-PX706XcCHr2FfkyhP2lpf+pX/tUvq6/ke7JYnnr0ykNdEMo+sb7cC/o91gnURh4sPYSiZJhsF2gbIqg9rciOHQ== + "@next/swc-linux-x64-gnu@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.7.tgz#feb61e16a68c67f3ef230f30d9562a3783c7bd59" integrity sha512-zaEC+iEiAHNdhl6fuwl0H0shnTzQoAoJiDYBUze8QTntE/GNPfTYpYboxF5LRYIjBwETUatvE0T64W6SKDipvg== +"@next/swc-linux-x64-musl@13.4.4": + version "13.4.4" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.4.tgz#907d81feb1abec3daec0ecb61e3f39b56e7aeafe" + integrity sha512-TKUUx3Ftd95JlHV6XagEnqpT204Y+IsEa3awaYIjayn0MOGjgKZMZibqarK3B1FsMSPaieJf2FEAcu9z0yT5aA== + "@next/swc-linux-x64-musl@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.7.tgz#02179ecfa6d24a2956c2b54f7d27a050568bbf24" integrity sha512-X6r12F8d8SKAtYJqLZBBMIwEqcTRvUdVm+xIq+l6pJqlgT2tNsLLf2i5Cl88xSsIytBICGsCNNHd+siD2fbWBA== +"@next/swc-win32-arm64-msvc@13.4.4": + version "13.4.4" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.4.tgz#1d754d2bb10bdf9907c0acc83711438697c3b5fe" + integrity sha512-FP8AadgSq4+HPtim7WBkCMGbhr5vh9FePXiWx9+YOdjwdQocwoCK5ZVC3OW8oh3TWth6iJ0AXJ/yQ1q1cwSZ3A== + "@next/swc-win32-arm64-msvc@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.7.tgz#274b7f00a2ec5934af73db15da8459e8647bfaed" integrity sha512-NPnmnV+vEIxnu6SUvjnuaWRglZzw4ox5n/MQTxeUhb5iwVWFedolPFebMNwgrWu4AELwvTdGtWjqof53AiWHcw== +"@next/swc-win32-ia32-msvc@13.4.4": + version "13.4.4" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.4.tgz#77b2c7f7534b675d46e46301869e08d504d23956" + integrity sha512-3WekVmtuA2MCdcAOrgrI+PuFiFURtSyyrN1I3UPtS0ckR2HtLqyqmS334Eulf15g1/bdwMteePdK363X/Y9JMg== + "@next/swc-win32-ia32-msvc@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.7.tgz#4a95c106a6db2eee3a4c1352b77995e298d7446a" integrity sha512-6Hxijm6/a8XqLQpOOf/XuwWRhcuc/g4rBB2oxjgCMuV9Xlr2bLs5+lXyh8w9YbAUMYR3iC9mgOlXbHa79elmXw== +"@next/swc-win32-x64-msvc@13.4.4": + version "13.4.4" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.4.tgz#faab69239f8a9d0be7cd473e65f5a07735ef7b0e" + integrity sha512-AHRITu/CrlQ+qzoqQtEMfaTu7GHaQ6bziQln/pVWpOYC1wU+Mq6VQQFlsDtMCnDztPZtppAXdvvbNS7pcfRzlw== + "@next/swc-win32-x64-msvc@13.4.7": version "13.4.7" resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.7.tgz#5137780f58d7f0230adc293a0429821bfa7d8c21" @@ -3813,7 +3863,30 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -next@^13.0.0, next@^13.4.1: +next@13.4.4: + version "13.4.4" + resolved "https://registry.yarnpkg.com/next/-/next-13.4.4.tgz#d1027c8d77f4c51be0b39f671b4820db03c93e60" + integrity sha512-C5S0ysM0Ily9McL4Jb48nOQHT1BukOWI59uC3X/xCMlYIh9rJZCv7nzG92J6e1cOBqQbKovlpgvHWFmz4eKKEA== + dependencies: + "@next/env" "13.4.4" + "@swc/helpers" "0.5.1" + busboy "1.6.0" + caniuse-lite "^1.0.30001406" + postcss "8.4.14" + styled-jsx "5.1.1" + zod "3.21.4" + optionalDependencies: + "@next/swc-darwin-arm64" "13.4.4" + "@next/swc-darwin-x64" "13.4.4" + "@next/swc-linux-arm64-gnu" "13.4.4" + "@next/swc-linux-arm64-musl" "13.4.4" + "@next/swc-linux-x64-gnu" "13.4.4" + "@next/swc-linux-x64-musl" "13.4.4" + "@next/swc-win32-arm64-msvc" "13.4.4" + "@next/swc-win32-ia32-msvc" "13.4.4" + "@next/swc-win32-x64-msvc" "13.4.4" + +next@^13.0.0: version "13.4.7" resolved "https://registry.yarnpkg.com/next/-/next-13.4.7.tgz#2ab20e6fada2e25cb81bd17f68956705ffd9824e" integrity sha512-M8z3k9VmG51SRT6v5uDKdJXcAqLzP3C+vaKfLIAM0Mhx1um1G7MDnO63+m52qPdZfrTFzMZNzfsgvm3ghuVHIQ==