Giter Club home page Giter Club logo

danstepanov / create-expo-stack Goto Github PK

View Code? Open in Web Editor NEW
936.0 9.0 56.0 2.85 MB

CLI tool to initialize a React Native application with Expo. Provides options to include Typescript, file-based routing via Expo Router, configuration based routing via pure React Navigation, styling via Nativewind, Restyle, Unistyles, StyleSheets, or Tamagui, and/or backend as a service such as Firebase and Supabase.

Home Page: https://createexpostack.com

License: MIT License

JavaScript 4.52% TypeScript 46.25% EJS 36.98% CSS 3.38% Astro 8.73% Shell 0.14%
boilerplate expo react-native expo-router expo-template nativewind react-native-template tailwindcss template templates

create-expo-stack's Introduction

Create Expo Stack CLI

Discord NPM version Downloads

An interactive CLI to create a highly configurable, typesafe Expo app.

Get started by running npx create-expo-stack

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

Description

This CLI tool is designed to help you get started with React Native and Expo as quickly as possible. The CLI options allow you to configure your project with Typescript, file-based routing with Expo Router, configuration-based navigation via React-Navigation, styling with NativeWind, Restyle, StyleSheets, or Tamagui and authentication via Supabase or Firebase.

You can also use flags such as --noInstall, --noGit, and --default in order to customize your project. The CLI will attempt to automatically determine your package manager of choice but you can also pass in your preferred package manager via --npm, --yarn, --pnpm, or --bun. Roadmap coming soon...

Usage

To get started, use npx to run the CLI tool. You will be prompted to opt into the features you want to use.

npx create-expo-stack

Tech Stack for the templates

Currently, all of the templates use the same versions of the following libraries. Not all of the templates include all of the libraries, but they are all available for use.

Each project is generated based on the results of the CLI, on a per-file basis. This approach makes this CLI extremely extendable and easy to use. Common files to all generated projects are stored in the base template folder while files pertaining to additional packages are stored in the packages template folder. Beyond adding files, this project makes use of EJS in order to manipulate existing files as necessary.

Library Category Version Description
React Native Mobile Framework v0.73 The best cross-platform mobile framework
React UI Framework v18 The most popular UI framework in the world
TypeScript Language v5 Static typechecking
React Navigation Navigation v6 Performant and consistent navigation framework
Expo SDK v50 Allows (optional) Expo modules
Expo Font Custom Fonts v11 Import custom fonts
Expo Linking URL Handling v5 Open your app via a URL
Expo Router Navigation v3 File-based routing in React-Native
Expo Splash Screen Splash Screen v0.18 Custom splash screen
Expo Status Bar Status Bar Library v1 Status bar support
Expo System UI System UI Library v2 System UI support
Expo Web Browser Web Browser Library v12 Open links in the browser
NativeWind UI Framework v4 Tailwind CSS for React Native
Restyle UI Framework v2 Theme-based styling library for React Native
Tamagui UI Framework v1 Universal UI with a smart optimizing compiler
Unistyles UI Framework v2 Superset of StyleSheet
Safe Area Context Safe Area Library v4 Safe area support
React Native Web Web Support v0.19 React Native for Web
Firebase Backend and Auth v10 Cloud-hosted NoSQL database from Google
Supabase Backend and Auth v2 Open source Firebase alternative

Reporting Bugs & Feedback

If you run into problems or have feedback, first search the issues and discussions in this repository. If you don't find anything, feel free to message me on Twitter or open a new issue.

Contributing

Contributions are welcome! Please open a pull request or an issue if you would like to contribute. There are existing feature requests labeled as [FR] in the issues section of this repo.

Want to move faster? I can help 😎

Getting up-to-speed on a new framework can be cumbersome. If you find that you need to move more quickly, I may be available to help.

If you'd like help with your React Native/Expo app or are just looking for a technical advisor to guide you along your journey, let's chat.

Contributors ✨

Thanks go to these wonderful people:

danstepanov
Dan Stepanov
hqasmei
Hosna Qasmei
sammoore
Sam Moore
ernestoresende
Ernesto Resende
frankcalise
Frank Calise
ludwig-pro
Ludwig
mrzachnugent
Zach Nugent
PickleNik
Null
dannyhw
Daniel Williams
kratos-respawned
Gaurav Bhandari
finnbayer
Finn Bayer
saimon24
Simon Grimm
todevmilen
Milen Todev
alitnk
Alireza Zamani
catalinmiron
Catalin Miron
b0iq
Null
coyksdev
Gerald
andrew-levy
Andrew Levy
gialencar
Gilson Alencar
mwarger
Mat Warger
gabimoncha
Gabimoncha
gwenoleR
Null
boek
Jeff Boek
zamplyy
Joar Karlsson
Joehoel
Joël Kuijper
asapMaki
Mahir Kadić
Hacksore
Sean Boult
YounessHassoune
YOUNESS HASSOUNE
bautistaaa
Null
debugtheworldbot
Pipizhu

create-expo-stack's People

Contributors

alitnk avatar andrew-levy avatar asapmaki avatar b0iq avatar bautistaaa avatar boek avatar catalinmiron avatar coyksdev avatar dannyhw avatar danstepanov avatar ernestoresende avatar finnbayer avatar frankcalise avatar gabimoncha avatar gialencar avatar github-actions[bot] avatar gwenoler avatar hacksore avatar hqasmei avatar joehoel avatar kratos-respawned avatar ludwig-pro avatar mrzachnugent avatar mwarger avatar picklenik avatar saimon24 avatar sammoore avatar todevmilen avatar younesshassoune avatar zamplyy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

create-expo-stack's Issues

[cli] Update expo router examples

We currently declare stack screen options in this way. I believe this only applies to the stack template for Expo Router and not the tabs template.

However, with recent updates to Expo Router, we can define stack screen options on a per screen basis. expo/router#834

[FR] Add flags to CLI

TODO

  • Look into how to handle this with GlueGun

Jamon: "They should just show up in parameters.options, try passing them in and console logging that object. Which reminds me, I need to support camel cased options like that. They will show up as parameters.options.install === false"

Flags to add

  • noInstall
  • noGit
  • default

There's something missing to make it work.

created with

pnpm dlx create-expo-stack@latest

with some errors info

> [email protected] format D:\proj\LittleLEmonExpoDan
> eslint '**/*.{js,jsx,ts,tsx}' --fix && prettier '**/*.{js,jsx,ts,tsx,json}' --write


Oops! Something went wrong! :(

ESLint: 8.55.0

No files matching the pattern "'**/*.{js,jsx,ts,tsx}'" were found.
Please check for typing mistakes in the pattern.

 ELIFECYCLE  Command failed with exit code 2.

then message Success! 🎉 Now, just run the following to get started

Your project configuration:
{
  projectName: 'LittleLEmonExpoDan',
  packages: [
    {
      name: 'react-navigation',
      type: 'navigation',
      options: { type: 'stack' }
    },
    { name: 'nativewind', type: 'styling' }
  ],
  flags: { noGit: undefined, noInstall: undefined, importAlias: '~/' }
}

To recreate this project, run:
  npx create-expo-stack@latest LittleLEmonExpoDan --react-navigation --nativewind --pnpm

then pnpm run android

› Opening on Android...
› Opening exp://192.168.1.2:8081 on Medium_Phone_API_34
› Press ? │ show all commands
Error: Unable to resolve module ./node_modules\expo\AppEntry from D:\proj\LittleLEmonExpoDan/.:

None of these files exist:
  * node_modules\expo\AppEntry(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
  * node_modules\expo\AppEntry\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
    at ModuleResolver.resolveDependency (D:\proj\LittleLEmonExpoDan\node_modules\.pnpm\[email protected]\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:114:15)
    at DependencyGraph.resolveDependency (D:\proj\LittleLEmonExpoDan\node_modules\.pnpm\[email protected]\node_modules\metro\src\node-haste\DependencyGraph.js:277:43)
    at D:\proj\LittleLEmonExpoDan\node_modules\.pnpm\[email protected]\node_modules\metro\src\lib\transformHelpers.js:169:21
    at Server._resolveRelativePath (D:\proj\LittleLEmonExpoDan\node_modules\.pnpm\[email protected]\node_modules\metro\src\Server.js:1045:12)
    at async Server.requestProcessor [as _processBundleRequest] (D:\proj\LittleLEmonExpoDan\node_modules\.pnpm\[email protected]\node_modules\metro\src\Server.js:449:37)
    at async Server._processRequest (D:\proj\LittleLEmonExpoDan\node_modules\.pnpm\[email protected]\node_modules\metro\src\Server.js:383:7)
Error: Unable to resolve module ./node_modules\expo\AppEntry from D:\proj\LittleLEmonExpoDan/.:

// package.json

{
  "name": "LittleLEmonExpoDan",
  "version": "1.0.0",
  "scripts": {
    "android": "expo start --android",
	
    	"format": "eslint '**/*.{js,jsx,ts,tsx}' --fix && prettier '**/*.{js,jsx,ts,tsx,json}' --write",
	
    "ios": "expo start --ios",
    "start": "expo start",
    "web": "expo start --web"
  },
  "dependencies": {
    
      "nativewind": "^2.0.11",
    

    

    
      "@react-navigation/native": "^6.1.7",
      "react-native-gesture-handler": "~2.12.0",
      "react-native-safe-area-context": "^4.6.3",
      "react-native-screens": "~3.22.0",
    

    
      "@react-navigation/stack": "^6.3.17",
    

    

    

    
    
    

	

	

    "expo": "~49.0.11",
    "expo-status-bar": "~1.6.0",
    "react": "18.2.0",
    "react-native": "0.72.6"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/react": "~18.2.14",
    "@typescript-eslint/eslint-plugin": "^6.7.2",
    "@typescript-eslint/parser": "^6.7.2",
    "eslint": "^8.50.0",
    "eslint-config-universe": "^12.0.0",
    "prettier": "^3.0.3",
    
      "tailwindcss": "3.3.2",
    
    
    "typescript": "^5.1.3"
  },
  "eslintConfig": {
    "extends": "universe/native"
  },
  
    "main": "node_modules/expo/AppEntry.js",
  
  
    "expo": {
      "install": {
        "exclude": ["react-native-safe-area-context"]
      }
    },
  
  "private": true
}

[docs] provide proper feedback with instructions about the release workflow

Currently, new contributors are clueless on what their role is for automated releases to work.

There are two steps that need to be taken in order to somewhat fix that:

  • Update both the contribution guidelines and the PR templates with instructions on how to properly create, manage and name changesets for releases. PR templates should probably have a checklist option regarding this.
  • Use the changeset-bot GitHub app to auto-comment on PR's giving feedback on the status of the changesets.

SyntaxError: Cannot use 'import.meta' outside a module

I follow the steps to generate the code, with successful library installation. I then follow the steps suggested (Firebase project setup and putting the creds + relevant info in the .env file). Unfortunately I'm met with this error:

const defaultConfig = getDefaultConfig(import.meta.dir);
                                              ^^^^

SyntaxError: Cannot use 'import.meta' outside a module

This happens when I try to run the code for the first time with npm run ios.

error while running format script

Getting the following error while running npm run format script
No files matching the pattern "'**/*.{js,jsx,ts,tsx}'" were found.

[cli] Improve Tests

Currently

  • Tests currently test the local files rather than the the build folder which means that the tests can pass while running npx create-expo-stack@latest can be broken.
  • Running tests is slow and/or trips up with bun
  • Tests do not have full coverage
  • Tests don't even pass locally

What this is

We need to be able to ensure that every single iteration of configurations and flags works as expected, at any point in time but particularly upon any change made to the cli.

The way to confirm that each iteration works is to ensure that:

  • Project set up succeeds, which is to say that
    • The appropriate cli json object is created
    • The appropriate command is generated to rerun the command, if desired by the user
    • Project initialization succeeds
    • Initializing git succeeds (flag)
    • Base assets are copied
    • Installation of dependencies succeeds with the specified package manager (flag)
    • Code formatting completes
  • All of the elements on each screen are present, laid out properly, with the proper styles applied (android & ios)
  • Navigating throughout the application should function as expected such that clicking on a button will lead you to the appropriate page and clicking some other button will return you to the previous page (android & ios)

Conditions

  • Tests should run on the build folder rather than the the local folder to prevent tests passing locally while breaking in production (eg npx create-expo-stack@latest)
  • If they are to be run locally, they can't take too long (more than 2 min is too much)
  • Tests should not run on commit
  • A PR pertaining to the cli should not be able to be merged without tests passing
  • Going through the CLI interactively, all iterations work
  • Going through non-interactive mode, all iterations work

What this is not

  • Tests for the landing page
  • Tests for the docs

[FR] Add CI tests

Why

When working on new or existing configurations, a lot of time is spent ensuring that the other configurations still run.

What

To avoid this, we should test each combination of configurations to ensure they run as expected.

How

One way to do this would be to create a collection of CI flags, each of which correlates to an individual configuration, these should require no user input. You can then run a single command that ensures that each test runs, as expected.

Future versions of this can do some kind of snapshot comparison of the output to a previously snapshotted version that is known to work.

[cli] EAS setup support

This CLI has scope to integrate the EAS setup support , that includes setting up the whole CI/CD pipeline across various environments and channels.

I've been experimenting with env variables and figuring out the right setup for our CI/CD. Let me know if this fits right in this.
Would need some help to start.

[cli] format code when noInstall is true

Your project configuration:
{
  projectName: 'my-expo-app',
  packages: [
    {
      name: 'expo-router',
      type: 'navigation',
      options: { type: 'stack' }
    },
    { name: 'tamagui', type: 'styling' },
    { name: 'supabase', type: 'authentication' },
    { name: 'stylesheet', type: 'styling' }
  ],
  flags: { noGit: false, noInstall: true, importAlias: '~/' }
}

Initializing your project...

Cleaning up your project...
$ bun run eslint '**/*.{js,jsx,ts,tsx}' --fix && bun run prettier '**/*.{js,jsx,ts,tsx,json}' --write
error: missing script "eslint"
error: script "format" exited with code 1 (SIGHUP)

Initializing git...

Success! 🎉 Now, here's what's next:

[cli] Connection failing

Whenever I connect to my app through ADB or qr code after some few minutes it aborts connection and I have to connect it again

Web hydration error on fresh project creation

I am seeing a hydration error with a fresh project using the following command:

npx create-expo-stack@latest my-expo-app --expo-router --tabs --nativewind --supabase --bun

This appears to not give any errors when loading through an iOS simulator, or deploying via Vercel and viewing on the web.

image

[ci] Release Beta Action fail when no changesets are available

Currently, the beta release action will only run correctly when changesets are available under the .changesets directory.

This happens because release-beta.ts script is never checking for the non-existence of changesets, and is trying to bump the package.json regardless, resulting in a malformed version: undefined-beta.{commit_hash} which cannot be published to NPM.

[Bug] Error: "Template not found" during install

I tried running the CLI and got an error (using both pnpx and npx @latest).

Reproduction Steps:

  1. Run npx create-expo-stack@latest
  2. Use all default options for the CLI

Expected outcome: CLI creates a new directory and finishes without errors
Actual outcome: "Oops, something went wrong while creating your project 😢
Error: template not found" (see full output below)

System details:
NPM: 9.6.6
PNPM: 8.3.1
OS: M2 MacBook Air (2022)
Terminal: Kitty 0.26.5

My terminal log (including selections from CLI):

pnpx create-expo-stack@latest
.../share/pnpm/store/v3/tmp/dlx-7568     | +152 +++++++++++++++
.../share/pnpm/store/v3/tmp/dlx-7568     | Progress: resolved 152, reused 117, downloaded 35, added 152, done
✔ What do you want to name your project? (my-expo-app) · touch-grass
✔ Would you like to use TypeScript with this project? (Y/n) · true
Good call, now using TypeScript! 🚀
✔ What would you like to use for Navigation? · Expo Router
✔ What type of navigation would you like to use? · Stack
Great, we'll use Expo Router!
✔ Would you like to use NativeWind (Tailwind for RN) with this project? (Y/n) · true
You'll be styling with ease using Tailwind.

Initializing your project...

Oops, something went wrong while creating your project 😢
Error: template not found /Users/nate/.local/share/pnpm/store/v3/tmp/dlx-7568/node_modules/.pnpm/[email protected]/node_modules/create-expo-stack/build/build/templates/base/assets/adaptive-icon.png
    at /Users/nate/.local/share/pnpm/store/v3/tmp/dlx-7568/node_modules/.pnpm/[email protected]/node_modules/gluegun/build/toolbox/template-tools.js:82:27
    at step (/Users/nate/.local/share/pnpm/store/v3/tmp/dlx-7568/node_modules/.pnpm/[email protected]/node_modules/gluegun/build/toolbox/template-tools.js:44:23)
    at Object.next (/Users/nate/.local/share/pnpm/store/v3/tmp/dlx-7568/node_modules/.pnpm/[email protected]/node_modules/gluegun/build/toolbox/template-tools.js:25:53)
    at /Users/nate/.local/share/pnpm/store/v3/tmp/dlx-7568/node_modules/.pnpm/[email protected]/node_modules/gluegun/build/toolbox/template-tools.js:19:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/nate/.local/share/pnpm/store/v3/tmp/dlx-7568/node_modules/.pnpm/[email protected]/node_modules/gluegun/build/toolbox/template-tools.js:15:12)
    at generate (/Users/nate/.local/share/pnpm/store/v3/tmp/dlx-7568/node_modules/.pnpm/[email protected]/node_modules/gluegun/build/toolbox/template-tools.js:64:16)
    at /Users/nate/.local/share/pnpm/store/v3/tmp/dlx-7568/node_modules/.pnpm/[email protected]/node_modules/create-expo-stack/build/commands/create-expo-stack.js:274:35
    at Array.reduce (<anonymous>)
    at /Users/nate/.local/share/pnpm/store/v3/tmp/dlx-7568/node_modules/.pnpm/[email protected]/node_modules/create-expo-stack/build/commands/create-expo-stack.js:255:44

If this was unexpected, please open an issue: https://github.com/danstepanov/create-expo-stack#reporting-bugs--feedback

[www] Footer call-out

The footer must have call-out that the Expo name and logo are trademarks of 650 Industries, Inc. This can be low key and doesn't need to be super prominent.

[cli] Stack imported from expo-router twice

Description

  • When the the project is done generating, you'll notice two lines with import { Stack } from "expo-router";
  • To reproduce: npx create-expo-stack@latest my-expo-app --expo-router --tabs --stylesheet --npm

How

  • Fix the _layout.tsx.ejs under cli\src\templates\packages\expo-router\tabs\app to not contain this duplicate line

[cli][www][FR] Auth providers

Why

Many people inquire about how to best get set up with an auth provider and create-expo-stack seems like a great way to convey this. Additionally, in order to support flags for other opinionated stacks, we might need to support auth providers out of the box.

What

Add a CLI option to select an auth provider (likely Supabase or Firebase, open to others).

How

There are more set up steps beyond just the mobile code configuration so this should contain both a minimal example set up with each auth provider as well as a link to some kind of walkthrough that highlights how to create an account, acquire keys, and familiarize with the relevant dashboard.

[cli] Expo router problem after installing axios

I initialized a new app using npx create-expo-stack@latest but when I installed axios using npm install axios I got this error Module '.. /.. /components/edit-screen-info was resolved to' d:/project/e-learning/components/edit-screen-infov.tsx' but '--jsx' is not set, i fixed it by adding jsx in my configuration file but now getting this error
expoerror

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.