Skip to content

Commit

Permalink
add pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
BilligsterUser committed Jun 23, 2023
1 parent dad2030 commit 88078d2
Show file tree
Hide file tree
Showing 37 changed files with 16,623 additions and 23,632 deletions.
11 changes: 0 additions & 11 deletions .eslintignore

This file was deleted.

22 changes: 20 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,18 @@
// "eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@rnx-kit/recommended",
"plugin:react/jsx-runtime"
// "plugin:import/errors",
// "plugin:import/warnings"
],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.d.ts"]
},
{
"files": ["*.json"],
"parser": "espree"
}
],
"globals": {
Expand All @@ -59,8 +64,9 @@
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"extraFileExtensions": [".json"],
"ecmaVersion": "latest",
// "sourceType": "module",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"globalReturn": true,
Expand Down Expand Up @@ -228,5 +234,17 @@
"quotes": ["warn", "single"],
"semi": ["warn", "never"]
},
"ignorePatterns": ["dist"]
"ignorePatterns": [
"node_modules",
"dist",
"build",
".expo",
".jest",
".vscode",
"coverage",
"patches",
"report",
"assets",
"scripts"
]
}
10 changes: 7 additions & 3 deletions .github/workflows/eas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ jobs:
- name: 🏗 Setup repo
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8.6.3

- name: 🏗 Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: npm
cache: pnpm

- name: 🏗 Setup EAS
uses: expo/expo-github-action@v8
Expand All @@ -26,7 +30,7 @@ jobs:
token: ${{ secrets.EXPO_TOKEN }}

- name: 📦 Install dependencies
run: npm install
run: pnpm ci

- name: 🚀 Build app
run: npm run build:ci
run: pnpm build:ci
26 changes: 19 additions & 7 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI
Expand All @@ -21,16 +21,28 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.6.3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run lint
- run: npm run build --if-present
- run: npm run test:coverage
# - run: npm run testtsx:coverage
cache: "pnpm"
- run: pnpm ci
- run: pnpm lint
- run: pnpm build --if-present
- run: |
pnpm metro build \
-c metro.config.js \
-p android -g \
--reset-cache \
-O build \
src/AppEntry.ts
- run: pnpm tsc

- run: pnpm test:coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// .npmrc
auto-install-peers=true
shamefully-hoist=true
2 changes: 1 addition & 1 deletion config/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { config as dotenvConfig } from 'dotenv'
import { ExpoConfig } from 'expo/config'
import type { ExpoConfig } from 'expo/config'

import { version } from './../package.json'

Expand Down
6 changes: 4 additions & 2 deletions config/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// import type { Config } from 'jest'
// import { defaults } from 'jest-config'
import { JestConfigWithTsJest, pathsToModuleNameMapper } from 'ts-jest'
import type { JestConfigWithTsJest} from 'ts-jest'
import { pathsToModuleNameMapper } from 'ts-jest'

import { compilerOptions } from '../tsconfig.json'

Expand All @@ -24,7 +25,8 @@ export default (): JestConfigWithTsJest => ({
// moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
preset: 'jest-expo',
transformIgnorePatterns: [
'node_modules/(?!((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)'
'node_modules/.pnpm/(?!((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)@',
// 'node_modules/(?!((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)'
],

// moduleDirectories: ['<rootDir>/node_modules', '<rootDir>'],
Expand Down
58 changes: 49 additions & 9 deletions config/metro.config.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,57 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
// Learn more https://docs.expo.io/guides/customizing-metro
// import * as c from '@expo/metro-config'
import { getDefaultConfig } from '@expo/metro-config'
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { makeMetroConfig } from '@rnx-kit/metro-config'
import MetroSymlinksResolver from '@rnx-kit/metro-resolver-symlinks'
import { MetroSerializer } from '@rnx-kit/metro-serializer'
import type { InputConfigT } from 'metro-config'
import type { ResolutionContext } from 'metro-resolver/src/types'
import { join } from 'path'

const config = getDefaultConfig(join(__dirname, '..', ''))

const config = getDefaultConfig(join(__dirname, '..',''))

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
config.resolver.assetExts.push('db')
// eslint-disable-next-line no-console
// console.log(config)

module.exports = config
// eslint-disable-next-line new-cap
const metroSymlinksResolver = MetroSymlinksResolver()
const c = {
...config,
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
...makeMetroConfig({
serializer: {
...config?.serializer ?? {},
// eslint-disable-next-line new-cap, @typescript-eslint/no-unsafe-call
customSerializer: MetroSerializer([
// eslint-disable-next-line new-cap
/* CyclicDependencies({
includeNodeModules: false,
linesOfContext: 1,
throwOnError: true,
}),
// eslint-disable-next-line new-cap
DuplicateDependencies({
ignoredModules: [],
bannedModules: [],
throwOnError: true,
}), */
]),
},
projectRoot: config?.projectRoot ?? join(__dirname, '..', ''),
resolver: {
...config?.resolver ?? {},
// eslint-disable-next-line new-cap
resolveRequest: (context: ResolutionContext, moduleName: string, platform: string | null) => {
if (moduleName === 'missing-asset-registry-path') {
// console.log({ /* context, */ moduleName, o: context.originModulePath })
return { type: 'assetFiles', filePaths: [context.originModulePath] }
}
return metroSymlinksResolver(context, moduleName, platform)
},
assetExts: [...config?.resolver?.assetExts ?? [], 'db'],
// assetRegistryPath: resolve('node_modules/react-native/Libraries/Image/AssetRegistry')
},
}) as InputConfigT,
}

module.exports = c

Loading

0 comments on commit 88078d2

Please sign in to comment.