Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI issues: Generated app default Project name invalid if CWD name has hyphens + why not generate in CWD #2092

Closed
cloudwheels opened this issue Nov 28, 2018 · 3 comments

Comments

@cloudwheels
Copy link

commented Nov 28, 2018

Current Behavior

lb4 app suggests a project name based on CWD. If this has hyphens they are replaced with spaces so the default suggested name is invalid.

More importantly, why bother suggesting this if it's going to create a sub-directory anyway.
Why not either:

  • create the project in CWD (that's why I created a folder for it!)
  • if it must be created in a subdir, just suggest "package" or "code", since I don't really want a structure my-project/my-project by default (From my home the default suggestion creates ~/username as the project directory.)

I can see the logic of not just spawning into my home directory, for example, without warning and I know other generators follow this pattern, but my preference would be just make directory, copy into that with WARN this is the current directory & make clear the Project name is really for the package.json.

See "Other examples" below.

ALSO
I am asked to enter the

Project root directory

but if I enter a path, the generator appears to complete, but doesn't actually create the directory:

? Project root directory: ~/my-lb4-app/code
create .npmrc
create .prettierignore
create .prettierrc
...
added 528 packages in 18.892s
Application nigel was created in ~/my-lb4-app/code
nigel@cloudshell:~$ cd ~/my-lb4-app/code
-bash: cd: /home/nigel/my-lb4-app/code: No such file or directory

Edit: actually it is there:

nigel@cloudshell:~ (cw-wadh)$ ls *~*
my-lb4-app

Ewww.

Other examples:

nigel@cloudshell:~$ mkdir loopback-next && cd $_ && lb4 app
? Project name: (loopback next) 
>> Invalid npm package name: loopback next
? Project name: loopback-next
Application loopback-next was created in loopback-next.
nigel@cloudshell:~/loopback-next$ ls
loopback-next

@cloudwheels cloudwheels changed the title CLI issues: Generated app default Project name invalid if CWD name has hyphens + why not generate in CWD + copy error not thrown CLI issues: Generated app default Project name invalid if CWD name has hyphens + why not generate in CWD Nov 28, 2018

@cloudwheels

This comment has been minimized.

Copy link
Author

commented Nov 28, 2018

removed

copy error not thrown

See above. It worked, just horribly.

@dhmlau

This comment has been minimized.

Copy link
Contributor

commented Dec 2, 2018

@cloudwheels,

If this has hyphens they are replaced with spaces so the default suggested name is invalid.

I just scaffolded an application with project name test-1-2-3, and it seems to be working as expected. It is being created in the test-1-2-3 directory. Is it what you're seeing too?

$ lb4 app
? Project name: test-1-2-3
? Project description: loopback4 example
? Project root directory: test-1-2-3

? Project root directory: ~/my-lb4-app/code

For this one, it looks like a bug.

@dhmlau dhmlau self-assigned this Dec 2, 2018

@dhmlau dhmlau added CLI bug labels Dec 2, 2018

@bajtos

This comment has been minimized.

Copy link
Member

commented Jan 11, 2019

More importantly, why bother suggesting this if it's going to create a sub-directory anyway.

I believe it's possible to create a new LB4 inside an existing directory too. It's an important option making it easy to scaffold a new LB4 project in a directory already initialized e.g. when creating a new GitHub repository.

@bajtos bajtos added 2019Q2 p1 labels Apr 12, 2019

@emonddr emonddr added p2 and removed p1 labels Apr 16, 2019

@dhmlau dhmlau removed their assignment Jun 11, 2019

@dhmlau dhmlau added 2019Q3 p1 and removed 2019Q2 p2 labels Jun 11, 2019

@agnes512 agnes512 self-assigned this Jun 24, 2019

@dhmlau dhmlau referenced this issue Jun 25, 2019
18 of 30 tasks complete

@agnes512 agnes512 added this to the July 2019 milestone milestone Jun 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.