From 4ce8874c40df9b995d6f358158a81282a76c6b1c Mon Sep 17 00:00:00 2001 From: j3lte Date: Wed, 22 Nov 2023 15:39:29 +0100 Subject: [PATCH] License check --- .github/workflows/test.yml | 2 +- dev_deps.ts | 1 - scripts/check-license.ts | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a7f2dac..05a9c3c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: run: deno lint - name: Check license - run: deno run check:license + run: deno task check:license - name: Tests run: deno task test diff --git a/dev_deps.ts b/dev_deps.ts index 211c28c..ce759db 100644 --- a/dev_deps.ts +++ b/dev_deps.ts @@ -9,4 +9,3 @@ export { emptyDir } from "https://deno.land/std@0.207.0/fs/mod.ts"; export { MockFetch } from "https://deno.land/x/deno_mock_fetch@1.0.1/mod.ts"; export { resolvesNext, stub } from "https://deno.land/std@0.207.0/testing/mock.ts"; export { walk } from "https://deno.land/std@0.207.0/fs/walk.ts"; -export { globToRegExp } from "https://deno.land/std@0.207.0/path/glob.ts"; diff --git a/scripts/check-license.ts b/scripts/check-license.ts index 3f932c7..2e966c0 100644 --- a/scripts/check-license.ts +++ b/scripts/check-license.ts @@ -1,9 +1,8 @@ // Copyright 2023 J.W. Lagendijk. All rights reserved. MIT license. -import { globToRegExp, walk } from "../dev_deps.ts"; +import { walk } from "../dev_deps.ts"; const EXTENSIONS = [".ts"]; -const EXCLUDED_DIRS = ["cov"]; const ROOT = new URL("../", import.meta.url); const CHECK = Deno.args.includes("--check"); @@ -19,7 +18,7 @@ for await ( const { path } of walk(ROOT, { exts: EXTENSIONS, skip: [ - ...EXCLUDED_DIRS.map((path) => globToRegExp(path)), + /\.coverage/, /node_modules/, /npm/, /_local_testing\.ts/, @@ -27,6 +26,7 @@ for await ( includeDirs: false, }) ) { + console.log("Checking " + path); const content = await Deno.readTextFile(path); const match = content.match(RX_COPYRIGHT);