loading...
Cover image for Maintain Javascript Project Efficiently with GitHub Actions

Maintain Javascript Project Efficiently with GitHub Actions

designrknight profile image Abel Mathew ・2 min read

My Workflow

GitHub Actions to analyze the packages used in a JavaScript project. Helps maintainers have control over the packages used in the project.

What it does:

  • Lists the unused packages
  • Lists the expected size of the node modules after deployment

Submission Category:

Maintainer Must-Haves

Usage

Adding the following to your workflow will create a new job using the js-package-info Action.

on: [pull_request]

jobs:
  js-package-info:
    runs-on: ubuntu-latest
    name: An Action to analyze javascript packages
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
      with:
        node-version: '12'
    - run: npm install -g bundle-phobia-cli
    - run: npm install -g depcheck
    - name: Get Package Info
      uses: DesignrKnight/js-package-info@v2
      with:
        node_dir: './'
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Link to Code

GitHub logo DesignrKnight / js-package-info

GitHub Actions to analyze the packages used in a JavaScript project

JS Package Info

GitHub Actions to analyze the packages used in a JavaScript project. Helps mainatiners have control over the packages used in project.

What it does:

  • Lists the unused packages
  • Lists the expected size of the node modules after deployemnt

Usage

Adding the following to your workflow will create a new job using the js-package-info Actions.


jobs
  js-package-info
    runs-on: ubuntu-latest
    name: An Action to analyze javascript packages
    steps
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
      with:
        node-version: '12'
    - run: npm install -g bundle-phobia-cli
    - run: npm install -g depcheck
    - name: Get Package Info
      uses: DesignrKnight/js-package-info@v2
      with:
        node_dir: './'
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Inputs

node_dir

The default is ./. Change it to point to the relative location of the package.json file in the git repo. If the location is ./server/package.json, then the environment variable will be ./server/

GITHUB_TOKEN

The GitHub token from context is used to run…

Input Parameters

node_dir

The default is

./

. Change it to point to the relative location of the package.json file in the git repo. If the location is

./server/package.json

, then the environment variable will be

./server/

GITHUB_TOKEN

The GitHub token from context is used to run this Action. Leaving this unchanged should work for almost all use cases.

Additional Resources / Info

The Actions uses the following for its working

Cover Photo by Stanley Dai on Unsplash

Discussion

pic
Editor guide