Skip to content
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 workspace support #153

Open
danieldelcore opened this issue Mar 23, 2023 · 0 comments
Open

pnpm workspace support #153

danieldelcore opened this issue Mar 23, 2023 · 0 comments
Labels
📈 enhancement New feature or request 🤩 good first issue Good for newcomers

Comments

@danieldelcore
Copy link
Contributor

Originally submitted to Discord: https://discord.com/channels/1062245324732768347/1062248060702437376/1086273854072172544

I'm trying to run codeshift in a monorepo following this guide: https://www.codeshiftcommunity.com/docs/monorepos, but when I get the the Development step: https://www.codeshiftcommunity.com/docs/monorepos/#development the CLI does not find any codemods, in the docs it says that it will leverage the workspace (we are using pnpm workspaces), but when I run the command there are no codemods in the list. if I create a codeshift.config.js in the root of the dir and I add the transform which is in one of my packages, then it works. am I doing something wrong? here is an example of the codeshift.config.js which i'm required to add at the root dir

module.exports = {
  maintainers: [],
  targets: [],
  description: 'Codemods for compat',

  transforms: {
    '1.0.0': require.resolve('./packages/compat/codemods/1.0.0/transform'),
  },

  presets: {},
};

For the docs, my understanding is that it should be able to read this already from my packages dir, for example ./packages/compat/codeshift.config.js ?

to note, we are using type:"module" in our packages, so my configs are .cjs instead. (I also tried without the cjs and type:"modules" but it's still the same issue)

I found the entry point for workspaces: https://github.com/CodeshiftCommunity/CodeshiftCommunity/blob/main/packages/cli/src/main.ts#L51C4-L87 but this means it's not always valid, for example in pnpm you define workspaces with the pnpm-workspace.yaml (https://pnpm.io/pnpm-workspace_yaml), defining it in packages does fix the issue.

@danieldelcore danieldelcore added 📈 enhancement New feature or request 🤩 good first issue Good for newcomers labels Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📈 enhancement New feature or request 🤩 good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant