AlexPshul / nxazure

MIT License
16 stars 7 forks source link

A generated functionApp may be a v3, while generating a function will always be v4 #27

Closed stijnjanmaat closed 1 year ago

stijnjanmaat commented 1 year ago

Thanks for the great plugin! I just tried it out and found out it generates a functionApp v3 by default, while in my case it always generates a function v4. The normalizedOptions when running nx g @nxazure/func:init someFuncApp look like this:

{
  appRoot: 'apps/some-func-app',
  appNames: {
    name: 'someFuncApp',
    className: 'SomeFuncApp',
    propertyName: 'someFuncApp',
    constantName: 'SOME_FUNC_APP',
    fileName: 'some-func-app'
  },
  strict: true,
  v4: false,
  tags: [ '' ]
}

So v4 is false. When running nx g @nxazure/func:new someFunc --project=someFuncApp --template="HTTP trigger"

{
  projectRoot: 'apps/some-func-app',
  funcNames: {
    name: 'someFunc',
    className: 'SomeFunc',
    propertyName: 'someFunc',
    constantName: 'SOME_FUNC',
    fileName: 'some-func'
  },
  template: 'HTTP trigger',
  language: 'TypeScript',
  v4: true,
  authLevel: undefined,
  silent: false
}

Here v4 is true. I suppose it has to do with normalizeOptions function in both generators has different way of determining v4. In new it uses the isV4 function, while init doesn't. Should init use isV4 as well?

func --help returns:

Azure Functions Core Tools
Core Tools Version:       4.0.5441 Commit hash: N/A  (64-bit)
Function Runtime Version: 4.25.3.21264

I'm on "@azure/functions": "^4.0.0", "@nxazure/func": "1.0.20",

stijnjanmaat commented 1 year ago

Messed the issue up, reopened it.

AlexPshul commented 1 year ago

Hi @stijnjanmaat , Thank you for the issue.

This is something I'm actually working on. V3 will be removed in v1.1 of the package to align with the func CLI tooling. Since V4 was released to GA, the new func CLI versions use the V4 by default, so the flag now is broken. If you still need V3, please downgrade your func CLI version to a lower version.

Or, use V4. It's much cooler. 😉

stijnjanmaat commented 1 year ago

That's great! I am using V4, so looking forward for the new version!