Skip to content

Commit cac24d4

Browse files
committed
fix(project): improve and update setup and template
release-npm
1 parent 4922314 commit cac24d4

File tree

9 files changed

+63
-58
lines changed

9 files changed

+63
-58
lines changed

.gitignore

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

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ Starting point for creating React Native plugins in TypeScript without native co
1212
## Usage
1313

1414
```
15-
npm init -y react-native-plugin@latest react-native-my-plugin
16-
# or
17-
npx create-react-native-plugin@latest react-native-my-plugin
15+
bun create react-native-plugin react-native-my-plugin
16+
npm init -y react-native-plugin@latest react-native-my-plugin / npx create-react-native-plugin@latest react-native-my-plugin
1817
```
1918

2019
This will bootstrap a new plugin inside a folder named `react-native-my-plugin` accordingly. Inside that folder the commands mentioned hereafter are available. The prefix `react-native-` is optional and will be removed where the React Native context is implied.

app.png

264 KB
Loading

customize.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { join } from 'path'
2-
import { existsSync, readFileSync, writeFileSync } from 'fs'
1+
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
2+
import { join } from 'node:path'
33

44
const files = [
55
'app/App.tsx',

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env node
2-
import { join, dirname } from 'path'
3-
import { existsSync, unlinkSync, rmdirSync, lstatSync, mkdirSync, cpSync, renameSync } from 'fs'
4-
import { execSync } from 'child_process'
5-
import names from './names.js'
2+
import { execSync } from 'node:child_process'
3+
import { cpSync, existsSync, lstatSync, mkdirSync, renameSync, rmdirSync, unlinkSync } from 'node:fs'
4+
import { dirname, join } from 'node:path'
65
import customize from './customize.js'
6+
import names from './names.js'
77

88
const args = process.argv
99

@@ -55,7 +55,7 @@ execSync('npm install --legacy-peer-deps', {
5555

5656
console.log('')
5757
console.log(`😃 Created new plugin called ${name.regular} in ${destinationDirectory}.`)
58-
console.log(`🛠️ Start coding in the file ./index.tsx.`)
59-
console.log(`🛠️ To preview the plugin edit app/App.tsx and create a RN installation with:`)
58+
console.log('🛠️ Start coding in the file ./index.tsx.')
59+
console.log('🛠️ To preview the plugin edit app/App.tsx and create a RN installation with:')
6060
console.log(`🐚 cd ${name.regular}`)
6161
console.log('🐚 npm run app')

package.json

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
"repository": "github:tobua/create-react-native-plugin",
66
"license": "MIT",
77
"author": "Matthias Giger",
8-
"padua": {
9-
"source": true,
10-
"ignore": [
11-
"template"
12-
]
8+
"scripts": {
9+
"check": "biome check --write ."
1310
},
1411
"dependencies": {
15-
"change-case": "5.4.2"
12+
"change-case": "^5.4.4"
1613
},
1714
"devDependencies": {
18-
"padua": "^2.0.9"
15+
"@biomejs/biome": "^1.8.1",
16+
"zero-configuration": "^0.10.1"
1917
},
18+
"trustedDependencies": [
19+
"zero-configuration"
20+
],
2021
"type": "module",
21-
"bin": "index.js",
22-
"source": "index.js",
22+
"bin": "./index.js",
2323
"files": [
2424
"template",
2525
"template/.gitignore",
@@ -30,21 +30,32 @@
3030
"plugin",
3131
"template"
3232
],
33-
"prettier": "padua/configuration/.prettierrc.json",
34-
"eslintConfig": {
35-
"extends": "./node_modules/padua/configuration/eslint.cjs",
36-
"rules": {
37-
"no-console": 0,
38-
"import/extensions": [
39-
2,
40-
"ignorePackages"
41-
]
42-
}
43-
},
4433
"publishConfig": {
4534
"provenance": true
4635
},
47-
"engines": {
48-
"node": ">= 18"
36+
"configuration": {
37+
"biome": {
38+
"extends": "recommended",
39+
"linter": {
40+
"rules": {
41+
"correctness": {
42+
"noNodejsModules": "off"
43+
},
44+
"suspicious": {
45+
"noConsoleLog": "off"
46+
},
47+
"style": {
48+
"noDefaultExport": "off"
49+
}
50+
}
51+
},
52+
"files": {
53+
"ignore": [
54+
"template"
55+
]
56+
}
57+
},
58+
"gitignore": "recommended",
59+
"vscode": "biome"
4960
}
5061
}

template/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules
2-
# package-lock.json has no effect when publishing your plugin to npm.
2+
# package-lock.json / bun.lockb has no effect when publishing your plugin to npm.
33
package-lock.json
4+
bun.lockb
45
dist
56
<%= pascal %>App
67
app/**/*

template/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ const styles = StyleSheet.create({
8080
const ThirdLayer = ({ percent, pressed }: { percent: number; pressed: boolean }) => {
8181
if (percent > 50) {
8282
return (
83-
<View
84-
key={percent + 99999}
85-
style={[styles.secondProgressLayer, rotation(percent - 50, 45)]}
86-
/>
83+
<View key={percent + 99999} style={[styles.secondProgressLayer, rotation(percent - 50, 45)]} />
8784
)
8885
}
8986

template/package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "MIT",
55
"scripts": {
66
"app": "node create-app.js",
7-
"app:install": "npm i --no-save $(npm pack . | tail -1) --prefix app",
7+
"app:install": "npm i --no-save $(npm pack . | tail -1) --prefix app",
88
"build": "esbuild index.tsx --outdir=dist --bundle --format=esm --sourcemap --external:react-native --external:react && tsc",
99
"watch": "npm-run-all --parallel build:watch copy",
1010
"copy": "cpx 'dist/**/*' app/node_modules/<%= name %>/dist --watch",
@@ -15,27 +15,27 @@
1515
"format": "prettier \"{,!(app|dist)/**/}*.{ts,tsx}\" --write"
1616
},
1717
"devDependencies": {
18-
"@react-native/babel-preset": "^0.74.0",
19-
"@react-native/eslint-config": "^0.74.0",
20-
"@react-native/typescript-config": "^0.74.0",
21-
"@types/jest": "^29.5.11",
22-
"@types/node": "^20.11.8",
23-
"@types/react": "^18.2.48",
24-
"@types/react-native": "^0.72.8",
25-
"@types/react-test-renderer": "^18.0.7",
18+
"@react-native/babel-preset": "^0.74.84",
19+
"@react-native/eslint-config": "^0.74.84",
20+
"@react-native/typescript-config": "^0.74.84",
21+
"@types/jest": "^29.5.12",
22+
"@types/node": "^20.14.2",
23+
"@types/react": "^18.3.3",
24+
"@types/react-native": "^0.73.0",
25+
"@types/react-test-renderer": "^18.3.0",
2626
"babel-jest": "^29.7.0",
2727
"cpx": "^1.5.0",
28-
"esbuild": "^0.20.0",
29-
"eslint": "^8.56.0",
28+
"esbuild": "^0.21.5",
29+
"eslint": "8.57.0",
3030
"eslint-plugin-flowtype": "^8.0.3",
3131
"eslint-plugin-prettier": "^5.1.3",
3232
"jest": "^29.7.0",
3333
"npm-run-all": "^4.1.5",
34-
"prettier": "^3.2.4",
35-
"react": "^18.2.0",
36-
"react-native": "^0.73.2",
37-
"react-test-renderer": "^18.2.0",
38-
"typescript": "^5.3.3"
34+
"prettier": "^3.3.2",
35+
"react": "^18.3.1",
36+
"react-native": "^0.74.2",
37+
"react-test-renderer": "^18.3.1",
38+
"typescript": "^5.4.5"
3939
},
4040
"peerDependencies": {
4141
"react": ">= 18",
@@ -54,7 +54,7 @@
5454
"dist"
5555
],
5656
"prettier": {
57-
"printWidth": 100,
57+
"printWidth": 120,
5858
"semi": false,
5959
"singleQuote": true
6060
},

0 commit comments

Comments
 (0)