Creates dedicated lockfiles for specific workspace projects within a pnpm monorepo
npx @tessl/cli install tessl/npm-pnpm--make-dedicated-lockfile@1000.0.0⚠️ DEPRECATED: This package is deprecated. Please use the pnpm deploy command instead.
Creates dedicated lockfiles for specific workspace projects within a pnpm monorepo. This package extracts dependency information from the main workspace lockfile and generates a focused lockfile containing only the dependencies relevant to a particular project and its subdirectories.
npm install @pnpm/make-dedicated-lockfileimport { makeDedicatedLockfile } from "@pnpm/make-dedicated-lockfile";For CommonJS:
const { makeDedicatedLockfile } = require("@pnpm/make-dedicated-lockfile");import { makeDedicatedLockfile } from "@pnpm/make-dedicated-lockfile";
// Create dedicated lockfile for a specific project
await makeDedicatedLockfile(
"/path/to/workspace/root", // lockfileDir - where pnpm-lock.yaml exists
"/path/to/workspace/root/packages/my-project" // projectDir - target project
);# Navigate to the project directory first
cd packages/my-project
# Run the CLI command
npx @pnpm/make-dedicated-lockfile
# or if installed globally
make-dedicated-lockfileCreates a dedicated lockfile for a specific project directory within a workspace, extracting only the dependencies relevant to that project.
/**
* Creates a dedicated lockfile for a specific project directory within a workspace
* @param lockfileDir - Directory containing the workspace lockfile (typically workspace root)
* @param projectDir - Target project directory to create dedicated lockfile for
* @throws Error if no lockfile found in lockfileDir
* @throws PnpmError if not in a workspace (CLI usage)
*/
function makeDedicatedLockfile(lockfileDir: string, projectDir: string): Promise<void>;Process Overview:
lockfileDir@pnpm/lockfile.prunerpnpm install with dedicated lockfile settingsSide Effects:
pnpm-lock.yaml in the target project directorypackage.json during installation processnode_modules directory reorganization during processpnpm exec with specific flagsError Conditions:
Error with message "no lockfile found" if workspace lockfile doesn't existPnpmError with code 'WORKSPACE_NOT_FOUND' if project is not in a workspace (CLI usage)Installation Flags Used:
--frozen-lockfile: Use exact versions from lockfile--lockfile-dir=.: Use current directory as lockfile location--fix-lockfile: Fix any lockfile inconsistencies--filter=.: Install only current project dependencies--no-link-workspace-packages: Don't link workspace packages--config.dedupe-peer-dependents=false: Disable peer dependency deduplication// Re-exported from @pnpm/types
type ProjectId = string & { __brand: 'ProjectId' };
// Re-exported from @pnpm/types
type DependenciesField = 'optionalDependencies' | 'dependencies' | 'devDependencies';
// Re-exported from @pnpm/types
const DEPENDENCIES_FIELDS: DependenciesField[] = [
'optionalDependencies',
'dependencies',
'devDependencies',
];
// Re-exported from @pnpm/lockfile.types
type ResolvedDependencies = Record<string, string>;
// Re-exported from @pnpm/lockfile.types
interface ProjectSnapshot {
specifiers: ResolvedDependencies;
dependencies?: ResolvedDependencies;
devDependencies?: ResolvedDependencies;
optionalDependencies?: ResolvedDependencies;
dependenciesMeta?: DependenciesMeta;
publishDirectory?: string;
}
// Re-exported from @pnpm/types
interface DependenciesMeta {
[depName: string]: {
injected?: boolean;
node?: string;
patch?: string;
};
}
// Re-exported from @pnpm/error
class PnpmError extends Error {
constructor(
code: string,
message: string,
opts?: {
attempts?: number;
hint?: string;
prefix?: string;
}
);
code: string;
hint?: string;
attempts?: number;
prefix?: string;
pkgsStack?: Array<{ id: string; name: string; version: string }>;
}The CLI entry point automatically determines the required directories:
process.cwd() (current working directory)@pnpm/find-workspace-dir to locate workspace root# The CLI workflow:
# 1. Get current directory as project directory
# 2. Find workspace root containing pnpm-lock.yaml
# 3. Call makeDedicatedLockfile with both paths
# 4. Handle workspace detection errorsThis package is deprecated. Use pnpm deploy instead:
# Instead of:
cd packages/my-project
make-dedicated-lockfile
# Use:
pnpm deploy packages/my-project /output/directoryThe pnpm deploy command provides similar functionality with better integration into the pnpm ecosystem and additional features like copying project files and handling deployment scenarios.