create-react-native-library 0.54.8 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -1
- package/lib/input.js +41 -19
- package/lib/input.js.map +1 -1
- package/lib/template.js +2 -0
- package/lib/template.js.map +1 -1
- package/lib/utils/configureTools.js +169 -0
- package/lib/utils/configureTools.js.map +1 -0
- package/lib/utils/prompt.js +25 -8
- package/lib/utils/prompt.js.map +1 -1
- package/package.json +2 -2
- package/templates/common/$.github/workflows/ci.yml +2 -0
- package/templates/common/$.yarn/releases/yarn-4.11.0.cjs +942 -0
- package/templates/common/$.yarnrc.yml +1 -7
- package/templates/common/$package.json +2 -61
- package/templates/common/CONTRIBUTING.md +22 -10
- package/templates/native-common/{%- project.name %}.podspec +4 -8
- package/templates/{common → tools/lefthook}/lefthook.yml +2 -0
- package/templates/tools/turborepo/turbo.json +42 -0
- package/templates/common/$.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
- package/templates/common/$.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs +0 -28
- package/templates/common/$.yarn/releases/yarn-3.6.1.cjs +0 -874
- /package/templates/{common → tools/eslint}/eslint.config.mjs +0 -0
- /package/templates/{common → tools/jest}/src/__tests__/index.test.tsx +0 -0
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
nodeLinker: node-modules
|
|
2
2
|
nmHoistingLimits: workspaces
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
|
6
|
-
spec: "@yarnpkg/plugin-interactive-tools"
|
|
7
|
-
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
|
8
|
-
spec: "@yarnpkg/plugin-workspace-tools"
|
|
9
|
-
|
|
10
|
-
yarnPath: .yarn/releases/yarn-3.6.1.cjs
|
|
4
|
+
yarnPath: .yarn/releases/yarn-4.11.0.cjs
|
|
@@ -39,9 +39,6 @@
|
|
|
39
39
|
<% if (example !== 'none') { -%>
|
|
40
40
|
"example": "yarn workspace <%- project.slug -%>-example",
|
|
41
41
|
<% } -%>
|
|
42
|
-
"test": "jest",
|
|
43
|
-
"typecheck": "tsc",
|
|
44
|
-
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
45
42
|
<% if (example !== 'expo') { -%>
|
|
46
43
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
47
44
|
<% } else { -%>
|
|
@@ -51,7 +48,7 @@
|
|
|
51
48
|
<% if (project.moduleConfig === 'nitro-modules' || project.viewConfig === 'nitro-view') { -%>
|
|
52
49
|
"nitrogen": "nitrogen",
|
|
53
50
|
<% } -%>
|
|
54
|
-
"
|
|
51
|
+
"typecheck": "tsc"
|
|
55
52
|
},
|
|
56
53
|
"keywords": [
|
|
57
54
|
"react-native",
|
|
@@ -72,38 +69,20 @@
|
|
|
72
69
|
"registry": "https://registry.npmjs.org/"
|
|
73
70
|
},
|
|
74
71
|
"devDependencies": {
|
|
75
|
-
"@commitlint/config-conventional": "^19.8.1",
|
|
76
|
-
"@eslint/compat": "^1.3.2",
|
|
77
|
-
"@eslint/eslintrc": "^3.3.1",
|
|
78
|
-
"@eslint/js": "^9.35.0",
|
|
79
|
-
"@evilmartians/lefthook": "^1.12.3",
|
|
80
72
|
<% if (example === 'vanilla' && (project.moduleConfig === 'turbo-modules' || project.viewConfig === 'fabric-view')) { -%>
|
|
81
73
|
"@react-native-community/cli": "20.0.1",
|
|
82
74
|
<% } -%>
|
|
83
75
|
"@react-native/babel-preset": "0.81.1",
|
|
84
|
-
"@react-native/eslint-config": "^0.81.1",
|
|
85
|
-
"@release-it/conventional-changelog": "^10.0.1",
|
|
86
|
-
"@types/jest": "^29.5.14",
|
|
87
76
|
"@types/react": "^19.1.12",
|
|
88
|
-
"commitlint": "^19.8.1",
|
|
89
77
|
"del-cli": "^6.0.0",
|
|
90
|
-
"eslint": "^9.35.0",
|
|
91
|
-
"eslint-config-prettier": "^10.1.8",
|
|
92
|
-
"eslint-plugin-prettier": "^5.5.4",
|
|
93
|
-
"jest": "^29.7.0",
|
|
94
78
|
<% if (project.moduleConfig === 'nitro-modules' || project.viewConfig === 'nitro-view') { -%>
|
|
95
79
|
"nitrogen": "^<%- versions.nitro %>",
|
|
96
80
|
<% } -%>
|
|
97
|
-
"prettier": "^3.6.2",
|
|
98
81
|
"react": "19.1.0",
|
|
99
82
|
"react-native": "0.81.1",
|
|
100
83
|
"react-native-builder-bob": "^<%- versions.bob %>",
|
|
101
84
|
<% if (project.moduleConfig === 'nitro-modules' || project.viewConfig === 'nitro-view') { -%>
|
|
102
85
|
"react-native-nitro-modules": "^<%- versions.nitro %>",
|
|
103
|
-
<% } -%>
|
|
104
|
-
"release-it": "^19.0.4",
|
|
105
|
-
<% if (example !== 'expo') { -%>
|
|
106
|
-
"turbo": "^2.5.6",
|
|
107
86
|
<% } -%>
|
|
108
87
|
"typescript": "^5.9.2"
|
|
109
88
|
},
|
|
@@ -121,45 +100,7 @@
|
|
|
121
100
|
"example"
|
|
122
101
|
],
|
|
123
102
|
<% } -%>
|
|
124
|
-
"packageManager": "yarn@
|
|
125
|
-
"jest": {
|
|
126
|
-
"preset": "react-native",
|
|
127
|
-
"modulePathIgnorePatterns": [
|
|
128
|
-
"<rootDir>/example/node_modules",
|
|
129
|
-
"<rootDir>/lib/"
|
|
130
|
-
]
|
|
131
|
-
},
|
|
132
|
-
"commitlint": {
|
|
133
|
-
"extends": [
|
|
134
|
-
"@commitlint/config-conventional"
|
|
135
|
-
]
|
|
136
|
-
},
|
|
137
|
-
"release-it": {
|
|
138
|
-
"git": {
|
|
139
|
-
"commitMessage": "chore: release ${version}",
|
|
140
|
-
"tagName": "v${version}"
|
|
141
|
-
},
|
|
142
|
-
"npm": {
|
|
143
|
-
"publish": true
|
|
144
|
-
},
|
|
145
|
-
"github": {
|
|
146
|
-
"release": true
|
|
147
|
-
},
|
|
148
|
-
"plugins": {
|
|
149
|
-
"@release-it/conventional-changelog": {
|
|
150
|
-
"preset": {
|
|
151
|
-
"name": "angular"
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
"prettier": {
|
|
157
|
-
"quoteProps": "consistent",
|
|
158
|
-
"singleQuote": true,
|
|
159
|
-
"tabWidth": 2,
|
|
160
|
-
"trailingComma": "es5",
|
|
161
|
-
"useTabs": false
|
|
162
|
-
},
|
|
103
|
+
"packageManager": "yarn@4.11.0",
|
|
163
104
|
"react-native-builder-bob": {
|
|
164
105
|
"source": "src",
|
|
165
106
|
"output": "lib",
|
|
@@ -84,10 +84,16 @@ yarn example web
|
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
<% } -%>
|
|
87
|
-
Make sure your code passes TypeScript
|
|
87
|
+
Make sure your code passes TypeScript:
|
|
88
88
|
|
|
89
89
|
```sh
|
|
90
90
|
yarn typecheck
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
<% if (tools.includes('eslint')) { -%>
|
|
94
|
+
To check for linting errors, run the following:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
91
97
|
yarn lint
|
|
92
98
|
```
|
|
93
99
|
|
|
@@ -97,12 +103,17 @@ To fix formatting errors, run the following:
|
|
|
97
103
|
yarn lint --fix
|
|
98
104
|
```
|
|
99
105
|
|
|
106
|
+
<% } -%>
|
|
107
|
+
<% if (tools.includes('jest')) { -%>
|
|
100
108
|
Remember to add tests for your change if possible. Run the unit tests by:
|
|
101
109
|
|
|
102
110
|
```sh
|
|
103
111
|
yarn test
|
|
104
112
|
```
|
|
105
113
|
|
|
114
|
+
<% } -%>
|
|
115
|
+
<% if (tools.includes('lefthook')) { -%>
|
|
116
|
+
|
|
106
117
|
### Commit message convention
|
|
107
118
|
|
|
108
119
|
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
|
|
@@ -115,14 +126,9 @@ We follow the [conventional commits specification](https://www.conventionalcommi
|
|
|
115
126
|
- `chore`: tooling changes, e.g. change CI config.
|
|
116
127
|
|
|
117
128
|
Our pre-commit hooks verify that your commit message matches this format when committing.
|
|
129
|
+
<% } -%>
|
|
118
130
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
|
|
122
|
-
|
|
123
|
-
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
|
|
124
|
-
|
|
125
|
-
Our pre-commit hooks verify that the linter and tests pass when committing.
|
|
131
|
+
<% if (tools.includes('release-it')) { -%>
|
|
126
132
|
|
|
127
133
|
### Publishing to npm
|
|
128
134
|
|
|
@@ -134,14 +140,20 @@ To publish new versions, run the following:
|
|
|
134
140
|
yarn release
|
|
135
141
|
```
|
|
136
142
|
|
|
143
|
+
<% } -%>
|
|
144
|
+
|
|
137
145
|
### Scripts
|
|
138
146
|
|
|
139
147
|
The `package.json` file contains various scripts for common tasks:
|
|
140
148
|
|
|
141
149
|
- `yarn`: setup project by installing dependencies.
|
|
142
150
|
- `yarn typecheck`: type-check files with TypeScript.
|
|
143
|
-
|
|
144
|
-
- `yarn
|
|
151
|
+
<% if (tools.includes('eslint')) { -%>
|
|
152
|
+
- `yarn lint`: lint files with [ESLint](https://eslint.org/).
|
|
153
|
+
<% } -%>
|
|
154
|
+
<% if (tools.includes('jest')) { -%>
|
|
155
|
+
- `yarn test`: run unit tests with [Jest](https://jestjs.io/).
|
|
156
|
+
<% } -%>
|
|
145
157
|
- `yarn example start`: start the Metro server for the example app.
|
|
146
158
|
- `yarn example android`: run the example app on Android.
|
|
147
159
|
- `yarn example ios`: run the example app on iOS.
|
|
@@ -13,16 +13,12 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.platforms = { :ios => min_ios_version_supported }
|
|
14
14
|
s.source = { :git => "<%- repo -%>.git", :tag => "#{s.version}" }
|
|
15
15
|
|
|
16
|
-
<% if (project.moduleConfig !== "nitro-modules"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<% } else { -%>
|
|
20
|
-
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
16
|
+
<% if (project.moduleConfig !== "nitro-modules" && project.viewConfig !== "nitro-view") { -%>
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
18
|
+
<% if (!project.swift) { -%>
|
|
21
19
|
s.private_header_files = "ios/**/*.h"
|
|
22
20
|
<% } -%>
|
|
23
|
-
<% } -%>
|
|
24
|
-
|
|
25
|
-
<% if (project.moduleConfig === "nitro-modules" || project.viewConfig === "nitro-view") { -%>
|
|
21
|
+
<% } else { -%>
|
|
26
22
|
s.source_files = [
|
|
27
23
|
"ios/**/*.{swift}",
|
|
28
24
|
"ios/**/*.{m,mm}",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://turbo.build/schema.json",
|
|
3
|
+
"globalDependencies": [".nvmrc", ".yarnrc.yml"],
|
|
4
|
+
"globalEnv": ["NODE_ENV"],
|
|
5
|
+
"tasks": {
|
|
6
|
+
"build:android": {
|
|
7
|
+
"env": ["ANDROID_HOME", "ORG_GRADLE_PROJECT_newArchEnabled"],
|
|
8
|
+
"inputs": [
|
|
9
|
+
"package.json",
|
|
10
|
+
"android",
|
|
11
|
+
"!android/build",
|
|
12
|
+
"src/*.ts",
|
|
13
|
+
"src/*.tsx",
|
|
14
|
+
"example/package.json",
|
|
15
|
+
"example/android",
|
|
16
|
+
"!example/android/.gradle",
|
|
17
|
+
"!example/android/build",
|
|
18
|
+
"!example/android/app/build"
|
|
19
|
+
],
|
|
20
|
+
"outputs": []
|
|
21
|
+
},
|
|
22
|
+
"build:ios": {
|
|
23
|
+
"env": [
|
|
24
|
+
"RCT_NEW_ARCH_ENABLED",
|
|
25
|
+
"RCT_USE_RN_DEP",
|
|
26
|
+
"RCT_USE_PREBUILT_RNCORE"
|
|
27
|
+
],
|
|
28
|
+
"inputs": [
|
|
29
|
+
"package.json",
|
|
30
|
+
"*.podspec",
|
|
31
|
+
"ios",
|
|
32
|
+
"src/*.ts",
|
|
33
|
+
"src/*.tsx",
|
|
34
|
+
"example/package.json",
|
|
35
|
+
"example/ios",
|
|
36
|
+
"!example/ios/build",
|
|
37
|
+
"!example/ios/Pods"
|
|
38
|
+
],
|
|
39
|
+
"outputs": []
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|