Skip to content

Commit 27f9274

Browse files
committed
fix: add content to installScripts type
1 parent eb171c7 commit 27f9274

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

shared/types/npm-registry.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* @see https://github.com/npm/registry/blob/main/docs/REGISTRY-API.md
77
*/
88

9+
import type { PackumentVersion } from '@npm/types'
10+
911
// Re-export official npm types for packument/manifest
1012
export type {
1113
Packument,
@@ -15,6 +17,18 @@ export type {
1517
PackageJSON,
1618
} from '@npm/types'
1719

20+
/** Install scripts info (preinstall, install, postinstall) */
21+
export interface InstallScriptsInfo {
22+
scripts: ('preinstall' | 'install' | 'postinstall')[]
23+
content: Record<string, string>
24+
npxDependencies: Record<string, string>
25+
}
26+
27+
/** PackumentVersion with additional install scripts info */
28+
export type SlimPackumentVersion = PackumentVersion & {
29+
installScripts?: InstallScriptsInfo
30+
}
31+
1832
/**
1933
* Slimmed down Packument for client-side use.
2034
* Strips unnecessary fields to reduce payload size.
@@ -38,16 +52,7 @@ export interface SlimPackument {
3852
'repository'?: { type?: string; url?: string; directory?: string }
3953
'bugs'?: { url?: string; email?: string }
4054
/** Only includes dist-tag versions (with installScripts info added per version) */
41-
'versions': Record<
42-
string,
43-
import('@npm/types').PackumentVersion & {
44-
/** Install scripts info (preinstall, install, postinstall) */
45-
installScripts?: {
46-
scripts: ('preinstall' | 'install' | 'postinstall')[]
47-
npxDependencies: Record<string, string>
48-
}
49-
}
50-
>
55+
'versions': Record<string, SlimPackumentVersion>
5156
}
5257

5358
/**

0 commit comments

Comments
 (0)