zendesk / zcli

A command-line tool for Zendesk
https://developer.zendesk.com
Apache License 2.0
62 stars 20 forks source link

fix(themes): fix a template identifier matching issue on Windows #200

Closed moremada closed 8 months ago

moremada commented 1 year ago

Description

Fixes an issue on Windows where the template identifier incorrectly matches due to non-posix path separator being used, but posix path separators being expected.

Do NOT write here! This section will be filled in by GitHub Action automatically. If you don't want this, either remove the markers or write outside the fences.

Detail

On Windows, the globSync function returns the \\ path separator by default. However, we are matching against a posix path separator of / as can be seen on line 9's split pattern of template.split('templates/'). This is causing the following error:

TypeError: Cannot read properties of undefined (reading 'split')

This PR explicitly instructs glob to return path results using posix path separators and allows the split pattern to match correctly.

Checklist

luis-almeida commented 1 year ago

@moremada thanks for following up on this! The problem seems to have been related to the branch name indeed.

I ran a git fetch origin pull/200/head:luis_moremada/fix-windows-glob-separator so I could keep your commits in a new branch and opened a duplicate PR. It got picked up in this build as well.

luis-almeida commented 8 months ago

Thanks @moremada for your help fixing this issue! Closing in favour of https://github.com/zendesk/zcli/pull/220 which includes the commits in this PR and just got released.