Skip to content

Commit 03bcd89

Browse files
committed
Bump version
1 parent fa9710e commit 03bcd89

File tree

10 files changed

+58
-9
lines changed

10 files changed

+58
-9
lines changed

.babelrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"node_modules",
99
"store.js",
1010
"coverage",
11-
"legacy",
12-
"cliModel/starter-code"
11+
"legacy"
1312
],
1413
"plugins": [
1514
"@babel/plugin-transform-regenerator",

lib/cliModel/install-commands.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,5 @@ module.exports = {
6969
install: 'npm install unstated-next --save',
7070
uninstall: 'npm uninstall unstated-next'
7171
}
72-
} // easyPeasy: "npm install easy-peasy"
73-
72+
}
7473
};

lib/cliModel/starter-code/propTypes.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"use strict";
2+
3+
var propTypesObject = function propTypesObject(fileName) {
4+
return {
5+
"import": "import PropTypes from 'prop-types'",
6+
declare: "".concat(fileName, ".PropTypes = {\n ///\n }")
7+
};
8+
};
9+
10+
var reactRouterObj = function reactRouterObj() {
11+
return {
12+
"import": "import {BrowserRouter as Route, Router, NavLink} from \"react-router-dom\"",
13+
declare: "Hello World"
14+
};
15+
};
16+
17+
var reduxObj = function reduxObj() {
18+
return {
19+
"import": "import {connect} from 'redux'",
20+
mapStateToProps: "const mapStateToProps = state => {\n return {\n // Your code here\n }\n}",
21+
mapDispatchToProps: "const mapDispatchToProps = dispatch => {\n return {\n // Your code here\n }\n} ",
22+
connect: "connect(mapStateToProps, mapDispatchToProps)"
23+
};
24+
};
25+
26+
module.exports = function (componentType, fileName, propTypes, reactRouter, Redux) {
27+
//Function Component
28+
var propTyping, reactRouting, reactRedux;
29+
propTypes === true ? propTyping = propTypesObject(fileName) : null;
30+
reactRouter === true ? reactRouting = reactRouterObj() : null;
31+
Redux === true ? reactRedux = reduxObj() : null;
32+
33+
if (componentType === 'function') {
34+
return "import React from \"react\";\n".concat(propTyping ? propTyping["import"] : '', "\n").concat(reactRouting ? reactRouting["import"] : '', "\n").concat(reactRedux ? reactRedux["import"] : '', "\n\nconst ").concat(fileName, " = (props) => {\n return (\n <div>\n Hello World\n </div>\n );\n};\n\n").concat(propTyping ? propTyping.declare : '', "\n").concat(reactRedux ? reactRedux.mapStateToProps : '', "\n").concat(reactRedux ? reactRedux.mapDispatchToProps : '', "\n\nexport default ").concat(reactRedux ? reactRedux.connect : '', "(").concat(fileName, ");");
35+
} // Class Component
36+
else if (componentType === 'class') {
37+
var _propTyping, _reactRouting, _reactRedux;
38+
39+
propTypes === true ? _propTyping = propTypesObject(fileName) : null;
40+
reactRouter === true ? _reactRouting = reactRouterObj() : null;
41+
Redux === true ? _reactRedux = reduxObj() : null;
42+
return "import React, { Component } from 'react'\n".concat(_propTyping ? _propTyping["import"] : '', "\n").concat(_reactRouting ? _reactRouting["import"] : '', "\n").concat(_reactRedux ? _reactRedux["import"] : '', "\n\nclass ").concat(fileName, " extends Component {\n constructor(props) {\n super(props);\n }\n\n state = {\n // Declare your component state here\n }\n\n render() {\n return (\n <div>\n <h2>Class Component</h2>\n </div>\n )\n }\n}\n\n").concat(_propTyping ? _propTyping.declare : '', "\n").concat(_reactRedux ? _reactRedux.mapStateToProps : '', "\n").concat(_reactRedux ? _reactRedux.mapDispatchToProps : '', "\n\nexport default ").concat(_reactRedux ? _reactRedux.connect : '', "(").concat(fileName, ");");
43+
}
44+
};

lib/cliModel/starter-code/redux.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/cliRoutes/StateManagement/redux.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ function () {
7777
value: function uninstall(packageInstaller) {
7878
switch (packageInstaller) {
7979
case 'NPM':
80-
customCMD.get("".concat(reduxObj.uninstall), 'install', 'Packages: redux & react-redux have been uninstalled successfully!');
80+
customCMD.get("".concat(reduxObj.uninstall), 'uninstall', 'Packages: redux & react-redux have been uninstalled successfully!');
8181
break;
8282

8383
case 'Yarn':
84-
customCMD.get("".concat(reduxObjYarn.uninstall), 'install', 'Packages: redux & react-redux have been uninstalled successfully!');
84+
customCMD.get("".concat(reduxObjYarn.uninstall), 'uninstall', 'Packages: redux & react-redux have been uninstalled successfully!');
8585
break;
8686
}
8787
}

lib/cliRoutes/StateManagement/reduxThunk.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ function () {
5353
switch (packageInstaller) {
5454
case 'NPM':
5555
customCMD.get("".concat(reduxThunkObj.install), 'install', 'Package: Redux-Thunk has been installed successfully! Check out more on how to get started with Redux-Thunk on the following links https://github.com/reduxjs/redux-thunk');
56-
console.log();
5756
break;
5857

5958
case 'Yarn':

lib/cliRoutes/propTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function () {
7474
switch (packageInstaller) {
7575
case 'NPM':
7676
customCMD.get("".concat(propTypesObj.install), 'install', 'Package: prop-types has been installed successfully! PropTypes Folder has been created!');
77+
break;
7778

7879
case 'Yarn':
7980
customCMD.get("".concat(propTypesObjYarn.install), 'install', 'Package: prop-types has been installed successfully! PropTypes Folder has been created!');

lib/customNodeCMD/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ Display custom message instead default node progress bar
3434

3535

3636
function getCommand(command, installOrUninstall, finalCommand) {
37-
console.log("".concat(installOrUninstall, "ing Packages..."));
37+
var installTxt = installOrUninstall.replace(installOrUninstall[0], installOrUninstall[0].toUpperCase());
38+
console.log("".concat(installTxt, "ing Packages..."));
3839
return new Promise(function (resolve, reject) {
3940
var subproc = spawn(command, {
4041
stdio: 'inherit',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "advanced-react-cli",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "NPM package which aims to provide a better way to install packages for your react application through an intuitive CLI",
55
"main": "cli.js",
66
"scripts": {

0 commit comments

Comments
 (0)