Skip to content
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

Asynchronous Api #4

Merged
merged 6 commits into from
Oct 27, 2016
Merged

Asynchronous Api #4

merged 6 commits into from
Oct 27, 2016

Conversation

haroldtreen
Copy link
Contributor

Hey @kcartlidge!

I've updated the api to be asynchronous. Test are be passing 👍.

Changes

  • nodepub.document: It was previously doing a synchronous check for whether the cover exists. I've removed that check to instead check that something is provided. Leaving nodepub.document as synchronous seemed like a good idea for backwards compatibility.
  • nodepub.getFilesForEPUB: Now includes an argument for a callback. Throws if no callback is provided. I'm using the npm async module to make reading all the files easier.
  • nodepub.writeFilesForEPUB: Accepts a callback. Throws if no callback is provided. Returns an error if something goes wrong...
  • makeFolder: Helper method is also now asynchronous. It returns an error in the case where it previously threw.
  • README.md: Updated with the api changes.
  • Also added a .editorconfig to stop my editor from adding different types of spacing. Should be consistent with the previous style.
  • Added a .eslintrc to catch little errors.
  • Updated the npm test command to show errors happening. Jasmine wasn't always reporting when things went 💥.
  • Bumped the package.json version to signify the breaking change.

That should be about it! You can give it a test with your setup and make sure all is well.

Let me know if there's any changes necessary. This seems to be working with my stuff though :).

Thanks!

@kcartlidge
Copy link
Owner

Thanks for the PR. I'll take a look over the weekend but reading the above it sounds good.

The only change (other than async) that might affect callers is the cover check you mentioned, however you're probably right to alter that anyway as this is a library module whose sole responsibility is to ensure that the EPUB is produced provided the inputs are available, and not to do the caller's validation checks for them.

@haroldtreen
Copy link
Contributor Author

Awesome :).

While testing I accidently created a few ebooks without a cover and they work fine (at least in iBooks). If it's not required for the epub standard, I would say providing no cover could even be valid.

I don't think it makes a huge difference either way.

@kcartlidge
Copy link
Owner

Sorry for the delay - other things on the go.

The PR looks fine. I can see you've updated the README for the example calls but the version number no longer matches the package so I'll update that separately before I publish to npm.

Thanks again.

@kcartlidge kcartlidge merged commit 9ad613f into kcartlidge:master Oct 27, 2016
@haroldtreen
Copy link
Contributor Author

Great!
Ya, I didn't quite know what to do with the version...
Thanks. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants