-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
231 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
/* eslint-disable n/no-process-exit, n/no-extraneous-require,@typescript-eslint/no-require-imports */ | ||
'use strict' | ||
const fs = require('fs') | ||
const path = require('path') | ||
const shell = require('shelljs') | ||
// @ts-check | ||
|
||
import fs from 'fs' | ||
import path from 'path' | ||
import checker from 'license-checker' | ||
import { createRequire } from 'module' | ||
|
||
const require = createRequire(import.meta.url) | ||
|
||
const DEBUG = false | ||
|
||
function getDirectories(source) { | ||
return fs | ||
|
@@ -14,20 +20,36 @@ function getDirectories(source) { | |
const sharedPackages = getDirectories(path.resolve('./shared/packages')) | ||
if (sharedPackages.length < 4) throw new Error('expected more shared/packages') | ||
|
||
const ROOT_VERSION = require('../package.json').version | ||
const CURRENT_VERSION = require('@shared/api/package.json').version | ||
|
||
const allowPackages = [ | ||
`[email protected]`, | ||
`[email protected]`, | ||
`[email protected]`, | ||
`[email protected]`, | ||
`[email protected]`, | ||
...sharedPackages.map((pkg) => `@shared/${pkg}@${CURRENT_VERSION}`), | ||
`superconductor-monorepo@${ROOT_VERSION}`, | ||
`superconductor@${CURRENT_VERSION}`, | ||
`tsr-bridge@${CURRENT_VERSION}`, | ||
] | ||
|
||
const cmd = ['yarn', 'sofie-licensecheck', '--allowPackages', `"${allowPackages.join(';')}"`] | ||
|
||
const res = shell.exec(cmd.join(' ')) | ||
process.exit(res.code) | ||
checker.init( | ||
{ | ||
start: path.resolve('.'), | ||
onlyAllow: 'MIT;BSD;ISC;Apache-2.0;CC0;CC-BY-3.0;CC-BY-4.0;Unlicense;Artistic-2.0;Python-2.0;BlueOak-1.0.0', | ||
excludePackages: allowPackages.join(';'), | ||
summary: !DEBUG, | ||
}, | ||
(err, packages) => { | ||
if (err) { | ||
//Handle error | ||
console.error(err) | ||
process.exit(1) | ||
} else { | ||
if (DEBUG) { | ||
console.log(packages) | ||
} | ||
process.exit(0) | ||
} | ||
} | ||
) |
Oops, something went wrong.