Open rxliuli opened 1 year ago
Just curious why not use --config
to specify a custom shared config file in a monorepo.
By the way, I like the prettier style too, if the configuration of multiple projects has no difference.
The main problem is hierarchy and sharing across monorepo
The problem with the first level is that you need to use a path of the form ../libs/configs/tsup.config.ts
, and if you want to have a hint that you must install tsup dependencies at the top level, in multiple different projects, The monorepo directory may be organized differently, which results in a different path to config
The second problem is that I do have multiple monorepo, which deal with different issues, but they all contain some libs, such as projects like joplin-utils/liuli-tools/mami , all need to be built with tsup
I agree with this feature. It would be very nice instead of having to pass relative --config
arguments, it would be nice if we could follow the typescript style for it though:
my-package/tsup.config.json
:
{
"entry": ["./src/index.ts"],
"format": ["cjs, esm"]
}
app/tsup.config.json
{
"extends": "my-package/tsup.config.json",
"dts": true
}
And something similar for typescript:
my-package-using-ts/tsup.config.ts
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["./src/index.ts"],
format: ["cjs", "esm"],
dts: true,
});
app-using-ts/tsup.config.ts
import { inheritConfig } from "tsup"; // Maybe we could use defineConfig with a different pattern?
import baseConfig from "my-package-using-ts/tsup.config.ts"; // NOTE: Right now, we can't do imports like this (from my testing)
export default inheritConfig(baseConfig, {...});
motivation
In a monorepo, multiple projects need to share the configuration, instead of each project writing its own command line parameters or configuration file, which is actually annoying, it would be nice if there was a way to specify the configuration via a simple option
Promise<Config>
Existing program
The eslint approach is through the extends option, ref: https://eslint.org/docs/latest/user-guide/configuring/configuration-files#adding-shared-settings prettier can directly point to a package, ref: https://prettier.io/docs/en/configuration.html#sharing-configurations
If you'd like to include this functionality, I'm willing to implement it
Upvote & Fund