DEV Community

Cover image for Maintain Javascript Project Efficiently with GitHub Actions
Abel Mathew
Abel Mathew

Posted on

2 2

Maintain Javascript Project Efficiently with GitHub Actions

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 }}
Enter fullscreen mode Exit fullscreen mode

Link to Code

GitHub logo DesignrKnight / js-package-info

GitHub Actions to analyze the packages used in a JavaScript project

JS Package Info

GitHub Action 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

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…

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

SurveyJS custom survey software

Simplify data collection in your JS app with a fully integrated form management platform. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more. Integrates with any backend system, giving you full control over your data and no user limits.

Learn more

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay