-
Notifications
You must be signed in to change notification settings - Fork 20
/
script.js
executable file
·96 lines (79 loc) · 2.45 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env node
console.log("Welcome to Mindinventory React native boilerplate");
const { execSync } = require("child_process");
const installDependencies = () => {
console.log("\n\n");
console.log(
"@mindinventory/react-native-boilerplate initialized with success! 🚀\n"
);
console.log("Installing dependencies... 🛠️\n");
execSync(`yarn`, { stdio: "inherit" });
console.log("Dependencies installed successfully. 🚀\n");
console.log("bundle Installing 🛠️\n");
execSync(`bundle`, { stdio: "inherit" });
console.log("bundle installed successfully.🚀\n");
console.log("pod-install Installing 🛠️\n");
execSync(`npx pod-install`, { stdio: "inherit" });
console.log("pod-install installed successfully.🚀\n");
};
const fs = require("fs");
const initializeGit = () => {
const gitignoreContent = `
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
`;
fs.writeFileSync(".gitignore", gitignoreContent);
console.log(".gitignore file created successfully. 🚀\n");
try {
execSync("git add .", { stdio: "inherit", shell: true });
execSync(`git commit -m 'Initial commit'`, {
stdio: "inherit",
shell: true,
});
} catch (error) {
console.error(`🚨 An error occurred while initializing git: ${error}`);
}
};
const main = async () => {
execSync("git init", { stdio: "inherit" });
installDependencies();
initializeGit();
};
new Promise((resolve) => {
main();
resolve();
})
.then(() => {
console.log(
"- 🎉 Congrats! Your project is ready with @mindinventory/react-native-boilerplate! 🎉\n"
);
console.log(
"- 📚 If you need to read more about this boilerplate : https://github.com/Mindinventory/react-native-boilerplate/blob/master/README.md\n"
);
console.log(
"- 🤕 If you have some troubles : https://github.com/Mindinventory/react-native-boilerplate/issues\n"
);
console.log(
"- ⭐ If you love this boilerplate, give us a star, you will be a ray of sunshine in our lives :) https://github.com/Mindinventory/react-native-boilerplate\n"
);
})
.catch((error) => {
console.error(`🚨 An error occurred with post init script: ${error}`);
throw new Error();
});