Skip to content

Commit

Permalink
Reorganize the modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydenseric committed Feb 1, 2022
1 parent 16a666d commit c37795f
Show file tree
Hide file tree
Showing 55 changed files with 329 additions and 287 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/private/CliError.test.mjs → CliError.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { strictEqual, throws } from "assert";

import CliError from "../../private/CliError.mjs";
import CliError from "./CliError.mjs";

export default (tests) => {
tests.add("`CliError` with argument 1 `message` not a string.", () => {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions test/private/CodeLocation.test.mjs → CodeLocation.test.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { deepStrictEqual, throws } from "assert";

import CodeLocation from "../../private/CodeLocation.mjs";
import CodePosition from "../../private/CodePosition.mjs";
import CodeLocation from "./CodeLocation.mjs";
import CodePosition from "./CodePosition.mjs";

export default (tests) => {
tests.add(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepStrictEqual, throws } from "assert";

import CodePosition from "../../private/CodePosition.mjs";
import CodePosition from "./CodePosition.mjs";

export default (tests) => {
tests.add("`CodePosition` with argument 1 `line` not a number.", () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import kleur from "kleur";
import revertableGlobals from "revertable-globals";
import snapshot from "snapshot-assertion";

import CliError from "../../private/CliError.mjs";
import CodeLocation from "../../private/CodeLocation.mjs";
import CodePosition from "../../private/CodePosition.mjs";
import InvalidJsdocError from "../../private/InvalidJsdocError.mjs";
import CliError from "./CliError.mjs";
import CodeLocation from "./CodeLocation.mjs";
import CodePosition from "./CodePosition.mjs";
import InvalidJsdocError from "./InvalidJsdocError.mjs";

export default (tests) => {
tests.add(
Expand Down Expand Up @@ -89,7 +89,7 @@ export default (tests) => {
await snapshot(
error.message,
new URL(
"../snapshots/InvalidJsdocError/code-location-end-position-none.ans",
"./test/snapshots/InvalidJsdocError/code-location-end-position-none.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -127,7 +127,7 @@ export default (tests) => {
await snapshot(
error.message,
new URL(
"../snapshots/InvalidJsdocError/code-location-end-position-matching-start.ans",
"./test/snapshots/InvalidJsdocError/code-location-end-position-matching-start.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -165,7 +165,7 @@ export default (tests) => {
await snapshot(
error.message,
new URL(
"../snapshots/InvalidJsdocError/code-location-end-position-beyond-start.ans",
"./test/snapshots/InvalidJsdocError/code-location-end-position-beyond-start.ans",
import.meta.url
)
);
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
- Updated Node.js support to `^12.22.0 || ^14.17.0 || >= 16.0.0`.
- Updated dependencies, some of which require newer Node.js versions than previously supported.
- Removed `./package` from the package `exports` field; the full `package.json` filename must be used in a `require` path.
- Public modules are now individually listed in the package `files` and `exports` fields.
- Shortened public module deep import paths, removing the `/public/`.

### Patch

- Also run GitHub Actions CI with Node.js v17.
- Simplified dev dependencies and config for ESLint.
- Simplified package scripts.
- Use a new [`replace-stack-traces`](https://npm.im/replace-stack-traces) dev dependency in tests.
- Reorganized the test file structure.
- Configured Prettier option `singleQuote` to the default, `false`.
- Added a `license.md` MIT License file.
- Improved documentation.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { strictEqual, throws } from "assert";

import CodePosition from "../../private/CodePosition.mjs";
import codePositionToIndex from "../../private/codePositionToIndex.mjs";
import CodePosition from "./CodePosition.mjs";
import codePositionToIndex from "./codePositionToIndex.mjs";

export default (tests) => {
tests.add(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { deepStrictEqual, rejects } from "assert";
import snapshot from "snapshot-assertion";

import codeToJsdocComments from "../../private/codeToJsdocComments.mjs";
import codeToJsdocComments from "./codeToJsdocComments.mjs";

const TEST_CODE_FILE_PATH = "/a.js";

Expand Down Expand Up @@ -85,7 +85,7 @@ let a;`,
2
),
new URL(
"../snapshots/codeToJsdocComments/single-comment-block-single-line-jsdoc.json",
"./test/snapshots/codeToJsdocComments/single-comment-block-single-line-jsdoc.json",
import.meta.url
)
);
Expand Down Expand Up @@ -124,7 +124,7 @@ let a;`,
2
),
new URL(
"../snapshots/codeToJsdocComments/single-comment-block-multi-line-jsdoc.json",
"./test/snapshots/codeToJsdocComments/single-comment-block-multi-line-jsdoc.json",
import.meta.url
)
);
Expand Down Expand Up @@ -152,7 +152,7 @@ let b;`,
2
),
new URL(
"../snapshots/codeToJsdocComments/multiple-comment-blocks-multi-line-jsdoc.json",
"./test/snapshots/codeToJsdocComments/multiple-comment-blocks-multi-line-jsdoc.json",
import.meta.url
)
);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { deepStrictEqual, throws } from "assert";

import deconstructJsdocNamepath from "../../private/deconstructJsdocNamepath.mjs";
import deconstructJsdocNamepath from "./deconstructJsdocNamepath.mjs";

export default (tests) => {
tests.add(
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { deepStrictEqual, throws } from "assert";
import { parse } from "comment-parser";
import snapshot from "snapshot-assertion";

import COMMENT_PARSER_OPTIONS from "../../private/COMMENT_PARSER_OPTIONS.mjs";
import getJsdocBlockDescriptionSource from "../../private/getJsdocBlockDescriptionSource.mjs";
import COMMENT_PARSER_OPTIONS from "./COMMENT_PARSER_OPTIONS.mjs";
import getJsdocBlockDescriptionSource from "./getJsdocBlockDescriptionSource.mjs";

export default (tests) => {
tests.add(
Expand Down Expand Up @@ -44,7 +44,7 @@ export default (tests) => {
await snapshot(
JSON.stringify(getJsdocBlockDescriptionSource(jsdocBlock), null, 2),
new URL(
"../snapshots/getJsdocBlockDescriptionSource/description-no-tags.json",
"./test/snapshots/getJsdocBlockDescriptionSource/description-no-tags.json",
import.meta.url
)
);
Expand All @@ -70,7 +70,7 @@ export default (tests) => {
await snapshot(
JSON.stringify(getJsdocBlockDescriptionSource(jsdocBlock), null, 2),
new URL(
"../snapshots/getJsdocBlockDescriptionSource/description-tags.json",
"./test/snapshots/getJsdocBlockDescriptionSource/description-tags.json",
import.meta.url
)
);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { deepStrictEqual, throws } from "assert";
import { parse } from "comment-parser";

import CodeLocation from "../../private/CodeLocation.mjs";
import CodePosition from "../../private/CodePosition.mjs";
import COMMENT_PARSER_OPTIONS from "../../private/COMMENT_PARSER_OPTIONS.mjs";
import getJsdocSourceTokenCodeLocation from "../../private/getJsdocSourceTokenCodeLocation.mjs";
import CodeLocation from "./CodeLocation.mjs";
import CodePosition from "./CodePosition.mjs";
import COMMENT_PARSER_OPTIONS from "./COMMENT_PARSER_OPTIONS.mjs";
import getJsdocSourceTokenCodeLocation from "./getJsdocSourceTokenCodeLocation.mjs";

export default (tests) => {
tests.add(
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions cli/jsdoc-md.mjs → jsdoc-md.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import arg from "arg";

import CliError from "../private/CliError.mjs";
import reportCliError from "../private/reportCliError.mjs";
import jsdocMd from "../public/jsdocMd.mjs";
import CliError from "./CliError.mjs";
import jsdocMd from "./jsdocMd.mjs";
import reportCliError from "./reportCliError.mjs";

/**
* Runs the `jsdoc-md` CLI.
Expand Down
38 changes: 19 additions & 19 deletions test/cli/jsdoc-md.test.mjs → jsdoc-md.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import snapshot from "snapshot-assertion";
import { fileURLToPath } from "url";

const JSDOC_MD_CLI_PATH = fileURLToPath(
new URL("../../cli/jsdoc-md.mjs", import.meta.url)
new URL("./jsdoc-md.mjs", import.meta.url)
);

export default (tests) => {
Expand All @@ -34,7 +34,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-source-glob-value-empty-stderr.ans",
"./test/snapshots/jsdoc-md/argument-source-glob-value-empty-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -67,7 +67,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-source-glob-value-missing-stderr.ans",
"./test/snapshots/jsdoc-md/argument-source-glob-value-missing-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -98,7 +98,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-s-value-missing-stderr.ans",
"./test/snapshots/jsdoc-md/argument-s-value-missing-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -130,7 +130,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-s-value-missing-following-short-arg-stderr.ans",
"./test/snapshots/jsdoc-md/argument-s-value-missing-following-short-arg-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -163,7 +163,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-markdown-path-value-empty-stderr.ans",
"./test/snapshots/jsdoc-md/argument-markdown-path-value-empty-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -196,7 +196,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-markdown-path-value-missing-stderr.ans",
"./test/snapshots/jsdoc-md/argument-markdown-path-value-missing-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -227,7 +227,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-m-value-missing-stderr.ans",
"./test/snapshots/jsdoc-md/argument-m-value-missing-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -259,7 +259,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-m-value-missing-following-short-arg-stderr.ans",
"./test/snapshots/jsdoc-md/argument-m-value-missing-following-short-arg-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -292,7 +292,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-target-heading-value-empty-stderr.ans",
"./test/snapshots/jsdoc-md/argument-target-heading-value-empty-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -325,7 +325,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-target-heading-value-missing-stderr.ans",
"./test/snapshots/jsdoc-md/argument-target-heading-value-missing-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -356,7 +356,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-t-value-missing-stderr.ans",
"./test/snapshots/jsdoc-md/argument-t-value-missing-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -388,7 +388,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-t-value-missing-following-short-arg-stderr.ans",
"./test/snapshots/jsdoc-md/argument-t-value-missing-following-short-arg-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -419,7 +419,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/unexpected-argument-stderr.ans",
"./test/snapshots/jsdoc-md/unexpected-argument-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -454,7 +454,7 @@ export default (tests) => {
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/unexpected-arguments-stderr.ans",
"./test/snapshots/jsdoc-md/unexpected-arguments-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -544,7 +544,7 @@ export default 1;

await snapshot(
await fs.promises.readFile(pathMd, "utf8"),
new URL("../snapshots/jsdoc-md/defaults.md", import.meta.url)
new URL("./test/snapshots/jsdoc-md/defaults.md", import.meta.url)
);
});
});
Expand Down Expand Up @@ -617,7 +617,7 @@ export default 1;

await snapshot(
await fs.promises.readFile(pathMd, "utf8"),
new URL("../snapshots/jsdoc-md/arguments.md", import.meta.url)
new URL("./test/snapshots/jsdoc-md/arguments.md", import.meta.url)
);
});
});
Expand Down Expand Up @@ -665,7 +665,7 @@ export default 1;
await snapshot(
spawnResult1.stderr.toString(),
new URL(
"../snapshots/jsdoc-md/argument-check-error-stderr.ans",
"./test/snapshots/jsdoc-md/argument-check-error-stderr.ans",
import.meta.url
)
);
Expand Down Expand Up @@ -746,7 +746,7 @@ export default 1;
await snapshot(
stderr.toString(),
new URL(
"../snapshots/jsdoc-md/invalid-jsdoc-error-stderr.ans",
"./test/snapshots/jsdoc-md/invalid-jsdoc-error-stderr.ans",
import.meta.url
)
);
Expand Down
File renamed without changes.
Loading

0 comments on commit c37795f

Please sign in to comment.