这是indexloc提供的服务,不要输入任何密码
Skip to content

support loading config from a parent folder (monorepo) #378

@jcayzac

Description

@jcayzac

Hi @egoist!

My project structure has:

+-- project
    +-- packages
    |   +-- library
    +-- tsup.config.ts

When I call tsup from the library folder, it fails to find the config file. I see you're setting joycon's stopDir to the current project's folder:

tsup/src/load.ts

Lines 44 to 55 in 405e165

const configPath = await configJoycon.resolve(
[
'tsup.config.ts',
'tsup.config.js',
'tsup.config.cjs',
'tsup.config.mjs',
'tsup.config.json',
'package.json',
],
cwd,
path.dirname(cwd)
)

Would you have any objection to changing that and allow resolve() to traverse the filesystem upward?

export async function loadTsupConfig(cwd: string) {
  const configJoycon = new JoyCon()
  const configPath = await configJoycon.resolve(
    [
      'tsup.config.ts',
      'tsup.config.js',
      'tsup.config.cjs',
      'tsup.config.mjs',
      'tsup.config.json',
      'package.json',
    ],
-   cwd,
-   path.dirname(cwd)
+   cwd
  )

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions