Skip to content

Commit c279577

Browse files
authored
build: use dv-scripts (#707)
- Simplifying configuration for: - Building - Linting - Testing - Releasing I'll fix code coverage in an upgrade.
1 parent 0d34e62 commit c279577

File tree

8 files changed

+2069
-2224
lines changed

8 files changed

+2069
-2224
lines changed

.circleci/config.yml

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

.eslintrc.js

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

.github/workflows/main.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Begin CI...
8+
uses: actions/checkout@v2
9+
with:
10+
fetch-depth: 0
11+
12+
- name: Use Node
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: '14'
16+
17+
- name: Install dependencies
18+
run: yarn install --frozen-lockfile
19+
env:
20+
CI: true
21+
22+
- name: Build
23+
run: yarn build
24+
env:
25+
CI: true
26+
27+
- name: CI
28+
run: yarn dv-scripts ci
29+
env:
30+
CI: true
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
33+
34+
- name: Test Coverage
35+
run: bash <(curl -s https://codecov.io/bash) -f coverage/lcov.info
36+
env:
37+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ dist/
4242

4343
# coverage reports
4444
coverage
45+
46+
# TypeScript incremental compilation cache
47+
*.tsbuildinfo

package.json

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
},
2020
"license": "(MIT AND Apache-2.0)",
2121
"author": "Dylan Vann <[email protected]> (https://dylanvann.com)",
22-
"main": "dist/index.js",
23-
"module": "dist/react-native-fast-image.esm.js",
22+
"main": "dist/index.cjs.js",
23+
"module": "dist/index.js",
2424
"typings": "dist/index.d.ts",
2525
"files": [
2626
"android",
@@ -31,23 +31,20 @@
3131
"RNFastImage.podspec"
3232
],
3333
"scripts": {
34-
"build": "tsdx build && cp src/index.js.flow dist/index.js.flow",
35-
"commit": "git-cz",
36-
"lint": "tsdx lint src",
37-
"semantic-release": "semantic-release",
38-
"test": "jest ./src/*.tsx"
39-
},
40-
"config": {
41-
"commitizen": {
42-
"path": "node_modules/cz-conventional-changelog"
43-
}
34+
"build": "dv-scripts build && cp src/index.js.flow dist/index.js.flow",
35+
"lint": "dv-scripts lint",
36+
"release": "dv-scripts release",
37+
"test": "dv-scripts test"
4438
},
4539
"prettier": {
4640
"semi": false,
4741
"singleQuote": true,
4842
"tabWidth": 4,
4943
"trailingComma": "all"
5044
},
45+
"eslintConfig": {
46+
"extends": "dv-scripts"
47+
},
5148
"jest": {
5249
"modulePathIgnorePatterns": [
5350
"ReactNativeFastImageExample*",
@@ -56,46 +53,25 @@
5653
"preset": "react-native"
5754
},
5855
"devDependencies": {
59-
"@babel/core": "^7.6.2",
60-
"@babel/runtime": "^7.6.2",
61-
"@react-native-community/eslint-config": "^0.0.5",
62-
"@semantic-release/changelog": "^5.0.0",
63-
"@semantic-release/commit-analyzer": "^8.0.1",
64-
"@semantic-release/git": "^9.0.0",
65-
"@semantic-release/npm": "^7.0.3",
66-
"@semantic-release/release-notes-generator": "^9.0.1",
56+
"@babel/core": "^7.10.5",
57+
"@babel/runtime": "^7.10.5",
58+
"@types/jest": "^26.0.4",
6759
"@types/react": "^16.9.23",
6860
"@types/react-native": "^0.61.17",
61+
"@types/react-test-renderer": "^16.9.2",
6962
"babel-jest": "^24.9.0",
70-
"commitizen": "^4.0.3",
71-
"cz-conventional-changelog": "^3.1.0",
72-
"eslint": "^6.5.1",
73-
"eslint-config-prettier": "^6.0.0",
74-
"eslint-plugin-jest": "^22.7.2",
75-
"eslint-plugin-prettier": "^3.1.0",
76-
"eslint-plugin-react": "^7.14.2",
63+
"dv-scripts": "^1.4.2",
64+
"eslint-config-dv-scripts": "^1.1.1",
7765
"jest": "^24.9.0",
7866
"metro-react-native-babel-preset": "^0.56.0",
79-
"prettier": "^1.19.1",
80-
"prettier-check": "^2.0.0",
67+
"prettier": "^2.0.5",
8168
"react": "16.9.0",
8269
"react-native": "0.61.5",
8370
"react-test-renderer": "16.9.0",
84-
"semantic-release": "^17.0.4",
85-
"tsdx": "^0.12.3",
86-
"typescript": "^3.8.3"
71+
"typescript": "^3.9.7"
8772
},
8873
"peerDependencies": {
8974
"react": "^16.8.6",
9075
"react-native": "^0.60.0"
91-
},
92-
"release": {
93-
"plugins": [
94-
"@semantic-release/commit-analyzer",
95-
"@semantic-release/release-notes-generator",
96-
"@semantic-release/changelog",
97-
"@semantic-release/npm",
98-
"@semantic-release/git"
99-
]
10076
}
10177
}

src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ function FastImageBase({
138138
style,
139139
fallback,
140140
children,
141+
// eslint-disable-next-line no-shadow
141142
resizeMode = 'cover',
142143
forwardedRef,
143144
...props

tsconfig.json

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
{
2-
"include": ["src", "types", "test"],
32
"compilerOptions": {
4-
"target": "es5",
5-
"module": "esnext",
6-
"lib": ["dom", "esnext"],
3+
"target": "ESNext",
4+
"module": "ESNext",
5+
"composite": true,
6+
"incremental": true,
7+
"lib": ["ESNext"],
78
"importHelpers": true,
9+
"declarationMap": true,
810
"declaration": true,
9-
"sourceMap": true,
10-
"rootDir": "./",
11+
"emitDeclarationOnly": true,
12+
"sourceMap": false,
1113
"strict": true,
1214
"noImplicitAny": true,
13-
"strictNullChecks": true,
14-
"strictFunctionTypes": true,
15-
"strictPropertyInitialization": true,
15+
"skipLibCheck": true,
16+
"skipDefaultLibCheck": true,
17+
"isolatedModules": true,
1618
"noImplicitThis": true,
1719
"alwaysStrict": true,
1820
"noUnusedLocals": true,
19-
"noUnusedParameters": true,
2021
"noImplicitReturns": true,
2122
"noFallthroughCasesInSwitch": true,
22-
"moduleResolution": "node",
23-
"baseUrl": "./",
24-
"paths": {
25-
"*": ["src/*", "node_modules/*"]
26-
},
23+
"forceConsistentCasingInFileNames": true,
24+
"moduleResolution": "Node",
2725
"jsx": "react",
28-
"esModuleInterop": true
29-
}
26+
"allowSyntheticDefaultImports": true,
27+
"esModuleInterop": true,
28+
"resolveJsonModule": true,
29+
"declarationDir": "./dist",
30+
"outDir": "./dist",
31+
"rootDir": "./src"
32+
},
33+
"include": ["./src"]
3034
}

0 commit comments

Comments
 (0)