Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandatoledo committed Jun 28, 2024
0 parents commit fb8cf73
Show file tree
Hide file tree
Showing 157 changed files with 22,619 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
API_URL=https://dummyjson.com/

## TODO: add the variable to your CI and remove it from here, not recommended setting sensitive values on your git repo
SECRET_KEY=my-secret-key
VAR_NUMBER=10 # this is a number variable
VAR_BOOL=true # this is a boolean variable
6 changes: 6 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
API_URL=https://dummyjson.com/

## TODO: add the variable to your CI and remove it from here, not recommended setting sensitive values on your git repo
SECRET_KEY=my-secret-key
VAR_NUMBER=10 # this is a number variable
VAR_BOOL=true # this is a boolean variable
6 changes: 6 additions & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
API_URL=https://dummyjson.com/

## TODO: add the variable to your CI and remove it from here, not recommended setting sensitive values on your git repo
SECRET_KEY=my-secret-key
VAR_NUMBER=10 # this is a number variable
VAR_BOOL=true # this is a boolean variable
10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
__tests__/
.vscode/
android/
coverage/
ios/
.expo
.expo-shared
docs/
cli/
117 changes: 117 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
const path = require('path');

module.exports = {
// Configuration for JavaScript files
extends: ['@react-native-community', 'plugin:prettier/recommended'],
plugins: ['unicorn'],
rules: {
'prettier/prettier': [
'error',
{
singleQuote: true,
endOfLine: 'auto',
},
],
'unicorn/filename-case': [
'error',
{
case: 'kebabCase',
ignore: ['/android', '/ios'],
},
],
},
overrides: [
// Configuration for TypeScript files
{
files: ['**/*.ts', '**/*.tsx', '**/*.js'],
plugins: [
'@typescript-eslint',
'unused-imports',
'tailwindcss',
'simple-import-sort',
],
extends: [
'plugin:tailwindcss/recommended',
'@react-native-community',
'plugin:prettier/recommended',
],
parserOptions: {
project: './tsconfig.json',
},
rules: {
'prettier/prettier': [
'error',
{
singleQuote: true,
endOfLine: 'auto',
},
],
'max-params': ['error', 3], // Limit the number of parameters in a function to use object instead
'max-lines-per-function': ['error', 70],
'react/destructuring-assignment': 'off', // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
'react/require-default-props': 'off', // Allow non-defined react props as undefined
'@typescript-eslint/comma-dangle': 'off', // Avoid conflict rule between Eslint and Prettier
'@typescript-eslint/consistent-type-imports': 'error', // Ensure `import type` is used when it's necessary
'import/prefer-default-export': 'off', // Named export is easier to refactor automatically
'tailwindcss/classnames-order': [
'warn',
{
officialSorting: true,
},
], // Follow the same ordering as the official plugin `prettier-plugin-tailwindcss`
'simple-import-sort/imports': 'error', // Import configuration for `eslint-plugin-simple-import-sort`
'simple-import-sort/exports': 'error', // Export configuration for `eslint-plugin-simple-import-sort`
'@typescript-eslint/no-unused-vars': 'off',
'tailwindcss/no-custom-classname': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
},
// Configuration for translations files (i18next)
{
files: ['src/translations/*.json'],
extends: ['plugin:i18n-json/recommended'],
rules: {
'i18n-json/valid-message-syntax': [
2,
{
syntax: path.resolve('./scripts/i18next-syntax-validation.js'),
},
],
'i18n-json/valid-json': 2,
'i18n-json/sorted-keys': [
2,
{
order: 'asc',
indentSpaces: 2,
},
],
'i18n-json/identical-keys': [
2,
{
filePath: path.resolve('./src/translations/en.json'),
},
],
'prettier/prettier': [
0,
{
singleQuote: true,
endOfLine: 'auto',
},
],
},
},
{
// Configuration for testing files
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
extends: ['plugin:testing-library/react'],
},
],
};
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Summary:

## Steps to reproduce:

## Expected behavior:

## Additional notes:

#### Tasks

- [ ] Task 1
- [ ] Task 2
- [ ] Task 3
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## What does this do?

<!---
_Describe what your changes **do**; did you add a $COOL_FEATURE? Write about it here._
-->

## Why did you do this?

<!---
_**Why** did you make these changes? This is your opportunity to provide the rationale that drove the design of your solution._
-->

## Who/what does this impact?

<!---
_Does your code affect something downstream? Are there side effects people should know about? Tag any developers that should be kept abreast of this change._
-->

## How did you test this?

<!---
_How did you test your change? Document it here._
-->
85 changes: 85 additions & 0 deletions .github/actions/eas-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# 🔗 Links:
# Source file: https://github.com/obytes/react-native-template-obytes/blob/master/.github/actions/eas-build/action.yml
# EAS Build docs: https://docs.expo.dev/eas-update/github-actions/

# ✍️ Description:
# This is a composite action, which means it can be used in other actions.
# This action is used to trigger an EAS Build for a specific environment (development, staging, production).
# This action accepts those inputs:
# `APP_ENV`, which is used to generate an APK for a specific environment (development, staging, production). We use staging by default.
# `AUTO_SUBMIT`, false by default, set to true if you want to automatically submit your build to stores.
# `EXPO_TOKEN`, required, access token for your Expo account. https://expo.dev/settings/access-tokens
# `VERSION`, required, version of the app to build. used as the build message.
# `ANDROID`, true by default, set to true if you don't want to trigger build for Android.
# `IOS`, false by default, set to true if you want to trigger build for IOS.

# Before triggering the build, we run a pre-build script to generate the necessary native folders based on the APP_ENV.
# Based on the ANDROID and IOS inputs, we trigger the build for the corresponding platform with the corresponding flags.

# 👀 Example usage:
# - name: ⏱️ EAS Build
# uses: ./.github/actions/eas-build
# with:
# APP_ENV: staging
# EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
# VERSION: ${{ github.event.release.tag_name }}
# IOS: false

name: 'Setup EAS Build + Trigger Build'
description: 'Setup EAS Build + Trigger Build'
inputs:
APP_ENV:
description: 'APP_ENV (one of): development, staging, production'
required: true
default: 'staging'
AUTO_SUBMIT: ## TODO: we need to handle this too
description: 'AUTO_SUBMIT (one of): true, false'
required: true
default: 'false'
ANDROID:
description: 'run for ANDROID (one of): true, false'
required: true
default: 'true'
VERSION:
description: 'VERSION'
required: true
default: '0.0.0'
IOS:
description: 'run for IOS (one of): true, false'
required: true
default: 'false'
EXPO_TOKEN:
description: 'EXPO_TOKEN'
required: true
default: 'false'

runs:
using: 'composite'
steps:
- name: 💯 Check for EXPO_TOKEN
run: |
if [ -z "${{ inputs.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
shell: bash

- name: 📦 Setup Expo and EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ inputs.EXPO_TOKEN }}

- name: ⚙️ Run Prebuild
run: pnpm prebuild:${{ inputs.APP_ENV }}
shell: bash

- name: 📱 Run Android Build
if: ${{ inputs.ANDROID == 'true' }}
run: pnpm build:${{ inputs.APP_ENV }}:android --non-interactive --no-wait --message "Build ${{ inputs.APP_ENV }} ${{ inputs.VERSION }}"
shell: bash

- name: 📱 Run IOS Build
if: ${{ inputs.IOS == 'true' }}
run: pnpm build:${{ inputs.APP_ENV }}:ios --non-interactive --no-wait --message "Build ${{ inputs.APP_ENV }} ${{ inputs.VERSION }}"
shell: bash
48 changes: 48 additions & 0 deletions .github/actions/setup-jdk-generate-apk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 🔗 Links:
# Source file: https://github.com/obytes/react-native-template-obytes/blob/master/.github/actions/setup-jdk-generate-apk/action.yml
# Composite actions docs: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action

# ✍️ Description:
# This is a composite action, which means it can be used in other actions.
# This action is used to set up the JDK environment and generate an Android APK for testing.
# This action accepts one input: `APP_ENV`, which is used to generate an APK for a specific environment (development, staging, production). We use staging by default.
# Before generating the APK, we run a pre-build script to generate the necessary native folders based on the APP_ENV.
# On success, the APK is generated at `./android/app/build/outputs/apk/release/app-release.apk`.

# 👀 Example usage:
# - name : 📦 Set Up JDK + Generate Test APK
# uses: ./.github/actions/setup-jdk-generate-apk
# with:
# APP_ENV: 'staging'

name: 'Setup JDK + GRADLE + Generate APK'
description: 'Setup JDK + GRADLE + Generate APK'
inputs:
APP_ENV:
description: 'APP_ENV (one of): development, staging, production'
required: true
default: 'staging'

runs:
using: 'composite'
steps:
- name: Set Up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Generate Test APK
run: |
pnpm prebuild:${{ inputs.APP_ENV }}
cd android
chmod +x ./gradlew
./gradlew assembleRelease --no-daemon
cd ..
shell: bash
env:
EXPO_NO_DOTENV: '1'
APP_ENV: ${{ inputs.APP_ENV }}
CI: 'true'
29 changes: 29 additions & 0 deletions .github/actions/setup-node-pnpm-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 🔗 Links:
# Source file: https://github.com/obytes/react-native-template-obytes/blob/master/.github/actions/setup-node-pnpm-install/action.yml
# Composite actions docs: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action

# ✍️ Description:
# This is a composite action, which means it can be used in other actions.
# It is used in almost all workflows to set up the environment and install dependencies.
# Updating the package manager or Node version here will be reflected in all workflows.

# 👀 Example usage:
# - name : 📦 Setup Node + PNPM + install deps
# uses: ./.github/actions/setup-node-pnpm-install

name: 'Setup Node + PNPM + Install Dependencies'
description: 'Setup Node + PNPM + Install Dependencies'
runs:
using: 'composite'
steps:
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'

- name: 📦 Install Project Dependencies
run: pnpm install --frozen-lockfile
shell: bash
Loading

0 comments on commit fb8cf73

Please sign in to comment.