Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jcayzac opened this issue Aug 7, 2021 · 5 comments · Fixed by #622
Closed

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

jcayzac opened this issue Aug 7, 2021 · 5 comments · Fixed by #622
Labels

Comments

@jcayzac
Copy link

jcayzac commented Aug 7, 2021

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!

@jcayzac
Copy link
Author

jcayzac commented Aug 7, 2021

Basically this would spare me having to write dummy one-line tsup.config.ts files in each of my packages, with just export * from '../../tsup.config'.

@egoist egoist closed this as completed in 325b254 Nov 25, 2021
@github-actions
Copy link

🎉 This issue has been resolved in version 5.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@michael-land
Copy link

does this still work in 5.12.1?

No input files, try "tsup <your-file>" instead

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

@schelmo
Copy link
Contributor

schelmo commented Apr 28, 2022

no it isnt for me too.
i think the code in

tsup/src/load.ts

Lines 39 to 50 in b8c51f4

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

should first check for tsup.config.{ts,js,cjs,mjs,ts,json}
and after that, check for package.json
so if there is a tsup.config.ts in workspace root, take that, else check for package.json

@github-actions
Copy link

github-actions bot commented May 5, 2022

🎉 This issue has been resolved in version 5.12.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants