Skip to content

Commit a76efda

Browse files
committed
updated readme and refactored installDependencies
1 parent b72865b commit a76efda

4 files changed

Lines changed: 44 additions & 6 deletions

File tree

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,41 @@
22

33
Create React Application with all standard practices, with easy formats known to users, so that users can easily modify the various config files.
44

5+
## Creating an App
6+
7+
### npm
8+
9+
```
10+
npm create-react-webpack demo-app
11+
```
12+
13+
it will create a directory `demo-app` in the current folder, with below file footprint.
14+
15+
```
16+
demo-app
17+
├── README.md
18+
├── node_modules
19+
├── package.json
20+
├── .gitignore
21+
├── .babelrc
22+
├── .eslintrc.json
23+
├── .eslintignore
24+
├── .prettierrc
25+
├── .prettierignore
26+
├── public
27+
│ ├── favicon.ico
28+
│ ├── index.html
29+
│ └── manifest.json
30+
└── src
31+
│ ├── App.css
32+
│ ├── App.js
33+
│ ├── App.spec.js
34+
│ └── index.js
35+
├── webpack.config.base.js
36+
├── webpack.config.dev.js
37+
└── webpack.config.prod.js
38+
```
39+
540
## Available Scripts
641

742
After creating project directory you can run following scripts:-

scripts/constants.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
const path = require("path");
2+
const CLEAN_NPM_CACHE = "npm cache clean --force";
23
const SPECIALCHAR = RegExp("/[!@#$%^&*()-=_,.?~:;\\{}|<>]/g");
34
const UNNECESSORYFOLDERS = RegExp("^node_modules|build|dist$", "i");
45
const TEMPLATE_PATH = path.join(__dirname, "../template");
56

6-
module.exports = { SPECIALCHAR, TEMPLATE_PATH, UNNECESSORYFOLDERS };
7+
module.exports = {
8+
CLEAN_NPM_CACHE,
9+
SPECIALCHAR,
10+
TEMPLATE_PATH,
11+
UNNECESSORYFOLDERS
12+
};

scripts/create.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require("path");
22
const { copyDirectory, ErrorMessage, SuccessMessage } = require("./helper");
3-
const { SPECIALCHAR, TEMPLATE_PATH } = require("./constants");
3+
const { CLEAN_NPM_CACHE, SPECIALCHAR, TEMPLATE_PATH } = require("./constants");
44
const {
55
installDependencies,
66
getDependencies,
@@ -28,6 +28,7 @@ if (dirName[0].match("^[A-Z0-9]")) {
2828
let commands = [],
2929
options;
3030

31+
commands.push(CLEAN_NPM_CACHE);
3132
commands.push(getDependencies());
3233
commands.push(getDevDependencies());
3334
options = { cwd: destination, stdio: "inherit" };

scripts/dependencies.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const child_process = require("child_process");
2-
const { SuccessMessage } = require("./helper");
32

43
const DEPENDENCIES = ["prop-types", "react", "react-dom", "react-hot-loader"];
54
const DEV_DEPENDENCIES = [
@@ -58,13 +57,10 @@ function getDevDependencies() {
5857
*/
5958
function installDependencies(commands, options) {
6059
options.stdio = options.stdio || "inherit";
61-
//cleaning the npm cache
62-
child_process.execSync("npm cache clean --force", options);
6360

6461
if (commands) {
6562
try {
6663
commands.forEach(command => {
67-
console.log(SuccessMessage(command));
6864
child_process.execSync(command, options);
6965
});
7066
} catch (error) {

0 commit comments

Comments
 (0)