@ac-tool/notices 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @ac-tool/notices
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 5c203e7: `ac-notices` no longer writes a package's `THIRD-PARTY-NOTICES.md` when its policy refuses a licence: the file it had, if any, is left as it was, and the run still exits 1. The usage text and the argument parser are both derived from the new `NOTICES_COMMAND` option table (also exported from `@ac-tool/notices/command`, with `NOTICES_EXIT_CODES`), so `--help` now shows `--root <directory>` as the parser reads it. The `homepage` points at the command's manual page.
8
+ - Updated dependencies [5c203e7]
9
+ - Updated dependencies [5c203e7]
10
+ - Updated dependencies [5c203e7]
11
+ - Updated dependencies [5c203e7]
12
+ - Updated dependencies [5c203e7]
13
+ - @ac-kit/core@0.14.0
14
+ - @ac-kit/node@0.13.0
15
+ - @ac-kit/format-markdown@0.2.4
16
+ - @ac-kit/format-semver@0.1.3
17
+ - @ac-kit/format-spdx@0.1.3
18
+ - @ac-kit/format-yaml@0.2.11
19
+
3
20
  ## 0.1.2
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -19,7 +19,11 @@ script; the configuration below imports it anyway.
19
19
 
20
20
  Options: `--root <directory>` (default: the current directory),
21
21
  `--config <file>`, `--help`. The exit code is `0` when every licence is
22
- allowed, `1` when one is not or the run fails, `2` on a usage error.
22
+ allowed, `1` when one is not or the run fails, `2` on a usage error. A package
23
+ with a licence its policy does not allow gets no `THIRD-PARTY-NOTICES.md`: the
24
+ file it had, if any, is left as it was. The
25
+ [manual page](https://anthochamp.pages.grenadine.io/node-essentials/tool/ac-notices/)
26
+ has every option, file and exit status.
23
27
 
24
28
  The configuration is a module in the root — `notices.config.js`, `.mjs`, `.ts`
25
29
  or `.mts` (TypeScript needs a Node.js that strips types) — whose default export
@@ -92,8 +96,11 @@ const markdown = renderNotices("@acme/app", packages);
92
96
  ```
93
97
 
94
98
  `runNotices(targets, options)` does all three for several packages, writing
95
- each file atomically, and `runNoticesCli(args, options)` is the command itself,
96
- with its output routed to your own functions. Every function that reads files
99
+ each file atomically when its policy allows every licence, and
100
+ `runNoticesCli(args, options)` is the command itself, with its output routed to
101
+ your own functions. `NOTICES_COMMAND` (also at `@ac-tool/notices/command`) is
102
+ the command's option table, from which its usage and its argument parser are
103
+ both derived, with `NOTICES_EXIT_CODES`. Every function that reads files
97
104
  takes a `signal`.
98
105
 
99
106
  The SPDX evaluation is `@ac-kit/format-spdx`, the version ordering
@@ -0,0 +1,44 @@
1
+ /** One option of {@link NOTICES_COMMAND}: a long flag, with or without a value. */
2
+ export type NoticesCommandOption = {
3
+ /** The flag without its dashes: `check` for `--check`. */
4
+ readonly name: string;
5
+ /** The value's placeholder, as the usage shows it, or `null` for a switch. */
6
+ readonly argument: string | null;
7
+ /** One line, as the usage prints it. */
8
+ readonly description: string;
9
+ };
10
+ /** What `ac-notices` may exit with, and why. */
11
+ export declare const NOTICES_EXIT_CODES: {
12
+ /** Every licence is allowed. */
13
+ readonly success: 0;
14
+ /**
15
+ * A licence is not allowed, a required peer dependency is missing, or the run
16
+ * failed.
17
+ */
18
+ readonly failure: 1;
19
+ /** An unknown option, or an option without its value. */
20
+ readonly usageError: 2;
21
+ };
22
+ /**
23
+ * The `ac-notices` command, as data: its usage text and its argument parser are
24
+ * both derived from it, and so is its manual page, so none of them can drift
25
+ * from the others.
26
+ */
27
+ export declare const NOTICES_COMMAND: {
28
+ readonly name: string;
29
+ /** What the command does, in one line. */
30
+ readonly summary: string;
31
+ /** The command line: every option but `--help`, in brackets. */
32
+ readonly synopsis: string;
33
+ /** The paragraph the usage prints under the synopsis. */
34
+ readonly description: string;
35
+ readonly options: readonly NoticesCommandOption[];
36
+ /** The environment variables the command reads: none. */
37
+ readonly environment: readonly {
38
+ readonly name: string;
39
+ readonly description: string;
40
+ }[];
41
+ };
42
+ /** The usage `ac-notices --help` prints, and a usage error ends with. */
43
+ export declare function formatNoticesUsage(): string;
44
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAGA,mFAAmF;AACnF,MAAM,MAAM,oBAAoB,GAAG;IAClC,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,gDAAgD;AAChD,eAAO,MAAM,kBAAkB;IAC9B,gCAAgC;aAChC,OAAO,EAAE,CAAC;IACV;;;OAGG;aACH,OAAO,EAAE,CAAC;IACV,yDAAyD;aACzD,UAAU,EAAE,CAAC;CACJ,CAAC;AAiBX;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAClD,yDAAyD;IACzD,QAAQ,CAAC,WAAW,EAAE,SAAS;QAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;KAC7B,EAAE,CAAC;CAeJ,CAAC;AAEF,yEAAyE;AACzE,wBAAgB,kBAAkB,IAAI,MAAM,CAW3C"}
@@ -0,0 +1,69 @@
1
+ import { NOTICES_CONFIG_FILE_NAMES } from "./config.js";
2
+ import { NOTICES_FILE_NAME } from "./run-notices.js";
3
+ /** What `ac-notices` may exit with, and why. */
4
+ export const NOTICES_EXIT_CODES = {
5
+ /** Every licence is allowed. */
6
+ success: 0,
7
+ /**
8
+ * A licence is not allowed, a required peer dependency is missing, or the run
9
+ * failed.
10
+ */
11
+ failure: 1,
12
+ /** An unknown option, or an option without its value. */
13
+ usageError: 2,
14
+ };
15
+ const OPTIONS_ = [
16
+ { name: "check", argument: null, description: "report only, write nothing" },
17
+ {
18
+ name: "root",
19
+ argument: "directory",
20
+ description: "the root package's directory",
21
+ },
22
+ {
23
+ name: "config",
24
+ argument: "file",
25
+ description: `the configuration module (default: ${configFileNames_()} in the root)`,
26
+ },
27
+ { name: "help", argument: null, description: "print this help" },
28
+ ];
29
+ /**
30
+ * The `ac-notices` command, as data: its usage text and its argument parser are
31
+ * both derived from it, and so is its manual page, so none of them can drift
32
+ * from the others.
33
+ */
34
+ export const NOTICES_COMMAND = {
35
+ name: "ac-notices",
36
+ summary: "write and check the third-party notices of a JavaScript workspace",
37
+ synopsis: [
38
+ "ac-notices",
39
+ ...OPTIONS_.filter((option) => option.name !== "help").map((option) => `[${formatFlag_(option)}]`),
40
+ ].join(" "),
41
+ description: `Writes ${NOTICES_FILE_NAME} beside each distributed package of the workspace
42
+ at <directory> (default: the current directory), and reports every
43
+ third-party licence its policy does not allow.`,
44
+ options: OPTIONS_,
45
+ environment: [],
46
+ };
47
+ /** The usage `ac-notices --help` prints, and a usage error ends with. */
48
+ export function formatNoticesUsage() {
49
+ const flags = NOTICES_COMMAND.options.map(formatFlag_);
50
+ const width = Math.max(...flags.map((flag) => flag.length)) + 2;
51
+ const lines = NOTICES_COMMAND.options.map((option, index) => ` ${flags[index].padEnd(width)}${option.description}`);
52
+ return `Usage: ${NOTICES_COMMAND.synopsis}
53
+
54
+ ${NOTICES_COMMAND.description}
55
+
56
+ ${lines.join("\n")}`;
57
+ }
58
+ function formatFlag_(option) {
59
+ return option.argument === null
60
+ ? `--${option.name}`
61
+ : `--${option.name} <${option.argument}>`;
62
+ }
63
+ /** `notices.config.{js,mjs,ts,mts}`, from the names the loader tries. */
64
+ function configFileNames_() {
65
+ const extensions = NOTICES_CONFIG_FILE_NAMES.map((name) => name.slice(name.lastIndexOf(".") + 1));
66
+ const stem = NOTICES_CONFIG_FILE_NAMES[0].slice(0, NOTICES_CONFIG_FILE_NAMES[0].lastIndexOf("."));
67
+ return `${stem}.{${extensions.join(",")}}`;
68
+ }
69
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAYrD,gDAAgD;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,gCAAgC;IAChC,OAAO,EAAE,CAAC;IACV;;;OAGG;IACH,OAAO,EAAE,CAAC;IACV,yDAAyD;IACzD,UAAU,EAAE,CAAC;CACJ,CAAC;AAEX,MAAM,QAAQ,GAAoC;IACjD,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAC5E;QACC,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,WAAW;QACrB,WAAW,EAAE,8BAA8B;KAC3C;IACD;QACC,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,sCAAsC,gBAAgB,EAAE,eAAe;KACpF;IACD,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE;CAChE,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAcxB;IACH,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,mEAAmE;IAC5E,QAAQ,EAAE;QACT,YAAY;QACZ,GAAG,QAAQ,CAAC,MAAM,CAAC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D,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CACrC,CAAC;IACF,MAAM,IAAI,GAAG,yBAAyB,CAAC,CAAC,CAAE,CAAC,KAAK,CAC/C,CAAC,EACD,yBAAyB,CAAC,CAAC,CAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAC9C,CAAC;IACF,OAAO,GAAG,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAC5C,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./collect-dependencies.js";
2
+ export * from "./command.js";
2
3
  export * from "./config.js";
3
4
  export * from "./render-notices.js";
4
5
  export * from "./run-notices.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./collect-dependencies.js";
2
+ export * from "./command.js";
2
3
  export * from "./config.js";
3
4
  export * from "./render-notices.js";
4
5
  export * from "./run-notices.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -16,9 +16,9 @@ export type RunNoticesCliOptions = {
16
16
  * Plug'n'Play install (`.pnp.cjs`) is refused.
17
17
  *
18
18
  * @param args The arguments after the command name.
19
- * @returns The exit code: `0` on success, `1` when a licence is not allowed, a
20
- * required peer dependency is missing or the run fails (an abort included),
21
- * `2` on a usage error.
19
+ * @returns The exit code, one of {@link NOTICES_EXIT_CODES}: `0` on success,
20
+ * `1` when a licence is not allowed, a required peer dependency is missing or
21
+ * the run fails (an abort included), `2` on a usage error.
22
22
  */
23
23
  export declare function runNoticesCli(args: readonly string[], options?: RunNoticesCliOptions | null): Promise<number>;
24
24
  //# sourceMappingURL=run-notices-cli.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-notices-cli.d.ts","sourceRoot":"","sources":["../src/run-notices-cli.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAyB,MAAM,cAAc,CAAC;AAapE,MAAM,MAAM,oBAAoB,GAAG;IAClC,yEAAyE;IACzE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IAClD,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACrC,CAAC;AAgBF;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAClC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,GACnC,OAAO,CAAC,MAAM,CAAC,CA4FjB"}
1
+ {"version":3,"file":"run-notices-cli.d.ts","sourceRoot":"","sources":["../src/run-notices-cli.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAyB,MAAM,cAAc,CAAC;AAkBpE,MAAM,MAAM,oBAAoB,GAAG;IAClC,yEAAyE;IACzE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IAClD,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACrC,CAAC;AAKF;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAClC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,GACnC,OAAO,CAAC,MAAM,CAAC,CA6FjB"}
@@ -4,18 +4,9 @@ import { parseArgs } from "node:util";
4
4
  import { formatError, isObject } from "@ac-kit/core";
5
5
  import { parseYaml } from "@ac-kit/format-yaml";
6
6
  import { isFileAsync, listWorkspaces, readFileOrNull, readPackageManifest, } from "@ac-kit/node";
7
+ import { formatNoticesUsage, NOTICES_COMMAND, NOTICES_EXIT_CODES, } from "./command.js";
7
8
  import { loadNoticesConfig } from "./config.js";
8
9
  import { runNotices } from "./run-notices.js";
9
- const USAGE_ = `Usage: ac-notices [--check] [--root <directory>] [--config <file>]
10
-
11
- Writes THIRD-PARTY-NOTICES.md beside each distributed package of the workspace
12
- at <directory> (default: the current directory), and reports every
13
- third-party licence its policy does not allow.
14
-
15
- --check report only, write nothing
16
- --root <dir> the root package's directory
17
- --config <file> the configuration module (default: notices.config.{js,mjs,ts,mts} in the root)
18
- --help print this help`;
19
10
  const PNPM_WORKSPACE_FILE_ = "pnpm-workspace.yaml";
20
11
  const YARN_PNP_FILE_ = ".pnp.cjs";
21
12
  /**
@@ -26,9 +17,9 @@ const YARN_PNP_FILE_ = ".pnp.cjs";
26
17
  * Plug'n'Play install (`.pnp.cjs`) is refused.
27
18
  *
28
19
  * @param args The arguments after the command name.
29
- * @returns The exit code: `0` on success, `1` when a licence is not allowed, a
30
- * required peer dependency is missing or the run fails (an abort included),
31
- * `2` on a usage error.
20
+ * @returns The exit code, one of {@link NOTICES_EXIT_CODES}: `0` on success,
21
+ * `1` when a licence is not allowed, a required peer dependency is missing or
22
+ * the run fails (an abort included), `2` on a usage error.
32
23
  */
33
24
  export async function runNoticesCli(args, options) {
34
25
  const stdout = options?.stdout ?? console.log;
@@ -38,28 +29,26 @@ export async function runNoticesCli(args, options) {
38
29
  try {
39
30
  ({ values } = parseArgs({
40
31
  args: [...args],
41
- options: {
42
- check: { type: "boolean" },
43
- root: { type: "string" },
44
- config: { type: "string" },
45
- help: { type: "boolean" },
46
- },
32
+ options: Object.fromEntries(NOTICES_COMMAND.options.map((option) => [
33
+ option.name,
34
+ { type: option.argument === null ? "boolean" : "string" },
35
+ ])),
47
36
  }));
48
37
  }
49
38
  catch (error) {
50
39
  stderr(error.message);
51
- stderr(USAGE_);
52
- return 2;
40
+ stderr(formatNoticesUsage());
41
+ return NOTICES_EXIT_CODES.usageError;
53
42
  }
54
- if (values.help === true) {
55
- stdout(USAGE_);
56
- return 0;
43
+ if (values["help"] === true) {
44
+ stdout(formatNoticesUsage());
45
+ return NOTICES_EXIT_CODES.success;
57
46
  }
58
47
  try {
59
- const check = values.check === true;
60
- const root = resolve(options?.cwd ?? process.cwd(), values.root ?? ".");
48
+ const check = values["check"] === true;
49
+ const root = resolve(options?.cwd ?? process.cwd(), stringOption_(values["root"]) ?? ".");
61
50
  signal?.throwIfAborted();
62
- const config = await loadNoticesConfig(root, values.config);
51
+ const config = await loadNoticesConfig(root, stringOption_(values["config"]));
63
52
  const rootManifest = await readPackageManifest(root, { signal });
64
53
  const workspaces = await listRootWorkspaces_(root, signal);
65
54
  const packages = workspaces.length > 0
@@ -100,16 +89,20 @@ export async function runNoticesCli(args, options) {
100
89
  stderr(`${problem.workspace}: ${problem.message}`);
101
90
  }
102
91
  if (problems.length > 0) {
103
- return 1;
92
+ return NOTICES_EXIT_CODES.failure;
104
93
  }
105
94
  stdout(`${targets.length} ${targets.length === 1 ? "package" : "packages"} ${check ? "checked" : "written"}`);
106
- return 0;
95
+ return NOTICES_EXIT_CODES.success;
107
96
  }
108
97
  catch (error) {
109
98
  stderr(formatError(error));
110
- return 1;
99
+ return NOTICES_EXIT_CODES.failure;
111
100
  }
112
101
  }
102
+ /** A string option's value: `parseArgs` gives a switch `true` instead. */
103
+ function stringOption_(value) {
104
+ return typeof value === "string" ? value : null;
105
+ }
113
106
  /**
114
107
  * The root's workspaces: `pnpm-workspace.yaml`'s `packages` when that file
115
108
  * exists (pnpm ignores the manifest's `workspaces`), the manifest's
@@ -1 +1 @@
1
- {"version":3,"file":"run-notices-cli.js","sourceRoot":"","sources":["../src/run-notices-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAiB,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACN,WAAW,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KAAK,SAAS,EAAE,CAAC;QACpD,QAAQ,GAAG,IAAI,CAAC;IACjB,CAAC;IACD,IACC,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QACxB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,EACxD,CAAC;QACF,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,uCAAuC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,cAAc,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAC7D,CAAC"}
@@ -25,8 +25,9 @@ export type RunNoticesOptions = CollectDependenciesOptions & {
25
25
  /**
26
26
  * Collects each target's production dependencies, reports every licence its
27
27
  * policy does not allow and every required peer dependency missing and, unless
28
- * checking, writes its {@link NOTICES_FILE_NAME} (atomically, whatever the
29
- * problems).
28
+ * checking, writes its {@link NOTICES_FILE_NAME} (atomically) when its policy
29
+ * allows every licence. A target with a licence its policy does not allow keeps
30
+ * the file it had, if any.
30
31
  *
31
32
  * @returns The problems of every target, in target order then package order.
32
33
  */
@@ -1 +1 @@
1
- {"version":3,"file":"run-notices.d.ts","sourceRoot":"","sources":["../src/run-notices.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,KAAK,0BAA0B,EAE/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEN,KAAK,aAAa,EAElB,MAAM,qBAAqB,CAAC;AAE7B,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB,2BAA2B,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,yBAAyB;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,aAAa,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAA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c,EAAE,CAAC,CAkCpC"}
@@ -7,8 +7,9 @@ export const NOTICES_FILE_NAME = "THIRD-PARTY-NOTICES.md";
7
7
  /**
8
8
  * Collects each target's production dependencies, reports every licence its
9
9
  * policy does not allow and every required peer dependency missing and, unless
10
- * checking, writes its {@link NOTICES_FILE_NAME} (atomically, whatever the
11
- * problems).
10
+ * checking, writes its {@link NOTICES_FILE_NAME} (atomically) when its policy
11
+ * allows every licence. A target with a licence its policy does not allow keeps
12
+ * the file it had, if any.
12
13
  *
13
14
  * @returns The problems of every target, in target order then package order.
14
15
  */
@@ -22,13 +23,15 @@ export async function runNotices(targets, options) {
22
23
  message: `${peer.dependent} needs the peer dependency ${peer.name}, which is not installed`,
23
24
  });
24
25
  }
25
- for (const entry of findDisallowedPackages(packages, target.policy)) {
26
+ const disallowed = findDisallowedPackages(packages, target.policy);
27
+ for (const entry of disallowed) {
26
28
  problems.push({
27
29
  workspace: target.name,
28
30
  message: `${entry.name}@${entry.version} has the licence ${entry.license ?? "UNKNOWN"}, which its policy does not allow`,
29
31
  });
30
32
  }
31
- if (!options.check) {
33
+ // A notices file is a statement that the package may ship what it lists.
34
+ if (!options.check && disallowed.length === 0) {
32
35
  try {
33
36
  await writeFileAtomic(join(target.directory, NOTICES_FILE_NAME), renderNotices(target.name, packages), { signal: options.signal ?? null });
34
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"run-notices.js","sourceRoot":"","sources":["../src/run-notices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAEN,6BAA6B,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,sBAAsB,EAEtB,aAAa,GACb,MAAM,qBAAqB,CAAC;AAE7B,+EAA+E;AAC/E,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAyB1D;;;;;;;GAOG;AACH,MAAM,C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,CAAC;QACD,yEAAyE;QACzE,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC;gBACJ,MAAM,eAAe,CACpB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,CAAC,EACzC,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,EACpC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE,CAClC,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,iEAAiE;gBACjE,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;gBACjC,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ac-tool/notices",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Third-party notices for a JavaScript workspace: walks each package's production dependencies, collects their licence texts, writes THIRD-PARTY-NOTICES.md and checks every licence against an allow-list.",
5
5
  "keywords": [
6
6
  "license",
@@ -8,7 +8,7 @@
8
8
  "spdx",
9
9
  "third-party"
10
10
  ],
11
- "homepage": "https://git.grenadine.io/anthochamp/node-essentials/src/branch/main/tools/notices#readme",
11
+ "homepage": "https://anthochamp.pages.grenadine.io/node-essentials/tool/ac-notices/",
12
12
  "bugs": {
13
13
  "url": "https://git.grenadine.io/anthochamp/node-essentials/issues"
14
14
  },
@@ -31,12 +31,14 @@
31
31
  "main": "./dist/index.js",
32
32
  "exports": {
33
33
  ".": "./dist/index.js",
34
+ "./command": "./dist/command.js",
34
35
  "./cli": "./dist/cli.js"
35
36
  },
36
37
  "publishConfig": {
37
38
  "main": "./dist/index.js",
38
39
  "exports": {
39
40
  ".": "./dist/index.js",
41
+ "./command": "./dist/command.js",
40
42
  "./cli": "./dist/cli.js"
41
43
  },
42
44
  "access": "public"
@@ -50,19 +52,19 @@
50
52
  "prepack": "yarn build"
51
53
  },
52
54
  "dependencies": {
53
- "@ac-kit/core": "^0.13.0",
54
- "@ac-kit/format-markdown": "^0.2.3",
55
- "@ac-kit/format-semver": "^0.1.2",
56
- "@ac-kit/format-spdx": "^0.1.2",
57
- "@ac-kit/format-yaml": "^0.2.10",
58
- "@ac-kit/node": "^0.12.0",
55
+ "@ac-kit/core": "^0.14.0",
56
+ "@ac-kit/format-markdown": "^0.2.4",
57
+ "@ac-kit/format-semver": "^0.1.3",
58
+ "@ac-kit/format-spdx": "^0.1.3",
59
+ "@ac-kit/format-yaml": "^0.2.11",
60
+ "@ac-kit/node": "^0.13.0",
59
61
  "@types/node": "^26.5.1"
60
62
  },
61
63
  "devDependencies": {
62
- "@ac-kit/integration-test-util": "0.6.0",
64
+ "@ac-kit/integration-test-util": "0.6.1",
63
65
  "@ac-kit/tsconfig": "0.1.0",
64
66
  "@ac-kit/typedoc-config": "0.1.0",
65
- "@ac-kit/vitest-config": "0.2.0",
67
+ "@ac-kit/vitest-config": "0.3.0",
66
68
  "@typescript/native": "typescript@7.0.2",
67
69
  "rimraf": "6.1.4",
68
70
  "tsx": "4.23.15",