Skip to content

Commit fdb7e22

Browse files
committed
chore: fix mongoose build
1 parent c0e08fa commit fdb7e22

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

build.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { basename, join } from 'path'
2-
import { build } from 'tsc-prog'
2+
import { build, EmitOptions } from 'tsc-prog'
33
import * as ts from 'typescript'
44
import * as tsdoc from '@microsoft/tsdoc'
55
import { writeFileSync } from 'fs'
@@ -8,6 +8,23 @@ const basePath = process.cwd()
88
const folderName = basename(basePath)
99
const dtsEntryPoint = 'index.d.ts'
1010

11+
let bundle: EmitOptions.Bundle | undefined
12+
13+
if (folderName !== 'http' && folderName !== 'mongoose') {
14+
bundle = {
15+
entryPoint: dtsEntryPoint,
16+
augmentations: false,
17+
}
18+
}
19+
20+
if (folderName === 'mongoose') {
21+
bundle = {
22+
entryPoint: dtsEntryPoint,
23+
augmentations: false,
24+
extras: [{ position: 'after-imports', declaration: 'import * as mongoose from "mongoose";' }],
25+
}
26+
}
27+
1128
build({
1229
basePath,
1330
configFilePath: 'tsconfig.json',
@@ -21,7 +38,7 @@ build({
2138
include: [`src/**/*`],
2239
exclude: ['**/__tests__', '**/test.ts', '**/*.test.ts', '**/*.spec.ts', 'node_modules'],
2340
clean: { outDir: true },
24-
bundleDeclaration: folderName !== 'http' ? { entryPoint: dtsEntryPoint, augmentations: false } : undefined,
41+
bundleDeclaration: bundle,
2542
})
2643

2744
syncOverloadsDoc()

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
"supertest": "^6.3.3",
4242
"ts-jest": "^29.1.0",
4343
"ts-node": "^10.9.1",
44-
"tsc-prog": "^2.2.1",
44+
"tsc-prog": "^2.3.0",
4545
"tslint": "^6.1.3",
4646
"tslint-config-prettier": "^1.18.0",
47-
"typescript": "^4.9.3",
47+
"typescript": "^4.9.5",
4848
"typescript-tslint-plugin": "^1.0.2"
4949
}
5050
}

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8879,10 +8879,10 @@ ts-node@^10.8.1, ts-node@^10.9.1:
88798879
v8-compile-cache-lib "^3.0.1"
88808880
yn "3.1.1"
88818881

8882-
tsc-prog@^2.2.1:
8883-
version "2.2.1"
8884-
resolved "https://registry.yarnpkg.com/tsc-prog/-/tsc-prog-2.2.1.tgz#7ea892e1628f1ef93ae6f4d0a97c8a9518e4b408"
8885-
integrity sha512-whYQUQjB+wm9c2FoikigaBVnXesgAjIYXgHrbzlK+Etg9L657a92MSUcbi5hrD/YBaRmjuDcTIQVZmo/f74OZQ==
8882+
tsc-prog@^2.3.0:
8883+
version "2.3.0"
8884+
resolved "https://registry.yarnpkg.com/tsc-prog/-/tsc-prog-2.3.0.tgz#b14ffb4e9487cca5cf42185f2a94963978faf8ee"
8885+
integrity sha512-ycET2d75EgcX7y8EmG4KiZkLAwUzbY4xRhA6NU0uVbHkY4ZjrAAuzTMxXI85kOwATqPnBI5C/7y7rlpY0xdqHA==
88868886

88878887
88888888
version "1.11.2"
@@ -9036,7 +9036,7 @@ typescript-tslint-plugin@^1.0.2:
90369036
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274"
90379037
integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==
90389038

9039-
typescript@^4.9.3:
9039+
typescript@^4.9.5:
90409040
version "4.9.5"
90419041
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
90429042
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==

0 commit comments

Comments
 (0)