Skip to content

Commit bcb563e

Browse files
committed
feat: Add .yarnrc.yml and update yarn version
Add .yarnrc.yml file with nodeLinker and yarnPath configurations. Also, update the yarn version to 4.5.0.
1 parent 759a5ed commit bcb563e

File tree

19 files changed

+10874
-7731
lines changed

19 files changed

+10874
-7731
lines changed

template/.eslintrcJsVersion.js

Lines changed: 0 additions & 72 deletions
This file was deleted.

template/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,9 @@ yarn-error.log
7272
!.yarn/releases
7373
!.yarn/sdks
7474
!.yarn/versions
75+
76+
# eslint
77+
.eslintcache
78+
79+
# vscode
80+
.vscode/*

template/.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.5.0.cjs
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { AssetType } from '@/theme/assets/getAssetsContext';
2+
3+
jest.mock('@/theme/assets/getAssetsContext', () =>
4+
jest.fn((type: AssetType) => {
5+
const context = (key: string) => {
6+
if (type === 'images') {
7+
return jest.mock('@/theme/assets/images/tom.png');
8+
}
9+
if (type === 'icons') {
10+
return jest.mock('@/theme/assets/images/tom.svg');
11+
}
12+
return key;
13+
};
14+
15+
context.keys = () => {
16+
if (type === 'images') {
17+
return ['images/tom.png'];
18+
}
19+
if (type === 'icons') {
20+
return ['images/tom.png'];
21+
}
22+
return [];
23+
};
24+
25+
return context;
26+
}),
27+
);

template/__mocks__/libs/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import '@testing-library/jest-native/extend-expect';
2+
// LOCAL
3+
import './react-native-reanimated';
4+
import './react-native-safe-area-context';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { setUpTests } from 'react-native-reanimated';
2+
3+
setUpTests();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import mockSafeAreaContext from 'react-native-safe-area-context/jest/mock';
2+
3+
jest.mock('react-native-safe-area-context', () => mockSafeAreaContext);

template/ios/.gitignore

Lines changed: 0 additions & 17 deletions
This file was deleted.

template/jest.setup.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
1-
import 'react-native-gesture-handler/jestSetup';
2-
import '@testing-library/jest-native/extend-expect';
3-
4-
import mockSafeAreaContext from 'react-native-safe-area-context/jest/mock';
5-
6-
jest.mock('react-native-reanimated', () =>
7-
require('react-native-reanimated/mock'),
8-
);
9-
10-
// Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing
11-
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
12-
13-
jest.mock('react-native-safe-area-context', () => mockSafeAreaContext);
1+
import './__mocks__/libs';
2+
import './__mocks__/getAssetsContext';

template/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lint:coventions": "eslint . --cache",
1212
"lint:code-format": "prettier --check \"{src,__mocks__}/**/*.{js,json,md,ts,tsx,yml,yaml}\"",
1313
"lint": "yarn lint:coventions && yarn lint:code-format && yarn lint:type-check",
14-
"lint:fix": "lint:coventions --fix && lint:code-format --write && lint:type-check",
14+
"lint:fix": "yarn lint:coventions --fix && yarn lint:code-format --write && yarn lint:type-check",
1515
"test:report": "jest --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporters=default --reporters=jest-junit --coverage",
1616
"pod-install": "cd ios && pod install && cd ..",
1717
"postinstall": "npx patch-package"
@@ -73,5 +73,6 @@
7373
},
7474
"engines": {
7575
"node": ">=18"
76-
}
76+
},
77+
"packageManager": "[email protected]"
7778
}

0 commit comments

Comments
 (0)