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.
I have re-arranged the app internally and made several improvements in my opinion:
1. removed umd export function from index file.
I have opted for regular
export default
which is can be changed into other export methods with rollup2. change build method
A clean start with rollup, the preferred builder for small modules. The advantage is that rollup is much easier to configure and understand. check the
build
folder for the very easy to understand config.For the time being I have set the build config to compile into two files with:
esm
module export method (export default
) defined under "module" in pkg.jsoncjs
export method (exports.default =
) defined under "main" in pkg.jsonThis makes sure that bundlers like webpack and rollup automatically use the
esm
build, and NodeJS will automatically use thecjs
build.These don't need to be minified as whatever application that uses these will probably use webpack to minify their own application.
We'll only need to make a minified version if we want to create a browser build for CDN's, easily done through the rollup config. In this case we'd also go for the iife export method. (ask me if you want this, i'll prepare it before merge)
3. port to TypeScript
While I didn't really add any useful typing what-so-ever, I prepared the package for TypeScript by changing the files, making the rollup build able to compile it with the TypeScript compiler and removed babel.
Going forward
We should add tests but I'm not sure how to fake keystrokes : D
I tested locally with
npm link
and everything still worked. Though I'm not sure how thorough my manual tests were.