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

rollup: multiple workspaces #36

Closed
tunnckoCore opened this issue Nov 1, 2019 · 6 comments
Closed

rollup: multiple workspaces #36

tunnckoCore opened this issue Nov 1, 2019 · 6 comments

Comments

@tunnckoCore
Copy link

tunnckoCore commented Nov 1, 2019

For monorepo setups, it should work for these scenarios too

@tunnckocore/
- kokoko/ # (named: `@tunnckocore/kokoko`)
--- src/
@hela/
- dev/ # (named: `@hela/dev`)
--- src/
configs
- eslint-config (named: `@tunnckocore/eslint-config`)
- babel-preset (named: `@tunnckocore/babel-preset`)
- ... etc
packages/
- foo/
--- src/
- bar/
--- src/

lerna config

  "packages": [
    "configs/*",
    "packages/*",
    "@tunnckocore/*",
    "@hela/*"
  ],

Or even if it doesn't support that... it still won't support through the --monorepo flag the following

  "packages": [
    "packages/@tunnckocore/*",
    "packages/@hela/*",
    "packages/configs/*",
    "packages/web/*",
    "packages/*",
  ],

To the rescue can com the @tunnckocore/utils package. Check it out.

The thing is that I want to have a clear and visible separation between what's what, what's scoped and what's not.

@JounQin
Copy link
Member

JounQin commented Nov 2, 2019

Pretty cool idea, I will consider implementing it in a few days.

@JounQin
Copy link
Member

JounQin commented Nov 2, 2019

It seems I've implement it at https://github.com/1stG/configs/blob/master/packages/eslint-config/_util.js#L8-L35 , will extract it into @pkgr/utils instead for sharing same logic.

@tunnckoCore
Copy link
Author

tunnckoCore commented Nov 2, 2019

Yea, I remember that. But definitely waste of using glob, isGlob and etc. Use just path.dirname - 99% of the cases it's packages/* so path.dirname will get the correct thing, then just check if it exists and continue merging with the others. ;]

const res = tunnckoCoreUtils.createAliases(process.cwd()) gives you a lot of things. Actually, everything needed. You can use res.alias or res.info to get all actual package roots, e.g. @tunnckocore/foo/, packages/qux-zaz/, @hela/dev/.

Should be noted, that it supports all these different structures like configs/babel-preset which package is actually named @tunnckocore/babel-preset. In res.info there is both @tunnckocore/babel-preset key and configs/babel-preset key.

I'm okay and happy to merge both utils.

@tunnckoCore
Copy link
Author

tunnckoCore commented Nov 2, 2019

Or just found the get-workspaces package which works with all major Workspaces solutions, except Lerna nad Pnpm :D

so, changesets/changesets#210

@JounQin
Copy link
Member

JounQin commented Nov 2, 2019

I'm using tiny-glob instead of glob there which is much lighter. And it has been used in eslint-import-resolver-typescript which is very common dev dependence, so I prefer keep tiny-glob as is, and also for robustness.

I personally will migrate to pnpm in near feature also, so get-workspaces would be cool if it supports them out of box.

Very appreciate for your reviewing.

@tunnckoCore
Copy link
Author

tunnckoCore commented Nov 2, 2019

I personally will migrate to pnpm in near feature also

Same here, just testing last few days and, except some ESLint loading problems (needed to copy paste all the deps from the config, to the monorepo root) - it works.

I'm using tiny-glob instead of glob there which is much lighter

Sure, I know. But it gives you nothing more than just fs.readdir(Sync).

@JounQin JounQin closed this as completed in 5fc9d17 Nov 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants