-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade docs/preview to Vite and TW4 (#2240)
* Remove tailwind v3 from example * Migrate to Vite * Fix reading and reloading docs * Tailwind v4 * Check variables before starting * Update Readme * Remove build command from docs-preview utility * Dedup package-lock.json, bump ws dependency
- Loading branch information
Showing
16 changed files
with
787 additions
and
427 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 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 |
---|---|---|
@@ -1,3 +1 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
@import 'tailwindcss'; |
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,7 @@ | ||
/// <reference types="vite/client" /> | ||
/// <reference types="@remix-run/node" /> | ||
|
||
declare module 'virtual:docs.json' { | ||
const value: Array<Record<string, any>>; | ||
export default value; | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,43 @@ | ||
import path from 'node:path'; | ||
import {defineConfig} from 'vite'; | ||
import {vitePlugin as remix} from '@remix-run/dev'; | ||
import tsconfigPaths from 'vite-tsconfig-paths'; | ||
import tailwindcss from '@tailwindcss/vite'; | ||
|
||
const {INIT_CWD, GEN_DOCS_PATH} = process.env; | ||
|
||
if (!GEN_DOCS_PATH && INIT_CWD === process.env.PWD) { | ||
const message = | ||
'\n\nRun this utility from a directory that contains a generated docs folder,\n' + | ||
'or set the `GEN_DOCS_PATH` environment variable to the path of the generated docs folder.\n\n'; | ||
const error = new Error(message); | ||
error.stack = ''; | ||
throw error; | ||
} | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
remix({ | ||
ignoredRouteFiles: ['**/.*'], | ||
future: { | ||
v3_fetcherPersist: false, | ||
v3_relativeSplatPath: false, | ||
v3_throwAbortReason: false, | ||
}, | ||
}), | ||
tsconfigPaths(), | ||
tailwindcss(), | ||
{ | ||
name: 'docs:preview', | ||
resolveId(id) { | ||
if (id.startsWith('virtual:docs.json')) { | ||
return { | ||
id: | ||
GEN_DOCS_PATH ?? | ||
path.join(INIT_CWD, 'docs/generated/generated_docs_data.json'), | ||
}; | ||
} | ||
}, | ||
}, | ||
], | ||
}); |
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.