This documentation is still work in progress, so be please patient.

# package.json

You can setup the project in whatever way you want, but here are some advices which could help a bit.

## concurrently

npm

    npm i -D concurrently

This library is quite useful, because it enables you execute multiple sections of your scripts in parallel. You may think it would not be required everywhere, but it's `-D` dependency, so who cares.

Than you can have something like this

package.json

    {
        "scripts": {
            "build": "concurrently npm:build:*",
            "build:esbuild": "node esbuild.mjs",
            "build:types": "tsc --outDir lib"
        }
    }

## del-cli

npm

    npm i -D del-cli

Nice tool for deleting files, useful if you want to cleanup mess generated by all those build tools.

💡

Be careful here, because this command deletes also JavaScript files in the src folder, so if you blindly copy and execute this, don't blame me.

It's useful when your `TSC` emits files into your source code, so you want to cleanup the mess.

package.json

    {
        "scripts": {
            "cleanup": "del-cli .turbo lib tsconfig.tsbuildinfo src/**/*.{d.ts,d.ts.map,js,js.map}"
        }
    }

## dotenv

npm

    npm i -D dotenv-cli

Nice tool for forwarding env variables and reads `.env` files. Quite cool thing.

💡

Do you see this? So don't do that! If there is `.env.development` file, it would get loaded and you'll f*ck up your production build.

package.json

    {
        "scripts": {
            "build": "dotenv -c development -- next build"
        }
    }

Monorepo Managed Code Pattern