nx icon indicating copy to clipboard operation
nx copied to clipboard

Add documentation how to create a custom inferred tasks plugin

Open TNAJanssen opened this issue 1 year ago • 4 comments

Documentation issue

  • [ ] Reporting a typo
  • [ ] Reporting a documentation bug
  • [X] Documentation improvement
  • [ ] Documentation feedback

Is there a specific documentation page you are reporting?

n/a

Additional context or description

I want to create a custom tsc check plugin using inferred tasks, but there is no documentation on how to do this.

TNAJanssen avatar Mar 15 '24 11:03 TNAJanssen

When following this documentation: https://nx.dev/extending-nx/recipes/project-graph-plugins

I get the following error: Inner Error: Error: Jest: Failed to parse the TypeScript config file libs/xxx/jest.config.ts TSError: ⨯ Unable to compile TypeScript: libs/xxx/jest.config.ts(11,7): error TS2451: Cannot redeclare block-scoped variable '_default'.

While i didn't add anything: import { CreateNodes, CreateNodesContext, readJsonFile } from '@nx/devkit'; import { dirname } from 'path';

export const createNodes: CreateNodes = [ '**/project.json', (projectConfigurationFile: string, opts, context: CreateNodesContext) => { const projectConfiguration = readJsonFile(projectConfigurationFile); const root = dirname(projectConfigurationFile);

return {
  projects: {
    [root]: projectConfiguration,
  },
};

}, ];

TNAJanssen avatar Mar 15 '24 12:03 TNAJanssen

I have encountered same error, and i am not certain if this has to do with me making a mistake in piecing together information across the guides or there is an issue with jest plugin.

Here is barebones reproduction repo: https://github.com/epliXs/nx-plugin-debug

The error is intermittent, the most consistent way of reproducing it is:

  • npx nx reset
  • npx nx run foobar-a:echo

epliXs avatar Apr 08 '24 20:04 epliXs

Thanks for reporting this!

Could you please expand on what piece of extra information you feel is needed or would like to see in the https://nx.dev/extending-nx/recipes/project-graph-plugins recipe? We recently added some extra information to that page.

The error reported is unrelated to the plugin you've created. It's an error thrown from the @nx/jest/plugin, and that's a separate issue. Please let's keep this issue focused on the documentation improvements you think are needed. If the issue's purpose was actually to get help on how to address that error, we can update the description and focus on that instead. Otherwise, feel free to create a separate issue for the Jest plugin error.

leosvelperez avatar May 09 '24 11:05 leosvelperez

This issue has been automatically marked as stale because more information has not been provided within 7 days. It will be closed in 21 days if no information is provided. If information has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] avatar May 17 '24 00:05 github-actions[bot]

Created https://github.com/nrwl/nx/issues/26245 for the issue with the jest plugin

a88zach avatar May 29 '24 15:05 a88zach

This issue has been automatically marked as stale because more information has not been provided within 7 days. It will be closed in 21 days if no information is provided. If information has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] avatar Jun 07 '24 00:06 github-actions[bot]

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

github-actions[bot] avatar Jul 29 '24 00:07 github-actions[bot]