As stated in the executor's PR:
If valid semver is acceptable in npm - the design of this will need to change somewhat 🤔
Originally posted by @Coly010 in #31545 (comment)
I am currently trying to use the executor with npm to deploy my repo's apps but can't prune the lockfile properly since the sourcecode is missing npm related checks.
Currently checking if the package is an internal package is done like so (compatible with yarn/pnpm but not npm):
if (pkgVersion.startsWith('workspace:') ||
pkgVersion.startsWith('file:') ||
pkgVersion.startsWith('link:')) {
packageJson.dependencies[pkgName] = `file:./workspace_modules/${pkgName}`;
}
But packages via npm workspaces use formats like:
"@repo/schemas": "0.0.1"
"@repo/schemas": "*"
which aren't supported..
Full source code
function createPrunedLockfile(packageJson, graph) {
const packageManager = (0, devkit_1.detectPackageManager)(devkit_1.workspaceRoot);
const lockfileName = (0, lock_file_1.getLockFileName)(packageManager);
const lockFile = (0, lock_file_1.createLockFile)(packageJson, graph, packageManager);
for (const [pkgName, pkgVersion] of Object.entries(packageJson.dependencies ?? {})) {
if (pkgVersion.startsWith('workspace:') ||
pkgVersion.startsWith('file:') ||
pkgVersion.startsWith('link:')) {
packageJson.dependencies[pkgName] = `file:./workspace_modules/${pkgName}`;
}
}
return {
lockfileName,
lockFile,
};
}
As stated in the executor's PR:
I am currently trying to use the executor with npm to deploy my repo's apps but can't prune the lockfile properly since the sourcecode is missing npm related checks.
Currently checking if the package is an internal package is done like so (compatible with yarn/pnpm but not npm):
But packages via npm workspaces use formats like:
"@repo/schemas": "0.0.1""@repo/schemas": "*"which aren't supported..
Full source code