Skip to content

Commit

Permalink
Merge branch 'main' into @tomekzaw/hermes-ios
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed Jun 26, 2024
2 parents bd535ef + a1d37e1 commit 08d16ef
Show file tree
Hide file tree
Showing 203 changed files with 22,323 additions and 47,741 deletions.
17 changes: 16 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
**/node_modules/*
parser/out.js
parser/react-native-live-markdown-parser.js

# any js file inside android and ios folders
**/android/**/*.js
**/ios/**/*.js

# Output of the build process & scripts
lib/**/*
scripts/**/*

babel.config.js
metro.config.js
react-native.config.js
jest.config.js
webpack.config.js
.eslintrc.js
50 changes: 26 additions & 24 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ module.exports = {
project: true,
tsconfigRootDir: __dirname,
},
env: {
jest: true,
},
extends: [
'expensify',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:@typescript-eslint/stylistic',
'plugin:import/typescript',
'prettier',
'plugin:prettier/recommended',
],
plugins: [
Expand All @@ -19,39 +25,31 @@ module.exports = {
],
settings: {
'import/resolver': {
alias: [['react-native-markdown-text-input', './src/index.tsx']],
alias: [['@expensify/react-native-live-markdown', './src/index.tsx']],
},
},
root: true,
rules: {
'prettier/prettier': [
'error',
'rulesdir/prefer-underscore-method': 'off',
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.tsx', '.jsx'] }],
"import/extensions": [
"error",
"ignorePackages",
{
quoteProps: 'consistent',
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
},
],
'curly': 'error',
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
'import/no-unresolved': 'error',
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'react/jsx-uses-vars': 'error',
'react/jsx-uses-react': 'error',
'no-use-before-define': 'off',
'es/no-nullish-coalescing-operators': 'off',
'es/no-optional-chaining': 'off',
'@typescript-eslint/no-use-before-define': 'off', // TODO consider enabling this (currently it reports styles defined at the bottom of the file)
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
'ts-expect-error': 'allow-with-description',
},
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-var-requires': 'warn',
'eqeqeq': 'error',
'no-unreachable': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
Expand All @@ -60,7 +58,11 @@ module.exports = {
'error',
{ fixMixedExportsWithInlineTypeSpecifier: false },
],
'valid-jsdoc': 'off',
'tsdoc/syntax': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}],
'@typescript-eslint/consistent-type-definitions': 'off',
'curly': ['error', 'all'],
},
};
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.pbxproj -text
# specific for windows script files
*.bat text eol=crlf
*.bat text eol=crlf
Binary file added .github/OSBotify-private-key.asc.gpg
Binary file not shown.
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- If necessary, assign reviewers that know the area or changes well. Feel free to tag any additional reviewers you see fit. -->

### Details
<!-- Explanation of the change or anything fishy that is going on -->

### Related Issues
<!-- Please replace GH_LINK with the link to the GitHub issue this Pull Request is related to -->
GH_LINK

### Manual Tests
<!---
Most changes should have accompanying tests. Describe the tests you added or if no tests were added an explanation about why one was not needed.
--->

### Linked PRs
<!---
Please include links to any update PRs in repos that must change their package.json version.
--->
55 changes: 55 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test Android build
on:
pull_request:
paths:
- .github/workflows/build-android.yml
- android/**
- cpp/**
- example/package.json
- example/android/**
- react-native.config.js
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/build-android.yml
- android/**
- cpp/**
- example/package.json
- example/android/**
- react-native.config.js

jobs:
build:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: ubuntu-latest
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
fail-fast: false
concurrency:
group: build-android-${{ matrix.react-native-architecture }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Install node_modules
run: yarn install --immutable

- name: Apply patches
working-directory: example
run: yarn patch-package

- name: Build app
working-directory: example/android
run: ./gradlew assembleDebug --build-cache -PreactNativeArchitectures=arm64-v8a -PnewArchEnabled=${{ matrix.react-native-architecture == 'Fabric' && 'true' || 'false' }}
83 changes: 83 additions & 0 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Test iOS build
on:
pull_request:
paths:
- .github/workflows/build-ios.yml
- RNLiveMarkdown.podspec
- ios/**
- cpp/**
- example/package.json
- example/ios/**
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/build-ios.yml
- RNLiveMarkdown.podspec
- ios/**
- cpp/**
- example/package.json
- example/ios/**

jobs:
build:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: macos-13
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
fail-fast: false
concurrency:
group: build-ios-${{ matrix.react-native-architecture }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: |
node_modules
example/node_modules
key: build-ios-node-modules-${{ matrix.react-native-architecture }}-${{ hashFiles('yarn.lock') }}
restore-keys: build-ios-node-modules-${{ matrix.react-native-architecture }}-

- name: Install node_modules
run: yarn install --immutable

- name: Restore Pods from cache
uses: actions/cache@v4
with:
path: |
example/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: build-ios-pods-${{ matrix.react-native-architecture }}-${{ hashFiles('example/node_modules/react-native/package.json') }}
restore-keys: build-ios-pods-${{ matrix.react-native-architecture }}-

- name: Install Pods
working-directory: example/ios
env:
RCT_NEW_ARCH_ENABLED: ${{ matrix.react-native-architecture == 'Fabric' && '1' || '0' }}
run: |
bundler install
bundler exec pod install
- name: Remove .xcode.env.local
working-directory: example/ios
run: rm -rf .xcode.env.local

- name: Restore build artifacts from cache
uses: actions/cache@v4
with:
path: ~/Library/Developer/Xcode/DerivedData
key: build-ios-derived-data-${{ matrix.react-native-architecture }}-${{ hashFiles('example/node_modules/react-native/package.json') }}
restore-keys: build-ios-derived-data-${{ matrix.react-native-architecture }}-

- name: Build app
working-directory: example
run: npx react-native@latest run-ios --no-packager
35 changes: 35 additions & 0 deletions .github/workflows/build-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test web build
on:
pull_request:
paths:
- .github/workflows/build-web.yml
- src/**
- WebExample/**
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/build-web.yml
- src/**
- WebExample/**

jobs:
build:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: ubuntu-latest
concurrency:
group: build-web-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Install node_modules
run: yarn install --immutable

- name: Build app
working-directory: WebExample
run: npx expo export:web
56 changes: 56 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Typecheck, lint and test
on:
pull_request:
merge_group:
branches:
- main
push:
branches:
- main

jobs:
check:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: ubuntu-latest
concurrency:
group: check-root-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install node_modules
run: yarn install --immutable

- name: Verify there's no parser diff
working-directory: parser
run: |
yarn build
if ! git diff --name-only --exit-code; then
# shellcheck disable=SC2016
echo 'Error: Parser diff detected! Please run `cd parser && yarn build` and commit the changes.'
exit 1
fi
- name: Typecheck library
run: yarn tsc --project tsconfig.json --noEmit

- name: Typecheck parser
run: yarn tsc --project parser/tsconfig.json --noEmit

- name: Typecheck example app
run: yarn tsc --project example/tsconfig.json --noEmit

- name: Typecheck WebExample app
run: yarn tsc --project WebExample/tsconfig.json --noEmit

- name: Lint
run: yarn lint

- name: Test
run: yarn test
Loading

0 comments on commit 08d16ef

Please sign in to comment.