Skip to content

Commit

Permalink
fix: determine nango yaml version (#3300)
Browse files Browse the repository at this point in the history
if nango.yaml only contains on-events script definition the version of
the nango.yaml file is wrongly determined to be v1, which prevents the
generation of on-events scripts that only works when v2

# how to test 
run `nango generate` with following nango.yaml 
```
integrations:
  hubspot:
    on-events:
      post-connection-creation:
        - add-whoami
```
with current CLI version, nothing is generated. After applying this
patch you should see the `hubspot/on-events/add-whoami.ts` file be
generated
  • Loading branch information
TBonnin authored Jan 14, 2025
1 parent c8ba13a commit 36ba871
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/nango-yaml/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function determineVersion(configData: NangoYaml): 'v1' | 'v2' {

const firstProviderConfig = configData.integrations[keys[0]!];

if (firstProviderConfig && ('syncs' in firstProviderConfig || 'actions' in firstProviderConfig)) {
if (firstProviderConfig && ('syncs' in firstProviderConfig || 'actions' in firstProviderConfig || 'on-events' in firstProviderConfig)) {
return 'v2';
} else {
return 'v1';
Expand Down

0 comments on commit 36ba871

Please sign in to comment.