jtz-js-utils
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Tiny bits of code that I often reach for across projects.

Work in progress, use at your own risk, etc.

NodeJS Versions Supported

To ship ESM only, this supports Node V >= 12.17.0, since those versions support ESM imports out-of-the-box.

Build Setup

There are a few peculiarities worth noting about the build setup used here:

  • TypeScript
    • Config has libs set to include DOM in all TS files, not just those under src/web. This is slightly unsafe, as it won't catch me doing something silly like using document.location inside src/node/index.ts
      • I'm doing this because isolating libs to specific files is almost impossible with TypeScript at the moment - triple slash directives bleed into other files, and VSCode doesn't play nice with multiple root tsconfigs, so the only way to do this correctly would be to split each subdirectory into a completely isolated build and bundling step... still might be worth exploring at some point
  • Bundling
    • Using Rollup
    • Targeting UMD for browser, ESM for NodeJS (since most live versions support now)

Testing

Tests are ran using Ava, which can execute them in parallel.

Due to an issue with NodeJS ESM requiring file extensions to be included in import syntax - but this breaking TS-Node completely - I am running Ava against the transpiled JS (/dist) instead of the raw TypeScript source (which would require TS-Node).

Readme

Keywords

Package Sidebar

Install

npm i jtz-js-utils

Weekly Downloads

0

Version

0.0.1

License

none

Unpacked Size

28.2 kB

Total Files

17

Last publish

Collaborators

  • joshuatz