Skip to content

Conversation

@dimaMachina
Copy link
Contributor

  • took workspace from pnpm-workspace.yaml
  • throw an error in case existing both pnpm-workspace.yaml and package.json#workspaces fields
  • add execa as dependency
  • cleanup unused deps

throw an error in case existing both `pnpm-workspace.yaml` and `package.json#workspaces` fields
add `execa` as dependency
cleanup unused deps
@changeset-bot
Copy link

changeset-bot bot commented Dec 22, 2022

🦋 Changeset detected

Latest commit: c69d5b6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
bob-the-bundler Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

"consola": "^2.15.3",
"cross-spawn": "^7.0.3",
"dependency-graph": "^0.11.0",
"execa": "5.1.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

execa imported and should be present in dependencies

Comment on lines -25 to -42
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@vercel/ncc": "^0.36.0",
"builtins": "^5.0.1",
"consola": "^2.15.3",
"cross-spawn": "^7.0.3",
"dependency-graph": "^0.11.0",
"execa": "5.1.1",
"fs-extra": "^10.1.0",
"globby": "^11.0.0",
"js-yaml": "^4.1.0",
"lodash.get": "^4.4.2",
"minimatch": "^5.1.0",
"mkdirp": "^1.0.4",
"p-limit": "^3.1.0",
"param-case": "^3.0.4",
"resolve.exports": "^1.1.0",
"rollup": "^2.75.6",
"rollup-plugin-generate-package-json": "^3.2.0",
"rollup-plugin-typescript2": "^0.34.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems bunch of these dependencies were nowhere used

Comment on lines -59 to +63
function compilerOptionsToArgs(
options: Record<string, unknown>
): Array<string> {
const args: Array<string> = [];
for (const [key, value] of Object.entries(options)) {
args.push(`--${key}`, `${value}`);
}
return args;
function compilerOptionsToArgs(options: Record<string, unknown>): string[] {
return Object.entries(options).flatMap(([key, value]) => [
`--${key}`,
`${value}`,
]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for better readability

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the former has better readability for me 😁

Comment on lines -1 to -3
declare module 'rollup-plugin-generate-package-json';
declare module 'rollup-plugin-auto-external';
declare module 'builtins';
Copy link
Contributor Author

@dimaMachina dimaMachina Dec 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does I was right that they are unused?

Comment on lines +21 to +34
const pnpmWorkspacePath = path.join(process.cwd(), "pnpm-workspace.yaml");
const isPnpmWorkspace = await fse.pathExists(pnpmWorkspacePath);

if (isPnpmWorkspace) {
if (result) {
throw new Error(
"Both `pnpm-workspace.yaml` and `package.json#workspaces` are not supported. Remove `package.json#workspaces` field."
);
}

result = jsYaml.load(await fse.readFile(pnpmWorkspacePath, "utf8")) as {
packages?: string[];
};
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here magic happens and I think it is better place to validate it in getWorkspaces than validatePackageJson

Comment on lines +1 to +7
type Exports =
| string
| {
require?: string | Record<string, string>;
import?: string | Record<string, string>;
default?: string | Record<string, string>;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that type was inlined 2 times, I extracted it

Comment on lines +1 to +4
{
"name": "monorepo-pnpm",
"private": true
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is identical to simple-monorepo except that it contain pnpm-workspace.yaml

@dimaMachina dimaMachina marked this pull request as ready for review December 22, 2022 02:34
@n1ru4l n1ru4l changed the title Support pnpm workspaces feat: support pnpm workspaces Dec 22, 2022
@n1ru4l n1ru4l merged commit 9ce6e27 into graphql-hive:master Dec 22, 2022
@dimaMachina dimaMachina deleted the support-pnpm branch December 22, 2022 11:19
@github-actions github-actions bot mentioned this pull request Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants