Conversation
🦋 Changeset detectedLatest commit: c51ef37 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| export function detectInvokedPackageManager(): PackageManager { | ||
| let detectedPackageManager: PackageManager = 'npm' | ||
| const invoker = require.main | ||
|
|
||
| if (!invoker) { | ||
| return detectedPackageManager | ||
| if (process.env.npm_config_user_agent) { | ||
| for (const pm of packageManagers) { | ||
| if (process.env.npm_config_user_agent.startsWith(`${pm}/`)) { | ||
| return pm | ||
| } | ||
| } | ||
| } | ||
|
|
||
| for (const pkgManager of packageManagers) { | ||
| if (invoker.path.includes(pkgManager)) { | ||
| detectedPackageManager = pkgManager | ||
| break | ||
| if (process.env.npm_execpath) { | ||
| for (const pm of packageManagers) { | ||
| if (process.env.npm_execpath.split(sep).includes(pm)) { | ||
| return pm | ||
| } | ||
| } | ||
| } | ||
| return detectedPackageManager | ||
| return 'npm' | ||
| } |
There was a problem hiding this comment.
@beeman i am not sure if this function needs to change or not but this is what nx is using now https://github.com/nrwl/nx/blob/master/packages/create-nx-workspace/src/utils/package-manager.ts
is there a way to test bun create with a local build of solana-create-app? i get the error warn: bun create [local file] only supports .jsx and .tsx files currently
currently this code is working for bunx but otherwise untested
There was a problem hiding this comment.
it would appear that the old way with require.main has some weird cases oven-sh/bun#8113
For example if I do bun exec ~/Developer/create-solana-dapp/dist/bin/index.cjs then process.env.verisons.bun is undefined but bun ~/Developer/create-solana-dapp/dist/bin/index.cjs (without the exec) has it
Also, if you currently try bun on the current version it thinks it'syarn
> $ bun create solana-dapp --verbose
packageManager: 'yarn',
i think the changes i made to the function should work for bun create though oven-sh/bun#11016
There was a problem hiding this comment.
I just did some local testing and managed to get a working project with bun.
I reckon we can merge it and see how it works in the wild and fix any issues
There was a problem hiding this comment.
That sounds good to me
292c562 to
c51ef37
Compare


Closes #139