Skip to content

Commit

Permalink
build: drop support for cjs (#40)
Browse files Browse the repository at this point in the history
Co-authored-by: Richard Herman <[email protected]>
  • Loading branch information
GeekyEggo and GeekyEggo authored Jun 28, 2024
1 parent 396c244 commit 84613bf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@
"streamdeck": "bin/streamdeck.mjs",
"sd": "bin/streamdeck.mjs"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./package.json": "./package.json"
},
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"./{bin,dist}/*.{js,cjs,mjs}",
"./{bin,dist}/*.d.{cts,ts}",
"./template"
],
"type": "module",
"engines": {
"node": "^20.1.0"
},
Expand Down
6 changes: 3 additions & 3 deletions src/json/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { parse } from "@humanwhocodes/momoa";
import Ajv, { type AnySchema, AnySchemaObject, type DefinedError, ErrorObject, KeywordDefinition } from "ajv";
import { type AnyValidateFunction, DataValidationCxt } from "ajv/dist/types";
import { type LimitNumberError } from "ajv/dist/vocabularies/validation/limitNumber";
import { isEqual, uniqWith } from "lodash";
import _ from "lodash";

import { type JsonLocation, type LocationRef } from "../common/location";
import { colorize } from "../common/stdout";
Expand Down Expand Up @@ -129,9 +129,9 @@ export class JsonSchema<T extends object> {
const ignoredKeywords = ["allOf", "anyOf", "if"];

// Remove ignored keywords, and remove duplicate errors.
return uniqWith(
return _.uniqWith(
errors.filter(({ keyword }) => !ignoredKeywords.includes(keyword)),
(a, b) => a.instancePath === b.instancePath && a.keyword === b.keyword && isEqual(a.params, b.params),
(a, b) => a.instancePath === b.instancePath && a.keyword === b.keyword && _.isEqual(a.params, b.params),
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/validation/file-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class FileValidationResult extends OrderedArray<ValidationEntry> {
/**
* Tracks the padding required for the location of a validation entry, i.e. the text before the entry level.
*/
private padding = 0;
#padding = 0;

/**
* Initializes a new instance of the {@link FileValidationResult} class.
Expand All @@ -32,7 +32,7 @@ export class FileValidationResult extends OrderedArray<ValidationEntry> {
* @returns New length of the validation results.
*/
public push(entry: ValidationEntry): number {
this.padding = Math.max(this.padding, entry.location.length);
this.#padding = Math.max(this.#padding, entry.location.length);
return super.push(entry);
}

Expand All @@ -52,7 +52,7 @@ export class FileValidationResult extends OrderedArray<ValidationEntry> {
output.log();
}

this.forEach((entry) => output.log(entry.toSummary(this.padding)));
this.forEach((entry) => output.log(entry.toSummary(this.#padding)));
output.log();
}
}
4 changes: 2 additions & 2 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export default defineConfig([
index: "src/index.ts",
},
outDir: "dist",
format: ["cjs", "esm"],
format: ["esm"],
banner,
clean: true,
dts: true,
},
]);
]);

0 comments on commit 84613bf

Please sign in to comment.