getmeli / meli

Platform for deploying static sites and frontend applications easily. Automatic SSL, deploy previews, reverse proxy, and more.
Other
2.4k stars 97 forks source link

Upload command from docs not working #176

Closed robertorubioguardia closed 3 years ago

robertorubioguardia commented 3 years ago

Hi guys,

I had to reorder the arguments in the upload command for it to work. Using it as stated in your docs it failed.

The working form was:

npx @getmeli/cli upload \
    ./public \
    --url https://myurl.tld \
    --site mysiteid \
    --token sometoken \
    --branch "master"

Note the folder was moved and put before the rest of the arguments. Error was: Not enough non-option arguments: got 0, need at least 1

Cheers and thanks for such a great tool.

gempain commented 3 years ago

@robertorubioguardia hi ! Thanks for reporting this. It's a known issue, when the --branch argument is last, yargs breaks for a reason I haven't been able to figure yet. Another way to workaround this is by placing --branch as non last argument:

npx @getmeli/cli upload \
    --url https://myurl.tld \
    --site mysiteid \
    --branch "master" \
    --token sometoken \
    ./public

I will update the docs with your suggestion to avoid confusion in the future 😄

gempain commented 3 years ago

I just updated the docs. I'll close, but we'll reopen if further help is needed 😄

phillipplum commented 3 years ago

It's a known issue, when the --branch argument is last, yargs breaks for a reason I haven't been able to figure yet.

@gempain hello, is it a problem that branch can be an array (https://github.com/getmeli/meli-cli/blob/1ea83325797010c257c238536cccb4c653b04824/src/commands/upload/upload-options.ts#L49)? See the following link: https://github.com/yargs/yargs/pull/164

So I think that's why the error comes, that one argument is missing. Because yargs then interprets: --branch = "master" ./public as ['master', '. /public']

gempain commented 3 years ago

@phillipplum hi there ! Thanks for jumping 😄 The problem definitely comes from branch being an array, but not from what you describe. AFAIK, arrays are specified by providing the same option multiple times: --branch branch1 --branch branch2. So, I would assume Yargs to understand that --branch branch ./public is ['branch'] 🤔

We could open an issue there to see what's going on.