nx-react-native-cli 1.0.15 → 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 +6 -2
- package/templates/.nvmrc +1 -1
- package/templates/apps/mobile/android/app/build.gradle +17 -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/fastlane/Fastfile +3 -3
- package/templates/apps/mobile/jest.config.ts +12 -0
- package/templates/apps/mobile/package.json +4 -1
- package/templates/apps/mobile/project.json +7 -3
- package/templates/apps/mobile/src/app/index.tsx +2 -8
- 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,7 +17,10 @@
|
|
|
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
|
-
"
|
|
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",
|
|
23
|
+
"relink": "npm unlink nxrn && npm run prepublish && npm link",
|
|
21
24
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
25
|
},
|
|
23
26
|
"author": {
|
|
@@ -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
|
|
|
@@ -92,18 +93,24 @@ android {
|
|
|
92
93
|
storePassword 'development'
|
|
93
94
|
keyAlias 'dev'
|
|
94
95
|
keyPassword 'development'
|
|
96
|
+
v1SigningEnabled true
|
|
97
|
+
v2SigningEnabled true
|
|
95
98
|
}
|
|
96
99
|
dev {
|
|
97
100
|
storeFile file('dev.keystore')
|
|
98
101
|
storePassword 'development'
|
|
99
102
|
keyAlias 'dev'
|
|
100
103
|
keyPassword 'development'
|
|
104
|
+
v1SigningEnabled true
|
|
105
|
+
v2SigningEnabled true
|
|
101
106
|
}
|
|
102
107
|
production {
|
|
103
108
|
storeFile file('production.keystore')
|
|
104
109
|
storePassword System.getenv("STORE_PASSWORD")
|
|
105
110
|
keyAlias System.getenv("KEY_ALIAS")
|
|
106
111
|
keyPassword System.getenv("KEY_PASSWORD")
|
|
112
|
+
v1SigningEnabled true
|
|
113
|
+
v2SigningEnabled true
|
|
107
114
|
}
|
|
108
115
|
}
|
|
109
116
|
|
|
@@ -133,27 +140,14 @@ android {
|
|
|
133
140
|
// see https://reactnative.dev/docs/signed-apk-android.
|
|
134
141
|
minifyEnabled enableProguardInReleaseBuilds
|
|
135
142
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
136
|
-
|
|
137
|
-
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
|
|
138
|
-
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
dependencies {
|
|
144
|
-
|
|
145
|
-
androidTestImplementation('com.wix:detox:+')
|
|
146
|
-
implementation 'androidx.appcompat:appcompat:1.1.0'
|
|
147
|
-
|
|
148
148
|
// The version of react-native is set by the React Native Gradle Plugin
|
|
149
149
|
implementation("com.facebook.react:react-android")
|
|
150
150
|
|
|
151
|
-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
|
|
152
|
-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
|
153
|
-
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
|
|
157
151
|
if (hermesEnabled.toBoolean()) {
|
|
158
152
|
implementation("com.facebook.react:hermes-android")
|
|
159
153
|
} else {
|
|
@@ -161,4 +155,4 @@ dependencies {
|
|
|
161
155
|
}
|
|
162
156
|
}
|
|
163
157
|
|
|
164
|
-
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"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
require 'fileutils'
|
|
3
3
|
|
|
4
|
-
def app_name = ""
|
|
4
|
+
def app_name = "AppsMobile"
|
|
5
5
|
|
|
6
6
|
def delete_gradle_temp()
|
|
7
7
|
UI.message("Deleting Gradle Temp...")
|
|
@@ -291,10 +291,10 @@ platform :ios do
|
|
|
291
291
|
lane :prod do
|
|
292
292
|
begin
|
|
293
293
|
build_number = setup_ios()
|
|
294
|
-
ios_build_ipa("Release",
|
|
294
|
+
ios_build_ipa("Release", app_name)
|
|
295
295
|
# (Optional) Uncomment if you want to upload dSYM to Firebase Crashlytics
|
|
296
296
|
# upload_dysm("Release", "Prod")
|
|
297
|
-
publish_ipa(build_number,
|
|
297
|
+
publish_ipa(build_number, app_name)
|
|
298
298
|
rescue => exception
|
|
299
299
|
UI.error(exception)
|
|
300
300
|
end
|
|
@@ -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",
|
|
@@ -42,7 +44,10 @@
|
|
|
42
44
|
"run-android": {
|
|
43
45
|
"executor": "@nx/react-native:run-android",
|
|
44
46
|
"dependsOn": ["ensure-symlink"],
|
|
45
|
-
"options": {
|
|
47
|
+
"options": {
|
|
48
|
+
"mode": "debug",
|
|
49
|
+
"tasks": "installDevDebug"
|
|
50
|
+
}
|
|
46
51
|
},
|
|
47
52
|
"build-android": {
|
|
48
53
|
"executor": "@nx/react-native:build-android",
|
|
@@ -97,6 +102,5 @@
|
|
|
97
102
|
"jestConfig": "apps/mobile/jest.config.ts"
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
|
-
}
|
|
101
|
-
"tags": []
|
|
105
|
+
}
|
|
102
106
|
}
|
|
@@ -18,14 +18,8 @@ LogBox.ignoreLogs(['VirtualizedLists', 'onAnimatedValueUpdate']);
|
|
|
18
18
|
|
|
19
19
|
enableFreeze(true);
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const MIN_IN_AN_HOUR = 60;
|
|
24
|
-
const HOURS_IN_A_DAY = 24;
|
|
25
|
-
const MS_IN_DAYS = MS_IN_S * S_IN_A_MIN * MIN_IN_AN_HOUR * HOURS_IN_A_DAY;
|
|
26
|
-
|
|
27
|
-
const CACHE_TIME = MS_IN_DAYS * 1;
|
|
28
|
-
const STALE_TIME = MS_IN_S * S_IN_A_MIN * MIN_IN_AN_HOUR; // 5 minutes
|
|
21
|
+
const CACHE_TIME = 0;
|
|
22
|
+
const STALE_TIME = 0;
|
|
29
23
|
|
|
30
24
|
const queryClient = new QueryClient({
|
|
31
25
|
defaultOptions: {
|
|
@@ -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
|
+
}
|