Skip to content

Commit

Permalink
refactor: uses node imports aliasses in package.json for the json sch…
Browse files Browse the repository at this point in the history
…emas
  • Loading branch information
sverweij committed Oct 8, 2023
1 parent 39f4b15 commit 76e1f9b
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
"main": "src/main/index.mjs",
"imports": {
"#cache/*": "./src/cache/*",
"#configuration-schema": "./src/schema/configuration.schema.mjs",
"#cli/*": "./src/cli/*",
"#cruise-result-schema": "./src/schema/cruise-result.schema.mjs",
"#enrich/*": "./src/enrich/*",
"#extract/*": "./src/extract/*",
"#graph-utl/*": "./src/graph-utl/*",
Expand Down
2 changes: 1 addition & 1 deletion src/main/format.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Ajv from "ajv";

import cruiseResultSchema from "../schema/cruise-result.schema.mjs";
import { assertFormatOptionsValid } from "./options/assert-validity.mjs";
import { normalizeFormatOptions } from "./options/normalize.mjs";
import reportWrap from "./report-wrap.mjs";
import cruiseResultSchema from "#cruise-result-schema";

function validateResultAgainstSchema(pResult) {
const ajv = new Ajv();
Expand Down
2 changes: 1 addition & 1 deletion src/main/rule-set/assert-validity.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import Ajv from "ajv";
import safeRegex from "safe-regex";
import has from "lodash/has.js";
import { assertCruiseOptionsValid } from "../options/assert-validity.mjs";
import configurationSchema from "../../schema/configuration.schema.mjs";
import { normalizeToREAsString } from "../helpers.mjs";
import configurationSchema from "#configuration-schema";

const ajv = new Ajv();
// the default for this is 25 - as noted in the safe-regex source code already,
Expand Down
2 changes: 1 addition & 1 deletion test/cli/init-config/build-config.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { tmpdir } from "node:os";
import { join } from "node:path/posix";
import { deepEqual, ok, equal } from "node:assert/strict";
import Ajv from "ajv";
import configurationSchema from "../../../src/schema/configuration.schema.mjs";
import deleteDammit from "../delete-dammit.utl.cjs";
import configurationSchema from "#configuration-schema";
import buildConfig from "#cli/init-config/build-config.mjs";
import normalizeInitOptions from "#cli/init-config/normalize-init-options.mjs";

Expand Down
2 changes: 1 addition & 1 deletion test/cli/init-config/index.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join } from "node:path";
import { deepEqual, equal } from "node:assert/strict";
import Ajv from "ajv";
import deleteDammit from "../delete-dammit.utl.cjs";
import configurationSchema from "../../../src/schema/configuration.schema.mjs";
import configurationSchema from "#configuration-schema";
import initConfig from "#cli/init-config/index.mjs";

const ajv = new Ajv();
Expand Down
2 changes: 1 addition & 1 deletion test/enrich/summarize.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { deepEqual } from "node:assert/strict";
import Ajv from "ajv";
import cruiseResultSchema from "../../src/schema/cruise-result.schema.mjs";
import cycleStartsOnOne from "./__mocks__/cycle-starts-on-one.mjs";
import cycleStartsOnTwo from "./__mocks__/cycle-starts-on-two.mjs";
import cycleFest from "./__mocks__/cycle-fest.mjs";
import cruiseResultSchema from "#cruise-result-schema";
import summarize from "#enrich/summarize/index.mjs";

const ajv = new Ajv();
Expand Down
2 changes: 1 addition & 1 deletion test/main/main.cruise-reporterless.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { deepEqual } from "node:assert/strict";
import Ajv from "ajv";
import cruiseResultSchema from "../../src/schema/cruise-result.schema.mjs";
import { createRequireJSON } from "../backwards.utl.mjs";
import cruiseResultSchema from "#cruise-result-schema";
import cruise from "#main/cruise.mjs";

const requireJSON = createRequireJSON(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion test/main/main.cruise.cache.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { deepEqual, notDeepStrictEqual } from "node:assert/strict";
import { rmSync } from "node:fs";
import Ajv from "ajv";
import cruiseResultSchema from "../../src/schema/cruise-result.schema.mjs";
import cruiseResultSchema from "#cruise-result-schema";
import Cache from "#cache/cache.mjs";
import cruise from "#main/cruise.mjs";

Expand Down
2 changes: 1 addition & 1 deletion test/main/main.cruise.dynamic-imports.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { deepEqual } from "node:assert/strict";
import Ajv from "ajv";
import cruiseResultSchema from "../../src/schema/cruise-result.schema.mjs";
import { createRequireJSON } from "../backwards.utl.mjs";
import normBaseDirectory from "./norm-base-directory.utl.mjs";
import cruiseResultSchema from "#cruise-result-schema";
import cruise from "#main/cruise.mjs";

const requireJSON = createRequireJSON(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion test/main/main.cruise.reachable-integration.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { deepEqual } from "node:assert/strict";
import { join } from "node:path";
import Ajv from "ajv";
import cruiseResultSchema from "../../src/schema/cruise-result.schema.mjs";
import cruiseResultSchema from "#cruise-result-schema";
import normalizeOptions from "#cli/normalize-cli-options.mjs";
import cruise from "#main/cruise.mjs";

Expand Down
2 changes: 1 addition & 1 deletion test/main/main.cruise.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { posix as path } from "node:path";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import Ajv from "ajv";
import cruiseResultSchema from "../../src/schema/cruise-result.schema.mjs";
import { createRequireJSON } from "../backwards.utl.mjs";
import normBaseDirectory from "./norm-base-directory.utl.mjs";
import cruiseResultSchema from "#cruise-result-schema";
import cruise from "#main/cruise.mjs";
import pathToPosix from "#utl/path-to-posix.mjs";

Expand Down
2 changes: 1 addition & 1 deletion test/main/main.cruise.ts-pre-compilation-deps.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { deepEqual } from "node:assert/strict";
import Ajv from "ajv";
import cruiseResultSchema from "../../src/schema/cruise-result.schema.mjs";
import { createRequireJSON } from "../backwards.utl.mjs";
import normBaseDirectory from "./norm-base-directory.utl.mjs";
import cruiseResultSchema from "#cruise-result-schema";
import cruise from "#main/cruise.mjs";

const requireJSON = createRequireJSON(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion test/main/main.cruise.type-only-imports.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { deepEqual } from "node:assert/strict";
import Ajv from "ajv";
import cruiseResultSchema from "../../src/schema/cruise-result.schema.mjs";
import { createRequireJSON } from "../backwards.utl.mjs";
import normBaseDirectory from "./norm-base-directory.utl.mjs";
import cruiseResultSchema from "#cruise-result-schema";
import cruise from "#main/cruise.mjs";

const requireJSON = createRequireJSON(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion test/main/main.cruise.type-only-module-references.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { deepEqual } from "node:assert/strict";
import Ajv from "ajv";
import cruiseResultSchema from "../../src/schema/cruise-result.schema.mjs";
import { createRequireJSON } from "../backwards.utl.mjs";
import normBaseDirectory from "./norm-base-directory.utl.mjs";
import cruiseResultSchema from "#cruise-result-schema";
import cruise from "#main/cruise.mjs";

const requireJSON = createRequireJSON(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion test/report/anon/anonymize.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { equal, deepEqual } from "node:assert/strict";
import Ajv from "ajv";
import cruiseResultSchema from "../../../src/schema/cruise-result.schema.mjs";
import sourceReport from "./__mocks__/src-report.mjs";
import fixtureReport from "./__fixtures__/src-report.mjs";
import sourceReportWithWordlist from "./__mocks__/src-report-wordlist.mjs";
Expand All @@ -15,6 +14,7 @@ import sourceFolders from "./__mocks__/folders.mjs";
import fixtureFolders from "./__fixtures__/folders.mjs";
import sourceFolderCycles from "./__mocks__/folder-cycles.mjs";
import fixtureFolderCycles from "./__fixtures__/folder-cycles.mjs";
import cruiseResultSchema from "#cruise-result-schema";
import anonymize from "#report/anon/index.mjs";
import { clearCache } from "#report/anon/anonymize-path-element.mjs";

Expand Down

0 comments on commit 76e1f9b

Please sign in to comment.