Skip to content

Commit

Permalink
refactor: use node: specifier imports and full relative paths (#561)
Browse files Browse the repository at this point in the history
* refactor: replace NodeJS internal module imports with `node:` specifier imports

* refactor: use full relative paths in imports

* build: fix `test:typescript` script
  • Loading branch information
wolfy1339 authored Dec 1, 2023
1 parent 4e55af9 commit a8bea63
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lint:fix": "prettier --write '{src,test}/**/*.{js,ts,css,less,scss,vue,json,gql,md}' README.md package.json",
"pretest": "npm run -s lint",
"test": "jest --coverage",
"test:typescript": "npx tsc --noEmit --declaration --noUnusedLocals --esModuleInterop test/typescript-validate.ts"
"test:typescript": "npx tsc --noEmit --declaration --noUnusedLocals --esModuleInterop --allowImportingTsExtensions test/typescript-validate.ts"
},
"repository": "github:octokit/action.js",
"keywords": [
Expand Down Expand Up @@ -60,6 +60,9 @@
"functions": 100,
"lines": 100
}
},
"moduleNameMapper": {
"^(.+)\\.jsx?$": "$1"
}
},
"release": {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { paginateRest } from "@octokit/plugin-paginate-rest";
import { legacyRestEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
export type { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods";

import { VERSION } from "./version";
import type { OctokitOptions } from "@octokit/core/dist-types/types";
import { VERSION } from "./version.js";
import type { OctokitOptions } from "@octokit/core/dist-types/types.js";
import { fetch as undiciFetch, ProxyAgent } from "undici";

const DEFAULTS = {
Expand Down
4 changes: 2 additions & 2 deletions test/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fetchMock from "fetch-mock";
import { createServer, type Server } from "https";
import { Octokit, getProxyAgent, customFetch } from "../src";
import { createServer, type Server } from "node:https";
import { Octokit, getProxyAgent, customFetch } from "../src/index.ts";
import { ProxyAgent } from "undici";

// mock undici such that we can substitute our own fetch implementation
Expand Down
3 changes: 2 additions & 1 deletion test/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"emitDeclarationOnly": false,
"noEmit": true,
"verbatimModuleSyntax": false
"verbatimModuleSyntax": false,
"allowImportingTsExtensions": true
},
"include": ["src/**/*"]
}
2 changes: 1 addition & 1 deletion test/typescript-validate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Octokit } from "../src";
import { Octokit } from "../src/index.ts";

// ************************************************************
// THIS CODE IS NOT EXECUTED. IT IS JUST FOR TYPECHECKING
Expand Down

0 comments on commit a8bea63

Please sign in to comment.