Skip to content
This repository has been archived by the owner on Dec 6, 2018. It is now read-only.

Add shortcut flag to CRNA for using reason-scripts #4

Open
brentvatne opened this issue Dec 4, 2017 · 5 comments
Open

Add shortcut flag to CRNA for using reason-scripts #4

brentvatne opened this issue Dec 4, 2017 · 5 comments

Comments

@brentvatne
Copy link
Member

create-react-native-app MyProject --scripts-version reason-react-native-scripts is fairly verbose and difficult to remember.

We could simplify this to create-react-native-app MyProject --reason

@anp
Copy link

anp commented Dec 6, 2017

Do we also want to do that for the TS, cljs, and scalajs forks?

@brentvatne
Copy link
Member Author

@dikaiosune - if they have their own react-native-scripts then possibly!

@anp
Copy link

anp commented Dec 7, 2017

@anp
Copy link

anp commented Dec 7, 2017

Can't find the others though.

@cem2ran
Copy link
Collaborator

cem2ran commented Dec 11, 2017

A few proposals:

  1. Rename scripts-version to with, and overload it to match on certain keywords before delegating to getInstallPackage such that reason maps to reason-react-native-scripts, etc. etc.:
const getScriptVersion = arg => {
  const normalized = String(arg).toLowerCase();
  switch(normalized) {
    case 'reason':
    case 'reasonml':
      return 'reason-react-native-scripts'
    case 'typescript':
    case 'ts':
      return 'react-native-scripts-ts'
    default: return arg
  } 
};

createApp(commands[0], !!argv.verbose, getScriptVersion(argv['with'])).then(() => {});

The following: yarn create react-native-app MyProject --with reason reads pretty imo.

This could also be implemented on top of create-react-native-app as a separate library/binary, but seems a bit overkill.

  1. Have a separate argument --language | --kind doing pretty much the same as 1.

  2. Use --reason, --typescript... directly as in my PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants