create-atlas-rn-app 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,143 @@
1
+ <p align="center">
2
+ <img alt="React Native Template Atlas" src="https://user-images.githubusercontent.com/11137944/93101697-808bc580-f6a2-11ea-8ce3-482be6ca456a.png" width="200" />
3
+
4
+ </p>
5
+ <h1 align="center">
6
+ React Native Template Atlas
7
+ </h1>
8
+
9
+ ![expo](https://img.shields.io/github/package-json/dependency-version/leanhtuan1994/react-native-template-atlas/expo?label=expo) ![GitHub Repo stars](https://img.shields.io/github/stars/leanhtuan1994/react-native-template-atlas) ![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/leanhtuan1994/react-native-template-atlas) ![GitHub issues](https://img.shields.io/github/issues/leanhtuan1994/react-native-template-atlas) ![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/leanhtuan1994/react-native-template-atlas)
10
+
11
+ ๐Ÿ“ฑ A template for your next React Native project ๐Ÿš€, Made with developer experience and performance first: Expo,TypeScript,tailwindcss, Husky, Lint-Staged, expo-router, react-query, react-hook-form, I18n.
12
+
13
+ # ๐Ÿš€ Quick start
14
+
15
+ ```sh
16
+ npx create-atlas-rn-app@latest MyApp
17
+
18
+ ```
19
+
20
+ # Overview
21
+
22
+ As a team of experienced developers at Atlas, we have spent years refining our approach to building high-quality React Native applications. Our starter kit is based on the best practices and tools that we have found to be most effective in our own projects.
23
+
24
+ This starter kit has been thoroughly tested and proven successful in multiple projects over the past four years. It is regularly used by our team on a daily basis and has helped us deliver great results for our clients.
25
+
26
+ While our starter kit is heavily influenced by our own opinions and experiences, we have carefully selected the included solutions to address common challenges and meet the needs of the majority of use cases. We believe it offers a streamlined and efficient approach to building React Native apps, and we are confident that it can help others achieve their project goals as well.
27
+
28
+ ## ๐Ÿš€ Motivation
29
+
30
+ Our goal with this starter kit was to streamline the process of building React Native apps, both for our own team and for our clients. We wanted to create a resource that would allow us to create high-quality apps faster and with less effort, while ensuring that all of our projects adhere to the same code standards and architectural principles.
31
+
32
+ The benefits of using this starter kit are numerous. It helps our team easily switch between projects, as we can rely on a consistent foundation of code. It also allows us to focus on the business logic of each project rather than getting bogged down in boilerplate code. And, because it promotes consistency across projects, it makes it easier to maintain and scale our apps, as well as share code between teams.
33
+
34
+ Overall, our starter kit is designed to facilitate efficient and effective app development, helping us to bring the best possible products to our clients
35
+
36
+ ## โœ๏ธ Philosophy
37
+
38
+ When creating this starter kit, we had several guiding principles in mind::
39
+
40
+ - **๐Ÿš€ Production-ready**: We wanted to ensure that this starter was ready for real-world use, providing a solid foundation for building production-grade apps.
41
+ - **๐Ÿฅท Developer experience and productivity**: Our focus was on creating a starter that would enhance the developer experience and increase productivity.
42
+ - **๐Ÿงฉ Minimal code and dependencies**: We aimed to keep the codebase and dependencies as small as possible.
43
+ - **๐Ÿ’ช Well-maintained third-party libraries**: We included only well-maintained and reliable third-party libraries, to provide stability and support for our projects.
44
+
45
+ ## โญ key Features
46
+
47
+ - โœ… The latest version of Expo SDK, along with the Custom Dev client, to give you access to a range of powerful features and tools.
48
+ - ๐ŸŽ‰ [TypeScript](https://www.typescriptlang.org/) for type checking, to help you catch bugs and improve code quality.
49
+ - ๐Ÿ’… A minimal UI kit built with [tailwindcss](https://docs.uniwind.dev/), which provides a range of pre-defined classes for styling your app.
50
+ - โš™๏ธ Support for multiple environment builds, including Production, Staging, and Development, using Expo configuration.
51
+ - ๐ŸฆŠ Husky for Git Hooks, to automate your git hooks and enforce code standards.
52
+ - ๐Ÿ’ก A clean project structure with Absolute Imports, to make it easier to navigate and manage your code.
53
+ - ๐Ÿšซ Lint-staged for running linters and TypeScript checks on Git staged files, to ensure that your code is always up to standards.
54
+ - ๐Ÿ—‚ VSCode recommended extensions, settings, and snippets to enhance the developer experience.
55
+ - โ˜‚๏ธ Pre-installed [Expo Router](https://docs.expo.dev/router/introduction/) with examples, to provide a comprehensive navigation solution for your app.
56
+ - ๐Ÿ’ซ An auth flow with [zustand](https://github.com/pmndrs/zustand) and [react-native-mmkv](https://github.com/mrousavy/react-native-mmkv) as a storage solution to save sensitive data.
57
+ - ๐Ÿ›  A simple workflow for building, releasing, and distributing your app using [Github action](https://github.com/features/actions).
58
+ - ๐Ÿ”ฅ [React Query](https://react-query.tanstack.com/) & [axios](https://github.com/axios/axios) and [axios](https://github.com/axios/axios) for fetching data, to help you build efficient and performant apps.
59
+ - ๐Ÿงต A good approach for handling forms with [react-hook-form](https://react-hook-form.com/) and [zod](https://github.com/colinhacks/zod) for validation + keyboard handling.
60
+ - ๐ŸŽฏ Localization with [i18next](https://www.i18next.com/) , along with Eslint for validation.
61
+
62
+ ## โœ๏ธ Documentation
63
+
64
+ - [Create new project ](https://leanhtuan1994.github.io/react-native-template-atlas/docs/getting-started/create-new-app)
65
+ - [Rules and Conventions](https://leanhtuan1994.github.io/react-native-template-atlas/docs/getting-started/rules-and-convetions)
66
+ - [Project structure](https://leanhtuan1994.github.io/react-native-template-atlas/docs/getting-started/project-structure)
67
+ - [Environment vars and config](https://leanhtuan1994.github.io/react-native-template-atlas/docs/getting-started/environment-vars-config)
68
+ - [UI and Theming](https://leanhtuan1994.github.io/react-native-template-atlas/docs/ui-and-theme/ui-theming)
69
+ - [Components](https://leanhtuan1994.github.io/react-native-template-atlas/docs/ui-and-theme/components)
70
+ - [Forms](https://leanhtuan1994.github.io/react-native-template-atlas/docs/ui-and-theme/Forms)
71
+ - [Data fetching](https://leanhtuan1994.github.io/react-native-template-atlas/docs/guides/data-fetching)
72
+ - [Contribute to starter](https://leanhtuan1994.github.io/react-native-template-atlas/docs/contribute)
73
+
74
+ ## ๐Ÿ˜‰ Why Expo?
75
+
76
+ Expo is a powerful tool for building React Native apps, offering a range of features and benefits that can help developers create high-quality apps more efficiently. One question we often receive from the community is why we choose to use Expo instead of the React Native CLI.
77
+
78
+ In the past, our team used the React Native CLI for our starter kit. However, we found that using Expo presented several advantages. In particular, the introduction of the Custom dev client feature allowed us to take advantage of the Expo ecosystem and utilize native libraries without the need for ejecting the app. This has greatly simplified our development process and enabled us to focus on the business logic of our projects.
79
+
80
+ Additionally, we have found that using Expo has made it easier to upgrade our apps to new versions, eliminating the issues we previously encountered when using the React Native CLI.
81
+
82
+ Overall, we believe that Expo offers numerous benefits for building React Native apps and is a valuable tool for any developer. The real question may be, **why not use Expo?**
83
+
84
+ ## ๐Ÿค” Is this starter for you?
85
+
86
+ If you are planning to build a React Native app and are looking for a strong foundation, well-designed architecture, and a positive developer experience, then this starter kit is an excellent resource to consider. It offers a comprehensive set of best practices and tools that have been tested and proven effective in multiple projects.
87
+
88
+ Even if you are not sure that using a starter kit is the right choice for your project, you can still benefit from this resource. You can explore the starter kit and draw inspiration from the solutions it provides for common challenges faced by React Native developers. This can be a helpful way to discover good practices and find effective solutions for your own app development process.
89
+
90
+ Overall, whether you choose to use this starter kit as is or simply take some ideas from it, we believe it offers valuable insights and resources for anyone looking to build a high-quality React Native app.
91
+
92
+ ## ๐Ÿง‘โ€๐Ÿ’ป Stay up to date
93
+
94
+ We are committed to continually improving our starter kit and providing the best possible resources for building React Native apps. To that end, we regularly add new features and fix any bugs that are discovered.
95
+
96
+ If you want to stay up to date with the latest developments in our starter kit, you can either watch the repository or hit the "star" button. This will allow you to receive notifications whenever new updates are available.
97
+
98
+ We value the feedback and contributions of our users, and we encourage you to let us know if you have any suggestions for improving our starter kit. We are always looking for ways to make it even more effective and useful for our community. So, please do not hesitate to reach out and share your thoughts with us.
99
+
100
+ <!-- add a gif image here -->
101
+
102
+ ## ๐Ÿ’Ž Libraries used
103
+
104
+ - [Expo](https://docs.expo.io/)
105
+ - [Expo Router](https://docs.expo.dev/router/introduction/)
106
+ - [Uniwind](https://docs.uniwind.dev/)
107
+ - [Flash list](https://github.com/Shopify/flash-list)
108
+ - [React Query](https://tanstack.com/query/v4)
109
+ - [Axios](https://axios-http.com/docs/intro)
110
+ - [React Hook Form](https://react-hook-form.com/)
111
+ - [i18next](https://www.i18next.com/)
112
+ - [zustand](https://github.com/pmndrs/zustand)
113
+ - [React Native MMKV](https://github.com/mrousavy/react-native-mmkv)
114
+ - [React Native Gesture Handler](https://docs.swmansion.com/react-native-gesture-handler/docs/)
115
+ - [React Native Reanimated](https://docs.swmansion.com/react-native-reanimated/docs/)
116
+ - [React Native Svg](https://github.com/software-mansion/react-native-svg)
117
+ - [ React Error Boundaries](https://github.com/bvaughn/react-error-boundary)
118
+ - [Expo Image](https://docs.expo.dev/versions/unversioned/sdk/image/)
119
+
120
+ ## Contributors
121
+
122
+ This starter is maintained by [Atlas mobile tribe team](https://leanhtuan1994.github.io/team) and we welcome new contributors to join us in improving it. If you are interested in getting involved in the project, please don't hesitate to open an issue or submit a pull request.
123
+
124
+ In addition to maintaining this starter kit, we are also available to work on custom projects and help you build your dream app. If you are looking for experienced and reliable developers to bring your app vision to life, please visit our website at [obytes.com/contact](https://leanhtuan1994.github.io/contact) to get in touch with us. We would be happy to discuss your project in more detail and explore how we can help you achieve your goals.
125
+
126
+ ## ๐Ÿ”ฅ How to contribute?
127
+
128
+ Thank you for your interest in contributing to our project. Your involvement is greatly appreciated and we welcome your contributions. Here are some ways you can help us improve this project:
129
+
130
+ 1. Show your support for the project by giving it a ๐ŸŒŸ on Github. This helps us increase visibility and attract more contributors.
131
+ 2. Share your thoughts and ideas with us by opening an issue. If you have any suggestions or feedback about any aspect of the project, we are always eager to hear from you and have a discussion.
132
+ 3. If you have any questions about the project, please don't hesitate to ask. Simply open an issue and our team will do our best to provide a helpful and informative response.
133
+ 4. If you encounter a bug or typo while using the starter kit or reading the documentation, we would be grateful if you could bring it to our attention. You can open an issue to report the issue, or even better, submit a pull request with a fix.
134
+
135
+ We value the input and contributions of our community and look forward to working with you to improve this project.
136
+
137
+ ## โ“ FAQ
138
+
139
+ If you have any questions about the starter and want answers, please check out the [Discussions](https://github.com/leanhtuan1994/react-native-template-atlas/discussions) page.
140
+
141
+ ## ๐Ÿ”– License
142
+
143
+ This project is MIT licensed.
package/clone-repo.js ADDED
@@ -0,0 +1,35 @@
1
+ const { runCommand } = require('./utils.js');
2
+ const { consola } = require('consola');
3
+
4
+ const getLatestRelease = async () => {
5
+ try {
6
+ const repoData = await fetch(
7
+ 'https://api.github.com/repos/leanhtuan1994/react-native-template-atlas/releases/latest'
8
+ );
9
+ const releaseData = await repoData.json();
10
+ return releaseData.tag_name || 'master';
11
+ } catch (error) {
12
+ console.warn(
13
+ 'Failed to retrieve the latest release; will use the master branch instead'
14
+ );
15
+ return 'master';
16
+ }
17
+ };
18
+
19
+ const cloneLastTemplateRelease = async (projectName) => {
20
+ consola.start('Extracting last release number ๐Ÿ‘€');
21
+ const latest_release = await getLatestRelease();
22
+ consola.info(`Using Atlas starter ${latest_release}`);
23
+
24
+ // create a new project based on atlas template
25
+ const cloneStarter = `git clone -b ${latest_release} --depth=1 https://github.com/leanhtuan1994/react-native-template-atlas.git ${projectName}`;
26
+ await runCommand(cloneStarter, {
27
+ loading: 'Extracting the starter template...',
28
+ success: 'Starter extracted successfully',
29
+ error: 'Failed to download and extract template',
30
+ });
31
+ };
32
+
33
+ module.exports = {
34
+ cloneLastTemplateRelease,
35
+ };
package/index.js ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { consola } = require('consola');
4
+ const { showMoreDetails } = require('./utils.js');
5
+ const { cloneLastTemplateRelease } = require('./clone-repo.js');
6
+ const { setupProject, installDeps } = require('./setup-project.js');
7
+
8
+ const createAtlasApp = async () => {
9
+ consola.box('Atlas Starter\nPerfect React Native App Kickstart ๐Ÿš€!');
10
+ // get project name from command line
11
+ const projectName = process.argv[2];
12
+ // check if project name is provided
13
+ if (!projectName) {
14
+ consola.error(
15
+ 'Please provide a name for your project: `npx create-atlas-rn-app@latest <project-name>`'
16
+ );
17
+ process.exit(1);
18
+ }
19
+ // clone the last release of the template from github
20
+ await cloneLastTemplateRelease(projectName);
21
+
22
+ // setup the project: remove unnecessary files, update package.json infos, name and set version to 0.0.1 + add initial version to osMetadata
23
+ await setupProject(projectName);
24
+
25
+ // install project dependencies using pnpm
26
+ await installDeps(projectName);
27
+
28
+ // show instructions to run the project + link to the documentation
29
+ showMoreDetails(projectName);
30
+ };
31
+
32
+ createAtlasApp();
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "create-atlas-rn-app",
3
+ "version": "1.7.1",
4
+ "description": "Atlas expo starter cli",
5
+ "homepage": "https://github.com/leanhtuan1994/react-native-template-atlas",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/leanhtuan1994/react-native-template-atlas.git"
9
+ },
10
+ "main": "index.js",
11
+ "scripts": {
12
+ "start": "node ."
13
+ },
14
+ "bin": {
15
+ "create-atlas-rn-app": "index.js"
16
+ },
17
+ "files": [
18
+ "index.js",
19
+ "utils.js",
20
+ "clone-repo.js",
21
+ "setup-project.js"
22
+ ],
23
+ "dependencies": {
24
+ "consola": "^3.2.3",
25
+ "fs-extra": "^10.1.0"
26
+ },
27
+ "keywords": [
28
+ "react-native",
29
+ "expo",
30
+ "template",
31
+ "react-native-starter",
32
+ "expo-starter",
33
+ "react-native-boilerplate",
34
+ "expo-boilerplate",
35
+ "cli",
36
+ "atlas"
37
+ ]
38
+ }
@@ -0,0 +1,90 @@
1
+ const { execShellCommand, runCommand } = require('./utils.js');
2
+ const { consola } = require('consola');
3
+ const fs = require('fs-extra');
4
+ const path = require('path');
5
+
6
+ const initGit = async (projectName) => {
7
+ await execShellCommand(`cd ${projectName} && git init && cd ..`);
8
+ };
9
+
10
+ const installDeps = async (projectName) => {
11
+ await runCommand(`cd ${projectName} && pnpm install`, {
12
+ loading: 'Installing project dependencies',
13
+ success: 'Dependencies installed',
14
+ error: 'Failed to install dependencies, Make sure you have pnpm installed',
15
+ });
16
+ };
17
+
18
+ // remove unnecessary files, such us .git, ios, android, docs, cli, LICENSE
19
+ const removeFiles = async (projectName) => {
20
+ const FILES_TO_REMOVE = [
21
+ '.git',
22
+ 'README.md',
23
+ 'ios',
24
+ 'android',
25
+ 'docs',
26
+ 'cli',
27
+ 'LICENSE',
28
+ ];
29
+
30
+ FILES_TO_REMOVE.forEach((file) => {
31
+ fs.removeSync(path.join(process.cwd(), `${projectName}/${file}`));
32
+ });
33
+ };
34
+
35
+ // Update package.json infos, name and set version to 0.0.1 + add initial version to osMetadata
36
+ const updatePackageInfos = async (projectName) => {
37
+ const packageJsonPath = path.join(
38
+ process.cwd(),
39
+ `${projectName}/package.json`
40
+ );
41
+ const packageJson = fs.readJsonSync(packageJsonPath);
42
+ packageJson.osMetadata = { initVersion: packageJson.version };
43
+ packageJson.version = '0.0.1';
44
+ packageJson.name = projectName?.toLowerCase();
45
+ packageJson.repository = {
46
+ type: 'git',
47
+ url: 'git+https://github.com/user/repo-name.git',
48
+ };
49
+ fs.writeJsonSync(packageJsonPath, packageJson, { spaces: 2 });
50
+ };
51
+
52
+ const updateProjectConfig = async (projectName) => {
53
+ const configPath = path.join(process.cwd(), `${projectName}/env.js`);
54
+ const contents = fs.readFileSync(configPath, {
55
+ encoding: 'utf-8',
56
+ });
57
+ const replaced = contents
58
+ .replace(/AtlasApp/gi, projectName)
59
+ .replace(/com.atlas/gi, `com.${projectName.toLowerCase()}`)
60
+ .replace(/atlas/gi, 'expo-owner');
61
+
62
+ fs.writeFileSync(configPath, replaced, { spaces: 2 });
63
+ const readmeFilePath = path.join(
64
+ process.cwd(),
65
+ `${projectName}/README-project.md`
66
+ );
67
+ fs.renameSync(
68
+ readmeFilePath,
69
+ path.join(process.cwd(), `${projectName}/README.md`)
70
+ );
71
+ };
72
+
73
+ const setupProject = async (projectName) => {
74
+ consola.start(`Clean up and setup your project ๐Ÿงน`);
75
+ try {
76
+ removeFiles(projectName);
77
+ await initGit(projectName);
78
+ updatePackageInfos(projectName);
79
+ updateProjectConfig(projectName);
80
+ consola.success(`Clean up and setup your project ๐Ÿงน`);
81
+ } catch (error) {
82
+ consola.error(`Failed to clean up project folder`, error);
83
+ process.exit(1);
84
+ }
85
+ };
86
+
87
+ module.exports = {
88
+ setupProject,
89
+ installDeps,
90
+ };
package/utils.js ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ const { exec } = require('child_process');
3
+ const { consola } = require('consola');
4
+
5
+ const execShellCommand = (cmd) => {
6
+ return new Promise((resolve, reject) => {
7
+ exec(cmd, (error, stdout, stderr) => {
8
+ if (error) {
9
+ console.warn(error);
10
+ reject(error);
11
+ }
12
+ resolve(stdout ? stdout : stderr);
13
+ });
14
+ });
15
+ };
16
+
17
+ const runCommand = async (
18
+ command,
19
+ { loading = 'loading ....', success = 'success', error = 'error' }
20
+ ) => {
21
+ consola.start(loading);
22
+ try {
23
+ await execShellCommand(command);
24
+ consola.success(success);
25
+ } catch (err) {
26
+ consola.error(`Failed to execute ${command}`, err);
27
+ process.exit(1);
28
+ }
29
+ };
30
+ // show more details message using chalk
31
+ const showMoreDetails = (projectName) => {
32
+ consola.box(
33
+ 'Your project is ready to go! \n\n\n',
34
+ '๐Ÿš€ To get started, run the following commands: \n\n',
35
+ ` \`cd ${projectName}\` \n`,
36
+ ' IOS : `pnpm ios` \n',
37
+ ' Android : `pnpm android` \n\n',
38
+ '๐Ÿ“š Starter Documentation: https://leanhtuan1994.github.io/react-native-template-atlas'
39
+ );
40
+ };
41
+
42
+ module.exports = {
43
+ runCommand,
44
+ showMoreDetails,
45
+ execShellCommand,
46
+ };