Socket
Socket
Sign inDemoInstall

eci-ui-components

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eci-ui-components

- [Setup](#setup) - [How to Publish](#how-to-publish) - [Test Coverage Threshold](#test-coverage-threshold)


Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Web Package Template

  • Setup
  • How to Publish
  • Test Coverage Threshold

Setup

Step 1: Create a new repo using this template

Option 1: via new repo page Screen Shot 2020-01-07 at 18 58 28

Option 2: via this repo Screen Shot 2020-01-09 at 13 59 08

Step 2: Clone your new repo

$ git clone git@github.com:traveloka/<repo_name>.git
& cd <repo_name>

Step 3: Setup your new repo

$ yarn setup

That's it! Have fun 😉

How to Publish

Cut a tag

$ yarn prepare-release
$ git push --follow-tags

Under the hood, the yarn prepare-release command uses standard-version utility to do the following tasks (simplified):

  • NPM package version bump
  • Changelog generation (if your commit message follows the Conventional Commits standard)
  • Git tagging

Finally, the second command will push your newly created tag to your remote & trigger the automated publishing process. To see the progress, just click on the "Actions" tab on your Github repo page.

Screen Shot 2020-01-13 at 17 37 28

Test Coverage Threshold

Note: The following is not mandatory and is meant only for a reference if you choose to enable it.

This template comes with Jest testing framework (as part of tsdx toolchain). Jest natively supports coverage reporting and adding thresholds which can help you maintain code quality. To enable it, simply follow these steps:

Step 1: Add coverage threshold config to package.json

{
  ...,
  "jest": {
    ...,
    "coverageThreshold": {
      "global": {
        "branches": 50,
        "functions": 50,
        "lines": 50,
        "statements": 50
      }
    }
  }
}

You can also apply more specific rules to certain glob patterns:

{
  ...,
  "jest": {
    ...,
    "coverageThreshold": {
      "global": {
        "branches": 50,
        "functions": 50,
        "lines": 50,
        "statements": 50
      },
      "./src/components/": {
        "branches": 40,
        "statements": 40
      },
      "./src/reducers/**/*.js": {
        "statements": 90
      },
      "./src/api/very-important-module.js": {
        "branches": 100,
        "functions": 100,
        "lines": 100,
        "statements": 100
      }
    }
  }
}

Step 2: Enable coverage reporting flags in test script

In your package.json:

{
  ...,
  "scripts": {
    ...,
-   "test": "tsdx test --env=jsdom",
+   "test": "tsdx test --env=jsdom --coverage --coverage-reporters=none"
  }
}

After this, your test will fail if the coverage doesn't meet the threshold specified in step 1. This configuration also applies to continuous integration (CI).

FAQs

Package last updated on 26 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc