-
Notifications
You must be signed in to change notification settings - Fork 113
Adds Support For Generating Maven Package For Android Library #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
796d565 to
e2d7a55
Compare
|
I have updated this PR with config options for the author's github, name and email. Testing:
|
frostney
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great pull request 👍
Looking at this, it would be great to have an interactive mode. Obviously totally out of the scope of this pull request, but do what you think about this idea in general?
| return ` | ||
| { | ||
| "name": "${moduleName}", | ||
| "title": "${moduleName.split('-').map(word => word[0].toUpperCase() + word.substr(1)).join(' ')}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we need this property here or if we could prepare this in the templates/android.js file instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I placed it into package.json on purpose. It may only be used by the Android maven config at this time, but for the sake of consistency I think it's good to have it here so that all config values that feed into the maven config can be changed in one place.
templates/general.js
Outdated
| "name": "${authorName}", | ||
| "email": "${authorEmail}" | ||
| }, | ||
| "license": "Apache-2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Do we need to hardcode the license? Could we get that as a command-line parameter or default value as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Fair point I'll make it configurble as well. 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| } | ||
| repositories { | ||
| maven { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changeset is also in #51, right? 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const DEFAULT_PLATFORMS = ['android', 'ios', 'windows']; | ||
| const DEFAULT_OVERRIDE_PREFIX = false; | ||
| const DEFAULT_AUTHOR_GITHUB = 'github_account_name' | ||
| const DEFAULT_AUTHOR_NAME = 'Your Name' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be out of the scope of this pull request, but do you think it would be possible to get the default values from the global Git config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, probably out of scope for this PR but I don't see a reason why that is not possible. Basically we could first default to the git config --global user.name (as well as email) and if those are not set, then only use these secondary default values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we should file an issue for it and follow up. Would be a good starter task too imho.
thorbenprimke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestions @frostney - I'll get this PR updated.
| const DEFAULT_PLATFORMS = ['android', 'ios', 'windows']; | ||
| const DEFAULT_OVERRIDE_PREFIX = false; | ||
| const DEFAULT_AUTHOR_GITHUB = 'github_account_name' | ||
| const DEFAULT_AUTHOR_NAME = 'Your Name' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, probably out of scope for this PR but I don't see a reason why that is not possible. Basically we could first default to the git config --global user.name (as well as email) and if those are not set, then only use these secondary default values.
| } | ||
| repositories { | ||
| maven { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return ` | ||
| { | ||
| "name": "${moduleName}", | ||
| "title": "${moduleName.split('-').map(word => word[0].toUpperCase() + word.substr(1)).join(' ')}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I placed it into package.json on purpose. It may only be used by the Android maven config at this time, but for the sake of consistency I think it's good to have it here so that all config values that feed into the maven config can be changed in one place.
templates/general.js
Outdated
| "name": "${authorName}", | ||
| "email": "${authorEmail}" | ||
| }, | ||
| "license": "Apache-2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Fair point I'll make it configurble as well. 💯
6b5c0f3 to
6846f0f
Compare
Summary: This adds support for generating the maven package similar to how React Native core does it. This allows a brownfield Android project reference this maven package instead of the project in the node_modules.
Updates README
6846f0f to
00174da
Compare
|
@maicki - mind giving this PR a look? |
maicki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| const DEFAULT_PLATFORMS = ['android', 'ios', 'windows']; | ||
| const DEFAULT_OVERRIDE_PREFIX = false; | ||
| const DEFAULT_AUTHOR_GITHUB = 'github_account_name' | ||
| const DEFAULT_AUTHOR_NAME = 'Your Name' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we should file an issue for it and follow up. Would be a good starter task too imho.
templates/general.js
Outdated
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/${authorGithub}/${moduleName}.git", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the url for the repository is at a different place as at the authors github username. Thinking off such libs that are under a organization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I considered that. Perhaps the naming should be changed to githubAccount or hostingGithubAccount.
I guess that brings up the next thing which is what if you use bitbucket or another service. I think this template / generator will serve most needs out of the box but in some cases a little modification may be necessary as it otherwise would make the options too complex.
Summary:
This adds support for generating the maven package similar to how
React Native core does it.
This allows a brownfield Android project reference this maven package
instead of the project in the node_modules.
This also adds a few new fields to
package.json. Do y'all think it's okay to have placeholder values or should I add the ability to provide them to the cli?