allow prod & stage s3 targets#533
Conversation
| @@ -1,7 +1,5 @@ | |||
| #!/usr/bin/env node | |||
|
|
|||
| 'use strict'; | |||
There was a problem hiding this comment.
Why did you remove this? Would be ideal to leave this in across all the JS files.
There was a problem hiding this comment.
i removed it because eslint flagged it as unncessary. maybe @mapbox/eslint-config-mapbox/.eslint.rc should have root: true set? i can put them back in but was just going with eslint.
There was a problem hiding this comment.
the rule in my upper-level eslintrc file is:
"strict": [2, "global"],
but that seems like it should allow a single 'use strict' at the top of files based on eslint doc.
There was a problem hiding this comment.
Okay. I'm not seeing that locally / or on travis. So, can you bring back the strict here and I'll investigate more this week.
There was a problem hiding this comment.
i think you're not seeing it because you don't have a upper-level directory with an eslintrc file that supplies defaults for settings not specified by your eslintrc files. i think if you add root: true (or "root": true) to your file then it won't pick up mine.
eslint doc - search for root: true.
There was a problem hiding this comment.
i in-place edited node_modules/@mapbox/eslinit-config-mapbox/base.js to start with:
module.exports = {
extends: 'eslint:recommended',
root: true,
env: {
es6: true
},
and restarted vscode. eslint no longer complains about 'use strict'.
There was a problem hiding this comment.
Okay, can you please revert your removal of use strict?
There was a problem hiding this comment.
am doing so now. will ping you when done.
There was a problem hiding this comment.
looks like you missed restoring one use strict, the one referenced by this comment
springmeyer
left a comment
There was a problem hiding this comment.
Ping me once the tests are passing and I'll do a deeper review.
|
@springmeyer - tests are running |
|
Okay, I've reviewed once more. Code looks good - no more feedback. Next steps before merging:
|
|
I will add some test(s) specific to this and push that. I'll let you know when I've pushed them. |
|
@springmeyer - i added tests and it is running in travis. codecov has come back with results that i don't understand. looking at the details it's not clear how coverage was reduced as much as reported. for example, the file lib/publish.js shows abs 0.0 relative 0.0, change -70.94. when looking at the diffs i don't see how the changes could change the coverage. i also do not understand how 0 absolute and relative changes could results in a 70% decrease. i added these tests to versioning.test.js because it seemed like the majority of what i'm testing in this pass relates to whether the i'll add tests that actually exercise publishing with different destinations in build.test.js next. but because i don't have access to the mapbox s3 buckets that will involve changing/rewriting the app?/package.json files in order for me to test. do you have any thoughts on how to best approach this? |
|
oops. my bad. left an only in there. am fixing. |
02d577c to
abbd9b4
Compare
|
ok, i rebased on your master, pushed, and things look a little better. but i still don't understand codecov's results. the changes in i haven't used codecov before so maybe i'm missing something obvious. |
|
As far as code coverage I think you are being unfairly penalized for touching files that lacked some coverage to begin with. So for the purposes of this PR I'd focus only on the coverage of the new code added to
|
|
thanks for the perspective. i have made changes to testing and those four lines should be covered now. when reviewing the logic for the expanded tests i thought a couple additional changes were needed as well. i removed the there is also a minor change in |
|
Great, thanks - coverage looks perfect now (for what matters). Just one thing before merging:
|
it doesn't always return a truthy value; i think the message is ok as it is. setBinaryHostProperty() returns a truthy value if binary.host is falsey, both binary.staging_host and binary.production_host are truthy, and the --s3_host option is either 'staging' or 'production'. it will also return a truthy value if it has been called once before and met those criteria (meaning it has already set binary.host to either 'staging_host' or 'production_host') in which case it just returns the value it was set to. the flag isn't set until completion, so i think log.info should only be called if it did change binary.host. (it would log also if it were the second call to setBinaryHostProperty, but i don't think that happens.) make sense? it's a bit confusing with the binaryHostSet flag maintaining state. |
|
Okay, I'll trust you on this - thanks. Okay, last things are:
I'm still mulling on what other changes will go into v1.0.0 so hopefully you can live with using HEAD for now to give me time to get a v1.0.0 out in the ~ next month. |
|
just pushed CHANGELOG.md addition. i appreciate your working with me on this. |
|
@springmeyer - don't do a release based on master. i believe i need to do a fix so that it will work when |
|
👍 |
allow prod & stage s3 targets
allow the binary.host property (the s3 target) to be set at execution time.
for this to take effect requires all the following to be true.
if any of the previous are not true then binary.host is used, as it is now.
the command line option,
--s3_hostcan specifystagingorproduction, e.g.,--s3_host=staging. if the value is notstagingorproductionand exception isthrown.
defaults when
--s3_hostis not specified:these defaults were chosen so that any command other than "publish" uses "production"
as the default without requiring any command-line options while "publish" requires
'--s3_host production_host' to be specified in order to really publish. publishing
to staging can be done freely without worrying about disturbing any production releases.
the main change this required is to centralize the reading (and preprocessing) or package.json. there is a duplicate of
the minor fix in the linux-differentiation PR to verify required binary properties.