Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
fix(plugin): Delegate git init and ignite attach to Ignite CLI (#183 by
Browse files Browse the repository at this point in the history
@jamonholmgren and @leonskim)

[skip ci]
  • Loading branch information
jamonholmgren authored May 22, 2019
1 parent f0583c4 commit 49a5d04
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- run:
name: Install React Native CLI and Ignite CLI
command: |
sudo npm i -g ignite-cli@next react-native-cli
sudo npm i -g ignite-cli@latest react-native-cli
- run:
name: Run tests
command: yarn ci:test # this command will be added to/found in your package.json scripts
Expand Down
14 changes: 0 additions & 14 deletions boilerplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ async function install(context) {
const templates = [
{ template: 'index.js.ejs', target: 'index.js' },
{ template: 'README.md', target: 'README.md' },
{ template: 'ignite.json.ejs', target: 'ignite/ignite.json' },
{ template: '.gitignore.ejs', target: '.gitignore' },
{ template: '.prettierignore', target: '.prettierignore' },
{ template: '.solidarity', target: '.solidarity' },
Expand Down Expand Up @@ -236,19 +235,6 @@ async function install(context) {
throw e
}

// git configuration
const gitExists = await filesystem.exists('./.git')
if (!gitExists && !parameters.options['skip-git'] && system.which('git')) {
// initial git
const spinner = print.spin('configuring git')

// TODO: Make husky hooks optional
const huskyCmd = '' // `&& node node_modules/husky/bin/install .`
await system.run(`git init . && git add . && git commit -m "Initial commit." ${huskyCmd}`)

spinner.succeed(`configured git`)
}

// re-run yarn
const installDeps = ignite.useYarn ? 'yarn' : 'npm install'
await system.run(installDeps)
Expand Down
22 changes: 13 additions & 9 deletions boilerplate/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <%= props.name %>
# <%= props.name %>

[![CircleCI](https://circleci.com/gh/infinitered/ignite-bowser.svg?style=svg)](https://circleci.com/gh/infinitered/ignite-bowser)

Expand All @@ -8,11 +8,11 @@ This is the boilerplate that [Infinite Red](https://infinite.red) uses as a way

Currently includes:

* React Native
* React Navigation
* MobX State Tree
* TypeScript
* And more!
- React Native
- React Navigation
- MobX State Tree
- TypeScript
- And more!

## Quick Start

Expand Down Expand Up @@ -85,6 +85,7 @@ app
├── app.tsx
├── environment-variables.ts
```

**components**
This is where your React components will live. Each component will have a directory containing the `.tsx` file, along with a story file, and optionally `.presets`, and `.props` files for larger components. The app will come with some commonly used components like Button.

Expand Down Expand Up @@ -112,16 +113,19 @@ This is a great place to put miscellaneous helpers and utilities. Things like da
**app.tsx** This is the entry point to your app. This is where you will find the main App component which renders the rest of the application. This is also where you will specify whether you want to run the app in storybook mode.

### ./ignite directory

The `ignite` directory stores all things Ignite, including CLI and boilerplate items. Here you will find generators, plugins and examples to help you get started with React Native.

### ./storybook directory

This is where your stories will be registered and where the Storybook configs will live

### ./test directory
This directory will hold your Jest configs and mocks, as well as your [storyshots](https://github.com/storybooks/storybook/tree/master/addons/storyshots) test file. This is a file that contains the snapshots of all your component storybooks.

This directory will hold your Jest configs and mocks, as well as your [storyshots](https://github.com/storybooks/storybook/tree/master/addons/storyshots) test file. This is a file that contains the snapshots of all your component storybooks.

## Running Storybook

From the command line in your generated app's root directory, enter `yarn run storybook`
This starts up the storybook server.

Expand All @@ -131,8 +135,8 @@ For Visual Studio Code users, there is a handy extension that makes it easy to l

## Previous Boilerplates

* [2017 aka Andross](https://github.com/infinitered/ignite-andross)
* [2016 aka Ignite 1.0](https://github.com/infinitered/ignite-ir-boilerplate-2016)
- [2017 aka Andross](https://github.com/infinitered/ignite-andross)
- [2016 aka Ignite 1.0](https://github.com/infinitered/ignite-ir-boilerplate-2016)

## Premium Support

Expand Down
7 changes: 0 additions & 7 deletions boilerplate/ignite.json.ejs

This file was deleted.

19 changes: 12 additions & 7 deletions commands/generate/navigator.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const patterns = require('../../lib/patterns')

module.exports = {
description: 'Generates a React Navigation navigator.',
run: async function(toolbox) {
const patterns = require('../../lib/patterns')

// grab some features
const {
parameters,
Expand All @@ -15,8 +15,6 @@ module.exports = {
filesystem: { list }
} = toolbox

const config = ignite.loadIgniteConfig()

// prettier-ignore
const navigatorTypes = {
'Stack': "createStackNavigator",
Expand All @@ -34,9 +32,16 @@ module.exports = {
return
}

// validation
if (config.navigation !== 'react-navigation') {
print.info('This generator only works with react-navigation.')
// grab the closest package.json
const packageJSON = await require('read-pkg-up')()
if (!packageJSON) {
print.error(`Can't find a package.json here or in parent directories.`)
return
}

// ensure react-navigation is installed
if (Object.keys(packageJSON.dependencies).includes('react-navigation') === false) {
print.error('This generator only works with react-navigation.')
return
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"tempy": "^0.2.1"
},
"dependencies": {
"ramda": "^0.25.0"
"ramda": "^0.25.0",
"read-pkg-up": "^5.0.0"
},
"jest": {
"testPathIgnorePatterns": [
Expand Down
20 changes: 12 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ This is the boilerplate that the [Infinite Red](https://infinite.red) team recom

Includes:

* React Native
* React Navigation
* MobX State Tree
* TypeScript
* Reactotron (requires 2.x)
* And more!
- React Native
- React Navigation
- MobX State Tree
- TypeScript
- Reactotron (requires 2.x)
- And more!

To see it in action, check out these [examples](https://github.com/infinitered/ignite-bowser-examples)!

Expand Down Expand Up @@ -93,6 +93,7 @@ app
├── app.tsx
├── environment-variables.ts
```

**components**
This is where your React dumb components will live. Each component will have a directory containing the `.tsx` file, along with a story file, and optionally `.presets`, and `.props` files for larger components. The app will come with some commonly used components like Button.

Expand Down Expand Up @@ -120,18 +121,21 @@ This is a great place to put miscellaneous helpers and utilities. Things like da
**app.tsx** This is the entry point to your app. This is where you will find the main App component which renders the rest of the application. This is also where you will specify whether you want to run the app in storybook mode.

### ./ignite directory

The `ignite` directory stores all things Ignite, including CLI and boilerplate items. Here you will find generators, plugins and examples to help you get started with React Native.

### ./storybook directory

This is where your stories will be registered and where the Storybook configs will live

### ./test directory

This directory will hold your Jest configs and mocks, as well as your [storyshots](https://github.com/storybooks/storybook/tree/master/addons/storyshots) test file. This is a file that contains the snapshots of all your component storybooks.

## Previous Boilerplates

* [2017 aka Andross](https://github.com/infinitered/ignite-andross)
* [2016 aka Ignite 1.0](https://github.com/infinitered/ignite-ir-boilerplate-2016)
- [2017 aka Andross](https://github.com/infinitered/ignite-andross)
- [2016 aka Ignite 1.0](https://github.com/infinitered/ignite-ir-boilerplate-2016)

## Premium Support

Expand Down

0 comments on commit 49a5d04

Please sign in to comment.