Skip to content

Commit 1a269d1

Browse files
committed
tech(base): update recipe install
1 parent 1c83bdf commit 1a269d1

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

recipes/install.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const {
1717
moduleSetInstall,
1818
} = require("./utils");
1919

20-
const install = function(appName,directory) {
20+
const install = function(directory, appName = '') {
2121
CFonts.say("React Chef", {
2222
type: 5,
2323
font: "block", // define the font face
@@ -48,7 +48,7 @@ const install = function(appName,directory) {
4848
const isSlimProject = (type) => type === defaultProjectType;
4949

5050
tryAccess(baseDirPath)
51-
.then(() => {}, function onPathExist() {
51+
.then(() => undefined, function onPathExist() {
5252
if(!directory){
5353
error(
5454
`Choose different App name. ${appName} is already exist in ${process.cwd()}`
@@ -146,6 +146,11 @@ const install = function(appName,directory) {
146146
return answers;
147147
})
148148
.then((answers) => {
149+
if (baseConfig.canAdd.gitIgnore) {
150+
const gitIgnoreFileName = `git-ignore.txt`;
151+
createFile('.gitignore', getFileContent(gitIgnoreFileName));
152+
}
153+
149154
const babelConfigFileName = `.babelrc`;
150155
createFile(babelConfigFileName, getFileContent(babelConfigFileName));
151156

@@ -189,6 +194,21 @@ const install = function(appName,directory) {
189194

190195
const sourceSnippetDir = `${__dirname}/${projectType}/snippets/sources`;
191196

197+
if (baseConfig.canAdd.hooks) {
198+
// Copy Hooks.
199+
shell.cp("-Rf", `${sourceSnippetDir}/hooks`, ".");
200+
}
201+
202+
if (baseConfig.canAdd.environment) {
203+
// Copy Environment.
204+
shell.cp("-Rf", `${sourceSnippetDir}/env`, ".");
205+
}
206+
207+
if (baseConfig.canAdd.constants) {
208+
// Copy Constants.
209+
shell.cp("-Rf", `${sourceSnippetDir}/constants`, ".");
210+
}
211+
192212
if (baseConfig.canAdd.utils) {
193213
// Copy Utils.
194214
shell.cp("-Rf", `${sourceSnippetDir}/utils`, ".");

0 commit comments

Comments
 (0)