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

Make ES5 compatible #80

Merged
merged 14 commits into from
May 20, 2022
Merged

Make ES5 compatible #80

merged 14 commits into from
May 20, 2022

Conversation

JakobMiksch
Copy link
Contributor

@JakobMiksch JakobMiksch commented May 17, 2022

fixes #73

This PR attempts to make geoserver-node-client compatible to ES5.

  • Note: importing the library via git does not work for ES5:
"geoserver-node-client": "git+https://github.com/jakobmiksch/geoserver-node-client.git"

TODO:

@JakobMiksch JakobMiksch requested a review from chrismayer May 18, 2022 07:54
@JakobMiksch
Copy link
Contributor Author

@chrismayer this commit e1910ad should ensure that release-it also builds the ESM5 compatible code.
I tested it with the dry run functinality: npx release-it --dry-run and the produced commands looked like expected (see below). So, I am optimistic that it will work in production as well.

? Select increment (next version): patch (0.0.8)
! npm version 0.0.8 --no-git-tag-version
! npm run build                                    <-- HERE RELEASE-IT TRIGGERS THE BUILT
$ git status --short --untracked-files=no

Empty changeset

! git add . --update
? Publish geoserver-node-client to npm? Yes
$ npm publish . --tag latest --dry-run
? Commit (Release 0.0.8)? Yes
! git commit --message Release 0.0.8
? Tag (0.0.8)? Yes
! git tag --annotate --message Release 0.0.8 0.0.8
? Push? Yes
$ git symbolic-ref HEAD  [cached]
$ git for-each-ref --format="%(upstream:short)" refs/heads/esm-approach  [cached]
! git push --follow-tags
🔗 https://www.npmjs.com/package/geoserver-node-client
🏁 Done (in 27s.)

@JakobMiksch
Copy link
Contributor Author

JakobMiksch commented May 18, 2022

@chrismayer the commit 9a66c88 also exposes the GeoServerResponseError to the user of the library. This can be useful to perform error handling based on different kinds of errors. Similar to the code below. Does this make sense to you?

try {
  myroutine(); // may throw three types of exceptions
} catch (e) {
  if (e instanceof TypeError) {
    // statements to handle TypeError exceptions
  } else if (e instanceof RangeError) {
    // statements to handle RangeError exceptions
  } else if (e instanceof EvalError) {
    // statements to handle EvalError exceptions
  } else {
    // statements to handle any unspecified exceptions
    logMyErrors(e); // pass exception object to error handler
  }
}

(taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch#conditional_catch-blocks )

@chrismayer
Copy link
Collaborator

chrismayer commented May 19, 2022

exposes the GeoServerResponseError to the user of the library. This can be useful to perform error handling based on different kinds of errors. Similar to the code below. Does this make sense to you?

Yes, makes totally sense. +1 for this. We just have to clarify where the export itself should be placed best. See my comment above.

@JakobMiksch
Copy link
Contributor Author

@chrismayer I responded to your comment inline.

@chrismayer
Copy link
Collaborator

chrismayer commented May 20, 2022

Since the Error stuff is moved to a separate PR (#83) this is good to go.

@JakobMiksch JakobMiksch merged commit 50da14c into meggsimum:master May 20, 2022
@JakobMiksch JakobMiksch deleted the esm-approach branch May 20, 2022 07:08
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.

ES5 compatibility
2 participants