Skip to content

Commit 0965f9b

Browse files
committed
bug: fix build on windows
removed shell scripts fixed manipulation of tsc with tsc-silent, and instead call tsc-silent directly for the generated source
1 parent 8474f84 commit 0965f9b

File tree

11 files changed

+82
-83
lines changed

11 files changed

+82
-83
lines changed

.aegir.cjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ module.exports = {
3232
* @param {MockServerController} controller
3333
*/
3434
async after (_, controller) {
35-
console.log('test after:')
3635
await controller.shutdown()
37-
3836
}
3937
}
4038
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ package-lock.json
1212
*.bak
1313
.swc
1414
.envrc
15+
.nyc_output
16+
generated/fetch/package.json
17+
generated/fetch/tsconfig.json

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const client = new PinsApi(config)
2525
// Get 10 failed Pins
2626
const pinsGetOptions: PinsGetRequest = {
2727
limit: 10,
28-
status: Status.Failed
28+
status: new Set([Status.Failed]) // requires a set, and not an array
2929
}
3030
const {count, results}: PinResults = await client.pinsGet(pinsGetOptions)
3131

npm-scripts/fix/gen.sh

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

npm-scripts/postinstall.sh

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

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,29 +131,30 @@
131131
]
132132
},
133133
"scripts": {
134+
"clean": "npx rimraf dist generated node_modules",
134135
"ci:test": "run-s test:*",
135136
"dep-check": "aegir dep-check src/**/*.ts test/**/*.ts generated/**/*.ts",
136137
"fix": "run-s fix:*",
137-
"fix:gen": "./npm-scripts/fix/gen.sh",
138138
"fix:lint": "aegir lint --fix",
139139
"lint": "run-s lint:*",
140140
"lint:main": "aegir lint",
141-
"lint:ts": "aegir ts -p check -- -p tsconfig.json --suppress 6133@generated 6192@generated --stats",
141+
"lint:ts": "aegir ts -p check",
142142
"lint-TODO:project": "check-aegir-project # currently broken due to corrupting the repoUrl",
143143
"release": "aegir release",
144-
"postinstall": "npm run gen && patch-package",
145-
"build": "aegir build -- -p tsconfig.json --suppress 6133@generated 6192@generated --stats",
146-
"build:main": "aegir build -- -p tsconfig.json --suppress 6133@generated 6192@generated --stats",
144+
"postinstall": "run-s gen",
145+
"build": "aegir build",
146+
"build2": "tsc-silent -p tsconfig.generated.json --suppress 6133@generated 6192@generated --stats",
147+
"build:main": "aegir build",
147148
"build:docs": "aegir ts docs",
148-
"build:types": "aegir ts -p types -- -p tsconfig.json --suppress 6133@generated 6192@generated --stats",
149+
"build:types": "aegir ts -p types",
149150
"test": "run-s test:*",
150151
"test:browser": "aegir test --target browser",
151152
"test:webworker": "aegir test --target webworker",
152153
"test:electron": "aegir test --target electron-main",
153154
"test:node": "aegir test --target node --cov && npx nyc report",
154155
"pregen": "openapi-generator-cli validate -i https://raw.githubusercontent.com/ipfs/pinning-services-api-spec/v1.0.0/ipfs-pinning-service.yaml",
155156
"gen": "run-p gen:fetch",
156-
"postgen": "run-s fix:gen",
157+
"postgen": "tsc-silent -p tsconfig.generated.json --suppress 6133@generated 6192@generated --stats",
157158
"gen:fetch": "openapi-generator-cli generate --generator-key fetch",
158159
"gen:node": "openapi-generator-cli generate --generator-key node",
159160
"gen:ts": "openapi-generator-cli generate --generator-key ts"

src/index.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import fetchPonyfill from 'fetch-ponyfill'
2-
import { Configuration as GeneratedConfiguration, ConfigurationParameters } from '../generated/fetch/src/index'
2+
import { Configuration as GeneratedConfiguration } from '../generated/fetch/dist/src'
3+
import type { ConfigurationParameters } from '../generated/fetch/dist/src'
34

4-
class Configuration extends GeneratedConfiguration {
5+
export * from '../generated/fetch/dist/src/apis'
6+
export * from '../generated/fetch/dist/src/models'
7+
8+
export class Configuration extends GeneratedConfiguration {
59
constructor (options: ConfigurationParameters) {
610
/**
711
* Prevent the need for everyone to have to override the fetch API...
@@ -13,5 +17,19 @@ class Configuration extends GeneratedConfiguration {
1317
}
1418
}
1519

16-
export * from '../generated/fetch/src/index'
17-
export { Configuration }
20+
export type { ConfigurationParameters }
21+
export {
22+
BASE_PATH,
23+
BaseAPI,
24+
BlobApiResponse,
25+
COLLECTION_FORMATS,
26+
// Configuration, // overwritten above
27+
JSONApiResponse,
28+
RequiredError,
29+
TextApiResponse,
30+
VoidApiResponse,
31+
canConsumeForm,
32+
exists,
33+
mapValues,
34+
querystring
35+
} from '../generated/fetch/dist/src/runtime'

tsconfig.generated.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"compilerOptions": {
3+
"sourceRoot": "generated/fetch/src",
4+
"outDir": "generated/fetch/dist",
5+
"emitDeclarationOnly": false,
6+
"module": "ES2020",
7+
"target": "ES2020",
8+
"typeRoots": [
9+
"./types",
10+
"./node_modules/@types"
11+
],
12+
"declaration": true,
13+
"noEmitOnError": true,
14+
"esModuleInterop": true,
15+
"noUnusedLocals": false,
16+
"noUnusedParameters": false,
17+
"isolatedModules": false,
18+
"rootDir": "generated/fetch",
19+
"sourceMap": true,
20+
"moduleResolution":"Node"
21+
22+
},
23+
"include": [
24+
"generated/fetch/src",
25+
"types/global.d.ts",
26+
],
27+
"exclude": [
28+
"./generated/fetch/dist"
29+
]
30+
}

tsconfig.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,25 @@
66
"module": "ES2020",
77
"typeRoots": [
88
"./types",
9-
"./node_modules/@types"
9+
"./node_modules/@types",
10+
"./generated/fetch/dist"
1011
],
11-
"noEmitOnError": true
12+
"noEmitOnError": true,
13+
"esModuleInterop": true,
14+
"noUnusedLocals": false,
15+
"noUnusedParameters": false
1216
},
1317
"include": [
1418
"src",
15-
"generated",
19+
"test",
1620
"test/**/*.ts",
17-
"generated",
18-
"types/**/*.d.ts"
19-
, "MockServer.ts" ],
21+
"types/**/*.d.ts",
22+
"MockServer.ts",
23+
"./generated/fetch/dist"
24+
],
25+
"exclude": [
26+
"generated"
27+
],
2028
"ts-node": {
2129
"transpileOnly": true,
2230
"files": true,

types/global.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11

22
declare type GlobalFetch = WindowOrWorkerGlobalScope
3-
4-
declare module 'mock-ipfs-pinning-service' {
5-
export * from 'mock-ipfs-pinning-service/dist/index'
6-
}

0 commit comments

Comments
 (0)