From 85f196b56bf33b3dd70932e93816ef2a6dd0c6f8 Mon Sep 17 00:00:00 2001 From: Matthew McClure Date: Tue, 5 Sep 2023 13:09:41 -0700 Subject: [PATCH 1/2] update readme to include recent wizard-y additions --- README.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe50007..a007218 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,15 @@ export default function Page() { ```bash cd your-next-app -npm install @mux/next-video npx @mux/next-video init ``` -This will create a `/videos` directory in your project which is where you will put all video source files. +This will (with prompting): + +- install `@mux/next-video` as a dependency +- update your `next.config.js` file +- if you're using TypeScript, add types for your video file imports +- create a `/videos` directory in your project which is where you will put all video source files. It will also add a .gitignore file to the `/videos` directory that ignores video files. Videos, particularly any of reasonable size, shouldn't be stored/tracked by git. Alternatively, if you'd like to store the original files you can remove the added gitignore lines and install [git-lfs](https://git-lfs.github.com/). @@ -45,7 +49,9 @@ MUX_TOKEN_ID=[YOUR_TOKEN_ID] MUX_TOKEN_SECRET=[YOUR_TOKEN_SECRET] ``` -### Add Next Video to `next.config.js` +### If you choose to do things manually + +#### Add Next Video to `next.config.js` ```js /** @type {import('next').NextConfig} */ @@ -56,6 +62,18 @@ const nextConfig = {}; // Your current Next Config object module.exports = withNextVideo(nextConfig); ``` +#### Add video import types to `tsconfig.json` + +This is only required if you're using TypeScript, and makes sure your video file imports don't yell at you for missing types. + +```json +{ + // ... + "include": ["video.d.ts", "next-env.d.ts", ...] + // ... +} +``` + ## Usage ### Local videos From bc64543caf9dac9eef132e6e5cbcc632a1a75c71 Mon Sep 17 00:00:00 2001 From: Matthew McClure Date: Tue, 5 Sep 2023 13:25:02 -0700 Subject: [PATCH 2/2] js instead for prettiness --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a007218..ccea45a 100644 --- a/README.md +++ b/README.md @@ -64,12 +64,19 @@ module.exports = withNextVideo(nextConfig); #### Add video import types to `tsconfig.json` -This is only required if you're using TypeScript, and makes sure your video file imports don't yell at you for missing types. +This is only required if you're using TypeScript, and makes sure your video file imports don't yell at you for missing types. `video.d.ts` should have been created in your project root when you ran `npx @mux/next-video init`, if not you can create it manually: -```json +```ts +// video.d.ts +/// +``` + +Then add that file to the `include` array in `tsconfig.json`. + +```js { // ... - "include": ["video.d.ts", "next-env.d.ts", ...] + "include": ["video.d.ts", "next-env.d.ts", /* ... */ ] // ... } ```