Skip to content

Commit

Permalink
add pnpm (#89)
Browse files Browse the repository at this point in the history
* add  pnpm

#81

* update ci

* update ci

* Update pnpm-lock.yaml

* Update node.js.yml

* Update README.md
  • Loading branch information
BilligsterUser committed Jun 23, 2023
1 parent dad2030 commit 38311f6
Show file tree
Hide file tree
Showing 38 changed files with 16,631 additions and 23,636 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"
]
}
11 changes: 8 additions & 3 deletions .github/workflows/eas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ jobs:
build:
env:
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
CI: true
runs-on: ubuntu-latest
steps:
- 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 +31,7 @@ jobs:
token: ${{ secrets.EXPO_TOKEN }}

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

- name: 🚀 Build app
run: npm run build:ci
run: pnpm build:ci
28 changes: 21 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 @@ -14,23 +14,37 @@ jobs:
build:
runs-on: ubuntu-latest

env:
CI: true

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

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 install
- run: pnpm lint
- 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
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ The NUT documents (**N**otation, **U**sage and **T**erminology) each specify par

- eNuts is built using the managed workflow provided by Expo, so the easiest way to run a development environment is their [Expo Go](https://expo.dev/client) app.
- NodeJS 16 or higher.
- pnpm [pnpm.io](https://pnpm.io/installation)

## 👏 Contribute

Expand All @@ -102,8 +103,8 @@ The process of proposing a change to eNuts can be summarized as follows:
1. Verify the open [issues](https://github.com/cashubtc/eNuts/issues) and [discussions](https://github.com/cashubtc/eNuts/discussions) to see if a related topic is available.
2. Fork the repository and create your branch from `main`
3. Make the desired changes to the sources and add tests if required.
4. Ensure the test suite passes, either locally with `npm run test` or on CI once you opened a pull request.
5. Make sure your code lints with `npm run lint`
4. Ensure the test suite passes, either locally with `pnpm test` or on CI once you opened a pull request.
5. Make sure your code lints with `pnpm lint`
6. Push the changes to your fork.
7. Create a pull request to the eNuts repository.
8. Request a review, link a related issue and describe your pull request.
Expand All @@ -114,8 +115,8 @@ If all goes well, your pull request will be merged. If it is not merged, maintai
## 🚀 Getting started

1. Fork this repository and create a local clone.
2. Navigate inside the repository and run `npm i`
3. Start the Expo dev server by running `npm run start`
2. Navigate inside the repository and run `pnpm i`
3. Start the Expo dev server by running `pnpm start`
4. Download the [Expo Go](https://expo.dev/client) app.
5. Scan the QR code provided by your terminal using the app (iOS users will have to use the Camera app).
6. A browser tab will be opened. Press the "Expo Go" button in the bottom of the page.
Expand Down
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 38311f6

Please sign in to comment.