Change your config globally
You might not like the extra folder required to configure Prisma Util. This guide will provide a quick and easy way of changing the root directory for the configuration file.
When using Prisma Util, you are forced to use a folder setup. By folder setup, we mean that you have to use a different folder like prisma-util that holds your configuration files. During this guide, we're going to get rid of the prisma-util folder and instead use the pre-v2.0.0 way of configuring Prisma Util (using the prisma-util.config.mjs file).
During this guide, we're going to use the following folder structure:
change-config-path (Project Root)
@node_modules
prisma-util
config.mjs
.env
package.jsonSo, let's get started.
1. Change the root directory
First of all, let's change the root directory from prisma-util to change-config-path. To do this, we're going to use the newly introduced configure command.
Open your terminal and type the following commands:
npx prisma-util configure root .This command will set the root folder to the project root. We can now move the config.mjs file to change-config-path and get rid of the initial folder. Our file structure should look like this now:
change-config-path (Project Root)
@node_modules
.env
config.mjs
package.json2. Change the configuration file name
Using config.mjs is pretty generic and we'd rather have something more descriptive such as prisma-util.config.mjs. To do this, let's rename our configuration file to the new path, and bring our file structure to this state:
change-config-path (Project Root)
@node_modules
.env
prisma-util.config.mjs
package.jsonNow, we just have to tell Prisma Util that we no longer want to use config.mjs as our configuration file. To do this, we can use the configure command from earlier like this:
npx prisma-util configure config prisma-util.config.mjsAnd we're done!
Wrapping Up
This feature has been requested by developers using Prisma Util, so we found a way of introducing it without creating breaking changes into the package.
Last updated