import { typescript, DependencyType, Project } from 'projen'; import { TypeScriptWorkspaceOptions } from './typescript-workspace-options'; /** * What kind of semver dependency to take * * - 'any-minor' corresponds to '^1' * - 'future-minor' corresponds to '^1.2.3' * - 'any-patch' to '~1.2' * - 'future-patch' corresponds to '~1.2.3' * - 'exact' corresponds to '1.2.3' * - 'any-future' corresponds to '>=1.2.3' * - 'any' corresponds to '*' */ export type VersionType = 'any-minor' | 'future-minor' | 'any-patch' | 'future-patch' | 'exact' | 'any-future' | 'any'; /** * A reference to a workspace in the same monorepo * * This can be used to reference packages in the same monorepo when declaring * `deps` and `devDeps`. * * By default, all `TypeScriptWorkspace`s implement this interface, representing themselves * with a `^` dependency and a restriction that public packages must have public dependencies. * * The method `.customizeReference({ ... })` can be used to create a workspace reference with * different behavior. */ export interface IWorkspaceReference { /** * Whether the referenced workspace package is private */ readonly isPrivatePackage: boolean; /** * The dependency name of the package */ readonly name: string; /** * The semver range that should be used to reference this package when it is released */ readonly versionType: VersionType; /** * The directory that holds this package in the monorepo */ readonly outdir: string; } /** * A TypeScript workspace in a `yarn.Monorepo` */ export declare class TypeScriptWorkspace extends typescript.TypeScriptProject implements IWorkspaceReference { readonly workspaceDirectory: string; readonly bundledDeps: string[]; readonly isPrivatePackage: boolean; readonly versionType = "future-minor"; private readonly monorepo; constructor(options: TypeScriptWorkspaceOptions); /** * I don't know why `tsconfig.dev.json` doesn't have an outdir, or where it's used, * but it's causing in-place `.js` files to appear. */ protected addTsconfigDevFix(): void; /** * Need to hack ESLint config * * .eslintrc.js will take precedence over the JSON file, it will load the * JSON file and patch it with a dynamic directory name that cannot be represented in * plain JSON (see https://github.com/projen/projen/issues/2405). * * Since eslint config is loaded with different cwd's depending on whether it's * from the VSCode plugin or from the command line, use absolute paths everywhere. */ protected addEslintRcFix(): void; /** * Return all Projects in the workspace that are also dependencies. * * Optionally filter by dependency type. */ workspaceDependencies(types?: DependencyType[]): Project[]; /** * Return a specialized reference to this workspace */ customizeReference(refOpts?: ReferenceOptions): IWorkspaceReference; } /** * Options for the `workspace.customizeReference()` method */ export interface ReferenceOptions { /** * What type of dependency to take on this package * * By default, dependencies will be referenced with a `^`, which means that * come install time a newer version may be installed. * * Choose a different range type to take, for example, an `exact` dependency. * * @default 'future-minor' */ readonly versionType?: VersionType; }