-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pnpm: "catalog:" is not supported #204
Comments
Thank you so much for reporting this! have you tried |
I used |
I will have a look, thanks! |
Hmm, do you have any reproduction or a repo? I want to see what kind of workspace pkg.pr.new should adapt to. |
The code is not public but here's how the relevant files look. pnpm-workspace.yaml
packages/core {
"name": "",
"version": "0.28.0",
"description": "",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"style": "dist/index.css",
"dependencies": {
"@baseline-ui/core": "workspace:*",
"@baseline-ui/utils": "workspace:*",
"@react-aria/interactions": "catalog:",
"@react-aria/utils": "catalog:",
"@react-spring/web": "^9.7.4",
},
"peerDependencies": {
"react": "^17.0.2 || ^18.0.0",
"react-dom": "^17.0.2 || ^18.0.0"
},
}
I was able to resolve this by running a script that replaces all occurences of #!/usr/bin/env ts-node
import { pick } from "lodash";
import fs from "node:fs/promises";
import path from "node:path";
import yaml from "yaml";
// This script removes the catalog from the dependencies of the packages in the monorepo.
// Temporary workaround for https://github.com/stackblitz-labs/pkg.pr.new/issues/204
void (async function () {
const pnpmWorkspace = await fs.readFile(
path.resolve(__dirname, "./pnpm-workspace.yaml"),
);
const catalog = yaml.parse(pnpmWorkspace.toString("utf8")).catalog;
const packagesName = await fs.readdir(path.resolve(__dirname, "./packages"));
const packages = packagesName.map((dir) =>
path.resolve(__dirname, `./packages/${dir}`),
);
for (const package_ of packages) {
const packageJson = await fs.readFile(
path.resolve(package_, "package.json"),
);
const packageJsonObj = JSON.parse(packageJson.toString("utf8"));
const dependencies = packageJsonObj.dependencies || {};
packageJsonObj.dependencies = {
...dependencies,
...pick(catalog, Object.keys(dependencies)),
};
const devDependencies = packageJsonObj.devDependencies || {};
packageJsonObj.devDependencies = {
...devDependencies,
...pick(catalog, Object.keys(devDependencies)),
};
await fs.writeFile(
path.resolve(package_, "package.json"),
JSON.stringify(packageJsonObj, null, 2),
);
}
})(); |
I can confirm this is also an issue in UnoCSS - see unocss/unocss#4122 for description and reproduction. We are also using the |
Interesting, now I'm thinking, how does pnpm handles catalogs? Does it handle catalogs in Since pkg.pr.new uses cc @zkochan out of curiosity! |
The docs indicate both |
Oh nice catch, yea, since we use pnpm pack, it should be handled but there might be a bug there? I think it'd be good to reproduce without pkg.pr.new and see if it's an actual bug in pnpm itself. |
Based on the following comment, using `pnpm` should resolve the workspace:*protocol correctly. Let's try it. stackblitz-labs/pkg.pr.new#204 (comment)
@ritz078 can you please confirm that using We also have an in-house patch to replace all |
The catalog: protocol is a new feature that is not supported by this app yet. https://pnpm.io/catalogs
The text was updated successfully, but these errors were encountered: