zendesk / zcli

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

zcli apps:new command does not work with flag scaffold=react #55

Open joelhellman opened 3 years ago

joelhellman commented 3 years ago

Expectations

zcli apps:new --scaffold=react works, as per command help examples

$ zcli apps:new --help
generates a bare bones app locally for development

USAGE
  $ zcli apps:new

OPTIONS
  --appName=appName          Name of the app
  --authorEmail=authorEmail  Email of app author
  --authorName=authorName    Name of app author
  --path=path                Path of your new app
  --scaffold=scaffold        [default: basic] Choose from open-source Zendesk app scaffold structures

EXAMPLES
  $ zcli apps:new
  $ zcli apps:new --scaffold=basic
  $ zcli apps:new --scaffold=react

The scaffold=basic flag works:

$ zcli apps:new --appName="myapp" --authorEmail="myname@example.com" --authorName="myname" --scaffold=basic
Enter a directory name to save the new app (will create the dir if it does not exist): myapp
Successfully created new project myapp

Reality

But the scaffold=react doesn't:

zcli apps:new --scaffold=react fails with error Download of scaffold structure failed

...folder 'myapp' from previous example has been removed
$ zcli apps:new --appName="myapp" --authorEmail="myname@example.com" --authorName="myname" --scaffold=react
Enter a directory name to save the new app (will create the dir if it does not exist): myapp
 ›   Error: Download of scaffold structure failed

Steps to Reproduce

  1. Should work: 1. $ zcli apps:new --appName="myapp" --authorEmail="myname@example.com" --authorName="myname" --scaffold=basic --path=myapp
  2. Should fail: $ zcli apps:new --appName="myapp" --authorEmail="myname@example.com" --authorName="myname" --scaffold=react --path=myapp

Issue details

eric-at-nocoast commented 3 years ago

Hey Joel,

I wasn't able to replicate your issue, are you still experiencing this?

joelhellman commented 3 years ago

Okay I just tested and I discovered two things.

zcli apps:new --scaffold=react and zcli apps:new --appName="myapp" --authorEmail="myname@example.com" --authorName="myname" --scaffold=basic --path=myapp both work now.

I end up with a subfolder myapp with the scaffold.

However the --scaffold=react doesn't return a react app, but the old scaffold app from the Zendesk repo from when you launched V2 apps.

The other thing is that the command behaves weirdly if you try to create an app in the current directoy. I often do this, create the directory first, cd into it, and run the command to put stuff in the current directory.

To recreate :

$ mkdir testapp && cd testapp
$ zcli apps:new
Enter a directory name to save the new app (will create the dir if it does not exist): . # <-- (I put a dot here to indicate the current directory)
Enter this app authors name: joe
Enter this app authors email: joe@example.com
Enter a name for this new app: testapp
    Error: ENOTEMPTY: directory not empty, rename '.../test/apps_scaffold_basic-master' -> '.../test'
    Code: ENOTEMPTY

If I look in the directory, I then have a zip and a directory:

drwxr-xr-x  4 4096 Aug 19 18:58 apps_scaffold_basic-master
-rw-r--r--  1 7527 Aug 19 18:58 scaffold.zip