Cli: Better placeholder name for the template

Created on 24 Jun 2019  路  8Comments  路  Source: react-native-community/cli

Description

Cross-posting https://github.com/microsoft/react-native-windows/issues/2663.

Reproducible Demo

Running react-native init helloworld_test will result in helloworld_test_test name being used in package.json, because:

  • our placeholder name is HelloWorld
  • the regex is case insensitive (?) and will replace helloworld in helloworld_test (not looking for a whole word, but part of it).

Would be good to use a better placeholder name, something more unique.

bug init

Most helpful comment

Okay, I think I know how to fix this. I'll assign myself to this issue and post PR soon.

All 8 comments

@grabbou May I give it a try ?

@KevinHu2014 sure! @Esemesek ideas on the name or how to make the replacing more correct?

@KevinHu2014 are you still interested in this issue?

@thymikee I might not have time working on this recently. Free to release it to the community!

I can give this issue a try, but I have a question is this has something to do with the NAME_REGEX?

https://github.com/react-native-community/cli/blob/master/packages/cli/src/commands/init/validate.js#L5-L10

We can't really change the template name, since it lives inside react-native and is likely coupled with global react-native-cli which we don't want to break.

We could disable using "helloworld" and alike as a template name, but maybe there's something else we can do.

@Esemesek what do you think?

Okay, I think I know how to fix this. I'll assign myself to this issue and post PR soon.

Sounds good!

PS. Blacklisting "helloworld" sounds like a fair workaround in case we can't fix it! @thymikee, good idea

Was this page helpful?
0 / 5 - 0 ratings