Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ef14d55

Browse files
authored
chore: modernize package.json and TypeScript configuration (#150)
1 parent 69fd373 commit ef14d55

File tree

10 files changed

+116
-67
lines changed

10 files changed

+116
-67
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: CI
22

33
on:
4-
- pull_request
5-
- push
4+
pull_request:
5+
branches: ["**"]
6+
push:
7+
branches: [main]
68

79
jobs:
810
ci:

‎eslint.config.mjs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// @ts-check
2-
31
import eslint from "@eslint/js";
42
import tseslint from "typescript-eslint";
53
import eslintConfigPrettier from "eslint-config-prettier";

‎jest.config.ts‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
import type { Config } from "@jest/types";
1+
import type { JestConfigWithTsJest } from "ts-jest";
22

3-
const config: Config.InitialOptions = {
4-
extensionsToTreatAsEsm: [".ts"],
3+
const config = {
4+
preset: "ts-jest/presets/default-esm",
5+
moduleFileExtensions: ["ts", "js"],
56
setupFilesAfterEnv: ["./jest.setup.ts"],
67
moduleNameMapper: {
78
"^(\\.{1,2}/.*)\\.js$": "1ドル",
89
},
9-
transform: {
10-
"^.+\\.ts$": [
11-
"ts-jest",
12-
{
13-
useESM: true,
14-
},
15-
],
16-
},
17-
};
10+
} satisfies JestConfigWithTsJest;
1811

19-
exportdefault config;
12+
module.exports= config;

‎package.json‎

Lines changed: 56 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,66 @@
22
"name": "@api-platform/api-doc-parser",
33
"version": "0.16.8",
44
"description": "Transform an API documentation (Hydra, OpenAPI, GraphQL) in an intermediate representation that can be used for various tasks such as creating smart API clients, scaffolding code or building administration interfaces.",
5-
"files": [
6-
"*.md",
7-
"lib",
8-
"src"
5+
"keywords": [
6+
"api",
7+
"api-platform",
8+
"documentation",
9+
"hydra",
10+
"openapi",
11+
"graphql",
12+
"jsonld",
13+
"json-schema",
14+
"typescript",
15+
"client"
916
],
10-
"type": "module",
11-
"exports": "./lib/index.js",
12-
"main": "./lib/index.js",
13-
"repository": "api-platform/api-doc-parser",
1417
"homepage": "https://github.com/api-platform/api-doc-parser",
1518
"bugs": "https://github.com/api-platform/api-doc-parser/issues",
16-
"author": "Kévin Dunglas",
19+
"repository": {
20+
"type": "git",
21+
"url": "git+https://github.com/api-platform/api-doc-parser.git"
22+
},
1723
"license": "MIT",
24+
"author": "Kévin Dunglas",
25+
"sideEffects": false,
26+
"type": "module",
27+
"exports": {
28+
".": {
29+
"types": "./lib/index.d.ts",
30+
"import": "./lib/index.js",
31+
"default": "./lib/index.js"
32+
},
33+
"./package.json": "./package.json"
34+
},
35+
"main": "./lib/index.js",
36+
"types": "./lib/index.d.ts",
37+
"files": [
38+
"lib",
39+
"LICENSE",
40+
"package.json",
41+
"README.md"
42+
],
43+
"scripts": {
44+
"build": "rm -rf lib && tsc --project tsconfig.build.json",
45+
"build:watch": "tsc --watch",
46+
"eslint-check": "eslint-config-prettier src/index.ts",
47+
"lint": "eslint src",
48+
"lint:fix": "eslint src --fix",
49+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
50+
"typecheck": "tsc --noEmit",
51+
"typecheck:watch": "tsc --noEmit --watch"
52+
},
53+
"dependencies": {
54+
"graphql": "^16.0.0",
55+
"inflection": "^3.0.0",
56+
"jsonld": "^8.3.2",
57+
"jsonref": "^9.0.0",
58+
"lodash.get": "^4.4.0"
59+
},
1860
"devDependencies": {
1961
"@eslint/compat": "^1.2.5",
2062
"@eslint/eslintrc": "^3.2.0",
2163
"@eslint/js": "^9.19.0",
64+
"@jest/globals": "29.7.0",
2265
"@jest/types": "29.0.0",
2366
"@types/inflection": "^1.13.0",
2467
"@types/jest": "^29.0.0",
@@ -41,25 +84,11 @@
4184
"typescript": "^5.7.0",
4285
"typescript-eslint": "^8.22.0"
4386
},
44-
"dependencies": {
45-
"graphql": "^16.0.0",
46-
"inflection": "^3.0.0",
47-
"jsonld": "^8.3.2",
48-
"jsonref": "^9.0.0",
49-
"lodash.get": "^4.4.0",
50-
"tslib": "^2.0.0"
51-
},
52-
"scripts": {
53-
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
54-
"lint": "eslint src",
55-
"fix": "pnpm lint --fix",
56-
"eslint-check": "eslint-config-prettier src/index.ts",
57-
"build": "rm -rf lib/* && tsc",
58-
"watch": "tsc --watch"
87+
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977",
88+
"engines": {
89+
"node": ">=18"
5990
},
60-
"sideEffects": false,
6191
"publishConfig": {
6292
"access": "public"
63-
},
64-
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
93+
}
6594
}

‎pnpm-lock.yaml‎

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/hydra/fetchJsonLd.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Document, JsonLd, RemoteDocument } from "jsonld/jsonld-spec";
1+
import type { Document, JsonLd, RemoteDocument } from "jsonld/jsonld-spec.js";
22
import type { RequestInitExtended } from "./types.js";
33

44
const jsonLdMimeType = "application/ld+json";

‎src/openapi3/parseOpenApi3Documentation.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Api } from "../Api.js";
22
import handleJson, { removeTrailingSlash } from "./handleJson.js";
33
import type { OpenAPIV3 } from "openapi-types";
4-
import type { RequestInitExtended } from "./types";
4+
import type { RequestInitExtended } from "./types.js";
55

66
export interface ParsedOpenApi3Documentation {
77
api: Api;

‎tsconfig.build.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
/* Emit */
5+
"rootDir": "src"
6+
},
7+
"include": ["./src"],
8+
"exclude": ["./src/**/*.test.ts"]
9+
}

‎tsconfig.eslint.json‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎tsconfig.json‎

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,41 @@
11
{
22
"compilerOptions": {
3-
"target": "es6",
4-
"module": "esnext",
5-
"moduleResolution": "node",
6-
"sourceMap": true,
7-
"outDir": "./lib",
3+
/* Type checking */
4+
// "exactOptionalPropertyTypes": true,
5+
"forceConsistentCasingInFileNames": true,
6+
"noFallthroughCasesInSwitch": true,
7+
"noImplicitOverride": true,
8+
"noImplicitReturns": true,
9+
// "noUncheckedIndexedAccess": true,
10+
"noPropertyAccessFromIndexSignature": true,
11+
"noUnusedLocals": true,
12+
"noUnusedParameters": true,
13+
"strict": true,
14+
15+
/* Modules */
16+
"module": "NodeNext",
17+
"noUncheckedSideEffectImports": true,
18+
"types": ["jest"],
19+
20+
/* Language and Environment */
21+
"lib": ["ES2022", "DOM"],
22+
"moduleDetection": "force",
23+
"target": "ES2022",
24+
25+
/* Output Formatting */
26+
"noErrorTruncation": true,
27+
28+
/* Emit */
829
"declaration": true,
930
"declarationMap": true,
10-
"rootDir": "./src",
11-
"importHelpers": true,
12-
"strict": true,
13-
"esModuleInterop": true
31+
"inlineSources": true,
32+
"outDir": "lib",
33+
"sourceMap": true,
34+
35+
/* Interop Constraints */
36+
// "erasableSyntaxOnly": true,
37+
"isolatedDeclarations": true,
38+
"verbatimModuleSyntax": true
1439
},
15-
"exclude": [
16-
"src/**/*.test.ts",
17-
],
1840
"include": ["./src"]
1941
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /