-
Notifications
You must be signed in to change notification settings - Fork 155
Export browser bundle of drivers as ECMAScript module #1038
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7b43d67 to
d1ac098
Compare
ECMAScript modules are the official standard format to package JavaScript code for reuse. This is standard improve the modularity of the applications by avoiding leaking global variables and other benefits. Usage example of the `neo4j-driver-lite` esm in browser: ```javascript // jsDelivr CDN minified for production use, version X.Y.Z where X.Y.Z >= 5.4.0 import neo4j from 'https://cdn.jsdelivr.net/npm/[email protected]/lib/browser/neo4j-lite-web.esm.min.js' const driver = neo4j.driver(/* your host */, neo4j.auth.basic(/* user */, /* password */)) driver.verifyConnectivity() .then(() => console.log('Connected')) .catch(e => console.error(e)) ``` **Changes in the `neo4j-driver-lite`** `Browserify` was replaced by `rollup` as the browser building tool for building `umd` and `esm` outputs. Since `rollup` is already being used in the `testkit-backend`, this change also standardise the tooling in the monorepo. The esm module is exported as `neo4j-lite-web.esm.js` (non-minified) and `neo4j-lite-web.esm.min.js` (minified). The files are available under `lib/browser` along with `umd` modules.
Remove dependencies: * vinyl-source-stream * gulp-babel
82fd558 to
df85fd9
Compare
bigmontz
added a commit
to bigmontz/neo4j-javascript-driver
that referenced
this pull request
Jan 9, 2023
ECMAScript modules are the official standard format to package JavaScript code for reuse. This is standard improve the modularity of the applications by avoiding leaking global variables and other benefits. Usage example of the `neo4j-driver-lite` esm in browser: ```javascript // jsDelivr CDN minified for production use, version X.Y.Z where X.Y.Z >= 5.4.0 import neo4j from 'https://cdn.jsdelivr.net/npm/[email protected]/lib/browser/neo4j-lite-web.esm.min.js' const driver = neo4j.driver(/* your host */, neo4j.auth.basic(/* user */, /* password */)) driver.verifyConnectivity() .then(() => console.log('Connected')) .catch(e => console.error(e)) ``` **Changes in the `neo4j-driver-lite`** `Browserify` was replaced by `rollup` as the browser building tool for building `umd` and `esm` outputs. Since `rollup` is already being used in the `testkit-backend`, this change also standardise the tooling in the monorepo. The esm module is exported as `neo4j-lite-web.esm.js` (non-minified) and `neo4j-lite-web.esm.min.js` (minified). The files are available under `lib/browser` along with `umd` modules. **Changes in the `neo4j-driver`** `Browserify` was replace by `rollup` as in the `neo4j-driver-lite`. However, its usage is done using `gulp`. The library build was changed to use `tsc` building tool instead of `babel`. Removed dev dependencies: * @babel/eslint-parser * @babel/preset-env * @istanbuljs/nyc-config-babel * babel-plugin-istanbul * babelify * browserify * browserify-transform-tools * gulp-babel * istanbul * karma-browserify * nyc * vinyl-source-stream Removed prod dependencies: * @babel/runtime Some babel dependencies still needed since the gulp script depends on ES6 imports.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ECMAScript modules are the official standard format to package JavaScript code for reuse. This is standard improve the modularity of the applications by avoiding leaking global variables and other benefits.
Usage example of the
neo4j-driver-liteesm in browser:Changes in the
neo4j-driver-liteBrowserifywas replaced byrollupas the browser building tool for buildingumdandesmoutputs. Sincerollupis already being used in thetestkit-backend, this change also standardise the tooling in the monorepo.The esm module is exported as
neo4j-lite-web.esm.js(non-minified) andneo4j-lite-web.esm.min.js(minified). The files are available underlib/browseralong withumdmodules.Changes in the
neo4j-driverBrowserifywas replace byrollupas in theneo4j-driver-lite. However, its usage is done usinggulp. The library build was changed to usetscbuilding tool instead ofbabel.Removed dev dependencies:
Removed prod dependencies:
Some babel dependencies still needed since the gulp script depends on ES6 imports.