diff --git a/README.md b/README.md index af0be1cd..636daac7 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,10 @@ Once you're up and running with Create React Native App, visit [this tutorial](h ### Templates -By default you create a [bare-workflow React](https://docs.expo.io/bare/exploring-bare-workflow/) project with support for iOS, Android, and web. You can opt to use an example project instead by selecting the "Templates from ..." option. Custom templates can be used with `--template ` option. +By default you create a [bare-workflow React](https://docs.expo.io/bare/exploring-bare-workflow/) project with support for iOS, Android, and web. You can opt to use an example project instead by selecting the "Templates from ..." option. Custom templates can be used with `--template ` option. - Use an [example](https://github.com/expo/examples): `npx create-react-native-app -t with-typescript` -- Use a custom template: `npx create-react-native-app --template https://github.com/someone/my-react-starter` -- Only works with Github repos on the master branch. +- Use a custom template: `npx create-react-native-app --template https://github.com/someone/my-react-starter` -- Only works with GitHub repos on the master branch. - All examples can be modified in the [expo/examples](https://github.com/expo/examples) repo. ## Sections diff --git a/src/Template.ts b/src/Template.ts index 3f0ee521..11d332e7 100644 --- a/src/Template.ts +++ b/src/Template.ts @@ -21,6 +21,8 @@ const pipeline = promisify(Stream.pipeline); const isMacOS = process.platform === 'darwin'; +const packageJSON = require('../package.json'); + export type PackageManagerName = 'yarn' | 'npm'; /** @@ -77,10 +79,10 @@ export async function initGitRepoAsync( // let's see if we're in a git tree try { await spawnAsync('git', ['rev-parse', '--is-inside-work-tree'], { stdio: 'ignore', cwd: root }); - !flags.silent && Logger.gray('New project is already inside of a git repo, skipping git init.'); + !flags.silent && Logger.gray('New project is already inside of a Git repo, skipping git init.'); } catch (e) { if (e.errno === 'ENOENT') { - !flags.silent && Logger.gray('Unable to initialize git repo. `git` not in PATH.'); + !flags.silent && Logger.gray('Unable to initialize Git repo. `git` not in PATH.'); return false; } } @@ -89,12 +91,13 @@ export async function initGitRepoAsync( try { await spawnAsync('git', ['init'], { stdio: 'ignore', cwd: root }); await spawnAsync('git', ['add', '-A'], { stdio: 'ignore', cwd: root }); - await spawnAsync('git', ['commit', '-m', '"Initial commit via create-react-native-app"'], { + const commitMsg = `Initial commit\n\nGenerated by ${packageJSON.name} ${packageJSON.version}.`; + await spawnAsync('git', ['commit', '-m', commitMsg], { stdio: 'ignore', cwd: root, }); - !flags.silent && Logger.gray('Initialized a git repository.'); + !flags.silent && Logger.gray('Initialized a Git repository.'); return true; } catch (e) { // no-op -- this is just a convenience and we don't care if it fails @@ -240,7 +243,7 @@ async function getNpmUrlAsync(packageName: string): Promise { const url = (await spawnAsync('npm', ['v', packageName, 'dist.tarball'])).stdout; if (!url) { - throw new Error(`Could not get NPM url for package "${packageName}"`); + throw new Error(`Could not get npm url for package "${packageName}"`); } return url; diff --git a/src/index.ts b/src/index.ts index 61b15efc..03c79b02 100755 --- a/src/index.ts +++ b/src/index.ts @@ -21,12 +21,12 @@ const program = new Command(packageJSON.name) .description('Creates a new React Native project') .option('--use-npm', 'Use npm to install dependencies. (default when Yarn is not installed)') .option('-y, --yes', 'Use the default options for creating a project') - .option('--no-install', 'Skip installing NPM packages or CocoaPods.') + .option('--no-install', 'Skip installing npm packages or CocoaPods.') .option( '-t, --template [template|url]', - 'The name of a template from expo/examples or URL to a github repo that contains an example.' + 'The name of a template from expo/examples or URL to a GitHub repo that contains an example.' ) - .option('--template-path [name]', 'The path inside of a github repo where the example lives.') + .option('--template-path [name]', 'The path inside of a GitHub repo where the example lives.') .allowUnknownOption() .action(projectRoot => (inputPath = projectRoot)) .parse(process.argv);