Skip to content

Commit f39a622

Browse files
committed
build setup
1 parent 4738d99 commit f39a622

File tree

8 files changed

+158
-40
lines changed

8 files changed

+158
-40
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
test/examples/*.ts
1+
test/examples/*.ts
2+
dist

jest.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@ module.exports = {
22
preset: 'ts-jest',
33
testEnvironment: 'jsdom',
44
modulePathIgnorePatterns: ['dist'],
5-
transform: {
6-
'^.+\\.(ts|tsx)$': 'ts-jest',
7-
},
85
}

package-lock.json

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

package.json

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,48 @@
11
{
22
"name": "openapi-typescript-fetch",
3+
"description": "A typed fetch wrapper for openapi-typescript",
34
"version": "1.0.0",
4-
"description": "A typed fetch wrapper for the code generated by openapi-typescript",
5-
"main": "dist/index.js",
6-
"types": "dist/index.d.ts",
5+
"engines": {
6+
"node": ">= 12.0.0",
7+
"npm": ">= 7.0.0"
8+
},
9+
"author": "Ajai Shankar",
10+
"license": "ISC",
11+
"main": "./dist/cjs/index.js",
12+
"module": "./dist/esm/index.js",
13+
"exports": {
14+
"browser": "./dist/esm/index.js",
15+
"import": "./dist/esm/index.js",
16+
"require": "./dist/cjs/index.js"
17+
},
18+
"files": [
19+
"dist"
20+
],
21+
"repository": {
22+
"type": "git",
23+
"url": "https://github.com/ajaishankar/openapi-typescript-fetch"
24+
},
25+
"keywords": [
26+
"fetch",
27+
"swagger",
28+
"typescript",
29+
"ts",
30+
"openapi",
31+
"openapi 3",
32+
"node"
33+
],
34+
"bugs": {
35+
"url": "https://github.com/ajaishankar/openapi-typescript-fetch/issues"
36+
},
37+
"homepage": "https://github.com/ajaishankar/openapi-typescript-fetch#readme",
738
"devDependencies": {
839
"msw": "^0.35.0",
940
"@typescript-eslint/eslint-plugin": "^4.30.0",
1041
"@typescript-eslint/parser": "^4.31.0",
1142
"eslint": "^7.32.0",
1243
"eslint-config-prettier": "^8.3.0",
1344
"eslint-plugin-prettier": "^4.0.0",
45+
"codecov": "^3.8.2",
1446
"jest": "^27.2.5",
1547
"@types/jest": "^27.0.0",
1648
"prettier": "^2.4.0",
@@ -27,10 +59,12 @@
2759
},
2860
"scripts": {
2961
"clean": "rimraf './dist'",
30-
"build": "tsc",
31-
"test": "jest --no-cache",
32-
"coverage": "jest --no-cache --coverage"
33-
},
34-
"author": "Ajai Shankar",
35-
"license": "MIT"
62+
"build": "npm run clean && tsc --project tsconfig.json && tsc --project tsconfig.cjs.json",
63+
"lint": "eslint .",
64+
"prepare": "npm run build",
65+
"test": "npm run build && jest",
66+
"test:coverage": "npm run build && jest --no-cache --coverage && codecov",
67+
"test:coverage:local": "npm run build && jest --no-cache --collectCoverage",
68+
"typecheck": "tsc --noEmit --project tsconfig.json"
69+
}
3670
}

test/fetch.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe('fetch', () => {
141141
expect(data.headers).toEqual({ ...expectedHeaders, admin: 'true' })
142142
})
143143

144-
it('use middleware', async () => {
144+
it('middleware', async () => {
145145
const fun = fetcher
146146
.path('/bodyquery/{id}')
147147
.method('post')

tsconfig.base.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"compilerOptions": {
3-
"strict": true,
4-
"alwaysStrict": true,
5-
"strictNullChecks": true,
6-
"noImplicitAny": true,
3+
"baseUrl": "./src",
4+
"declaration": true,
75
"esModuleInterop": true,
8-
"emitDecoratorMetadata": true,
9-
"experimentalDecorators": true,
10-
"noUnusedLocals": true,
11-
"skipLibCheck": true,
6+
"forceConsistentCasingInFileNames": true,
7+
"lib": ["dom", "dom.iterable", "ES2018"],
8+
"moduleResolution": "Node",
9+
"noImplicitReturns": true,
10+
"removeComments": true,
1211
"sourceMap": true,
13-
"jsx": "react",
14-
"downlevelIteration": true
15-
}
16-
}
12+
"strict": true,
13+
"target": "ES2015",
14+
"useDefineForClassFields": true
15+
},
16+
"include": ["src"]
17+
}

tsconfig.cjs.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"module": "CommonJS",
4+
"outDir": "./dist/cjs"
5+
},
6+
"extends": "./tsconfig.base.json"
7+
}

tsconfig.json

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
{
2-
"extends": "./tsconfig.base.json",
32
"compilerOptions": {
4-
"rootDir": "src",
5-
"outDir": "dist",
6-
"baseUrl": ".",
7-
"target": "es5",
8-
"lib": ["dom", "dom.iterable", "esnext"],
9-
"allowJs": true,
10-
"forceConsistentCasingInFileNames": true,
11-
"module": "commonjs",
12-
"moduleResolution": "node",
13-
"resolveJsonModule": true,
14-
"isolatedModules": true,
3+
"module": "ES2020",
4+
"outDir": "./dist/esm"
155
},
16-
"include": ["src"]
17-
}
6+
"extends": "./tsconfig.base.json"
7+
}

0 commit comments

Comments
 (0)