microsoft / Oryx

Build your repo automatically.
Other
751 stars 173 forks source link

[Feature] pnpm/corepack support #2340

Open dtinth opened 8 months ago

dtinth commented 8 months ago

Feature Request

From https://github.com/microsoft/Oryx/issues/1150#issuecomment-1886067023

We're not currently looking to support pnpm. Closing this issue for now, please create a new issue and link to this one if you feel strongly.

I feel strongly about this and decided to open a new issue.

My suggestions is at follows:

How this will improve things:

In short, supporting pnpm via corepack will improve both developer experience in Codespaces and deployment experiences in Azure services.

simonjj commented 8 months ago

Thank you for opening this issue and linking back.

PhantipK commented 8 months ago

Please update and scale the Oryx to support for pnpm, so it can reach a broader audience including OSS developers who switched to pnpm and businesses using Azure Static Web Apps.

sytexa-julia commented 5 months ago

This would be helpful to my team as well!

GalindoSVQ commented 5 months ago

What about using pnpm/action-setup@v3 ?

Or you can just work with Azure and use _PRE_BUILDCOMMAND & _CUSTOM_BUILDCOMMAND commands like:

      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        env:
          PRE_BUILD_COMMAND: npm install -g pnpm
          CUSTOM_BUILD_COMMAND: pnpm install --frozen-lockfile && pnpm run build
fturmel commented 5 months ago

@GalindoSVQ From my experience deploying a NextJS app last week, these PRE_BUILD_COMMAND and CUSTOM_BUILD_COMMAND variables did work to some extent.

The blocker was that during the Azure Functions build phase, npm install --production would always run regardless and I could not find a way to override that part of the pipeline. I was forced to alter my app deps to use npm to successfully deploy.

GalindoSVQ commented 5 months ago

@GalindoSVQ From my experience deploying a NextJS app last week, these PRE_BUILD_COMMAND and CUSTOM_BUILD_COMMAND variables did work to some extent.

The blocker was that during the Azure Functions build phase, npm install --production would always run regardless and I could not find a way to override that part of the pipeline. I was forced to alter my app deps to use npm to successfully deploy.

react app boostraped using vite works fine, I am not sure but.. have you tried specifying pnpm as engine in package.json?

https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines

fturmel commented 5 months ago

react app boostraped using vite works fine

That makes sense to me, it's probably a static app that doesn't have APIs/backend and doesn't use Azure Functions? Or maybe your project isn't pruning dev dependencies and you're not hitting the same build/deploy path I am.

I don't think specifying pnpm in package.json will make a difference. Everything in Oryx seems hardcoded to use npm or yarn exclusively.

I can track the problem here for my specific blocker (in case it helps the maintainers in any way), where ProductionOnlyPackageInstallCommand always runs and there are no overrides to make packageInstallCommand be pnpm install.

https://github.com/microsoft/Oryx/blob/8fb59f3713371b0d39b4b4df3a96b3a36b9c52a7/src/BuildScriptGenerator/Node/NodeBashBuildSnippet.sh.tpl#L120-L125

https://github.com/microsoft/Oryx/blob/8fb59f3713371b0d39b4b4df3a96b3a36b9c52a7/src/BuildScriptGenerator/Node/NodePlatform.cs#L196-L218

abforman commented 5 months ago

This is impacting my attempt to execute a static site build from ADO using AzureStaticWebApp@0 because it forces the build_command to use yarn 1.x, not 4.2.1 as defined in my package.json packageManager config. Per the docs (https://github.com/microsoft/Oryx/blob/main/doc/runtimes/nodejs.md#package-manager) package manager is currently derived (incorrectly in my case) rather than simply reading the value!

asheemak commented 3 months ago

same issue here cannot use pnpm

faxg commented 2 weeks ago

+1