Skip to content

Commit 7ff4e44

Browse files
author
Christopher J. Brody
committed
add native item with package ID to package.json
in order to make the `android/build.gradle` artifact 100% generic (rendered directly from the template, with zero module-specific customization needed)
1 parent fb35257 commit 7ff4e44

File tree

32 files changed

+119
-26
lines changed

32 files changed

+119
-26
lines changed

templates/android.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = platform => [{
22
name: () => `${platform}/build.gradle`,
3-
content: ({ packageIdentifier }) => `// ${platform}/build.gradle
3+
content: () => `// ${platform}/build.gradle
44
55
def safeExtGet(prop, fallback) {
66
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
@@ -74,7 +74,7 @@ def configureReactNativePom(def pom) {
7474
name packageJson.title
7575
artifactId packageJson.name
7676
version = packageJson.version
77-
group = "${packageIdentifier}"
77+
group = packageJson.native.packageIdentifier
7878
description packageJson.description
7979
url packageJson.repository.baseUrl
8080

templates/general.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ${name};
7070
},
7171
}, {
7272
name: () => 'package.json',
73-
content: ({ moduleName, platforms, githubAccount, authorName, authorEmail, license }) => {
73+
content: ({ moduleName, packageIdentifier, platforms, githubAccount, authorName, authorEmail, license }) => {
7474
const withWindows = platforms.indexOf('windows') >= 0;
7575

7676
const peerDependencies =
@@ -117,6 +117,9 @@ ${name};
117117
"license": "${license}",
118118
"licenseFilename": "LICENSE",
119119
"readmeFilename": "README.md",
120+
"native": {
121+
"packageIdentifier": "${packageIdentifier}"
122+
},
120123
"peerDependencies": ${peerDependencies},
121124
"devDependencies": ${devDependencies}
122125
}

tests/integration/cli/create/view/__snapshots__/cli-create-with-view.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def configureReactNativePom(def pom) {
198198
name packageJson.title
199199
artifactId packageJson.name
200200
version = packageJson.version
201-
group = \\"com.reactlibrary\\"
201+
group = packageJson.native.packageIdentifier
202202
description packageJson.description
203203
url packageJson.repository.baseUrl
204204
@@ -684,6 +684,9 @@ RCT_EXPORT_MODULE()
684684
\\"license\\": \\"MIT\\",
685685
\\"licenseFilename\\": \\"LICENSE\\",
686686
\\"readmeFilename\\": \\"README.md\\",
687+
\\"native\\": {
688+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
689+
},
687690
\\"peerDependencies\\": {
688691
\\"react\\": \\"^16.8.1\\",
689692
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"

tests/integration/cli/create/with-defaults/__snapshots__/cli-create-with-defaults.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def configureReactNativePom(def pom) {
198198
name packageJson.title
199199
artifactId packageJson.name
200200
version = packageJson.version
201-
group = \\"com.reactlibrary\\"
201+
group = packageJson.native.packageIdentifier
202202
description packageJson.description
203203
url packageJson.repository.baseUrl
204204
@@ -677,6 +677,9 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu
677677
\\"license\\": \\"MIT\\",
678678
\\"licenseFilename\\": \\"LICENSE\\",
679679
\\"readmeFilename\\": \\"README.md\\",
680+
\\"native\\": {
681+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
682+
},
680683
\\"peerDependencies\\": {
681684
\\"react\\": \\"^16.8.1\\",
682685
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"

tests/with-injection/create/view/with-defaults/__snapshots__/create-view-with-defaults.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ content:
112112
\\"license\\": \\"MIT\\",
113113
\\"licenseFilename\\": \\"LICENSE\\",
114114
\\"readmeFilename\\": \\"README.md\\",
115+
\\"native\\": {
116+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
117+
},
115118
\\"peerDependencies\\": {
116119
\\"react\\": \\"^16.8.1\\",
117120
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -273,7 +276,7 @@ def configureReactNativePom(def pom) {
273276
name packageJson.title
274277
artifactId packageJson.name
275278
version = packageJson.version
276-
group = \\"com.reactlibrary\\"
279+
group = packageJson.native.packageIdentifier
277280
description packageJson.description
278281
url packageJson.repository.baseUrl
279282

tests/with-injection/create/view/with-example/with-defaults/__snapshots__/create-view-with-example-with-defaults.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ content:
116116
\\"license\\": \\"MIT\\",
117117
\\"licenseFilename\\": \\"LICENSE\\",
118118
\\"readmeFilename\\": \\"README.md\\",
119+
\\"native\\": {
120+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
121+
},
119122
\\"peerDependencies\\": {
120123
\\"react\\": \\"^16.8.1\\",
121124
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -278,7 +281,7 @@ def configureReactNativePom(def pom) {
278281
name packageJson.title
279282
artifactId packageJson.name
280283
version = packageJson.version
281-
group = \\"com.reactlibrary\\"
284+
group = packageJson.native.packageIdentifier
282285
description packageJson.description
283286
url packageJson.repository.baseUrl
284287

tests/with-injection/create/view/with-example/with-options/__snapshots__/create-view-with-example-with-options.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ content:
116116
\\"license\\": \\"ISC\\",
117117
\\"licenseFilename\\": \\"LICENSE\\",
118118
\\"readmeFilename\\": \\"README.md\\",
119+
\\"native\\": {
120+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
121+
},
119122
\\"peerDependencies\\": {
120123
\\"react\\": \\"^16.8.1\\",
121124
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -278,7 +281,7 @@ def configureReactNativePom(def pom) {
278281
name packageJson.title
279282
artifactId packageJson.name
280283
version = packageJson.version
281-
group = \\"com.reactlibrary\\"
284+
group = packageJson.native.packageIdentifier
282285
description packageJson.description
283286
url packageJson.repository.baseUrl
284287

tests/with-injection/create/view/with-options/for-android/__snapshots__/lib-view-android-config-options.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ content:
9595
\\"license\\": \\"ISC\\",
9696
\\"licenseFilename\\": \\"LICENSE\\",
9797
\\"readmeFilename\\": \\"README.md\\",
98+
\\"native\\": {
99+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
100+
},
98101
\\"peerDependencies\\": {
99102
\\"react\\": \\"^16.8.1\\",
100103
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -235,7 +238,7 @@ def configureReactNativePom(def pom) {
235238
name packageJson.title
236239
artifactId packageJson.name
237240
version = packageJson.version
238-
group = \\"com.reactlibrary\\"
241+
group = packageJson.native.packageIdentifier
239242
description packageJson.description
240243
url packageJson.repository.baseUrl
241244

tests/with-injection/create/view/with-options/for-ios/__snapshots__/create-view-with-options-for-ios.test.js.snap

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ content:
8787
\\"license\\": \\"ISC\\",
8888
\\"licenseFilename\\": \\"LICENSE\\",
8989
\\"readmeFilename\\": \\"README.md\\",
90+
\\"native\\": {
91+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
92+
},
9093
\\"peerDependencies\\": {
9194
\\"react\\": \\"^16.8.1\\",
9295
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"

tests/with-injection/create/with-defaults/__snapshots__/create-with-defaults.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ content:
112112
\\"license\\": \\"MIT\\",
113113
\\"licenseFilename\\": \\"LICENSE\\",
114114
\\"readmeFilename\\": \\"README.md\\",
115+
\\"native\\": {
116+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
117+
},
115118
\\"peerDependencies\\": {
116119
\\"react\\": \\"^16.8.1\\",
117120
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -273,7 +276,7 @@ def configureReactNativePom(def pom) {
273276
name packageJson.title
274277
artifactId packageJson.name
275278
version = packageJson.version
276-
group = \\"com.reactlibrary\\"
279+
group = packageJson.native.packageIdentifier
277280
description packageJson.description
278281
url packageJson.repository.baseUrl
279282

tests/with-injection/create/with-defaults/bogus-platforms/bogus-name/__snapshots__/bogus-platforms-name.test.js.snap

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ content:
7070
\\"license\\": \\"MIT\\",
7171
\\"licenseFilename\\": \\"LICENSE\\",
7272
\\"readmeFilename\\": \\"README.md\\",
73+
\\"native\\": {
74+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
75+
},
7376
\\"peerDependencies\\": {
7477
\\"react\\": \\"^16.8.1\\",
7578
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"

tests/with-injection/create/with-defaults/bogus-platforms/empty-array/__snapshots__/bogus-platforms-empty-array.test.js.snap

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ content:
7070
\\"license\\": \\"MIT\\",
7171
\\"licenseFilename\\": \\"LICENSE\\",
7272
\\"readmeFilename\\": \\"README.md\\",
73+
\\"native\\": {
74+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
75+
},
7376
\\"peerDependencies\\": {
7477
\\"react\\": \\"^16.8.1\\",
7578
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"

tests/with-injection/create/with-defaults/bogus-platforms/empty-string/__snapshots__/bogus-platforms-empty-string.test.js.snap

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ content:
7070
\\"license\\": \\"MIT\\",
7171
\\"licenseFilename\\": \\"LICENSE\\",
7272
\\"readmeFilename\\": \\"README.md\\",
73+
\\"native\\": {
74+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
75+
},
7376
\\"peerDependencies\\": {
7477
\\"react\\": \\"^16.8.1\\",
7578
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"

tests/with-injection/create/with-example/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ content:
116116
\\"license\\": \\"MIT\\",
117117
\\"licenseFilename\\": \\"LICENSE\\",
118118
\\"readmeFilename\\": \\"README.md\\",
119+
\\"native\\": {
120+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
121+
},
119122
\\"peerDependencies\\": {
120123
\\"react\\": \\"^16.8.1\\",
121124
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -278,7 +281,7 @@ def configureReactNativePom(def pom) {
278281
name packageJson.title
279282
artifactId packageJson.name
280283
version = packageJson.version
281-
group = \\"com.reactlibrary\\"
284+
group = packageJson.native.packageIdentifier
282285
description packageJson.description
283286
url packageJson.repository.baseUrl
284287

tests/with-injection/create/with-example/with-missing-package-scripts/__snapshots__/recover-from-missing-package-scripts.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ content:
116116
\\"license\\": \\"MIT\\",
117117
\\"licenseFilename\\": \\"LICENSE\\",
118118
\\"readmeFilename\\": \\"README.md\\",
119+
\\"native\\": {
120+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
121+
},
119122
\\"peerDependencies\\": {
120123
\\"react\\": \\"^16.8.1\\",
121124
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -278,7 +281,7 @@ def configureReactNativePom(def pom) {
278281
name packageJson.title
279282
artifactId packageJson.name
280283
version = packageJson.version
281-
group = \\"com.reactlibrary\\"
284+
group = packageJson.native.packageIdentifier
282285
description packageJson.description
283286
url packageJson.repository.baseUrl
284287

tests/with-injection/create/with-example/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-null-prefix.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ content:
116116
\\"license\\": \\"MIT\\",
117117
\\"licenseFilename\\": \\"LICENSE\\",
118118
\\"readmeFilename\\": \\"README.md\\",
119+
\\"native\\": {
120+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
121+
},
119122
\\"peerDependencies\\": {
120123
\\"react\\": \\"^16.8.1\\",
121124
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -278,7 +281,7 @@ def configureReactNativePom(def pom) {
278281
name packageJson.title
279282
artifactId packageJson.name
280283
version = packageJson.version
281-
group = \\"com.reactlibrary\\"
284+
group = packageJson.native.packageIdentifier
282285
description packageJson.description
283286
url packageJson.repository.baseUrl
284287

tests/with-injection/create/with-example/with-options/__snapshots__/create-with-example-with-options.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ content:
116116
\\"license\\": \\"ISC\\",
117117
\\"licenseFilename\\": \\"LICENSE\\",
118118
\\"readmeFilename\\": \\"README.md\\",
119+
\\"native\\": {
120+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
121+
},
119122
\\"peerDependencies\\": {
120123
\\"react\\": \\"^16.8.1\\",
121124
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -278,7 +281,7 @@ def configureReactNativePom(def pom) {
278281
name packageJson.title
279282
artifactId packageJson.name
280283
version = packageJson.version
281-
group = \\"com.reactlibrary\\"
284+
group = packageJson.native.packageIdentifier
282285
description packageJson.description
283286
url packageJson.repository.baseUrl
284287

tests/with-injection/create/with-name-in-camel-case/__snapshots__/create-with-name-in-camel-case.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ content:
112112
\\"license\\": \\"MIT\\",
113113
\\"licenseFilename\\": \\"LICENSE\\",
114114
\\"readmeFilename\\": \\"README.md\\",
115+
\\"native\\": {
116+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
117+
},
115118
\\"peerDependencies\\": {
116119
\\"react\\": \\"^16.8.1\\",
117120
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -273,7 +276,7 @@ def configureReactNativePom(def pom) {
273276
name packageJson.title
274277
artifactId packageJson.name
275278
version = packageJson.version
276-
group = \\"com.reactlibrary\\"
279+
group = packageJson.native.packageIdentifier
277280
description packageJson.description
278281
url packageJson.repository.baseUrl
279282

tests/with-injection/create/with-options/for-android/__snapshots__/create-with-options-for-android.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ content:
9595
\\"license\\": \\"ISC\\",
9696
\\"licenseFilename\\": \\"LICENSE\\",
9797
\\"readmeFilename\\": \\"README.md\\",
98+
\\"native\\": {
99+
\\"packageIdentifier\\": \\"com.alicebits\\"
100+
},
98101
\\"peerDependencies\\": {
99102
\\"react\\": \\"^16.8.1\\",
100103
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -235,7 +238,7 @@ def configureReactNativePom(def pom) {
235238
name packageJson.title
236239
artifactId packageJson.name
237240
version = packageJson.version
238-
group = \\"com.alicebits\\"
241+
group = packageJson.native.packageIdentifier
239242
description packageJson.description
240243
url packageJson.repository.baseUrl
241244

tests/with-injection/create/with-options/for-ios/__snapshots__/create-with-options-for-ios.test.js.snap

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ content:
8787
\\"license\\": \\"ISC\\",
8888
\\"licenseFilename\\": \\"LICENSE\\",
8989
\\"readmeFilename\\": \\"README.md\\",
90+
\\"native\\": {
91+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
92+
},
9093
\\"peerDependencies\\": {
9194
\\"react\\": \\"^16.8.1\\",
9295
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"

tests/with-injection/create/with-options/platforms-array/__snapshots__/platforms-array.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ content:
112112
\\"license\\": \\"ISC\\",
113113
\\"licenseFilename\\": \\"LICENSE\\",
114114
\\"readmeFilename\\": \\"README.md\\",
115+
\\"native\\": {
116+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
117+
},
115118
\\"peerDependencies\\": {
116119
\\"react\\": \\"^16.8.1\\",
117120
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -273,7 +276,7 @@ def configureReactNativePom(def pom) {
273276
name packageJson.title
274277
artifactId packageJson.name
275278
version = packageJson.version
276-
group = \\"com.reactlibrary\\"
279+
group = packageJson.native.packageIdentifier
277280
description packageJson.description
278281
url packageJson.repository.baseUrl
279282

tests/with-injection/create/with-options/platforms-comma-separated/__snapshots__/platforms-comma-separated.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ content:
112112
\\"license\\": \\"ISC\\",
113113
\\"licenseFilename\\": \\"LICENSE\\",
114114
\\"readmeFilename\\": \\"README.md\\",
115+
\\"native\\": {
116+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
117+
},
115118
\\"peerDependencies\\": {
116119
\\"react\\": \\"^16.8.1\\",
117120
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -273,7 +276,7 @@ def configureReactNativePom(def pom) {
273276
name packageJson.title
274277
artifactId packageJson.name
275278
version = packageJson.version
276-
group = \\"com.reactlibrary\\"
279+
group = packageJson.native.packageIdentifier
277280
description packageJson.description
278281
url packageJson.repository.baseUrl
279282

tests/with-injection/create/with-options/with-custom-module-prefix/__snapshots__/create-with-custom-module-prefix.test.js.snap

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ content:
112112
\\"license\\": \\"MIT\\",
113113
\\"licenseFilename\\": \\"LICENSE\\",
114114
\\"readmeFilename\\": \\"README.md\\",
115+
\\"native\\": {
116+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
117+
},
115118
\\"peerDependencies\\": {
116119
\\"react\\": \\"^16.8.1\\",
117120
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -273,7 +276,7 @@ def configureReactNativePom(def pom) {
273276
name packageJson.title
274277
artifactId packageJson.name
275278
version = packageJson.version
276-
group = \\"com.reactlibrary\\"
279+
group = packageJson.native.packageIdentifier
277280
description packageJson.description
278281
url packageJson.repository.baseUrl
279282

0 commit comments

Comments
 (0)