alge
[![trunk](https://github.com/jasonkuhrt/alge/actions/workflows/trunk.yml/badge.svg)](https://github.com/jasonkuhrt/alge/actions/workflows/trunk.yml)
Last updated 5 years ago by jasonkuhrt .
MIT · Repository · Original npm · Tarball · package.json
$ npm install alge 
SYNC missed versions from official npm registry.

alge

trunk

Project template for TypeScript libraries

Quick Start

  1. Setup a clone of this repo, enable Corepack, and install dependencies:

    gh repo clone jasonkuhrt/alge <your package name> && \
    cd <your package name> && \
    corepack enable && \
    yarn
    
  2. Run the bootstrap script. You will be prompted to answer some questions:

    yarn ts-node scripts/bootstrap
    
  3. Setup a repo secret called NPM_TOKEN containing an npm token for CI package publishing.

Example:

gh repo clone jasonkuhrt/alge foobar \
   && cd foobar \
   && yarn \
   && yarn bootstrap \
      --orgAndRepo 'jasonkuhrt/foobar' \
      --developerName 'Jason Kuhrt' \
      --packageName 'foobar' \
      --createGithubRepo

Features

TypeScript for Type Safety & Productivity

  1. Optimal settings for the safety of your implementation

    1. strict mode enabled.
    2. All lint flags enabled:
  2. .tsbuildinfo cache setup, output discretely into node_modules/.cache

  3. Inherit settings from @tsconfig/recommended (Node 14 flavour)

  4. Base tsconfig.json shared across tests, src, and ts-node.

  5. ts-patch setup for enhanced language features:

    1. typescript-transform-paths for a working tsconfig paths config!
    2. Intentional avoidance of ttypescript
  6. Optimal output setup for your users

    1. Target ES2020 which Node as low as version 14 has good support for (Kangax compatibility table).
    2. declaration so your users can power their intellisense with your packages typings.
    3. declarationMap enabled to make your published source code be navigated to when your users use "go to definition".
    4. package.json typeVersions used to emit only one set of declaration files shared by both CJS and ESM builds.
    5. sourceMap enabled to allow your users' tools to base off the source for e.g. stack traces instead of the less informative derived built JS.
    6. importHelpers enabled to minimize build size.
    7. Publish src with dist files so that jump-to-definition tools work optimally for users.
  7. ts-node for running TypeScript scripts/modules.

    1. Setup to use SWC for maximum speed.

ESLint For Linting

  1. TypeScript integration
  2. TS type-checker powered eslint checks enabled
  3. Prettier integration using just eslint-config-prettier. eslint-plugin-prettier is not used to avoid lint noise and slower run time. Prettier is expected to be run by your IDE and your CI and if really needed you manually via yarn format.
  4. Setup as a CI check for PRs
  5. Always display as warning to keep IDE error feedback for TypeScript (CI enforces warnings).
  6. Auto-fixable import sorting

Jest for Testing

  1. Transpile TypeScript tests with @swc/jest
  2. Useful watch mode plugins
    1. jest-watch-typeahead
    2. jest-watch-suspend
    3. jest-watch-select-projects
  3. jest.config.ts (TypeScript file) for type safe & intellisense configuration.
  4. typescript-snapshots-plugin for viewing snapshots on hover of .toMatchSnapshot method.
  5. konn for type safe test context creation.
  6. Strongly typed Jest configuration via use of @jest/types

Dripip for Releasing

Simple succinct friendly low-barrier issue templates

  1. Emojis ✈️
  2. Feature / bug / docs / something-else
  3. Config to display discussions link right in new issue type listing UI

Prettier for code formatting

  1. Prisma Labs config preset, 110 line width
  2. Setup as a CI check for PRs
  3. VSCode extension in recommended extensions list so that when collaborators open the project they'll get prompted to install it if they haven't already.
  4. npm script

npm scripts for development lifecycle

  1. clean to remove cache and dist files
  2. build that runs clean beforehand
  3. prepublishOnly that runs build beforehand
  4. format to quickly run prettier over whole codebase
  5. lint to quickly run eslint over whole codebase

CI with GitHub Actions

  1. Separate trunk and pull-request (PR) workflows.
  2. Dependency install cache enabled.
  3. On PR:
    1. Prettier Check
    2. Lint Check
    3. Tests across matrix of mac/linux/windows for Node 14/16
  4. On trunk:
    1. Tests across matrix of mac/linux/windows for Node 14/16
    2. Automated canary release

Renovate configuration

  1. JSON Schema setup for optimal intellisense
  2. Group all non-major devDependency updates into single PR (which "chore" conventional commit type)
  3. Group all major devDependency updates into single PR (with "chore" conventional commit type)
  4. Group all non-major dependency updates into single PR (with "deps" conventional commit type)
  5. Each major dependency update in own PR (with "deps" conventional commit type)

Yarn 2 for package management

  1. Painless/familiar workflow via node_modules for nodeLinker
  2. Using Corepack. This means the Yarn specified in package.json will be used. And note this is a Yarn binary shipped with Node now. In a future version of Node you will not need to even opt-in into Corepack. Make sure you've done corepack enable at least once.
  3. Plugins:
    1. plugin-outdated Bring back outdated command from Yarn 1.
    2. plugin-typescript for painless @types consumptions (e.g. You probably forget how to pull down @types packages for already-scoped npm packages, doesn't matter now).
    3. plugin-interactive-tools for some slick in-terminal project maintenance.

CJS+ESM Hybrid package build

See Dr. Axel's article about this)

  1. Use exports field to give support to both modern import and legacy require consumers using Node 12.x and up. For details about the exports field refer to the Official Node.js Docs about it.
  2. Use main field for legacy versions of Node (before 12.x) requiring the CJS build.
  3. Use module field for legacy bundlers importing the ESM build.

VSCode Settings

  1. Optimize project search by ignoring dist-*/, .yarn/, snapshots, lock files, and more.
  2. On-Save actions for optimal editing experience (e.g. ESLint auto-fix to organize imports automatically)
  3. List of VSCode extensions that users who open the project will be prompted to install if they don't already.
  4. Enable typescript.enablePromptUseWorkspaceTsdk so that oneself and collaborators will get prompted to use the workspace version of TypeScript instead of the one in the editor.

Readme Table of Contents

  1. Using markdown-toc

Useful TypeScript Libraries

Here are some TypeScript libraries you might want to use for your new project:

https://github.com/stars/jasonkuhrt/lists/typescript

Alt

Current Tags

  • 0.8.1                                ...           latest (4 years ago)
  • 0.8.1                                ...           next (4 years ago)

71 Versions

  • 0.8.1                                ...           4 years ago
  • 0.8.1-next.1                                ...           4 years ago
  • 0.8.0                                ...           4 years ago
  • 0.8.0-next.1                                ...           4 years ago
  • 0.7.0                                ...           4 years ago
  • 0.7.0-next.4                                ...           4 years ago
  • 0.7.0-next.3                                ...           4 years ago
  • 0.7.0-next.2                                ...           4 years ago
  • 0.7.0-next.1                                ...           4 years ago
  • 0.6.1                                ...           4 years ago
  • 0.6.1-next.1                                ...           4 years ago
  • 0.6.0                                ...           4 years ago
  • 0.6.0-next.1                                ...           4 years ago
  • 0.5.1                                ...           4 years ago
  • 0.5.1-next.4                                ...           4 years ago
  • 0.5.1-next.3                                ...           4 years ago
  • 0.5.1-next.2                                ...           4 years ago
  • 0.5.1-next.1                                ...           4 years ago
  • 0.5.0                                ...           4 years ago
  • 0.5.0-next.1                                ...           4 years ago
  • 0.4.3                                ...           4 years ago
  • 0.4.3-next.1                                ...           4 years ago
  • 0.4.2                                ...           4 years ago
  • 0.4.2-next.2                                ...           4 years ago
  • 0.4.2-next.1                                ...           4 years ago
  • 0.4.1                                ...           4 years ago
  • 0.4.1-next.1                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.4.0-next.2                                ...           4 years ago
  • 0.4.0-next.1                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.3.0-next.1                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.2.0-next.6                                ...           4 years ago
  • 0.2.0-next.5                                ...           4 years ago
  • 0.2.0-next.4                                ...           4 years ago
  • 0.2.0-next.3                                ...           4 years ago
  • 0.2.0-next.2                                ...           4 years ago
  • 0.2.0-next.1                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.1-next.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.1.0-next.28                                ...           4 years ago
  • 0.1.0-next.27                                ...           5 years ago
  • 0.1.0-next.26                                ...           5 years ago
  • 0.1.0-next.25                                ...           5 years ago
  • 0.1.0-next.24                                ...           5 years ago
  • 0.1.0-next.23                                ...           5 years ago
  • 0.1.0-next.22                                ...           5 years ago
  • 0.1.0-next.21                                ...           5 years ago
  • 0.1.0-next.20                                ...           5 years ago
  • 0.1.0-next.19                                ...           5 years ago
  • 0.1.0-next.18                                ...           5 years ago
  • 0.1.0-next.17                                ...           5 years ago
  • 0.1.0-next.16                                ...           5 years ago
  • 0.1.0-next.15                                ...           5 years ago
  • 0.1.0-next.14                                ...           5 years ago
  • 0.1.0-next.13                                ...           5 years ago
  • 0.1.0-next.12                                ...           5 years ago
  • 0.1.0-next.11                                ...           5 years ago
  • 0.1.0-next.10                                ...           5 years ago
  • 0.1.0-next.9                                ...           5 years ago
  • 0.1.0-next.8                                ...           5 years ago
  • 0.1.0-next.7                                ...           5 years ago
  • 0.1.0-next.6                                ...           5 years ago
  • 0.1.0-next.5                                ...           5 years ago
  • 0.1.0-next.4                                ...           5 years ago
  • 0.1.0-next.3                                ...           5 years ago
  • 0.1.0-next.2                                ...           5 years ago
  • 0.1.0-next.1                                ...           5 years ago
  • 0.0.1-next.1                                ...           5 years ago
Maintainers (1)
Downloads
Total 159
Today 0
This Week 0
This Month 109
Last Day 4
Last Week 11
Last Month 0
Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE