Skip to content

comparis/github-action-yarn-forbid-portals

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yarn Forbid Portals GitHub Action

A GitHub Action that stops the workflow if portals are set in package.json files.

Motivation

Yarn Modern (yarn >= 2) changed the way dependencies are linked between projects (i.e.: when using a custom component library).

Instead of using symbolic links, it adds a few rows in the resolution section of the package.json file (see yarn link). The problem with this solution, is that it will use the full path of the package in the file system, which will almost inevitably be invalid in another system.

This GitHub Action will check if the portal: keyword is used in the package.json file and return an error, blocking the entire workflow.

If needed, I might extend the functionality to automatically remove the portals and commit the changed files.

Please note that this action doesn't check the yarn.lock file at the moment, which can still contain the wrong references.

Usage

steps:
  ...
  - name: Forbid portals
    uses: comparis/[email protected]
    with:
      # Optional file list
      # Defaults to "./package.json"
      files: |
        package.json

If you want to check multiple package.json files, use the following array syntax:

files: |
  package.json
  packages/package1-name/package.json
  packages/package2-name/package.json

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A GitHub Action to stop the workflow if portals are detected

Resources

License

Stars

Watchers

Forks

Packages

No packages published