Skip to content

Commit

Permalink
Merge remote-tracking branch 'mobile-app/reorganised-history' into mo…
Browse files Browse the repository at this point in the history
…bile-monorepo-correct
  • Loading branch information
compojoom committed Dec 20, 2024
2 parents 7825b1c + 013110a commit 0107aa7
Show file tree
Hide file tree
Showing 438 changed files with 37,255 additions and 1,864 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/mobile-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run Lint

on:
push:
branches:
- main
paths:
- apps/mobile/**
- packages/store/**
pull_request:
paths:
- apps/mobile/**
- packages/store/**

jobs:
lint:
runs-on: ubuntu-latest

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

# Set up Node.js
- uses: actions/setup-node@v4
with:
node-version: '22.11.0' # jod
cache: 'yarn'

# Install dependencies
- name: Install dependencies
run: yarn install --immutable

# Run tests with coverage
- name: Run lint
run: |
yarn workspace @safe-global/mobile run lint
45 changes: 45 additions & 0 deletions .github/workflows/mobile-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Run Tests and Coverage

on:
push:
branches:
- main
paths:
- apps/mobile/**
pull_request:
paths:
- apps/mobile/**

jobs:
test-and-coverage:
runs-on: ubuntu-latest

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

# Set up Node.js
- uses: actions/setup-node@v4
with:
node-version: '22.11.0' # jod
cache: 'yarn'

# Install dependencies
- name: Install dependencies
run: yarn install --immutable

# Run tests with coverage
- name: Run Jest tests with coverage
run: |
yarn workspace @safe-global/mobile test:coverage --coverageReporters=text --coverageReporters=json-summary | tee ./coverage.txt && exit ${PIPESTATUS[0]}
- name: Jest Coverage Comment
uses: MishaKav/jest-coverage-comment@v1
with:
coverage-summary-path: ./coverage/coverage-summary.json
coverage-title: Coverage
coverage-path: ./coverage.txt
44 changes: 27 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
**/node_modules/*
/.pnp
.pnp.js

Expand All @@ -23,14 +22,36 @@
*.pem
.idea

# Yarn v4
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# expo
**/.expo/*

# tamagui
**/.tamagui/*


# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

.env
.env.local
.env.local*
.env.development.local
.env.test.local
.env.production.local
.env.production

# vercel
.vercel
Expand All @@ -41,21 +62,10 @@ yarn-error.log*
# yalc
.yalc
yalc.lock
.env

/cypress/videos
/cypress/screenshots
/cypress/downloads

/public/sw.js
/public/sw.js.map
/public/worker-*.js
/public/workbox-*.js
/public/workbox-*.js.map
/public/fallback*
/public/*.js.LICENSE.txt
certificates
*storybook.log

# Yarn v4
.yarn/*
# os
THUMBS_DB
thumbs.db
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
8 changes: 8 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"*.ts": ["yarn prettier:fix"],
"*.tsx": ["yarn prettier:fix"],
"apps/mobile/assets/fonts/safe-icons/selection.json": [
"node ./apps/mobile/scripts/generateIconTypes.js",
"git add ./apps/mobile/src/types/iconTypes.ts"
]
}
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ignore artifacts:
build
coverage
node_modules
html
ios
android
/assets

apps/mobile/assets
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ yarn workspace <workspace-name> remove <package-name>

> [!Note]
>
> Yarn treats commands that contain a semicolon as global commands. For example if you have a
> command in a workspace that has a semicolon and there isn't another workspace that has the same command,
> Yarn treats commands that contain a colon as global commands. For example if you have a
> command in a workspace that has a colon and there isn't another workspace that has the same command,
> you can run the command without specifying the workspace name. For example:
>
> ```bash
Expand Down
38 changes: 38 additions & 0 deletions apps/mobile/.eas/build/build-and-maestro-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
build:
name: Create a build and run Maestro tests on it
steps:
- eas/checkout

- run:
name: Enable corepack
command: corepack enable

# if you are not interested in using custom .npmrc config you can skip it
- eas/use_npm_token

- eas/install_node_modules

- eas/resolve_build_config

- eas/prebuild

- run:
name: Install pods
working_directory: ./ios
command: pod install

# if you are not using EAS Update you can remove this step from your config
# https://docs.expo.dev/eas-update/introduction/
- eas/configure_eas_update:
inputs:
throw_if_not_configured: false

- eas/generate_gymfile_from_template

- eas/run_fastlane

- eas/find_and_upload_build_artifacts
- eas/maestro_test:
inputs:
flow_path: |
e2e/flow.yml
37 changes: 37 additions & 0 deletions apps/mobile/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/

# Auto generated storybook file
.storybook/storybook.requires.ts

# From jest
html
coverage

# macOS
.DS_Store

# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
# The following patterns were generated by expo-cli

expo-env.d.ts
# @end expo-cli
/.idea
# Tamagui UI generates a lot of cache files
.tamagui

*storybook.log
/storybook-static

# Android and iOS build files
/android/*
/ios/*
11 changes: 11 additions & 0 deletions apps/mobile/.storybook/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import AsyncStorage from '@react-native-async-storage/async-storage'
import { view } from './storybook.requires'

const StorybookUIRoot = view.getStorybookUI({
storage: {
getItem: AsyncStorage.getItem,
setItem: AsyncStorage.setItem,
},
})

export default StorybookUIRoot
52 changes: 52 additions & 0 deletions apps/mobile/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import type { StorybookConfig as WebStorybookConfig } from '@storybook/react-webpack5'
import type { StorybookConfig as RNStorybookConfig } from '@storybook/react-native'

const isWeb = process.env.STORYBOOK_WEB
import path from 'path'
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'

let config: WebStorybookConfig | RNStorybookConfig

if (isWeb) {
config = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-interactions',
{
name: '@storybook/addon-react-native-web',
options: {
projectRoot: '../',
modulesToTranspile: [],
},
},
'@storybook/addon-webpack5-compiler-babel',
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
webpackFinal: async (config) => {
if (config.resolve) {
config.resolve.plugins = [
...(config.resolve.plugins || []),
new TsconfigPathsPlugin({
extensions: config.resolve.extensions,
}),
]

config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname, '../'),
}
}
return config
},
} as WebStorybookConfig
} else {
config = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: ['@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-actions'],
} as RNStorybookConfig
}
export default config
40 changes: 40 additions & 0 deletions apps/mobile/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { Preview } from '@storybook/react'
import { NavigationIndependentTree } from '@react-navigation/native'
import { SafeThemeProvider } from '@/src/theme/provider/safeTheme'
import { View } from 'react-native'
import { SafeToastProvider } from '@/src/theme/provider/toastProvider'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { PortalProvider } from 'tamagui'

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
tags: ['autodocs'],
decorators: [
(Story) => {
return (
<PortalProvider shouldAddRootHost>
<NavigationIndependentTree>
<SafeAreaProvider>
<SafeThemeProvider>
<SafeToastProvider>
<View style={{ padding: 16, flex: 1 }}>
<Story />
</View>
</SafeToastProvider>
</SafeThemeProvider>
</SafeAreaProvider>
</NavigationIndependentTree>
</PortalProvider>
)
},
],
}

export default preview
7 changes: 7 additions & 0 deletions apps/mobile/.storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "commonjs"
},
"include": ["../src/**/*", "./**/*"]
}
Loading

0 comments on commit 0107aa7

Please sign in to comment.