@procore/license-check
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@procore/license-check

Validates that the licenses of a project do not violate Procore's software license requirements. Works for both monorepos as well as single-module projects.

Quick Start

This package can either be installed in a project or run directly using npx/pnpx. Additionally, the package provides an API that can be invoked in code.

Install inside of project
yarn add -D @procore/license-check # or npm, pnpm

Then run the command:

yarn license-check check
Execute directly using npx/pnpx
npx @procore/license-check check
Invoked in JavaScript code

Install in project

yarn add -D @procore/license-check # or npm, pnpm

Then use!

import { checkLicenses } from '@procore/license-check'

const startDir = process.cwd()
const forbiddenLicenses = ['GPL-3.0-only']

await checkLicenses(startDir, forbiddenLicenses)

CLI Commands

Usage:
  $ license-check

Commands:
  check [startDir]  license check


For more info, run any command with the `--help` flag:
  $ license-check check --help
  $ license-check --help

Options:
  -h, --help     Display this message
  -v, --version  Display version number

API Methods

checkLicenses(startDir: string, forbiddenLicenses?: Array<string>): Promise<Array<{ name: string; invalid: Array<string>}>>

Returns a list of each workspace in project, along with which licenses are invalid

Parameters:

  • startDir: string: the root directory of the project to evaluate.
  • forbiddenLicenses: Array<string> (defaults to Procore's forbidden licenses): the list of licenses that should be considered invalid.

Returns:

An array of results objects containing the following properties:

  • name: string: the name of the project, as specified in its package.json file.
  • invalid: Array<string>: the package names and versions that violated the license check.
Example
import { checkLicenses } from '@procore/license-check'

const startDir = process.cwd()
const results = await checkLicenses(startDir)

checkLicensesCLI(startDir: string, forbiddenLicenses?: Array<string>): Promise<void>

Executes the license, and formats the output into an easy-to-read format.

Parameters:

  • startDir: string: the root directory of the project to evaluate.
  • forbiddenLicenses: Array<string> (defaults to Procore's forbidden licenses): the list of licenses that should be considered invalid.

NOTE:

  • If there are invalid licenses, the output will be written to stderr, and program will exit with an exit code of -1.
  • If all licenses are valid, and short message will be output to stdout.
Example
import { checkLicensesCLI } from '@procore/license-check'

const startDir = process.cwd()
await checkLicensesCLI(startDir)

Development

This project uses pnpm, and supports the following commands:

  • build: builds and bundles the project.
  • format: runs prettier on the project.
  • test: runs the unit test suite, reporting coverage.
  • test:dev: run the unit test suite in watch mode.

Readme

Keywords

Package Sidebar

Install

npm i @procore/license-check

Weekly Downloads

192

Version

2.0.1

License

SEE LICENSE IN LICENSE

Unpacked Size

44.2 kB

Total Files

8

Last publish

Collaborators

  • alyelashram_procore
  • melch-procore
  • peterknif
  • moaz-ashraf
  • attachi
  • a.elbadawei
  • hyogman
  • dmitri_wm
  • stephanie.brereton
  • procore-oss-user
  • stevenkang3
  • max.helmetag
  • codyrobertsprocore
  • miguel.garcia-procore
  • magdyyx
  • atoaima
  • mustafa-abdelrahman
  • elewando-procore
  • ahmed.ghorab
  • lnspatz914
  • richard.bunn
  • omar.wagdy
  • mona.khairbek
  • mbartlett413
  • cody_schindler_procore
  • yoasyo25
  • ritchlee
  • andersontr15
  • steven.hinkle
  • jamie-dugan-procore
  • hgouhierprocore
  • denzylbalram
  • sarah.freitas
  • alan.bresani
  • amyprocore
  • yoyis3000
  • elijah.procore
  • mike-arndt-procore
  • jnhoang1
  • pam-whisenhunt
  • shradha.khard
  • david-christensen-procore
  • javio-procore
  • chance.eakin.procore
  • gideon-procore
  • ihor.diachenko_procore
  • justinmwatts
  • tedyang
  • jyang-procore
  • pwhisenhunt-procore
  • fairchild
  • rodayna.ehab
  • neil1023
  • scottstern
  • brian.smith1
  • g2mitchell
  • dlameter-procore
  • kylepietz
  • abhijit-procore
  • lhuang325
  • jake-pitkin
  • erikthoreson
  • simona.iancu
  • decha-sanson
  • aberkowitz
  • asamay
  • mustafa-u-abdelrahman
  • rajatmenhdiratta
  • jacksonleach-procore
  • pmfrawley
  • phunguyen-pcor
  • tatsiana.clifton
  • deiab
  • srichaitanya.peddinti
  • kenny.foisy
  • matheusprocore
  • jgreene_procore
  • hectorthiele
  • etokarev
  • daniel.ferreira-contractor
  • dmccraw-procore
  • cyrille.bai
  • greg.sparks
  • fabiomelo513
  • phil.custer
  • bbreyel921
  • amir-iskander
  • neil.mckeeman
  • nickprocore
  • lzhou888
  • davidshure
  • stevenliprocore
  • ramysaid2
  • refaiepcn
  • jgentes
  • faraz.hanif
  • mostafaeltazy
  • agamaleldin
  • andrew.isaac
  • saranahal2
  • rodrigo.dejuana
  • kellen.stewart
  • bill-wagner
  • ezrasimeloff
  • jeffgiaquinto
  • gturkadze
  • sean.spearman.procore
  • kylemartinez-procore
  • roobo-romeski
  • andres-mendez-procore
  • gaurav.sharma.procore
  • tracy.otto
  • sarah.heredia
  • victorbendeck-pc
  • cbathgate
  • davidkangpro
  • kyle.liu
  • amin.jaipuri
  • grafffffff
  • mishaelowoyemi
  • evan.cerwonka.procore
  • ilya.dryha-contractor
  • varomir
  • yogevfine1
  • timofeee
  • matt.harris0223
  • winson.chu
  • andersonbispoprocore
  • scorgiat-procore
  • ladavarga
  • procore_halzy
  • enyaga
  • willpankonien
  • sateesh-kadiyala-procore
  • chris.berber
  • txin1
  • epalinprocore
  • mehrdad-panahandeh
  • tyler.wasden.procore
  • jeremy.lund
  • dineshkumar.jayak
  • ryanfuentesprocore
  • stajics
  • brocktillotsonprocore
  • kyle.williams
  • dtorres-procore
  • noor.ali
  • ari-procore
  • alanprocore
  • jl4ever
  • james.lawson
  • ajaykumar-procore
  • dennis.heckman
  • tara.chambers
  • lalovar-procore
  • james.cleary
  • chadryder
  • devin.cunningham.procore
  • abhijit.patwardhan
  • lydiahara
  • sherylnapigkit
  • changprocore
  • apcarroll_procore
  • andy.mayer
  • bob.laskowski
  • vinaya-procore
  • kahliholmes
  • andrew.wheeler
  • leandro-proc
  • yadhu.prakash
  • jason-kaye
  • jesse.olsen
  • patrick.lardin
  • brad.urani
  • allenanle.procore
  • brookyboy009
  • uddhavjoglekar
  • dancingshell
  • rysmithprocore
  • robbiegprocore
  • jadamsss
  • jeremy.bouzigard
  • timdoherty
  • b.bookout
  • jalyng
  • htael
  • dev-account-admin
  • sseanwang
  • bhargavrnd
  • farismmk
  • dannyporrello
  • danny.ou
  • messanjah
  • eyvettesou
  • jgee67
  • cagmz
  • mariah_delaney
  • lukenispel
  • kimhin267
  • juliana.hernandez
  • judy-lu-pc
  • procore-it-support
  • andrewburke-pc
  • jkleintech
  • rachel.arkebauer
  • procore-npm-bot
  • james.dabbs-procore
  • laurenbrandsteinprocore
  • scottbieser-procore
  • zach.mckenzie.procore
  • shayonj_procore
  • heplayskeys
  • mike.south
  • thomasoboyle
  • dischorde
  • derek-carter-procore
  • dlgasser
  • cfprocore
  • evan.waits
  • jeremy-marcus
  • jmejia-fsl
  • ersgonzalo
  • stephan-procore
  • aleclarsenprocore
  • yihai.zweifel
  • jay-rajan
  • jacky-lei
  • peter.jin