Last active
August 24, 2016 16:59
-
-
Save swapnilmishra/0049b41507fb82f5b96db2cf0f8a1836 to your computer and use it in GitHub Desktop.
Script to create component and index file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo -n "Enter Component name > " | |
read componentName | |
mkdir -p -- "$componentName" | |
cd $componentName | |
{ | |
echo "import React, { Component } from 'react';" | |
echo "import { observer, inject } from 'mobx-react';" | |
echo "import styles from './style.scss';" | |
echo "@observer" | |
echo "class '$componentName' extends Component {" | |
echo " render() {" | |
echo " return (" | |
echo " <div className = 'test-component'>" | |
echo "{'test component'}" | |
echo '</div>' | |
echo ');' | |
echo '}' | |
echo '}' | |
echo "export default '$componentName";'' | |
} >$componentName.jsx | |
{ | |
echo "import '$componentName' from './"$componentName"';" | |
echo "" | |
echo "export default '$componentNam'";" | |
} >index.js | |
{ | |
echo "" | |
} >style.scss |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment