lib-tools

The lib-tools helps you simplify the build, bundle, test and npm packaging workflows for Typescript, JavaScript, Angular library projects and assets module projects.

Usage no npm install needed!

<script type="module">
  import libTools from 'https://cdn.skypack.dev/lib-tools';
</script>

README

Lib Tools – Build, Test and NPM Package Workflows Make Easy

GitHub Actions Status Azure Pipelines Status npm version

The lib-tools helps you simplify the build, bundle, test and npm packaging workflows for Typescript, JavaScript, Angular library projects and assets module projects (e.g. sass, scss, css or icons). This tool can automatically set up for your projects without the time spent with webpack, rollup, karma, postcss, autoprefixer or clean-css configuration files. You can start from zero-configuration to fully customizable options!

Getting Started

Installation

You can install lib-tools cli either globally or locally.

npm install -D lib-tools

or install globally

npm install -g lib-tools

Latest npm package is npm version

Build/Bundle the Project(s)

To build/bundle the project(s) using workflow.json configuration file

lib build

Or, to automatically detect and build the project(s) without workflow.json configuration file

lib build --workflow=auto

To learn more about the build command options, see Build Command Usage wiki, or run

lib build --help

Test the Project(s)

To run the test(s) using workflow.json configuration file.

lib test

Or, to automatically detect and run the test(s) without workflow.json configuration file.

lib test --workflow=auto

To learn more about the test command options, see Test Command Usage wiki, or run

lib test --help

Configuration (workflow.json file)

The following is an example workflow.json configuration for building and testing the Typescript library project.

{
  "projects": {
    "demo-project": {
      "root": "./",
      "tasks": {
        "build": {
          "outputPath": "dist/demo-project",
          "script": {
            "compilations": [
              {
                "declaration": true,
                "target": "ES2015",
                "outDir": "esm2015",
                "esBundle": {
                  "outputFile": "fesm2015/demo-project.js"
                }
              },
              {
                "declaration": false,
                "target": "es5",
                "outDir": "esm5",
                "esBundle": true,
                "umdBundle": {
                  "outputFile": "bundles/demo-project.umd.js"
                }
              }
            ],
            "tsConfig": "tsconfig.build.json",
            "entry": "public_api.ts",
            "umdId": "demo",
            "peerDependenciesAsExternals": true,
            "dependenciesAsExternals": true,
            "externals": {
              "tslib": "tslib"
            }
          }
        },
        "test": {
          "karmaConfig": "karma.conf.js",
          "testIndexFile": "test/test.ts",
          "tsConfig": "tsconfig.test.json",
          "envOverrides": {
            "ci": {
              "reporters": [
                "junit",
                "coverage"
              ],
              "codeCoverageExclude": [
                "**/test.ts",
                "**/index.ts",
                "**/public_api.ts"
              ],
              "browsers": [
                "ChromeHeadlessCI"
              ],
              "singleRun": true
            }
          }
        }
      }
    }
  }
}

To learn more about workflow configuration, see Build Workflow Configuration and Test Workflow Configuration.

Docs

Examples

Some Projects Using Lib Tools

  • Typescript/JavaScript Projects

    • translit-js - General purpose transliterate service for JavaScript applications
    • myanmar-text-extractor-js - Burmese language (Myanmar text) extractor JavaScript library for word segmentation, text extraction or syllable break
    • zawgyi-unicode-translit-rules - Zawgyi Unicode transliterate / convert regular expression rules in JavaScript
  • Angular Projects

General Discussions

We’re using the following discussion channels as a place to connect with other members of our community.

Feedback and Contributing

Check out our Contributing page.

License

This repository is licensed with the MIT license.