Skip to content

Github Action that modifies the package.json and match dependency versions for a given base Angular version

License

Notifications You must be signed in to change notification settings

ngworker/angular-versions-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

GitHub Action - Match Angular Versions

This GitHub Action (written in JavaScript) modifies the root package.json of a project and replaces the version of all Angular related dependencies for given base version.

When necessary it updates the angular.json to use the correct builder.

ngworker

Usage

Pre-requisites

Create a workflow .yml file in your repositories .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

  • angular-version: The base Angular version used to match the dependency version. Ex: 8.0.x, 10.0.x. To check the full list of supported versions, see supported versions.
  • root-path: The path to the root folder of the project where the package.json and angular.json files are located. Defaults to ./.

Example workflow - match Angular versions

name: CI workflow

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        angular-version:
          - 6.0.x
          - 6.1.x
          - 7.0.x
          - 7.1.x
          - 7.2.x
          - 8.0.x
          - 8.1.x
          - 8.2.x
          - 9.0.x
          - 9.1.x
          - 10.0.x
          - 10.1.x
          - 10.2.x
          - 11.0.x
          - 11.1.x
          - 11.2.x
          - 12.0.x
          - 12.1.x
          - 12.2.x
          - 13.0.x

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js 12.x
        uses: actions/setup-node@v2
        with:
          node-version: 12.x
      - name: Use Angular ${{ matrix.angular-version }}
        uses: ngworker/angular-versions-action@v4
        with:
          angular-version: ${{ matrix.angular-version }}

      - run: yarn install
      - run: yarn lint
      - run: yarn build
      - run: yarn test

This example use the github matrix to build, lint and test your code against different versions of Angular. This should be specially useful for library authors.

Supported Angular versions

At the moment this actions supports a limited set of Angular versions listed below.

  • 6.0.x
  • 6.1.x
  • 7.0.x
  • 7.1.x
  • 7.2.x
  • 8.0.x
  • 8.1.x
  • 8.2.x
  • 9.0.x
  • 9.1.x
  • 10.0.x
  • 10.1.x
  • 10.2.x
  • 11.0.x
  • 11.1.x
  • 11.2.x
  • 12.0.x
  • 12.1.x
  • 12.2.x
  • 13.0.x

Managed packages

The following packages are managed by this action:

  • @angular/animations
  • @angular/cdk
  • @angular/cli
  • @angular/common
  • @angular/compiler
  • @angular/compiler-cli
  • @angular/core
  • @angular-builders/jest
  • @angular-devkit/build-angular
  • @angular-devkit/build-ng-packagr
  • @angular-devkit/schematics-cli
  • @angular/elements
  • @angular/forms
  • @angular/google-maps
  • @angular/material
  • @angular/platform-browser
  • @angular/platform-browser-dynamic
  • @angular/router
  • @angular/youtube-player
  • @types/node
  • codelyzer
  • ng-packagr
  • rxjs
  • tsickle
  • tslib
  • tslint
  • ts-node
  • typescript
  • zone.js

Additional features

  • Replace the angular.json library builder (ng-packagr) based on the angular version.
    • Use @angular-devkit/build-ng-packagr:build for version prior (<) Angular 10.1
    • Use @angular-devkit/build-angular:ng-packagr for version post (>=) Angular 10.1
  • Remove allowedCommonJsDependencies options on Angular versions under 10

Contributing

We would love you to contribute to @ngworker/angular-versions-action, pull requests are welcome! Please see the CONTRIBUTING.md for more information.

Contributors

Thanks goes to these wonderful people (emoji key):


Nacho Vazquez

💬 🐛 💼 💻 📖 💡 🤔 🚇 🚧 📆 👀 🛡️ ⚠️ 🔧 📓

Lars Gyrup Brink Nielsen

🐛 💻 📖 💡 🤔 🚇 🚧 🧑‍🏫 📦 🔌 👀 ⚠️

Tim Deschryver

📖

profanis

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

License

The scripts and documentation in this project are released under the MIT License

About

Github Action that modifies the package.json and match dependency versions for a given base Angular version

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages