mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Tools: Check licenses for one package
This commit is contained in:
parent
1f2930f037
commit
8a836ea4f9
@ -1,6 +1,8 @@
|
||||
import { readdir, stat, writeFile } from 'fs-extra';
|
||||
import { chdir, cwd } from 'process';
|
||||
import { execCommand2, rootDir } from './tool-utils';
|
||||
import yargs = require('yargs');
|
||||
import { rtrimSlashes } from '@joplin/lib/path-utils';
|
||||
|
||||
interface LicenseInfo {
|
||||
licenses: string;
|
||||
@ -33,14 +35,22 @@ const enforceString = (line: any): string => {
|
||||
};
|
||||
|
||||
async function main() {
|
||||
const argv = await yargs.argv;
|
||||
const pathToCheck = rtrimSlashes(argv._.length ? argv._[0].toString() : '');
|
||||
|
||||
const directories: string[] = [];
|
||||
const packageItems = await readdir(`${rootDir}/packages`);
|
||||
for (const item of packageItems) {
|
||||
const fullPath = `${rootDir}/packages/${item}`;
|
||||
if (pathToCheck && !fullPath.endsWith(pathToCheck)) continue;
|
||||
|
||||
const info = await stat(fullPath);
|
||||
if (info.isDirectory()) directories.push(fullPath);
|
||||
}
|
||||
directories.push(rootDir);
|
||||
|
||||
if (!pathToCheck || rootDir.endsWith(pathToCheck)) {
|
||||
directories.push(rootDir);
|
||||
}
|
||||
|
||||
let licenses: Record<string, LicenseInfo> = {};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user