@ng-easy/npm-setup
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

@ng-easy/npm-setup

CI npm latest version Downloads semantic-release renovate

Opinionated zero-config GitHub Action to automate the installation of npm dependencies for Angular projects and Nx workspaces.

It is heavily inspired of npm-install GitHub action, and it might be used for other Node projects as well, as long as these requirements are met:

  • Use npm as dependency manager, others not supported
  • Have a package-lock.json and run npm ci for installation
  • Just use a root node_modules

The approach taken for caching is:

  • Try to restore node_modules if there is an exact match for package-lock.json
  • If not, restore ~/.npm based on package-lock.json and package.json, and use rolling cache to avoid cache snowball
  • Detects if Cypress is a dependency, if so caches its installation
  • Detects if Angular is a dependency, if so caches its build artifacts
  • Caches Nx local execution cache instead of relying on Nx Cloud if an input is provided, using rolling cache as well

Usage

name: main
on: [push]

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    name: Build and test
    steps:
      - uses: actions/checkout@v2
      - uses: ng-easy/npm-install@v2
      - run: npm run build

If you want to cache Nx local execution cache then pass nx-key input:

- uses: ng-easy/npm-install@v2
  with:
    nx-key: build # or any other key you want to use for the cache that uniquely identifies the job in the workflow

Package Sidebar

Install

npm i @ng-easy/npm-setup

Weekly Downloads

2

Version

4.0.0

License

MIT

Unpacked Size

31.6 kB

Total Files

24

Last publish

Collaborators

  • samuel.fernandez