nx-react-native-cli 1.0.16 → 1.0.17
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.cjs +32 -32
- package/package.json +5 -1
- package/templates/.nvmrc +1 -1
- package/templates/apps/mobile/android/app/build.gradle +11 -23
- package/templates/apps/mobile/android/build.gradle +6 -19
- package/templates/apps/mobile/babel.config.json +2 -1
- package/templates/apps/mobile/export-node-binary.sh +6 -0
- package/templates/apps/mobile/jest.config.ts +12 -0
- package/templates/apps/mobile/package.json +4 -1
- package/templates/apps/mobile/project.json +3 -2
- package/templates/apps/mobile/src/routes/screen-options.ts +1 -5
- package/templates/apps/mobile/test-setup.ts +1 -0
- package/templates/apps/mobile/tsconfig.spec.json +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx-react-native-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "A react native starter (with NX) cli script",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"build": "rm -rf lib && esbuild src/index.js --format=cjs --platform=node --bundle --outfile=lib/index.cjs --minify --analyze",
|
|
18
18
|
"prepublish": "npm run build",
|
|
19
19
|
"example": "npx nxrn create example",
|
|
20
|
+
"example-fresh": "npx nxrn create example-fresh --fresh",
|
|
21
|
+
"generate-diff": "./generate-diff.sh",
|
|
22
|
+
"show-diff": "npx diff2html -s side --sc --hc --cs light -i file -o preview -F diff.html -- diff.diff && open diff.html",
|
|
20
23
|
"relink": "npm unlink nxrn && npm run prepublish && npm link",
|
|
21
24
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
25
|
},
|
|
@@ -33,6 +36,7 @@
|
|
|
33
36
|
"prettier": "^3.3.3"
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
39
|
+
"diff2html-cli": "^5.2.15",
|
|
36
40
|
"esbuild": "^0.23.0"
|
|
37
41
|
}
|
|
38
42
|
}
|
package/templates/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
v18.
|
|
1
|
+
v18.20.3
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
apply plugin: "com.android.application"
|
|
2
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
2
3
|
apply plugin: "com.facebook.react"
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -9,12 +10,12 @@ react {
|
|
|
9
10
|
/* Folders */
|
|
10
11
|
// The root of your project, i.e. where "package.json" lives. Default is '..'
|
|
11
12
|
// root = file("../")
|
|
12
|
-
// The folder where the react-native NPM package is. Default is
|
|
13
|
-
|
|
14
|
-
// The folder where the react-native Codegen package is. Default is
|
|
15
|
-
|
|
16
|
-
// The cli.js file which is the React Native CLI entrypoint. Default is
|
|
17
|
-
|
|
13
|
+
// The folder where the react-native NPM package is. Default is ../../../../node_modules/react-native
|
|
14
|
+
reactNativeDir = file("../../../../node_modules/react-native")
|
|
15
|
+
// The folder where the react-native Codegen package is. Default is ../../../../node_modules/@react-native/codegen
|
|
16
|
+
codegenDir = file("../../../../node_modules/@react-native/codegen")
|
|
17
|
+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../../../node_modules/react-native/cli.js
|
|
18
|
+
cliFile = file("../../../../node_modules/react-native/cli.js")
|
|
18
19
|
|
|
19
20
|
/* Variants */
|
|
20
21
|
// The list of variants to that are debuggable. For those we're going to
|
|
@@ -36,7 +37,7 @@ react {
|
|
|
36
37
|
// bundleAssetName = "MyApplication.android.bundle"
|
|
37
38
|
//
|
|
38
39
|
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
|
39
|
-
|
|
40
|
+
entryFile = file("../../src/main.tsx")
|
|
40
41
|
//
|
|
41
42
|
// A list of extra flags to pass to the 'bundle' commands.
|
|
42
43
|
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
|
@@ -48,7 +49,6 @@ react {
|
|
|
48
49
|
//
|
|
49
50
|
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
|
50
51
|
// hermesFlags = ["-O", "-output-source-map"]
|
|
51
|
-
entryFile = file("../../src/main.tsx")
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
@@ -71,7 +71,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
|
|
|
71
71
|
|
|
72
72
|
android {
|
|
73
73
|
ndkVersion rootProject.ext.ndkVersion
|
|
74
|
-
|
|
74
|
+
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
75
|
+
compileSdk rootProject.ext.compileSdkVersion
|
|
75
76
|
namespace "com.appsmobile"
|
|
76
77
|
flavorDimensions "default"
|
|
77
78
|
|
|
@@ -139,27 +140,14 @@ android {
|
|
|
139
140
|
// see https://reactnative.dev/docs/signed-apk-android.
|
|
140
141
|
minifyEnabled enableProguardInReleaseBuilds
|
|
141
142
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
142
|
-
|
|
143
|
-
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
|
|
144
|
-
|
|
145
143
|
}
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
dependencies {
|
|
150
|
-
|
|
151
|
-
androidTestImplementation('com.wix:detox:+')
|
|
152
|
-
implementation 'androidx.appcompat:appcompat:1.1.0'
|
|
153
|
-
|
|
154
148
|
// The version of react-native is set by the React Native Gradle Plugin
|
|
155
149
|
implementation("com.facebook.react:react-android")
|
|
156
150
|
|
|
157
|
-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
|
|
158
|
-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
|
159
|
-
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
|
|
163
151
|
if (hermesEnabled.toBoolean()) {
|
|
164
152
|
implementation("com.facebook.react:hermes-android")
|
|
165
153
|
} else {
|
|
@@ -167,4 +155,4 @@ dependencies {
|
|
|
167
155
|
}
|
|
168
156
|
}
|
|
169
157
|
|
|
170
|
-
apply from: file("
|
|
158
|
+
apply from: file("../../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
2
|
-
|
|
3
1
|
buildscript {
|
|
4
2
|
ext {
|
|
5
|
-
buildToolsVersion = "
|
|
6
|
-
minSdkVersion =
|
|
3
|
+
buildToolsVersion = "34.0.0"
|
|
4
|
+
minSdkVersion = 23
|
|
7
5
|
compileSdkVersion = 34
|
|
8
6
|
targetSdkVersion = 34
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
|
|
12
|
-
ndkVersion = "23.1.7779620"
|
|
7
|
+
ndkVersion = "26.1.10909125"
|
|
8
|
+
kotlinVersion = "1.9.22"
|
|
13
9
|
}
|
|
14
10
|
repositories {
|
|
15
11
|
google()
|
|
@@ -18,17 +14,8 @@ buildscript {
|
|
|
18
14
|
dependencies {
|
|
19
15
|
classpath("com.android.tools.build:gradle")
|
|
20
16
|
classpath("com.facebook.react:react-native-gradle-plugin")
|
|
21
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin
|
|
17
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
repositories {
|
|
27
|
-
|
|
28
|
-
maven {
|
|
29
|
-
// https://wix.github.io/Detox/docs/introduction/project-setup
|
|
30
|
-
url("$rootDir/../node_modules/detox/Detox-android")
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
21
|
+
apply plugin: "com.facebook.react.rootproject"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
displayName: 'mobile',
|
|
3
|
+
preset: 'react-native',
|
|
4
|
+
resolver: '@nx/jest/plugins/resolver',
|
|
5
|
+
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
|
|
6
|
+
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
|
7
|
+
moduleNameMapper: {
|
|
8
|
+
'\\.svg$': '@nx/react-native/plugins/jest/svg-mock',
|
|
9
|
+
},
|
|
10
|
+
coverageDirectory: '../../coverage/apps/mobile',
|
|
11
|
+
};
|
|
12
|
+
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
+
|
|
6
7
|
"android:connect": "adb reverse tcp:8081 tcp:8081",
|
|
7
8
|
"start": "npx nx start mobile --skip-nx-cache",
|
|
8
9
|
"run-ios": "npx nx run-ios mobile --skip-nx-cache --scheme=Dev --simulator='iPhone 13 (A96A9251-28D7-48B1-8F6A-20B6CCB8810B)'",
|
|
@@ -10,11 +11,13 @@
|
|
|
10
11
|
"ensure-symlink": "npx nx ensure-symlink mobile",
|
|
11
12
|
"sync-deps": "npx nx sync-deps mobile",
|
|
12
13
|
"pod-install": "npx nx pod-install mobile",
|
|
13
|
-
"
|
|
14
|
+
"export-node-binary": "./export-node-binary.sh",
|
|
15
|
+
"bundle:pod-install": "cd ios && bundle install && bundle exec pod install --repo-update && npm run export-node-binary",
|
|
14
16
|
"pre-build": "npm run ensure-symlink && npm run sync-deps && npm run pod-install",
|
|
15
17
|
"list:ios-configurations": "cd ios && xcodebuild -list",
|
|
16
18
|
"list:ios-devices": "xcrun xctrace list devices",
|
|
17
19
|
"xcode": "open ios/AppsMobile.xcworkspace",
|
|
20
|
+
"touch-xcode": "cd ios && touch .xcode.env",
|
|
18
21
|
"check-env:mobile": "cd ../.. && npm run check-env:mobile",
|
|
19
22
|
"setup-fastlane": "rbenv local && bundle install && bundle update",
|
|
20
23
|
"deploy-android:dev": "bundle exec fastlane android dev --env development",
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
4
|
"sourceRoot": "apps/mobile/src",
|
|
5
5
|
"projectType": "application",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"// targets": "to see all targets run: nx show project mobile --web",
|
|
6
8
|
"targets": {
|
|
7
9
|
"check-env": {
|
|
8
10
|
"executor": "nx:run-script",
|
|
@@ -100,6 +102,5 @@
|
|
|
100
102
|
"jestConfig": "apps/mobile/jest.config.ts"
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
|
-
}
|
|
104
|
-
"tags": []
|
|
105
|
+
}
|
|
105
106
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-native/extend-expect';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"types": ["jest", "node"]
|
|
7
|
+
},
|
|
8
|
+
"include": [
|
|
9
|
+
"jest.config.ts",
|
|
10
|
+
"src/**/*.test.ts",
|
|
11
|
+
"src/**/*.spec.ts",
|
|
12
|
+
"src/**/*.test.tsx",
|
|
13
|
+
"src/**/*.spec.tsx",
|
|
14
|
+
"src/**/*.test.js",
|
|
15
|
+
"src/**/*.spec.js",
|
|
16
|
+
"src/**/*.test.jsx",
|
|
17
|
+
"src/**/*.spec.jsx",
|
|
18
|
+
"src/**/*.d.ts"
|
|
19
|
+
]
|
|
20
|
+
}
|