Skip to content

Commit

Permalink
Add workspaces to PackageJson type
Browse files Browse the repository at this point in the history
  • Loading branch information
ifiokjr committed Feb 4, 2020
1 parent 8b857ce commit 0f388a2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions source/package-json.d.ts
Expand Up @@ -257,8 +257,26 @@ declare namespace PackageJson {
typings?: string;
}

export interface Workspaces {
/**
The packages blob to use for workspaces.
*/
packages: string[];
/**
A list of glob patterns for packages that should not be hoisted.
*/
nohoist: string[];
}

export interface YarnConfiguration {
/**
Used to configure yarn (and other) workspaces.
Please note private should be set to true to use workspaces
*/
workspaces?: string[] | Workspaces;

/**
If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command line, set this to `true`.
Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an application), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.
Expand Down
1 change: 1 addition & 0 deletions test-d/package-json.ts
Expand Up @@ -35,6 +35,7 @@ expectType<PackageJson.Dependency | undefined>(packageJson.peerDependencies);
expectType<string[] | undefined>(packageJson.bundleDependencies);
expectType<string[] | undefined>(packageJson.bundledDependencies);
expectType<PackageJson.Dependency | undefined>(packageJson.resolutions);
expectType<PackageJson.Workspaces | string[] | undefined>(packageJson.workspaces);
expectType<{[engineName: string]: string} | undefined>(packageJson.engines);
expectType<boolean | undefined>(packageJson.engineStrict);
expectType<
Expand Down

0 comments on commit 0f388a2

Please sign in to comment.