-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add "binary.tag" option #19
base: master
Are you sure you want to change the base?
Conversation
f8fad5e
to
f8ef367
Compare
f8ef367
to
fe41cef
Compare
hostPrefix = 'https://github.com/' + this.owner + '/' + this.repo + '/releases/download/'; | ||
|
||
hostPrefix = 'https://github.com' | ||
pathPrefix = '/' + this.owner + '/' + this.repo + '/releases/download/'; | ||
if(!this.package_json.binary || 'object' !== typeof this.package_json.binary || 'string' !== typeof this.package_json.binary.host){ | ||
throw new Error('Missing binary.host in package.json'); | ||
} | ||
else if (this.package_json.binary.host.substr(0, hostPrefix.length) !== hostPrefix){ | ||
throw new Error('binary.host in package.json should begin with: "' + hostPrefix + '"'); | ||
} |
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 was going to ask you to split the above else if
statement into two, like so:
else if (!this.package_json.binary.tag && this.package_json.binary.host.substr(0, hostPrefix.length) !== hostPrefix){
throw new Error('binary.host in package.json should begin with: "' + hostPrefix + '" when binary.tag is not used.');
}
else if (this.package_json.binary.tag && 'string' === typeof this.package_json.binary.tag && this.package_json.binary.host.substr(0, hostPrefix.length) !== hostPrefix){
throw new Error('binary.host in package.json should be equal to: "' + hostPrefix + '"');
}
but now I am pondering whether it makes sense to try to make this backwards compatible with the old format. What are your thoughts? Regardless, I will be making this a MAJOR version change so I'm not sure there is a point to make it backwards compatible.
me too 😃
@thom-nic it's looking good! I just posted #19 (comment) and now I am thinking it makes more sense to remove any extra code that allows for backwards compatibility. I think this will make it easier long term to maintain... What are your thoughts on that? Would you mind making those changes? |
Although I haven't tested your changes yet, I gave it some more thought and I don't understand how the "host": "https://github.com",
"remote_path": "/[owner]/[repo]/releases/download/{version}" instead of this: "host": "https://github.com/[owner]/[repo]/releases/download/",
"remote_path": "{version}" or instead of what you are proposing: "host": "https://github.com",
"remote_path": "/[owner]/[repo]/releases/download/",
"tag": "{version}" |
Certainly your first suggestion:
works, as that's how one would do it if they were not using node-pre-gyp-github. I figured that would not work for you as you were using I think the extra I did quickly try to publish and it worked, so a cursory trial suggests node-pre-gyp doesn't care about the extra property. My test release: But certainly if you can think of a way for node-pre-gyp-github to use the first format, that aligns with standard node-pre-gyp configuration so that would be great. I'm amenable to tweaking things either way. |
hey @bchr02 do you want to try to go without a |
@thom-nic sorry for not responding sooner. I believe we can make it work without the tag property but haven't had time to confirm this. I will try to get this done soon. Thanks. |
@thom-nic I hate to keep you waiting any longer. I have certain things going on right now that are keeping me tied up. Any chance you could try to make the change so we could do it without needing a new property tag? Please let me know. Thanks. |
Yeah I understand. What's your train of thought here as to how it might work? You could def generate the git tag from I'll take another look at the fields node-pre-gyp defines, it's been a couple weeks since I last looked at this too. |
Separates tag creation from the
remote_path
option.Not tested yet but wanted to put it up here for review.
Apologies for the whitespace changes - I can try to fix if it's a problem.
Also I updated the README - I wonder why you were using triple-backticks to denote inline code spans instead of just a single backtick pairs? I've only used triple-backticks for multiline blocks.
Fixes #18