Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create new @pnpm/catalogs.types package #8026

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions catalogs/types/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @pnpm/catalogs.types

## 0.1.0

Initial release
3 changes: 3 additions & 0 deletions catalogs/types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @pnpm/catalogs.types

> Types related to the pnpm catalogs feature.
38 changes: 38 additions & 0 deletions catalogs/types/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "@pnpm/catalogs.types",
"version": "0.1.0",
"description": "Types related to the pnpm catalogs feature.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"engines": {
"node": ">=18.12"
},
"files": [
"lib",
"!*.map"
],
"repository": "https://github.com/pnpm/pnpm/blob/main/catalogs/types",
"keywords": [
"pnpm9",
"pnpm",
"types"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/main/catalogs/types#readme",
"scripts": {
"lint": "eslint \"src/**/*.ts\"",
"compile": "tsc --build && pnpm run lint --fix",
"prepublishOnly": "pnpm run compile",
"test": "pnpm run compile"
},
"funding": "https://opencollective.com/pnpm",
"exports": {
".": "./lib/index.js"
},
"devDependencies": {
"@pnpm/catalogs.types": "workspace:*"
}
}
29 changes: 29 additions & 0 deletions catalogs/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Catalogs parsed from the pnpm-workspace.yaml file.
*
* https://github.com/pnpm/rfcs/pull/1
*/
export interface Catalogs {
/**
* The default catalog.
*
* The default catalog can be defined in 2 ways.
*
* 1. Users can specify a top-level "catalog" field or,
* 2. An explicitly named "default" catalog under the "catalogs" map.
*
* This field contains either definition. Note that it's an error to define
* the default catalog using both options. The parser will fail when reading
* the workspace manifest.
*/
readonly default?: Catalog

/**
* Named catalogs.
*/
readonly [catalogName: string]: Catalog | undefined
}

export interface Catalog {
readonly [dependencyName: string]: string | undefined
}
13 changes: 13 additions & 0 deletions catalogs/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "@pnpm/tsconfig",
"composite": true,
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"include": [
"src/**/*.ts",
"../../__typings__/**/*.d.ts"
],
"references": []
}
8 changes: 8 additions & 0 deletions catalogs/types/tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"include": [
"src/**/*.ts",
"test/**/*.ts",
"../../__typings__/**/*.d.ts"
]
}
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

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

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ packages:
- __typings__
- __utils__/*
- "!__utils__/build-artifacts"
- catalogs/*
- cli/*
- completion/*
- config/*
Expand Down