Skip to content

Commit

Permalink
build: fix issues with module resolution
Browse files Browse the repository at this point in the history
This is not a bug with the TypeScript compiler but a "feature"...
See microsoft/TypeScript#49160
See ajv-validator/ajv#2047
  • Loading branch information
wolfy1339 committed Sep 16, 2023
1 parent 2c4e540 commit c537210
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
5 changes: 3 additions & 2 deletions bin/octokit-webhooks.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env ts-node-transpile-only

import yargs from "yargs";
import type { Options as yargsOptions, Arguments } from "yargs";
import { hideBin } from "yargs/helpers";
import { checkOrUpdateWebhooks } from "../lib/index.mjs";

Expand All @@ -11,7 +12,7 @@ interface Options {
updateAll?: boolean;
}

const options: Record<string, yargs.Options> = {
const options: Record<string, yargsOptions> = {
cached: {
describe: "Load HTML from local cache",
type: "boolean",
Expand Down Expand Up @@ -52,7 +53,7 @@ const {
.alias("h", ["help", "usage"])
.demandCommand(1, "")
.scriptName("bin/octokit-webhooks")
.usage("$0 <command> [--cached]").argv as yargs.Arguments<Options>;
.usage("$0 <command> [--cached]").argv as Arguments<Options>;

if (!["update", "check"].includes(command.toString())) {
console.log(`"${command}" must be one of: update, check`);
Expand Down
4 changes: 2 additions & 2 deletions bin/validate-schema.mts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { parseArgv } from "./utils/index.mjs";
const __filename = fileURLToPath(import.meta.url);
const [, {}] = parseArgv(__filename, [], []);

const ajv = new Ajv({ strict: true });
const ajv = new Ajv.default({ strict: true });

addFormats(ajv);
addFormats.default(ajv);
ajv.addKeyword("tsAdditionalProperties");

const __dirname = fileURLToPath(new URL(".", import.meta.url));
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"ajv-formats": "^2.1.1",
"cheerio": "^1.0.0-rc.10",
"fast-deep-equal": "^3.1.3",
"got": "^12.6.1",
"got": "^13.0.0",
"json-diff": "^1.0.0",
"json-schema-to-typescript": "^13.0.0",
"prettier": "3.0.3",
Expand Down
4 changes: 2 additions & 2 deletions payload-schemas/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { readFileSync, readdirSync } from "fs";
import { resolve } from "path";
import { fileURLToPath } from "url";

export const ajv = new Ajv({
export const ajv = new Ajv.default({
strict: true,
strictTypes: true,
strictTuples: true,
});

addFormats(ajv);
addFormats.default(ajv);

const __dirname = fileURLToPath(new URL('.', import.meta.url));
const schemaDir = resolve(__dirname, "api.github.com");
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "es2019",
"module": "ESNext",
"moduleResolution": "node",
"module": "Node16",
"moduleResolution": "node16",
"lib": ["es2020"],
"rootDir": "./",
"allowJs": true,
Expand Down

0 comments on commit c537210

Please sign in to comment.