Skip to content

Commit 25f3184

Browse files
committed
Basic code starter
1 parent 87c8bdb commit 25f3184

File tree

178 files changed

+23765
-0
lines changed

Some content is hidden

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

178 files changed

+23765
-0
lines changed

.env.development

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

.env.production

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

.env.staging

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

.eslintignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules
2+
__tests__/
3+
.vscode/
4+
android/
5+
coverage/
6+
ios/
7+
.expo
8+
.expo-shared
9+
docs/
10+
cli/

.eslintrc.js

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
extends: ['expo', 'plugin:tailwindcss/recommended', 'prettier'],
5+
plugins: [
6+
'unicorn',
7+
'@typescript-eslint',
8+
'unused-imports',
9+
'tailwindcss',
10+
'simple-import-sort',
11+
],
12+
parserOptions: {
13+
project: './tsconfig.json',
14+
},
15+
rules: {
16+
'unicorn/filename-case': [
17+
'error',
18+
{
19+
case: 'kebabCase',
20+
ignore: ['/android', '/ios'],
21+
},
22+
],
23+
'max-params': ['error', 3], // Limit the number of parameters in a function to use object instead
24+
'max-lines-per-function': ['error', 70],
25+
'react/display-name': 'off',
26+
'react/no-inline-styles': 'off',
27+
'react/destructuring-assignment': 'off', // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
28+
'react/require-default-props': 'off', // Allow non-defined react props as undefined
29+
'@typescript-eslint/comma-dangle': 'off', // Avoid conflict rule between Eslint and Prettier
30+
'@typescript-eslint/consistent-type-imports': [
31+
'warn',
32+
{
33+
prefer: 'type-imports',
34+
fixStyle: 'inline-type-imports',
35+
disallowTypeAnnotations: true,
36+
},
37+
], // Ensure `import type` is used when it's necessary
38+
'import/prefer-default-export': 'off', // Named export is easier to refactor automatically
39+
'import/no-cycle': ['error', { maxDepth: '∞' }],
40+
'tailwindcss/classnames-order': [
41+
'warn',
42+
{
43+
officialSorting: true,
44+
},
45+
], // Follow the same ordering as the official plugin `prettier-plugin-tailwindcss`
46+
'simple-import-sort/imports': 'error', // Import configuration for `eslint-plugin-simple-import-sort`
47+
'simple-import-sort/exports': 'error', // Export configuration for `eslint-plugin-simple-import-sort`
48+
'@typescript-eslint/no-unused-vars': 'off',
49+
'tailwindcss/no-custom-classname': 'off',
50+
'unused-imports/no-unused-imports': 'error',
51+
'unused-imports/no-unused-vars': [
52+
'error',
53+
{
54+
argsIgnorePattern: '^_',
55+
varsIgnorePattern: '^_',
56+
caughtErrorsIgnorePattern: '^_',
57+
},
58+
],
59+
},
60+
overrides: [
61+
// Configuration for translations files (i18next)
62+
{
63+
files: ['src/translations/*.json'],
64+
extends: ['plugin:i18n-json/recommended'],
65+
rules: {
66+
'i18n-json/valid-message-syntax': [
67+
2,
68+
{
69+
syntax: path.resolve('./scripts/i18next-syntax-validation.js'),
70+
},
71+
],
72+
'i18n-json/valid-json': 2,
73+
'i18n-json/sorted-keys': [
74+
2,
75+
{
76+
order: 'asc',
77+
indentSpaces: 2,
78+
},
79+
],
80+
'i18n-json/identical-keys': [
81+
2,
82+
{
83+
filePath: path.resolve('./src/translations/en.json'),
84+
},
85+
],
86+
'prettier/prettier': [
87+
0,
88+
{
89+
singleQuote: true,
90+
endOfLine: 'auto',
91+
},
92+
],
93+
},
94+
},
95+
{
96+
// Configuration for testing files
97+
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
98+
extends: ['plugin:testing-library/react'],
99+
},
100+
],
101+
};

.github/ISSUE_TEMPLATE.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Summary:
2+
3+
## Steps to reproduce:
4+
5+
## Expected behavior:
6+
7+
## Additional notes:
8+
9+
#### Tasks
10+
11+
- [ ] Task 1
12+
- [ ] Task 2
13+
- [ ] Task 3

.github/PULL_REQUEST_TEMPLATE.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## What does this do?
2+
3+
<!---
4+
_Describe what your changes **do**; did you add a $COOL_FEATURE? Write about it here._
5+
-->
6+
7+
## Why did you do this?
8+
9+
<!---
10+
_**Why** did you make these changes? This is your opportunity to provide the rationale that drove the design of your solution._
11+
-->
12+
13+
## Who/what does this impact?
14+
15+
<!---
16+
_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._
17+
-->
18+
19+
## How did you test this?
20+
21+
<!---
22+
_How did you test your change? Document it here._
23+
-->

.github/actions/eas-build/action.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# 🔗 Links:
2+
# Source file: https://github.com/obytes/react-native-template-obytes/blob/master/.github/actions/eas-build/action.yml
3+
# EAS Build docs: https://docs.expo.dev/eas-update/github-actions/
4+
5+
# ✍️ Description:
6+
# This is a composite action, which means it can be used in other actions.
7+
# This action is used to trigger an EAS Build for a specific environment (development, staging, production).
8+
# This action accepts those inputs:
9+
# `APP_ENV`, which is used to generate an APK for a specific environment (development, staging, production). We use staging by default.
10+
# `AUTO_SUBMIT`, false by default, set to true if you want to automatically submit your build to stores.
11+
# `EXPO_TOKEN`, required, access token for your Expo account. https://expo.dev/settings/access-tokens
12+
# `VERSION`, required, version of the app to build. used as the build message.
13+
# `ANDROID`, true by default, set to true if you don't want to trigger build for Android.
14+
# `IOS`, false by default, set to true if you want to trigger build for IOS.
15+
16+
# Before triggering the build, we run a pre-build script to generate the necessary native folders based on the APP_ENV.
17+
# Based on the ANDROID and IOS inputs, we trigger the build for the corresponding platform with the corresponding flags.
18+
19+
# 👀 Example usage:
20+
# - name: ⏱️ EAS Build
21+
# uses: ./.github/actions/eas-build
22+
# with:
23+
# APP_ENV: staging
24+
# EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
25+
# VERSION: ${{ github.event.release.tag_name }}
26+
# IOS: false
27+
28+
name: 'Setup EAS Build + Trigger Build'
29+
description: 'Setup EAS Build + Trigger Build'
30+
inputs:
31+
APP_ENV:
32+
description: 'APP_ENV (one of): development, staging, production'
33+
required: true
34+
default: 'staging'
35+
AUTO_SUBMIT: ## TODO: we need to handle this too
36+
description: 'AUTO_SUBMIT (one of): true, false'
37+
required: true
38+
default: 'false'
39+
ANDROID:
40+
description: 'run for ANDROID (one of): true, false'
41+
required: true
42+
default: 'true'
43+
VERSION:
44+
description: 'VERSION'
45+
required: true
46+
default: '0.0.0'
47+
IOS:
48+
description: 'run for IOS (one of): true, false'
49+
required: true
50+
default: 'false'
51+
EXPO_TOKEN:
52+
description: 'EXPO_TOKEN'
53+
required: true
54+
default: 'false'
55+
56+
runs:
57+
using: 'composite'
58+
steps:
59+
- name: 💯 Check for EXPO_TOKEN
60+
run: |
61+
if [ -z "${{ inputs.EXPO_TOKEN }}" ]; then
62+
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"
63+
exit 1
64+
fi
65+
shell: bash
66+
67+
- name: 📦 Setup Expo and EAS
68+
uses: expo/expo-github-action@v8
69+
with:
70+
eas-version: latest
71+
token: ${{ inputs.EXPO_TOKEN }}
72+
73+
- name: ⚙️ Run Prebuild
74+
run: pnpm prebuild:${{ inputs.APP_ENV }}
75+
shell: bash
76+
77+
- name: 📱 Run Android Build
78+
if: ${{ inputs.ANDROID == 'true' }}
79+
run: pnpm build:${{ inputs.APP_ENV }}:android --non-interactive --no-wait --message "Build ${{ inputs.APP_ENV }} ${{ inputs.VERSION }}"
80+
shell: bash
81+
82+
- name: 📱 Run IOS Build
83+
if: ${{ inputs.IOS == 'true' }}
84+
run: pnpm build:${{ inputs.APP_ENV }}:ios --non-interactive --no-wait --message "Build ${{ inputs.APP_ENV }} ${{ inputs.VERSION }}"
85+
shell: bash
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 🔗 Links:
2+
# Source file: https://github.com/obytes/react-native-template-obytes/blob/master/.github/actions/setup-jdk-generate-apk/action.yml
3+
# Composite actions docs: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
4+
5+
# ✍️ Description:
6+
# This is a composite action, which means it can be used in other actions.
7+
# This action is used to set up the JDK environment and generate an Android APK for testing.
8+
# 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.
9+
# Before generating the APK, we run a pre-build script to generate the necessary native folders based on the APP_ENV.
10+
# On success, the APK is generated at `./android/app/build/outputs/apk/release/app-release.apk`.
11+
12+
# 👀 Example usage:
13+
# - name : 📦 Set Up JDK + Generate Test APK
14+
# uses: ./.github/actions/setup-jdk-generate-apk
15+
# with:
16+
# APP_ENV: 'staging'
17+
18+
name: 'Setup JDK + GRADLE + Generate APK'
19+
description: 'Setup JDK + GRADLE + Generate APK'
20+
inputs:
21+
APP_ENV:
22+
description: 'APP_ENV (one of): development, staging, production'
23+
required: true
24+
default: 'staging'
25+
26+
runs:
27+
using: 'composite'
28+
steps:
29+
- name: Set Up JDK
30+
uses: actions/setup-java@v3
31+
with:
32+
distribution: 'zulu' # See 'Supported distributions' for available options
33+
java-version: '11'
34+
- name: Setup Gradle
35+
uses: gradle/gradle-build-action@v2
36+
37+
- name: Generate Test APK
38+
run: |
39+
pnpm prebuild:${{ inputs.APP_ENV }}
40+
cd android
41+
chmod +x ./gradlew
42+
./gradlew assembleRelease --no-daemon
43+
cd ..
44+
shell: bash
45+
env:
46+
EXPO_NO_DOTENV: '1'
47+
APP_ENV: ${{ inputs.APP_ENV }}
48+
CI: 'true'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# 🔗 Links:
2+
# Source file: https://github.com/obytes/react-native-template-obytes/blob/master/.github/actions/setup-node-pnpm-install/action.yml
3+
# Composite actions docs: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
4+
5+
# ✍️ Description:
6+
# This is a composite action, which means it can be used in other actions.
7+
# It is used in almost all workflows to set up the environment and install dependencies.
8+
# Updating the package manager or Node version here will be reflected in all workflows.
9+
10+
# 👀 Example usage:
11+
# - name : 📦 Setup Node + PNPM + install deps
12+
# uses: ./.github/actions/setup-node-pnpm-install
13+
14+
name: 'Setup Node + PNPM + Install Dependencies'
15+
description: 'Setup Node + PNPM + Install Dependencies'
16+
runs:
17+
using: 'composite'
18+
steps:
19+
- uses: pnpm/action-setup@v4
20+
with:
21+
run_install: false
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
cache: 'pnpm'
26+
27+
- name: 📦 Install Project Dependencies
28+
run: pnpm install --frozen-lockfile
29+
shell: bash

.github/workflows/compress-images.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 🔗 Links:
2+
# Source file: https://github.com/obytes/react-native-template-obytes/blob/master/.github/workflows/compress-images.yml
3+
4+
# ✍️ Description:
5+
# This workflow is used to compress images in the repo.
6+
# This workflow will trigger on a push to the "master" or "main" branch and only run when a new image is added or updated.
7+
# If it's the case, it will compress those images and create a pull request with the compressed images.
8+
9+
# 🚨 GITHUB SECRETS REQUIRED: None
10+
11+
name: Compress images
12+
on:
13+
push:
14+
branches:
15+
- master
16+
- main
17+
paths:
18+
- '**.jpg'
19+
- '**.jpeg'
20+
- '**.png'
21+
- '**.webp'
22+
workflow_dispatch:
23+
24+
jobs:
25+
build:
26+
name: calibreapp/image-actions
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout Branch
30+
uses: actions/checkout@v3
31+
with:
32+
fetch-depth: 0
33+
- name: Compress Images
34+
id: calibre
35+
uses: calibreapp/image-actions@main
36+
with:
37+
githubToken: ${{ secrets.GITHUB_TOKEN }}
38+
compressOnly: true
39+
ignorePaths: 'node_modules/**,ios/**,android/**'
40+
41+
- name: Create Pull Request
42+
if: steps.calibre.outputs.markdown != ''
43+
uses: peter-evans/create-pull-request@v3
44+
with:
45+
title: Auto Compress Images
46+
branch-suffix: timestamp
47+
commit-message: Compress Images
48+
body: ${{ steps.calibre.outputs.markdown }}

0 commit comments

Comments
 (0)