@brisberg/typescript-pkg

<Description of TypeScript package>

Usage no npm install needed!

<script type="module">
  import brisbergTypescriptPkg from 'https://cdn.skypack.dev/@brisberg/typescript-pkg';
</script>

README

<package-name>

Describe this package. Delete the TypeScript Pkg README below.

Actions

yarn build - Builds the package, emitting .js and .d.ts files
yarn lint - Runs lint over the project source
yarn test - Runs all tests under the src/ directory
yarn publish - Bumps package version and publishes the package to Github Packages

Toolchain

Uses @brisberg/typescript-pkg as a template for Toolchain configuration.

See that repo for a list of tools, documentation, and upgrade steps.


TypeScript Pkg (Template)

Standard project configuration template for @brisberg TypeScript packages.

This is an opinionated toolchain configuration for TypeScript packages published to Github Packages.

Usage

Add as a remote of your repository:

git remote add toolchain https://github.com/brisberg/typescript-pkg.git

Merge changes from toolchain template into your repository. Be sure to manually keep any project specific overrides.

Latest directly from master:

git fetch toolchain --no-tags
git merge toolchain/master --allow-unrelated-histories

Or, latest stable release:

git fetch toolchain \
        $(git ls-remote --tags --refs --sort=\"version:refname\" toolchain \
        | awk -F/ 'END{print$NF}')
git merge FETCH_HEAD --allow-unrelated-histories

Note: Recommended to make a git alias for the above command

Resolve merge conflicts, keeping project specific overrides and deletions.

Often simply discard and regenerate lockfile:

rm yarn.lock
yarn install

Verify tests still pass before committing:

yarn test
# Tests pass
git add .
git merge --continue
# Tests fail (debug or bail)
git merge --abort

Tools

  • VSCode - Hackable IDE
  • TypeScript - TypeScript language compiler
  • Yarn - Package Manager of choice for node modules
  • Jest - All-in-one test framework and assertion library
  • ESLint - Pluggable lint for Javascript/TypeScript
  • clang-format - Code Formatting library

CI

Best Practices