Skip to content

Commit 1c11ceb

Browse files
Add environment files for navigation templates and implement utility functions for command checks, online status, and directory write permissions
1 parent d4777af commit 1c11ceb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3245
-2753
lines changed

.github/workflows/publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: NPM Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: "16" # Specify the Node.js version you want to use
20+
registry-url: "https://registry.npmjs.org"
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Build
26+
run: npm run build
27+
28+
- name: Publish to NPM
29+
run: npm publish
30+
env:
31+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,97 @@
1-
# React Native CLI Setup
1+
<h1 style="text-align: center;">React Native Lab</h1>
22

3-
![Github License](https://img.shields.io/github/license/developer-sumit/react-native-cli-setup)
3+
![Github License](https://img.shields.io/github/license/developer-sumit/react-native-lab)
44

55
**GITHUB** \
6-
![Github Version](https://img.shields.io/github/package-json/v/developer-sumit/react-native-cli-setup)
7-
![Github Repo Created At](https://img.shields.io/github/created-at/developer-sumit/react-native-cli-setup)
8-
![Github Repo Contributors](https://img.shields.io/github/contributors/developer-sumit/react-native-cli-setup)
9-
![Github Repo Fork](https://img.shields.io/github/forks/developer-sumit/react-native-cli-setup)
6+
![Github Version](https://img.shields.io/github/package-json/v/developer-sumit/react-native-lab)
7+
![Github Repo Created At](https://img.shields.io/github/created-at/developer-sumit/react-native-lab)
8+
![Github Repo Contributors](https://img.shields.io/github/contributors/developer-sumit/react-native-lab)
9+
![Github Repo Fork](https://img.shields.io/github/forks/developer-sumit/react-native-lab)
1010

1111
**NPM** \
12-
![NPM Package Version](https://img.shields.io/npm/v/react-native-cli-setup)
13-
![NPM Package Last Updated](https://img.shields.io/npm/last-update/react-native-cli-setup)
14-
![NPM Package Downloads](https://img.shields.io/npm/dw/react-native-cli-setup)
12+
![NPM Package Version](https://img.shields.io/npm/v/react-native-lab)
13+
![NPM Package Last Updated](https://img.shields.io/npm/last-update/react-native-lab)
14+
![NPM Package Downloads](https://img.shields.io/npm/d18m/react-native-lab)
1515

16-
`react-native-cli-setup` is a npm package tool to set up a React Native project with some pre-defined configurations. This tool helps you quickly set up a React Native development environment, including installing necessary dependencies like JDK, Android Studio, and the React Native CLI.
16+
`react-native-lab` is a cli tool to set up a React Native project with some pre-defined configurations. This tool helps you quickly set up a React Native development environment, including installing necessary dependencies like JDK, Android Studio.
1717

18-
## Table of Contents
18+
This project is inspired by the simplicity and effectiveness of [create-next-app](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
1919

20-
- 🚀 [Features](#🚀-features)
21-
- ⚙️ [Prerequisites](#⚙️-prerequisites)
22-
- 🏁 [Getting Started](#🏁-getting-started)
23-
- 🛠️ [Common Issues](#🛠️-common-issues)
24-
- 🆘 [Getting Help](#🆘-getting-help)
25-
- 🤝 [Contributing](#🤝-contributing)
26-
- 📜 [License](#📜-license)
20+
<h2 style="text-align: center;">Table of Contents</h2>
2721

28-
## 🚀 Features
22+
- 🚀 [Features](#features)
23+
- 📸 [Screenshots](#screenshots)
24+
- ⚙️ [Prerequisites](#prerequisites)
25+
- 🏁 [Getting Started](#getting-started)
26+
- 🛠️ [Common Issues](#common-issues)
27+
- 🆘 [Getting Help](#getting-help)
28+
- 🤝 [Contributing](#contributing)
29+
- 📜 [License](#license)
2930

30-
- Installs JDK (OpenJDK)
31-
- Installs Android Studio
32-
- Installs React Native CLI
33-
- Adds system environment variables - ANDROID_HOME, ANDROID_SDK_ROOT, JAVA_HOME
34-
- Initializes a new React Native project
31+
<h2 id="features" style="text-align: center;">🚀 Features</h2>
3532

36-
## ⚙️ Prerequisites
33+
- **Installs JDK (OpenJDK)**: Automatically installs the necessary JDK for Android development.
34+
- **Installs Android Studio**: Sets up Android Studio, including the necessary SDKs and tools.
35+
- **Sets Environment Variables**: Configures system environment variables such as `ANDROID_HOME`, `ANDROID_SDK_ROOT`, and `JAVA_HOME`.
36+
- **Pre-built Templates**: Choose from a variety of pre-built templates to kickstart your React Native project.
37+
- **Customizable Configuration**: Allows you to customize the project setup according to your preferences.
38+
- **Cross-Platform Support**: Works on Windows, macOS, and Linux.
39+
- **Environment Setup**: Optionally sets up a `.env` file for managing environment variables.
40+
- **Navigation Setup**: Optionally sets up React Navigation in your project.
41+
- **Alias Configuration**: Configures path aliases for cleaner and more manageable imports.
42+
43+
<h2 id="screenshots" style="text-align: center;">📸 Screenshots</h2>
44+
45+
Here are the available templates you can use with `react-native-lab`:
46+
47+
![Setup](./images/setup-1.png)
48+
![Setup](./images/setup-2.png)
49+
50+
<div style="display: flex; gap: 20px;">
51+
<div style="text-align: center;">
52+
<h4>Blank Template</h4>
53+
<img src="./images/blank-template.png" alt="Blank Template" style="width: 300px; border-radius: 10px;">
54+
</div>
55+
<div style="text-align: center;">
56+
<h4>Navigation Template</h4>
57+
<img src="./images/navigation-template.png" alt="Navigation Template" style="width: 300px; border-radius: 10px;">
58+
</div>
59+
</div>
60+
61+
<h2 id="prerequisites" style="text-align: center;">⚙️ Prerequisites</h2>
3762

3863
- Node.js (v14 or higher)
3964
- npm (v6 or higher)
40-
- Windows operating system
4165

42-
## 🏁 Getting Started
66+
<h2 id="getting-started" style="text-align: center;">🏁 Getting Started</h2>
4367

44-
To get started with `react-native-cli-setup`, follow these steps:
68+
To get started with `react-native-lab`, follow these steps:
4569

4670
1. Ensure you have all the prerequisites installed on your system.
4771
2. You can use `npx` to run the tool without installing it:
4872
```sh
49-
npx react-native-cli-setup
73+
npx react-native-lab
5074
```
5175

52-
## 🛠️ Common Issues
76+
<h2 id="common-issues" style="text-align: center;">🛠️ Common Issues</h2>
5377

5478
- **Installation Errors**: Ensure you have the correct versions of Node.js and npm installed. Try clearing the npm cache:
5579
```sh
5680
npm cache clean --force
5781
```
5882
- **Permission Errors**: Run the command with elevated privileges (e.g., using `sudo` on macOS/Linux or running the terminal as an administrator on Windows).
5983

60-
## 🆘 Getting Help
84+
<h2 id="getting-help" style="text-align: center;">🆘 Getting Help</h2>
6185

6286
If you need further assistance, you can:
6387

64-
- Check the [GitHub Issues](https://github.com/developer-sumit/react-native-cli-setup/issues) for similar problems.
88+
- Check the [GitHub Issues](https://github.com/developer-sumit/react-native-lab/issues) for similar problems.
6589
- Open a new issue with detailed information about your problem.
6690
- Reach out to the community for support.
6791

6892
By following these steps, you should be able to resolve most issues and get your React Native project up and running smoothly.
6993

70-
## 🤝 Contributing
94+
<h2 id="contributing" style="text-align: center;">🤝 Contributing</h2>
7195

7296
Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.
7397

@@ -82,6 +106,6 @@ To contribute:
82106

83107
Please make sure to follow the project's coding guidelines and standards.
84108

85-
## 📜 License
109+
<h2 id="license" style="text-align: center;">📜 License</h2>
86110

87111
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

images/banner.jpg

147 KB
Loading

images/blank-template.png

307 KB
Loading

images/navigation-template.png

74 KB
Loading

images/setup-1.png

30 KB
Loading

images/setup-2.png

58.5 KB
Loading

images/template-2.png

63.6 KB
Loading

index.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env node
2+
/* eslint-disable import/no-extraneous-dependencies */
3+
4+
import prompts from "./src/prompts";
5+
import retry from "./src/helpers/retry";
6+
import createReactNative from "./react-native-lab";
7+
import { installJDK, installAndroidStudio } from "./src/install";
8+
9+
/** Main setup function */
10+
async function setup() {
11+
const prompt = await prompts();
12+
13+
if (prompt.installJDK) {
14+
await retry(installJDK);
15+
}
16+
17+
if (prompt.installAndroidStudio) {
18+
await retry(installAndroidStudio);
19+
}
20+
21+
// Create the React Native project with user inputs
22+
await createReactNative({
23+
appPath: prompt.projectName,
24+
packageManager: prompt.packageManager,
25+
srcDir: prompt.srcDir,
26+
envEnabled: prompt.envEnabled,
27+
template: prompt.template,
28+
disableGit: prompt.disableGit,
29+
skipInstall: false,
30+
});
31+
}
32+
33+
// Run the setup function
34+
setup().catch((error) => {
35+
console.error("Setup failed:", error);
36+
process.exit(1);
37+
});

0 commit comments

Comments
 (0)