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

Port to TypeScript 🦄 #6

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

mesqueeb
Copy link
Contributor

@mesqueeb mesqueeb commented Feb 23, 2019

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 rollup

2. 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.json
  • cjs export method (exports.default = ) defined under "main" in pkg.json

This makes sure that bundlers like webpack and rollup automatically use the esm build, and NodeJS will automatically use the cjs 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.

@mesqueeb
Copy link
Contributor Author

I will change rollup to be used locally. Am investigating how to do this now.

@mesqueeb
Copy link
Contributor Author

  • Changed rollup to be a local dependency
  • Rewrote build file. Now it's reaaaally easy to understand how the dist files are created and definitely worth to check out over gulp!

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.

1 participant