forked from obytes/react-native-template-obytes
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
executable file
·34 lines (28 loc) · 1.11 KB
/
index.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
#!/usr/bin/env node
const { consola } = require('consola');
const { showMoreDetails } = require('./utils.js');
const { cloneLatestTemplateRelease } = require('./clone-repo.js');
const { setupProject, installDependencies } = require('./setup-project.js');
const pkg = require('./package.json');
const { name: packageName } = pkg;
const createRootstrapApp = async () => {
consola.box("Rootstrap's React Native Template\nPerfect React Native App Kickstart 🚀!");
// get project name from command line
const projectName = process.argv[2];
// check if project name is provided
if (!projectName) {
consola.error(
`Please provide a name for your project: \`npx ${packageName}@latest <project-name>\``
);
process.exit(1);
}
// clone the latest release of the template from github
await cloneLatestTemplateRelease(projectName);
// setup the project
await setupProject(projectName);
// install project dependencies using pnpm
await installDependencies(projectName);
// show instructions to run the project + link to the documentation
showMoreDetails(projectName);
};
createRootstrapApp();