Skip to content

Commit

Permalink
refactor: create a package for hook types (#6380)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Apr 12, 2023
1 parent 0ab1e52 commit ece5a1a
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-cats-own.md
@@ -0,0 +1,5 @@
---
"@pnpm/hooks.types": major
---

Initial release.
2 changes: 1 addition & 1 deletion hooks/pnpmfile/package.json
Expand Up @@ -33,9 +33,9 @@
"@pnpm/pnpmfile": "workspace:*"
},
"dependencies": {
"@pnpm/core": "workspace:*",
"@pnpm/core-loggers": "workspace:*",
"@pnpm/error": "workspace:*",
"@pnpm/hooks.types": "workspace:*",
"@pnpm/lockfile-types": "workspace:*",
"@pnpm/store-controller-types": "workspace:*",
"@pnpm/types": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion hooks/pnpmfile/src/requireHooks.ts
@@ -1,5 +1,5 @@
import path from 'path'
import type { PreResolutionHook, PreResolutionHookContext, PreResolutionHookLogger } from '@pnpm/core'
import type { PreResolutionHook, PreResolutionHookContext, PreResolutionHookLogger } from '@pnpm/hooks.types'
import { hookLogger } from '@pnpm/core-loggers'
import pathAbsolute from 'path-absolute'
import type { Lockfile } from '@pnpm/lockfile-types'
Expand Down
4 changes: 2 additions & 2 deletions hooks/pnpmfile/tsconfig.json
Expand Up @@ -25,10 +25,10 @@
"path": "../../packages/types"
},
{
"path": "../../pkg-manager/core"
"path": "../../store/store-controller-types"
},
{
"path": "../../store/store-controller-types"
"path": "../types"
}
],
"composite": true
Expand Down
15 changes: 15 additions & 0 deletions hooks/types/README.md
@@ -0,0 +1,15 @@
# @pnpm/hooks.types

> Types for hooks
[![npm version](https://img.shields.io/npm/v/@pnpm/hooks.types.svg)](https://www.npmjs.com/package/@pnpm/hooks.types)

## Installation

```sh
pnpm add @pnpm/hooks.types
```

## License

MIT
41 changes: 41 additions & 0 deletions hooks/types/package.json
@@ -0,0 +1,41 @@
{
"name": "@pnpm/hooks.types",
"version": "0.0.0",
"description": "Types for hooks",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib",
"!*.map"
],
"engines": {
"node": ">=16.14"
},
"scripts": {
"test": "pnpm run compile",
"prepublishOnly": "pnpm run compile",
"compile": "tsc --build && pnpm run lint --fix",
"lint": "eslint \"src/**/*.ts\""
},
"repository": "https://github.com/pnpm/pnpm/blob/main/hooks/types",
"keywords": [
"pnpm8",
"pnpm"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/main/hooks/types#readme",
"devDependencies": {
"@pnpm/hooks.types": "workspace:*"
},
"dependencies": {
"@pnpm/lockfile-types": "workspace:*",
"@pnpm/types": "workspace:*"
},
"funding": "https://opencollective.com/pnpm",
"exports": {
".": "./lib/index.js"
}
}
@@ -1,4 +1,4 @@
import type { Lockfile } from '@pnpm/lockfile-file'
import type { Lockfile } from '@pnpm/lockfile-types'
import type { Registries } from '@pnpm/types'

export interface PreResolutionHookContext {
Expand Down
20 changes: 20 additions & 0 deletions hooks/types/tsconfig.json
@@ -0,0 +1,20 @@
{
"extends": "@pnpm/tsconfig",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"include": [
"src/**/*.ts",
"../../__typings__/**/*.d.ts"
],
"references": [
{
"path": "../../lockfile/lockfile-types"
},
{
"path": "../../packages/types"
}
],
"composite": true
}
8 changes: 8 additions & 0 deletions hooks/types/tsconfig.lint.json
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": [
"src/**/*.ts",
"test/**/*.ts",
"../../__typings__/**/*.d.ts"
]
}
1 change: 1 addition & 0 deletions pkg-manager/core/package.json
Expand Up @@ -28,6 +28,7 @@
"@pnpm/headless": "workspace:*",
"@pnpm/hoist": "workspace:*",
"@pnpm/hooks.read-package-hook": "workspace:*",
"@pnpm/hooks.types": "workspace:*",
"@pnpm/lifecycle": "workspace:*",
"@pnpm/link-bins": "workspace:*",
"@pnpm/lockfile-file": "workspace:*",
Expand Down
1 change: 0 additions & 1 deletion pkg-manager/core/src/index.ts
Expand Up @@ -8,7 +8,6 @@ export type {
} from '@pnpm/types'
export type { HoistingLimits } from '@pnpm/headless'
export * from './api'
export * from './install/hooks'

export { type ProjectOptions, UnexpectedStoreError, UnexpectedVirtualStoreDirError } from '@pnpm/get-context'
export type { InstallOptions } from './install/extendInstallOptions'
Expand Down
2 changes: 1 addition & 1 deletion pkg-manager/core/src/install/extendInstallOptions.ts
Expand Up @@ -17,7 +17,7 @@ import {
} from '@pnpm/types'
import { pnpmPkgJson } from '../pnpmPkgJson'
import { type ReporterFunction } from '../types'
import { type PreResolutionHookContext } from './hooks'
import { type PreResolutionHookContext } from '@pnpm/hooks.types'

export interface StrictInstallOptions {
autoInstallPeers: boolean
Expand Down
3 changes: 3 additions & 0 deletions pkg-manager/core/tsconfig.json
Expand Up @@ -42,6 +42,9 @@
{
"path": "../../hooks/read-package-hook"
},
{
"path": "../../hooks/types"
},
{
"path": "../../lockfile/filter-lockfile"
},
Expand Down
31 changes: 23 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ece5a1a

Please sign in to comment.