Skip to content

Commit bc5b8ff

Browse files
committed
chore: cleanup unused packages and update setup
1 parent 8d72e21 commit bc5b8ff

17 files changed

Lines changed: 437 additions & 1081 deletions

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ docs/dist/
44
docs/build/
55
docs/public/
66
docs/static/
7+
example/dist/
78
web-build/
89
jest/testSetup.js
10+
__ts-tests__/
911
__fixtures__/
1012

1113
# generated by bob

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
{
6161
"files": ["*.test.js", "*.test.tsx"],
6262
"rules": {
63-
"local-rules/no-react-forwardref-usage": "off"
63+
"local-rules/no-react-forwardref-usage": "off",
64+
"react-native/no-inline-styles": "off"
6465
}
6566
}
6667
],

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313

1414
<!-- Describe the **steps to test this change**, so that a reviewer can verify it. Provide screenshots or videos if the change affects UI. -->
1515

16-
<!-- Keep in mind that PR changes must pass lint, typescript and tests. -->
16+
<!-- Keep in mind that PR changes must pass lint, typecheck and tests. -->

.github/workflows/ci.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
uses: ./.github/actions/setup
1919

2020
- name: Lint
21-
run: yarn lint-no-fix
21+
run: yarn lint
2222

23-
typescript:
24-
name: TypeScript
23+
typecheck:
24+
name: Typecheck
2525
runs-on: ubuntu-latest
2626
steps:
2727
- name: Checkout
@@ -31,7 +31,7 @@ jobs:
3131
uses: ./.github/actions/setup
3232

3333
- name: Check types
34-
run: yarn typescript
34+
run: yarn typecheck
3535

3636
unit-tests:
3737
name: Unit tests
@@ -73,7 +73,20 @@ jobs:
7373
- name: Build package
7474
run: |
7575
yarn prepack
76-
node ./scripts/typescript-output-lint
76+
node ./scripts/typescript-output-lint.ts
77+
78+
build-example:
79+
name: Build example
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
84+
85+
- name: Setup
86+
uses: ./.github/actions/setup
87+
88+
- name: Build example
89+
run: yarn example expo export --platform all
7790

7891
build-docs:
7992
name: Build docs

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ Our pre-commit hooks verify that your commit message matches this format when co
3232

3333
### Linting and tests
3434

35-
We use `typescript` for type checking, `eslint` with `prettier` for linting and formatting the code, and `jest` for testing. Our pre-commit hooks verify that the linter and tests pass when commiting. You can also run the following commands manually:
35+
We use `typescript` for type checking, `eslint` with `prettier` for linting and formatting the code, and `jest` for testing. Our pre-commit hooks verify that type checking, linting, and tests pass when committing. You can also run the following commands manually:
3636

37-
- `yarn typescript`: type-check files with `tsc`.
37+
- `yarn typecheck`: type-check files with `tsc`.
3838
- `yarn lint`: lint files with `eslint` and `prettier`.
3939
- `yarn test`: run unit tests with `jest`.
4040

@@ -43,7 +43,7 @@ We use `typescript` for type checking, `eslint` with `prettier` for linting and
4343
When you're sending a pull request:
4444

4545
- Prefer small pull requests focused on one change.
46-
- Verify that `typescript`, `eslint` and all tests are passing.
46+
- Verify that `typecheck`, `lint` and all tests are passing.
4747
- Preview the documentation to make sure it looks good.
4848
- Follow the pull request template when opening a pull request.
4949

@@ -58,7 +58,7 @@ When you're working on a component:
5858

5959
The example app uses [Expo](https://expo.dev/) for the React Native example. You will need to install the Expo app for [Android](https://play.google.com/store/apps/details?id=host.exp.exponent) and [iOS](https://itunes.apple.com/app/apple-store/id982107779) to start developing.
6060

61-
> [!IMPORTANT]
61+
> [!IMPORTANT]
6262
> The example app is built with `react-native@0.77.x` and Expo SDK 52, which isn’t compatible with Expo Go. To run the app, you have to create a [development build](https://docs.expo.dev/develop/development-builds/create-a-build/).
6363
6464
After you're done, you can run `yarn example start` in the project root (or `npx expo start` in the `example/` folder) and scan the QR code to launch it on your device.
@@ -72,7 +72,7 @@ If you want to test the changes brought by a pull request, you can do so by poin
7272
```json
7373
{
7474
"dependencies": {
75-
"react-native-paper": "git+https://github.com/callstack/react-native-paper.git#<commit-hash>",
75+
"react-native-paper": "git+https://github.com/callstack/react-native-paper.git#<commit-hash>"
7676
}
7777
}
7878
```

lefthook.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
commit-msg:
2+
jobs:
3+
- name: commitlint
4+
run: yarn commitlint --edit {1}
5+
6+
pre-commit:
7+
parallel: true
8+
jobs:
9+
- name: lint
10+
run: yarn lint
11+
12+
- name: typecheck
13+
run: yarn typecheck
14+
15+
- name: test
16+
run: yarn test

package.json

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
"docs"
3636
],
3737
"scripts": {
38-
"typescript": "tsc --noEmit",
39-
"lint": "yarn lint-no-fix --fix",
40-
"lint-no-fix": "eslint --ext '.js,.ts,.tsx' .",
38+
"lint": "eslint --ext '.js,.ts,.tsx' .",
39+
"typecheck": "tsc",
4140
"test": "jest",
42-
"prepack": "bob build && node ./scripts/generate-mappings.js",
41+
"prepack": "bob build",
42+
"generate-mappings": "node ./scripts/generate-mappings.ts",
4343
"release": "release-it --only-version",
4444
"docs": "yarn --cwd docs",
4545
"example": "yarn --cwd example"
@@ -55,7 +55,7 @@
5555
"devDependencies": {
5656
"@babel/core": "^7.29.0",
5757
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
58-
"@babel/runtime": "^7.29.0",
58+
"@babel/types": "^7.28.5",
5959
"@callstack/eslint-config": "^13.0.2",
6060
"@commitlint/config-conventional": "^8.3.4",
6161
"@jest/globals": "^29.7.0",
@@ -68,39 +68,28 @@
6868
"@testing-library/react-native": "11.5.0",
6969
"@types/color": "^3.0.0",
7070
"@types/jest": "^29.2.1",
71-
"@types/node": "^13.1.0",
72-
"@types/react-dom": "^19.1.1",
73-
"@types/react-native-vector-icons": "^6.4.18",
71+
"@types/node": "^24.0.0",
7472
"@types/react-test-renderer": "^19.1.0",
7573
"@typescript-eslint/eslint-plugin": "^5.41.0",
7674
"@typescript-eslint/parser": "^5.41.0",
7775
"all-contributors-cli": "^6.24.0",
78-
"babel-cli": "^6.26.0",
79-
"babel-core": "^7.0.0-bridge.0",
8076
"babel-jest": "^29.6.3",
81-
"babel-loader": "^8.2.3",
8277
"babel-test": "^0.1.1",
83-
"chalk": "^4.0.0",
8478
"commitlint": "^8.3.4",
85-
"conventional-changelog-cli": "^2.0.11",
86-
"dedent": "^0.7.0",
8779
"eslint": "8.31.0",
8880
"eslint-plugin-flowtype": "^8.0.3",
8981
"eslint-plugin-local-rules": "^1.3.2",
90-
"glob": "^7.1.3",
91-
"husky": "^1.3.1",
9282
"jest": "^29.6.3",
9383
"jest-file-snapshot": "^0.3.2",
84+
"lefthook": "^2.1.9",
9485
"react": "19.2.3",
95-
"react-dom": "19.2.3",
9686
"react-native": "0.85.3",
9787
"react-native-builder-bob": "^0.42.1",
9888
"react-native-reanimated": "4.3.1",
9989
"react-native-safe-area-context": "5.7.0",
10090
"react-native-worklets": "0.8.3",
10191
"react-test-renderer": "19.2.3",
10292
"release-it": "^13.4.0",
103-
"rimraf": "^3.0.2",
10493
"typescript": "5.8.3"
10594
},
10695
"peerDependencies": {
@@ -110,12 +99,6 @@
11099
"react-native-safe-area-context": "*",
111100
"react-native-worklets": ">=0.8.1"
112101
},
113-
"husky": {
114-
"hooks": {
115-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
116-
"pre-commit": "yarn lint-no-fix && yarn typescript && yarn test"
117-
}
118-
},
119102
"jest": {
120103
"preset": "@react-native/jest-preset",
121104
"setupFiles": [
@@ -149,7 +132,6 @@
149132
"react-test-renderer",
150133
"@types/react-native",
151134
"@types/jest",
152-
"husky",
153135
"eslint"
154136
]
155137
},
@@ -163,6 +145,13 @@
163145
{
164146
"project": "tsconfig.build.json"
165147
}
148+
],
149+
[
150+
"custom",
151+
{
152+
"script": "generate-mappings",
153+
"clean": "lib/mappings.json"
154+
}
166155
]
167156
]
168157
},

scripts/generate-component-docs.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
const childProcess = require('child_process');
2-
const fs = require('fs');
3-
const os = require('os');
4-
const path = require('path');
1+
import * as childProcess from 'node:child_process';
2+
import * as fs from 'node:fs';
3+
import { createRequire } from 'node:module';
4+
import * as os from 'node:os';
5+
import * as path from 'node:path';
6+
import { fileURLToPath } from 'node:url';
57

68
type PluginOptions = {
79
docsRootDir: string;
@@ -21,6 +23,9 @@ type PluginFactory = (
2123
const isRecord = (value: unknown): value is { [key: string]: unknown } =>
2224
typeof value === 'object' && value !== null;
2325

26+
const isPluginFactory = (value: unknown): value is PluginFactory =>
27+
typeof value === 'function';
28+
2429
const normalizeDocs = (value: unknown, sourceDir: string): unknown => {
2530
if (Array.isArray(value)) {
2631
return value.map((item) => normalizeDocs(item, sourceDir));
@@ -74,7 +79,11 @@ const main = async () => {
7479
return;
7580
}
7681

77-
const rootDir = path.resolve(__dirname, '..');
82+
const requireFromScript = createRequire(import.meta.url);
83+
const rootDir = path.resolve(
84+
path.dirname(fileURLToPath(import.meta.url)),
85+
'..'
86+
);
7887
const tempDir = fs.mkdtempSync(
7988
path.join(os.tmpdir(), 'react-native-paper-docs-')
8089
);
@@ -118,7 +127,7 @@ const main = async () => {
118127
}
119128

120129
const configPath = path.join(sourceDir, 'docs', 'docusaurus.config.js');
121-
const config = require(configPath);
130+
const config: unknown = requireFromScript(configPath);
122131

123132
if (!isRecord(config) || !Array.isArray(config.plugins)) {
124133
throw new Error(`Unable to read plugins from ${configPath}`);
@@ -139,11 +148,19 @@ const main = async () => {
139148
);
140149
}
141150

142-
const pluginFactory: PluginFactory = require(path.join(
151+
const pluginFactoryPath = path.join(
143152
sourceDir,
144153
'docs',
145154
'component-docs-plugin'
146-
));
155+
);
156+
const pluginFactory: unknown = requireFromScript(pluginFactoryPath);
157+
158+
if (!isPluginFactory(pluginFactory)) {
159+
throw new Error(
160+
`Unable to read component docs plugin from ${pluginFactoryPath}`
161+
);
162+
}
163+
147164
const plugin = await pluginFactory({}, pluginConfig[1]);
148165
const docs = await plugin.loadContent();
149166
const destination = path.resolve(rootDir, outputPath);

scripts/generate-mappings.js

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

0 commit comments

Comments
 (0)