Skip to content

Commit

Permalink
added warning message that package is deprecated (#152)
Browse files Browse the repository at this point in the history
* added warning message that package is deprecated

* comments updated

* added unused binaries in knip ignore binaries

* changed the message

---------

Co-authored-by: Alem Tuzlak <[email protected]>
  • Loading branch information
abrulic1 and AlemTuzlak authored Oct 8, 2024
1 parent 5081e7a commit 85c6619
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ dist

# IDE
.idea
.tsup
.tsup
14 changes: 14 additions & 0 deletions src/vite/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ type RemixViteConfig = {
/** The directory where the remix app is located. Defaults to the "./app" relative to where vite.config is being defined. */
remixDir?: string
editor?: EditorConfig
/**
* If the package is marked as deprecated, a warning will be logged in the console
* To disable this warning, set the option to true
* @default false
*/
suppressDeprecationWarning?: boolean
}

export const defineRdtConfig = (config: RemixViteConfig) => config
Expand Down Expand Up @@ -167,6 +173,14 @@ export const remixDevTools: (args?: RemixViteConfig) => Plugin[] = (args) => {
return shouldInject(config.mode)
},
async configResolved(resolvedViteConfig) {
if (!args?.suppressDeprecationWarning && resolvedViteConfig.appType === "custom") {
// Log a warning message
console.log(
`\n\n⚠️ ${chalk.yellowBright("remix-development-tools")} are going to be deprecated and will be renamed to ${chalk.greenBright("react-router-devtools ")} when React Router v7 is released ⚠️`,
`\n⚠️ Set suppressDeprecationWarning to true in your ${chalk.greenBright("vite.config.ts")} file to silence this warning ⚠️`
)
}

const remixIndex = resolvedViteConfig.plugins.findIndex((p) => p.name === "remix")
const devToolsIndex = resolvedViteConfig.plugins.findIndex((p) => p.name === "remix-development-tools")

Expand Down
6 changes: 4 additions & 2 deletions test-apps/remix-vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ const config = defineRdtConfig({
},
pluginDir: "./plugins",
includeInProd: true,
// Set this option to true to suppress deprecation warnings
// suppressDeprecationWarning: true,
server: {
serverTimingThreshold: 250
serverTimingThreshold: 250,
}
});

Expand All @@ -35,6 +37,6 @@ export default defineConfig({
],
server: {
open: true,
port: 3005 ,
port: 3005,
},
});

0 comments on commit 85c6619

Please sign in to comment.