Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite typescript codes #46

Open
wants to merge 4 commits into
base: rewrite-media-styles
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 38 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
name: CI
on: push

on:
pull_request:
types: [opened, synchronize]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2

- uses: actions/setup-node@v3
with:
node-version: '15'
- name: Install modules
run: yarn
node-version: '16'

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Lint
run: yarn lint
run: npm run lint

- name: Test
run: yarn test --ci --coverage --maxWorkers=2
run: npm run test --ci --coverage --maxWorkers=2

- name: Build
run: yarn build
run: npm run build
37 changes: 37 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "http://json.schemastore.org/swcrc",
"module": {
"type": "commonjs",
// These are defaults.
"strict": false,
"strictMode": true,
"lazy": false,
"noInterop": false
},
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": true,
"dynamicImport": false
},
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"react": {
"runtime": "automatic",
"useBuiltins": true
}
},
"keepClassNames": true,
"minify": {
"compress": {
"unused": true,
"keep_classnames": true,
"keep_fnames": true,
"keep_fargs": true
}
}
},
"minify": true
}
31 changes: 31 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const esmModules = [
'((jest-)?react-native|@react-native(-community)?)',
'expo(nent)?',
'@expo(nent)/.*?',
'@expo-google-fonts/.*',
'react-navigation',
'@react-navigation/.*',
'@unimodules/.*',
'unimodules',
'sentry-expo',
'native-base',
'react-native-svg',
].join('|');

export default {
preset: 'react-native',
transform: {
'^.+\\.tsx?$': ['@swc/jest'],
// NOTE: For flow in React Native Library.
'^.+\\.jsx?$': ['babel-jest'],
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve(
'react-native/jest/assetFileTransformer.js'
),
},
modulePathIgnorePatterns: [
'<rootDir>/example/node_modules',
'<rootDir>/lib/',
],
transformIgnorePatterns: [`node_modules/(?!(?:.pnpm/)?(${esmModules}))`],
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
};
38 changes: 15 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
},
"scripts": {
"build": "bob build",
"prepare": "yarn build",
"prepare": "npm run build",
"release": "np --any-branch",
"watch": "npm-watch",
"test": "jest",
"lint": "yarn lint:lib & yarn lint:example",
"lint": "npm run lint:lib & npm run lint:example",
"lint:lib": "eslint ./src --ext .js --config .eslintrc",
"lint:lib:fix": "eslint ./src --ext .js --config .eslintrc --fix",
"lint:example": "eslint ./example --ext .ts,.tsx --config .eslintrc",
Expand All @@ -48,16 +48,19 @@
"lodash.merge": "4.6.2"
},
"devDependencies": {
"@babel/core": "7.14.8",
"@babel/runtime": "7.14.8",
"@testing-library/jest-native": "4.0.1",
"@testing-library/react-native": "7.2.0",
"@types/jest": "26.0.24",
"@babel/core": "7.20.7",
"@babel/runtime": "7.20.7",
"@swc/core": "^1.3.24",
"@swc/jest": "^0.2.24",
"@testing-library/jest-native": "5.4.0",
"@testing-library/react-native": "11.5.0",
"@types/jest": "29.2.5",
"@types/node": "^18.11.18",
"@types/react": "^18.0.24",
"@types/react-native": "^0.70.6",
"@typescript-eslint/eslint-plugin": "4.6.1",
"@typescript-eslint/parser": "4.6.1",
"babel-jest": "27.0.6",
"babel-jest": "29.3.1",
"eslint": "7.31.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-standard": "16.0.3",
Expand All @@ -69,14 +72,16 @@
"eslint-plugin-react-hooks": "4.2.0",
"eslint-plugin-standard": "5.0.0",
"husky": "6.0.0",
"jest": "27.0.6",
"jest": "29.3.1",
"metro-react-native-babel-preset": "^0.73.3",
"npm-watch": "^0.11.0",
"prettier": "2.3.2",
"react": "18.0.0",
"react-native": "0.69.6",
"react-native-builder-bob": "0.18.1",
"react-test-renderer": "18.0.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "4.7.3"
},
"peerDependencies": {
Expand All @@ -85,19 +90,9 @@
},
"husky": {
"hooks": {
"pre-commit": "yarn lint"
"pre-commit": "npm run lint"
}
},
"jest": {
"preset": "react-native",
"modulePathIgnorePatterns": [
"<rootDir>/example/node_modules",
"<rootDir>/lib/"
],
"setupFilesAfterEnv": [
"@testing-library/jest-native/extend-expect"
]
},
"react-native-builder-bob": {
"source": "src/internals",
"output": "lib",
Expand Down Expand Up @@ -125,9 +120,6 @@
"tabWidth": 2,
"trailingComma": "es5"
},
"np": {
"yarn": true
},
"keywords": [
"android",
"ios",
Expand Down
Loading
Loading