t3-oss / create-t3-turbo

Clean and simple starter repo using the T3 Stack along with Expo React Native
https://turbo.t3.gg
MIT License
4.74k stars 408 forks source link

Use pnpm catalogs #1081

Closed simonecervini closed 4 months ago

simonecervini commented 5 months ago

Blocked by: the stable release of pnpm 9.5.0.

Catalogs (RFC: https://github.com/pnpm/rfcs/pull/1) are now available in pnpm@9.5.0-beta.0.

I think this is a very useful feature for create-t3-turbo because it reduces duplication in the codebase.

I believe this is a good default – most of the time, I don't want to use different versions of prettier across the codebase – and it's very easy to opt out for specific packages.

juliusmarminge commented 5 months ago

omg this looks fantastic. love this. let's wait for stable release before merging though 🙏

I think we should also add react to the catalog as it sucks having multiple versions of react in a monorepo from my experience atleast

simonecervini commented 5 months ago

I agree about React! We could also consider Zod, which is currently used by 6 packages in the monorepo

juliusmarminge commented 4 months ago

9.5 is released - wanna get this ready for merge?

simonecervini commented 4 months ago

9.5 is released - wanna get this ready for merge?

Certainly, it should be very quick

simonecervini commented 4 months ago

@juliusmarminge Idk maybe this is a better name? The idea behind the React named catalog is to make it easier to manage apps with different React versions by grouping all the related dependencies (react, react-dom, @types/*, etc.) that need to stay in sync

diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 650de9e..8a10a1a 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -10,7 +10,7 @@ catalog:
   zod: ^3.23.8

 catalogs:
-  react:
+  react18:
     react: 18.3.1
     react-dom: 18.3.1
     "@types/react": ^18.3.3
(END)
necmettindev commented 4 months ago

@simonecervini i think the spelling should be react18, it looks weird when you use a centre line.

simonecervini commented 4 months ago

@necmettindev Yes, I agree. I actually wrote it that way already (https://github.com/t3-oss/create-t3-turbo/pull/1081/commits/3c3e89dbf24aa641c777ffc7c54da34a0807aa80), but I misspelled it in the diff message

NaN72dev commented 4 months ago

I think using catalogs breaks other package managers. I choose npm and npx create-turbo@lastest -e https://github.com/t3-oss/create-t3-turbo crashes on step "Installing dependencies".

stderr from npm install:

'npm error code EUNSUPPORTEDPROTOCOL\n' +
'npm error Unsupported URL Type "catalog:": catalog:\n' +
'npm error A complete log of this run can be found in: /Users/nhanlc/.npm/_logs/2024-07-10T15_52_18_279Z-debug-0.log'

I haven't used pnpm and couldn't find any solution online so I think I'll ask it here: can we still use catalog with other package managers, or do we drop them?

dBianchii commented 4 months ago

I think using catalogs breaks other package managers. I choose npm and npx create-turbo@lastest -e https://github.com/t3-oss/create-t3-turbo crashes on step "Installing dependencies".

stderr from npm install:


'npm error code EUNSUPPORTEDPROTOCOL\n' +

'npm error Unsupported URL Type "catalog:": catalog:\n' +

'npm error A complete log of this run can be found in: /Users/nhanlc/.npm/_logs/2024-07-10T15_52_18_279Z-debug-0.log'

I haven't used pnpm and couldn't find any solution online so I think I'll ask it here: can we still use catalog with other package managers, or do we drop them?

Just use pnpm?

NaN72dev commented 4 months ago

Just use pnpm?

That's... fair. Didn't realize until now that the choices of package managements is from create-turbo, not this repo. My mistake.

juliusmarminge commented 4 months ago

can we still use catalog with other package managers, or do we drop them?

No, catalogs is a pnpm workspace feature (might be coming to Bun from what I've heard) so you'd have to drop them if you wanna use something else. Turbo's converter has been ok when I tried it, not sure if they support migrating from catalogs yet though

rycerzes commented 4 months ago
 'Scope: all 14 workspace projects\n' +
    'D:\\Github\\my\\my-turborepo\\apps\\auth-proxy:\r\n' +
    " ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER  eslint@catalog: isn't supported by any available resolver.\n" +
    '\n' +
    'This error happened while installing a direct dependency of D:\\Github\\my\\my-turborepo\\apps\\auth-proxy\n' +
    'Progress: resolved 1, reused 0, downloaded 0, added 0',

This is thrown when using pnpm to run

simonecervini commented 4 months ago
 'Scope: all 14 workspace projects\n' +
    'D:\\Github\\my\\my-turborepo\\apps\\auth-proxy:\r\n' +
    " ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER  eslint@catalog: isn't supported by any available resolver.\n" +
    '\n' +
    'This error happened while installing a direct dependency of D:\\Github\\my\\my-turborepo\\apps\\auth-proxy\n' +
    'Progress: resolved 1, reused 0, downloaded 0, added 0',

This is thrown when using pnpm to run

What version of pnpm are you using? You need version 9.5.0 or higher

rycerzes commented 4 months ago

Ah got it, I was running 9.4.0. Thanks for the help!