Skip to content

Commit 96d6087

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 i.e. rendered directly from the template, with zero module-specific customization
1 parent cc22885 commit 96d6087

File tree

34 files changed

+125
-26
lines changed

34 files changed

+125
-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
@@ -21,7 +21,7 @@ ${name};
2121
`,
2222
}, {
2323
name: () => 'package.json',
24-
content: ({ moduleName, platforms, githubAccount, authorName, authorEmail, license }) => {
24+
content: ({ moduleName, packageIdentifier, platforms, githubAccount, authorName, authorEmail, license }) => {
2525
const withWindows = platforms.indexOf('windows') >= 0;
2626

2727
const peerDependencies =
@@ -68,6 +68,9 @@ ${name};
6868
"license": "${license}",
6969
"licenseFilename": "LICENSE",
7070
"readmeFilename": "README.md",
71+
"native": {
72+
"packageIdentifier": "${packageIdentifier}"
73+
},
7174
"peerDependencies": ${peerDependencies},
7275
"devDependencies": ${devDependencies}
7376
}

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def configureReactNativePom(def pom) {
172172
name packageJson.title
173173
artifactId packageJson.name
174174
version = packageJson.version
175-
group = \\"com.reactlibrary\\"
175+
group = packageJson.native.packageIdentifier
176176
description packageJson.description
177177
url packageJson.repository.baseUrl
178178
@@ -658,6 +658,9 @@ RCT_EXPORT_MODULE()
658658
\\"license\\": \\"MIT\\",
659659
\\"licenseFilename\\": \\"LICENSE\\",
660660
\\"readmeFilename\\": \\"README.md\\",
661+
\\"native\\": {
662+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
663+
},
661664
\\"peerDependencies\\": {
662665
\\"react\\": \\"^16.8.1\\",
663666
\\"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
@@ -172,7 +172,7 @@ def configureReactNativePom(def pom) {
172172
name packageJson.title
173173
artifactId packageJson.name
174174
version = packageJson.version
175-
group = \\"com.reactlibrary\\"
175+
group = packageJson.native.packageIdentifier
176176
description packageJson.description
177177
url packageJson.repository.baseUrl
178178
@@ -651,6 +651,9 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu
651651
\\"license\\": \\"MIT\\",
652652
\\"licenseFilename\\": \\"LICENSE\\",
653653
\\"readmeFilename\\": \\"README.md\\",
654+
\\"native\\": {
655+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
656+
},
654657
\\"peerDependencies\\": {
655658
\\"react\\": \\"^16.8.1\\",
656659
\\"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
@@ -86,6 +86,9 @@ content:
8686
\\"license\\": \\"MIT\\",
8787
\\"licenseFilename\\": \\"LICENSE\\",
8888
\\"readmeFilename\\": \\"README.md\\",
89+
\\"native\\": {
90+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
91+
},
8992
\\"peerDependencies\\": {
9093
\\"react\\": \\"^16.8.1\\",
9194
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -247,7 +250,7 @@ def configureReactNativePom(def pom) {
247250
name packageJson.title
248251
artifactId packageJson.name
249252
version = packageJson.version
250-
group = \\"com.reactlibrary\\"
253+
group = packageJson.native.packageIdentifier
251254
description packageJson.description
252255
url packageJson.repository.baseUrl
253256

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
@@ -90,6 +90,9 @@ content:
9090
\\"license\\": \\"MIT\\",
9191
\\"licenseFilename\\": \\"LICENSE\\",
9292
\\"readmeFilename\\": \\"README.md\\",
93+
\\"native\\": {
94+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
95+
},
9396
\\"peerDependencies\\": {
9497
\\"react\\": \\"^16.8.1\\",
9598
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -252,7 +255,7 @@ def configureReactNativePom(def pom) {
252255
name packageJson.title
253256
artifactId packageJson.name
254257
version = packageJson.version
255-
group = \\"com.reactlibrary\\"
258+
group = packageJson.native.packageIdentifier
256259
description packageJson.description
257260
url packageJson.repository.baseUrl
258261

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
@@ -90,6 +90,9 @@ content:
9090
\\"license\\": \\"ISC\\",
9191
\\"licenseFilename\\": \\"LICENSE\\",
9292
\\"readmeFilename\\": \\"README.md\\",
93+
\\"native\\": {
94+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
95+
},
9396
\\"peerDependencies\\": {
9497
\\"react\\": \\"^16.8.1\\",
9598
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -252,7 +255,7 @@ def configureReactNativePom(def pom) {
252255
name packageJson.title
253256
artifactId packageJson.name
254257
version = packageJson.version
255-
group = \\"com.reactlibrary\\"
258+
group = packageJson.native.packageIdentifier
256259
description packageJson.description
257260
url packageJson.repository.baseUrl
258261

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
@@ -76,6 +76,9 @@ content:
7676
\\"license\\": \\"ISC\\",
7777
\\"licenseFilename\\": \\"LICENSE\\",
7878
\\"readmeFilename\\": \\"README.md\\",
79+
\\"native\\": {
80+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
81+
},
7982
\\"peerDependencies\\": {
8083
\\"react\\": \\"^16.8.1\\",
8184
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -216,7 +219,7 @@ def configureReactNativePom(def pom) {
216219
name packageJson.title
217220
artifactId packageJson.name
218221
version = packageJson.version
219-
group = \\"com.reactlibrary\\"
222+
group = packageJson.native.packageIdentifier
220223
description packageJson.description
221224
url packageJson.repository.baseUrl
222225

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
@@ -76,6 +76,9 @@ content:
7676
\\"license\\": \\"ISC\\",
7777
\\"licenseFilename\\": \\"LICENSE\\",
7878
\\"readmeFilename\\": \\"README.md\\",
79+
\\"native\\": {
80+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
81+
},
7982
\\"peerDependencies\\": {
8083
\\"react\\": \\"^16.8.1\\",
8184
\\"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
@@ -86,6 +86,9 @@ content:
8686
\\"license\\": \\"MIT\\",
8787
\\"licenseFilename\\": \\"LICENSE\\",
8888
\\"readmeFilename\\": \\"README.md\\",
89+
\\"native\\": {
90+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
91+
},
8992
\\"peerDependencies\\": {
9093
\\"react\\": \\"^16.8.1\\",
9194
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -247,7 +250,7 @@ def configureReactNativePom(def pom) {
247250
name packageJson.title
248251
artifactId packageJson.name
249252
version = packageJson.version
250-
group = \\"com.reactlibrary\\"
253+
group = packageJson.native.packageIdentifier
251254
description packageJson.description
252255
url packageJson.repository.baseUrl
253256

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
@@ -66,6 +66,9 @@ content:
6666
\\"license\\": \\"MIT\\",
6767
\\"licenseFilename\\": \\"LICENSE\\",
6868
\\"readmeFilename\\": \\"README.md\\",
69+
\\"native\\": {
70+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
71+
},
6972
\\"peerDependencies\\": {
7073
\\"react\\": \\"^16.8.1\\",
7174
\\"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
@@ -66,6 +66,9 @@ content:
6666
\\"license\\": \\"MIT\\",
6767
\\"licenseFilename\\": \\"LICENSE\\",
6868
\\"readmeFilename\\": \\"README.md\\",
69+
\\"native\\": {
70+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
71+
},
6972
\\"peerDependencies\\": {
7073
\\"react\\": \\"^16.8.1\\",
7174
\\"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
@@ -66,6 +66,9 @@ content:
6666
\\"license\\": \\"MIT\\",
6767
\\"licenseFilename\\": \\"LICENSE\\",
6868
\\"readmeFilename\\": \\"README.md\\",
69+
\\"native\\": {
70+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
71+
},
6972
\\"peerDependencies\\": {
7073
\\"react\\": \\"^16.8.1\\",
7174
\\"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
@@ -90,6 +90,9 @@ content:
9090
\\"license\\": \\"MIT\\",
9191
\\"licenseFilename\\": \\"LICENSE\\",
9292
\\"readmeFilename\\": \\"README.md\\",
93+
\\"native\\": {
94+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
95+
},
9396
\\"peerDependencies\\": {
9497
\\"react\\": \\"^16.8.1\\",
9598
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -252,7 +255,7 @@ def configureReactNativePom(def pom) {
252255
name packageJson.title
253256
artifactId packageJson.name
254257
version = packageJson.version
255-
group = \\"com.reactlibrary\\"
258+
group = packageJson.native.packageIdentifier
256259
description packageJson.description
257260
url packageJson.repository.baseUrl
258261

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
@@ -90,6 +90,9 @@ content:
9090
\\"license\\": \\"MIT\\",
9191
\\"licenseFilename\\": \\"LICENSE\\",
9292
\\"readmeFilename\\": \\"README.md\\",
93+
\\"native\\": {
94+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
95+
},
9396
\\"peerDependencies\\": {
9497
\\"react\\": \\"^16.8.1\\",
9598
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -252,7 +255,7 @@ def configureReactNativePom(def pom) {
252255
name packageJson.title
253256
artifactId packageJson.name
254257
version = packageJson.version
255-
group = \\"com.reactlibrary\\"
258+
group = packageJson.native.packageIdentifier
256259
description packageJson.description
257260
url packageJson.repository.baseUrl
258261

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
@@ -90,6 +90,9 @@ content:
9090
\\"license\\": \\"MIT\\",
9191
\\"licenseFilename\\": \\"LICENSE\\",
9292
\\"readmeFilename\\": \\"README.md\\",
93+
\\"native\\": {
94+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
95+
},
9396
\\"peerDependencies\\": {
9497
\\"react\\": \\"^16.8.1\\",
9598
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -252,7 +255,7 @@ def configureReactNativePom(def pom) {
252255
name packageJson.title
253256
artifactId packageJson.name
254257
version = packageJson.version
255-
group = \\"com.reactlibrary\\"
258+
group = packageJson.native.packageIdentifier
256259
description packageJson.description
257260
url packageJson.repository.baseUrl
258261

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
@@ -90,6 +90,9 @@ content:
9090
\\"license\\": \\"ISC\\",
9191
\\"licenseFilename\\": \\"LICENSE\\",
9292
\\"readmeFilename\\": \\"README.md\\",
93+
\\"native\\": {
94+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
95+
},
9396
\\"peerDependencies\\": {
9497
\\"react\\": \\"^16.8.1\\",
9598
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -252,7 +255,7 @@ def configureReactNativePom(def pom) {
252255
name packageJson.title
253256
artifactId packageJson.name
254257
version = packageJson.version
255-
group = \\"com.reactlibrary\\"
258+
group = packageJson.native.packageIdentifier
256259
description packageJson.description
257260
url packageJson.repository.baseUrl
258261

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
@@ -86,6 +86,9 @@ content:
8686
\\"license\\": \\"MIT\\",
8787
\\"licenseFilename\\": \\"LICENSE\\",
8888
\\"readmeFilename\\": \\"README.md\\",
89+
\\"native\\": {
90+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
91+
},
8992
\\"peerDependencies\\": {
9093
\\"react\\": \\"^16.8.1\\",
9194
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -247,7 +250,7 @@ def configureReactNativePom(def pom) {
247250
name packageJson.title
248251
artifactId packageJson.name
249252
version = packageJson.version
250-
group = \\"com.reactlibrary\\"
253+
group = packageJson.native.packageIdentifier
251254
description packageJson.description
252255
url packageJson.repository.baseUrl
253256

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
@@ -76,6 +76,9 @@ content:
7676
\\"license\\": \\"ISC\\",
7777
\\"licenseFilename\\": \\"LICENSE\\",
7878
\\"readmeFilename\\": \\"README.md\\",
79+
\\"native\\": {
80+
\\"packageIdentifier\\": \\"com.alicebits\\"
81+
},
7982
\\"peerDependencies\\": {
8083
\\"react\\": \\"^16.8.1\\",
8184
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -216,7 +219,7 @@ def configureReactNativePom(def pom) {
216219
name packageJson.title
217220
artifactId packageJson.name
218221
version = packageJson.version
219-
group = \\"com.alicebits\\"
222+
group = packageJson.native.packageIdentifier
220223
description packageJson.description
221224
url packageJson.repository.baseUrl
222225

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
@@ -76,6 +76,9 @@ content:
7676
\\"license\\": \\"ISC\\",
7777
\\"licenseFilename\\": \\"LICENSE\\",
7878
\\"readmeFilename\\": \\"README.md\\",
79+
\\"native\\": {
80+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
81+
},
7982
\\"peerDependencies\\": {
8083
\\"react\\": \\"^16.8.1\\",
8184
\\"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
@@ -86,6 +86,9 @@ content:
8686
\\"license\\": \\"ISC\\",
8787
\\"licenseFilename\\": \\"LICENSE\\",
8888
\\"readmeFilename\\": \\"README.md\\",
89+
\\"native\\": {
90+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
91+
},
8992
\\"peerDependencies\\": {
9093
\\"react\\": \\"^16.8.1\\",
9194
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -247,7 +250,7 @@ def configureReactNativePom(def pom) {
247250
name packageJson.title
248251
artifactId packageJson.name
249252
version = packageJson.version
250-
group = \\"com.reactlibrary\\"
253+
group = packageJson.native.packageIdentifier
251254
description packageJson.description
252255
url packageJson.repository.baseUrl
253256

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
@@ -86,6 +86,9 @@ content:
8686
\\"license\\": \\"ISC\\",
8787
\\"licenseFilename\\": \\"LICENSE\\",
8888
\\"readmeFilename\\": \\"README.md\\",
89+
\\"native\\": {
90+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
91+
},
8992
\\"peerDependencies\\": {
9093
\\"react\\": \\"^16.8.1\\",
9194
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -247,7 +250,7 @@ def configureReactNativePom(def pom) {
247250
name packageJson.title
248251
artifactId packageJson.name
249252
version = packageJson.version
250-
group = \\"com.reactlibrary\\"
253+
group = packageJson.native.packageIdentifier
251254
description packageJson.description
252255
url packageJson.repository.baseUrl
253256

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
@@ -86,6 +86,9 @@ content:
8686
\\"license\\": \\"MIT\\",
8787
\\"licenseFilename\\": \\"LICENSE\\",
8888
\\"readmeFilename\\": \\"README.md\\",
89+
\\"native\\": {
90+
\\"packageIdentifier\\": \\"com.reactlibrary\\"
91+
},
8992
\\"peerDependencies\\": {
9093
\\"react\\": \\"^16.8.1\\",
9194
\\"react-native\\": \\">=0.59.0-rc.0 <1.0.x\\"
@@ -247,7 +250,7 @@ def configureReactNativePom(def pom) {
247250
name packageJson.title
248251
artifactId packageJson.name
249252
version = packageJson.version
250-
group = \\"com.reactlibrary\\"
253+
group = packageJson.native.packageIdentifier
251254
description packageJson.description
252255
url packageJson.repository.baseUrl
253256

0 commit comments

Comments
 (0)