-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
feat: expose forge publish api #811
Conversation
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!
A couple of change requests:
- We should expose the
publishTargets
option as a command argument, e.g.ember electron:make --publish --publish-targets=@electron-forge/publisher-github,@electron-forge/publisher-s3
(or maybeember electron:make --publish --publish-target=@electron-forge/publisher-github --publish-target=@electron-forge/publisher-s3
would be cleaner? can't remember whatember-cli
's argument parsing makes easy and hard) because people might have different workflows for publishing the same project to different publisher targets. - Let's add some tests to the make suite to cover these new options. I think it should be pretty straightforward to stub forge's publish API like we already do for the make/package API and then verify that we do/don't call it correctly according to the arguments, and that we forward 0, 1, or >1 publish targets to the API when calling it., according to whichever of the
--publish-target
or--publish-targets
command option we land on.
Also, thinking through and writing down a few other things for posterity, but I don't think anything here is actionable:
|
Q: How do I run the make suite tests locally? |
You should be able to run |
think I copied, stole, pasted, and adapted some tests... please let me know what you think |
@@ -157,4 +162,30 @@ describe('electron:make command', function () { | |||
rimraf.sync('electron-app'); | |||
await expect(command.validateAndRun([])).to.be.rejected; | |||
}); | |||
|
|||
it('can publish', async function () { |
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 is a great start on the tests. It's currently only testing the command code and not the task code, though, because the task is being stubbed rather than the forge API method. So let's stop stubbing the task and instead use the forge API stub to verify results. Then we can also verify that the dir
argument is being passed correctly, and that the make results are being conveyed properly.
So, this test would look like:
let makeResults = {};
// Change the make stub to return some fake results so we can ensure they
// they are passed to the publish API method
api.make.resetBehavior();
api.make.resolves(makeResults);
await expect(command.validateAndRun(['---publish'])).to.be.fulfilled;
expect(api.publish).to.be.calledOnce;
expect(api.publish.firstCall.args[0].dir).to.equal('electron-app');
expect(api.publish.firstCall.args[0].makeResults).to.equal(makeResults);
expect(api.publish.firstCall.args[0].publishTargets).to.be.undefined;
Then in the next two tests you can skip the make results stubbing since we've already verified that, and just assert that api.publish
was called and that the publishTargets
are correct.
of course, thank you for guiding me |
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.
Excellent, so glad to add publishing support -- thanks for the contribution!
an attempt to expose the publish feature from electron forge
see #637