Skip to content

Commit

Permalink
feat: create new @pnpm/catalogs.types package (#8026)
Browse files Browse the repository at this point in the history
  • Loading branch information
gluxon committed Apr 29, 2024
1 parent 0056c0a commit 95e9a8d
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 0 deletions.
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

0 comments on commit 95e9a8d

Please sign in to comment.