Fullstack JS developer. Mentor @DevMeetingsES. Co-organizes @AlicanteFront. Open source and new-stack tech lover. Clean code and best practices advocate. Also likes beer and sport.
Writing a library or project always requires some work:
Typescript library starter solves all of that and more, plus:
Let's see how easy is to use it.
Let's start by running:
git clone https://github.com/alexjoverm/typescript-library-starter.git cd typescript-library-starter npm install
A prompt will show up asking your library name:
When you do so, it will configure the project for you based on the library name and your git config. It re-inits the git directory, configures webpack, package.json and your entry files (both src and test).
See it yourself! Try running
npm t, it will run a sample test. Or run
npm run build, it will create a
dist folder with the bundle, typings file and documentation.
See all the commands available on the repo Readme
We need to do some previous steps. First, make sure you've created an account on:
Also, make sure you've set the
repository.url property on your
Now, run the following script:
At this point, you just need to install semantic release. Answer NO to the "Generate travis.yml" question, because it is already prepared for you.
npm install -g semantic-release-cli semantic-release setup
From now on, better use
npm run commit. It will show you a prompt which is very convenient for creating a conventional commit. Note that running
git commit -a without the proper commit message will fail.
You'll notice that when you run
git push, the exactly same command that Travis CI runs is run locally on your machine, so you can see early if the build will fail.
We haven't dived into any kind of configuration, but we were able to not only write a dummy library, but also make sure all quality steps (linting, testing, coverage) are asserted and that we can create bundles, builds, typings and all things needed for a TypeScript library.
Not only that, but also how to make maintainability easy by automating releases!