Closed appsforartists closed 2 years ago
I've just confirmed that commit SHAs can be made idempotent if you add these lines to the top of uploadPackage
:
process.env.GIT_AUTHOR_DATE = `1970-01-01T00:00:00.000Z`;
process.env.GIT_COMMITTER_DATE = `1970-01-01T00:00:00.000Z`;
To-do:
time=0
). Are there any potential bad side effects if the files in a node_module
have no timestamp?
uploadPackage
git fetch --dry-run origin <tag-name>
will tell you if a tag exists, but I haven't yet figured out how to convert it to a SHA.
Currently, gitpkg throws an error if the tag it wants to write already exists. Ideally, this would not error if the contents of the new tag and the old tag are the same.
Therefore, I propose an idempotent mode. Before pushing the tag, it would amend the commit time to
0
(1/1/1970). Then, you should be able to simply compare the SHA of the existing tag with the new one, and treat the command as a success if they match.This would enable
publish
to be run indiscriminately across many packages, without worrying about which ones have fresh changes. It would also make it possible to easily detect which packages have changes since the last publication (since they would still throw the error.)(I should investigate this a bit more, but wanted to write it down while it was in my head.)