-
Notifications
You must be signed in to change notification settings - Fork 16
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
CB-12397 fix .gitignore for plugins & platforms (cordova-create part) #8
Conversation
I just commented out some extra tests to get these changes to pass, now looking forward to review and feedback. |
I would still like to see this change integrated, new JIRA issue is needed since proposal in CB-12397 was rejected in apache/cordova-discuss#69 (comment). |
Closing in favor of the solution proposed by @raphinesse in apache/cordova-discuss#69 (comment). |
As I said in apache/cordova-app-hello-world#22 (comment) I think we still need a workaround solution like this one due to NPM behavior, reopening for discussion. I am about to take a long weekend, will be back next Tuesday. P.S. I would be happy to rebase and retest sometime next week. |
(some redundant test code removed) Co-authored-by: Christopher J. Brody <brodybits@litehelpers.net> Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
XXX TODO: USE fs-extra function instead, XXX WAITING FOR apache#14 to be merged NOTE: This implementation is a workaround for the npm .gitignore/.npmignore behavior discussed in: - npm/npm#1862 - npm/npm#3763 - npm/npm#7252
I just pushed WIP update to this branch, based on some spec updates from #14, with XXX TODO comment that the final change is waiting for #14 to be merged. Remaining TODO items that I can think of:
|
Looking at the code I realized that it will be harder than I had thought before to get this one right. The existing code in I suspect that this would already be documented to a certain extent, not sure how complete or accurate it really is. I would like to see the documentation updated as well. Unfortunately I do not have the time to review the existing behavior and documentation due to a critical client deadline, should be able to revisit in 1-2 months or so. My bad for not seeing this before working on #14. Another thing is that if we switch over to using
I will understand if the I will understand if someone else wants to take this one over, would hope to see it done with the kind of testing I had already done for this one and #14. |
Yes, the current logic is pretty convoluted. Most of it is not documented either, AFAIK. I proposed to simplify much of it in apache/cordova-discuss#89 which also outlines some of the current logic. For the reasons mentioned in apache/cordova-discuss#69 I do not support the "hacky" solution proposed by you. I rather hope that we can land some changes from apache/cordova-discuss#89 and build an easy and clean solution on top of the simplified cordova-create base. And I think #14 is still fine, even if this change here is delayed a bit. |
Leaving it up to @raphinesse or anyone else who wants to continue working on this fix. I would be happy to answer any questions or contribute feedback on GitHub. I HIGHLY recommend using the test updates I contributed in #14 (also included in this PR) as a starting point. |
Reopening for discussion. I would be happy to revisit this fix when I get some time, with the I continue to be very concerned about what seems like inconsistent behavior about which artifacts do and do not get overwritten from the user-provided template, if provided, which artifacts still come from In addition I would like to see the spec updates I proposed in f4b752d (part of #14) merged ASAP, will raise in a new PR. |
@brodybits please don't open a new PR for the test changes. I'm just now preparing a PR that builds on top of your changes. I think I might have it ready later today. |
@raphinesse got it. I hope it will check for presence vs absence of both Rationale: there are cases reproduced in f4b752d where |
It is impossible to deploy `.gitignore` files via npm packages. Instead, Cordova templates should include `gitignore` files that we rename to `.gitignore`. This commit implements that renaming. For more details see apache/cordova-discuss#69. Closes apache#8 and cordova-app-hello-world#30
It is impossible to deploy `.gitignore` files via npm packages. Instead, Cordova templates should include `gitignore` files that we rename to `.gitignore`. This commit implements that renaming. For more details see apache/cordova-discuss#69. Closes apache#8 and cordova-app-hello-world#30
It is impossible to deploy `.gitignore` files via npm packages. Instead, Cordova templates should include `gitignore` files that we rename to `.gitignore`. This PR implements that renaming. For more details see apache/cordova-discuss#69. This also bumps the dependency on `cordova-app-hello-world` to a version that includes apache/cordova-app-hello-world#50. Closes #8, apache/cordova-app-hello-world#30 and apache/cordova-discuss#69.
Platforms affected
All
What does this PR do?
Workaround for Apache Cordova CB-12397: include .gitignore from
template_src
subdirectory ofcordova-app-hello-world
, needed due to the npm .gitignore/.npmignore behavior discussed in:npm pack
/publish
option to not rename or keep a copy of.gitignore
files npm/npm#7252NOTE: Another part of the fix for Apache Cordova CB-12397 is in https://github.com/brodybits/cordova-app-hello-world/tree/cb-12397, to be raised after this PR.
Additional commits:
What testing has been done on this change?
Unit test
Test suite updated to verify that
.gitignore
is included in the generated app when the standardcordova-app-hello-world
template is used.Cordova CLI test
cordova-cli
test version in https://github.com/brodybits/cordova-cli/tree/cb-12397-devtest1 which uses local test installation ofcordova-lib
from https://github.com/brodybits/cordova-lib/tree/cb-12397-devtest1 due to limitations discussed in Allow subdirectories within git repos in npm install npm/npm#2974.cordova-lib
in https://github.com/brodybits/cordova-lib/tree/cb-12397-devtest1 referencescordova-create
in https://github.com/brodybits/cordova-create/tree/cb-12397-devtest1 which includes this fix.cordova-create
in https://github.com/brodybits/cordova-create/tree/cb-12397-devtest1 referencescordova-app-hello-world
in https://github.com/brodybits/cordova-app-hello-world/tree/cb-12397-devtest1 which includes thecordova-app-hello-world
fix in https://github.com/brodybits/cordova-app-hello-world/tree/cb-12397.Testing with results and other output on Windows:
.gitignore
is now present in the generated app, withplugins
andplatforms
as neededChecklist