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

feat(nuxt): nodes for build, serve, test targets #20145

Merged
merged 1 commit into from Nov 30, 2023

Conversation

mandarini
Copy link
Member

@mandarini mandarini commented Nov 9, 2023

A plugin (@nx/nuxt/plugin) which will add Nuxt targets/projects to the Nx project graph. This allows you to run Nuxt for projects that have a nuxt.config.ts file without creating a project.json file.

To-do's

  • Read outputs from config (when async is ready)
  • test node
  • Look into correct dir resolution - what outputs are indeed needed
  • Decide on what to do with the docs

Once this PR is merged, we can add the cypress web server config.

How it works

On @nx/nuxt:init (which is called through the @nx/nuxt:application generator this is added in the nx.json:

...
plugins: [
  {
    plugin: '@nx/nuxt/plugin',
    options: {
      buildTargetName: 'build',
      serveTargetName: 'serve',
      testTargetName: 'test'
    },
  },
  ...
]

so that you can run nx build my-app, nx test my-app etc, without manually defining these targets in your projects' project.json.

The plugin generates these targets with bare minimum (no extra) options configuration. Any options you need for your nuxt app, you can add in your project's nuxt.config.ts.

@mandarini mandarini self-assigned this Nov 9, 2023
Copy link

vercel bot commented Nov 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Nov 30, 2023 3:11pm

@mandarini mandarini force-pushed the feat/nuxt-nodes branch 3 times, most recently from 068f8c7 to 2dd509f Compare November 9, 2023 11:20
@mandarini mandarini changed the title Feat/nuxt nodes feat(nuxt): plugin build, serve nodes Nov 9, 2023
@mandarini mandarini marked this pull request as ready for review November 9, 2023 11:21
@mandarini mandarini requested review from a team as code owners November 9, 2023 11:21
@mandarini mandarini changed the title feat(nuxt): plugin build, serve nodes feat(nuxt): nodes for build, serve targets Nov 9, 2023
@mandarini mandarini force-pushed the feat/nuxt-nodes branch 2 times, most recently from 76a1b1f to c2f4cf9 Compare November 10, 2023 13:18
@mandarini mandarini requested a review from a team as a code owner November 10, 2023 14:29
@mandarini mandarini force-pushed the feat/nuxt-nodes branch 3 times, most recently from 52a09e4 to 9565424 Compare November 10, 2023 14:36
packages/nuxt/src/plugins/plugin.ts Outdated Show resolved Hide resolved
packages/nuxt/src/plugins/plugin.ts Outdated Show resolved Hide resolved
packages/nuxt/src/plugins/plugin.ts Outdated Show resolved Hide resolved
packages/nuxt/src/plugins/plugin.ts Outdated Show resolved Hide resolved
packages/nuxt/src/plugins/plugin.ts Outdated Show resolved Hide resolved
packages/nuxt/src/plugins/plugin.ts Outdated Show resolved Hide resolved
@mandarini mandarini force-pushed the feat/nuxt-nodes branch 2 times, most recently from 2c07457 to 2c1fc81 Compare November 30, 2023 14:58
docs/map.json Outdated
@@ -2171,6 +2171,13 @@
"name": "Overview of the Nx Nuxt Plugin",
"description": "The Nx Plugin for Nuxt contains generators for managing Nuxt applications within a Nx workspace. This page also explains how to configure Nuxt on your Nx workspace.",
"file": "shared/packages/nuxt/nuxt-plugin"
},
{
"id": "nuxt-nodes-plugin",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would add this information in the nuxt overview guide.

Comment on lines 10 to 28
// jest.mock('@nuxt/kit', () => ({
// loadNuxtConfig: jest.fn().mockImplementation(() => {
// return Promise.resolve({
// path: 'nuxt.config.ts',
// config: {},
// dependencies: [],
// });
// }),
// }));

// jest.mock('@nx/nuxt', () => ({
// loadNuxtKitDynamicImport: jest.fn().mockResolvedValue({
// loadNuxtConfig: jest.fn().mockResolvedValue({
// path: 'nuxt.config.ts',
// config: {},
// dependencies: [],
// }),
// }),
// }));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be removed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can remove this now if we generate a target with command

@mandarini mandarini merged commit 468de36 into nrwl:master Nov 30, 2023
6 checks passed
Copy link

github-actions bot commented Dec 6, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants