static-web-apps-cli icon indicating copy to clipboard operation
static-web-apps-cli copied to clipboard

swa init --yes should consider yarn.lock

Open codepic opened this issue 2 years ago • 1 comments

Are you accessing the CLI from the default port :4280 ?

  • [x] Yes, I am accessing the CLI from port :4280

Describe the bug If yarn.lock exists, swa init --yes should use yarn instead of npm

To Reproduce

yarn create next-app # accept all defaults
cd my-app
swa init -y
cat .\swa-cli.config.json
{
  "$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
  "configurations": {
    "my-app": {
      "appLocation": ".",
      "outputLocation": ".next",
      "appBuildCommand": "npm run build",
      "run": "npm run dev",
      "appDevserverUrl": "http://localhost:3000"
    }
  }
}

Expected behavior

cat .\swa-cli.config.json
{
  "$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
  "configurations": {
    "my-app": {
      "appLocation": ".",
      "outputLocation": ".next",
      "appBuildCommand": "yarn build",
      "run": "yarn dev",
      "appDevserverUrl": "http://localhost:3000"
    }
  }
}

codepic avatar Feb 18 '23 19:02 codepic

I'm finding that even if I manually update swa-cli.config.json appBuildCommand and apiBuildCommand to "pnpm run build", it still uses npm. I've confirmed that by installing only-allow to force the use of pnpm and swa fails as it tries to use npm.

So I don't think this is an init only problem (i.e., swa runs npm even when trying to deploy the app after the init process has be completed).

Using 1.1.3

smolattack avatar Jul 12 '23 11:07 smolattack