-
Notifications
You must be signed in to change notification settings - Fork 343
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 --filename option to specify a filename template #1900
Conversation
I'm not sure if the Am I on the right track @rpl ? |
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.
@escapewindow Thanks a lot for taking care of reviving the pull request for this enhancement!
I'm not sure if the
audit-deps
error is actionable. I may be misreading, but it looks like the security advisories are for older versions of the dependencies?
yeah, you are not misreading it. Don't worry about that, I'll take care of it in #1902, then you'll just need to rebase this once we merged that pull request and the audit-deps failure should go away.
Am I on the right track @rpl ?
This looks definitely on the right track, follows a round of review comments related to this version.
Questions:
- Does
-n
make sense as a single letter filename option? (n
for name) I'm happy to add that or keep it as-is.
👍 n
isn't used for any other option, and so I think that I would be ok with it.
- Is there a reason why we can't specify a directory path? I could see dying if the path specified doesn't exist, but I'm not sure why we can't write to a different directory.
well, we could probably allow it, but I have the feeling that we may then need to also check if any of the interpolated strings contains something that may be handled like a path to don't make that surprising (eg. "../../").
The developer can already customize the location of the artifacts dir with another one of the command line parameters, wouldn't that be enough for most of the use cases?
I would keep it simple in this PR and eventually re-evaluate that separately in a follow up if we agreed that there may be some reasonable use case that isn't already covered by customizing the artifacts dir location.
- The code, as written, changes the
@
in the name to an underscore_
(minimal-example_web-ext-test-suite
. Is that expected? Should we allow for people to name the file what they want, if they pass in a flag (or warn that their name doesn't follow certain conventions)?
That should be due to safeFileName
, I can't currently recall if there was any reason to not include @
into the safe characters, at a first glance it seems that @
should be actually fine, let me think about it, we can eventually add it to the regexp used inside safeFileName
(we can as well do it in a follow up)
Thanks! I rebased against master. Between that, and the commit lint, I had to rebase the entire PR. I'm hoping it's still easy to re-review?
Thanks for your review! I think it's ready for re-review.
Added. I don't have a strong opinion here.
I think the
I'm still a bit concerned that the name isn't 100% deterministic -- we'll get different filenames if (Edit: By deterministic, I don't mean that the value is going to fluctuate between runs, but that the output might not be expected without digging into the extension's localization and the rules of Thanks for your help! |
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! I rebased against master. Between that, and the commit lint, I had to rebase the entire PR. I'm hoping it's still easy to re-review?
This looks pretty good (and the diff is pretty clean and readable, thanks!)
There are just a couple of small additional issues that requires some additional changes (which should still be small enough), and a couple of optional nits, then this should be good to go.
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 looks great to me. 👍 r+ \o/ 🎉
Thanks @escapewindow for reviving and then completing this pull request.
}) | ||
.then(makeSureItFails()) | ||
.catch((error) => { | ||
log.info(error); |
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.
Nit, these long.info(error) are not really needed, I just noticed that we did already have one which got merge in a old patch, but not a big deal. We will have to rewrite all these tests into async functions at some point (to make them a bit more readable), and so don't worry about that.
@@ -86,6 +121,44 @@ describe('build', () => { | |||
); | |||
}); | |||
|
|||
it('throws an error if the filename contains a path', () => { |
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.
Nit, it would probably good to have also one test that verifies that if an interpolated part of the template is a string that looks like a path then we still throw this kind of UsageError (which is actually the case with the version in this patch, it would be mostly an additional test to have more coverage in case of a refactoring), but we can deal with it in a follow up.
@rpl Is there a release planned anytime soon? We have a number of webextensions that would use this feature, if it were available. Thanks! |
@escapewindow yeah, we should cut a new release and publish it on npm soon. Sorry for letting you wait. |
Fixes #1335. Based off #1741 and its review comments.
Questions:
-n
make sense as a single letter filename option? (n
for name) I'm happy to add that or keep it as-is.@
in the name to an underscore_
(minimal-example_web-ext-test-suite
. Is that expected? Should we allow for people to name the file what they want, if they pass in a flag (or warn that their name doesn't follow certain conventions)?JavaScript isn't my strong suit; please review accordingly :)