-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vue): init, app, component and lib generators (#19130)
Co-authored-by: Katerina Skroumpelou <[email protected]>
- Loading branch information
Showing
98 changed files
with
5,388 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: Overview of the Nx Vue Plugin | ||
description: The Nx Plugin for Vue contains generators for managing Vue applications and libraries within an Nx workspace. This page also explains how to configure Vue on your Nx workspace. | ||
--- | ||
|
||
The Nx plugin for [Vue](https://vuejs.org/). | ||
|
||
## Setting up a new Nx workspace with Vue | ||
|
||
You can create a new workspace that uses Vue with one of the following commands: | ||
|
||
- Generate a new monorepo with a Vue app set up with Vue | ||
|
||
```shell | ||
npx create-nx-workspace@latest --preset=vue | ||
``` | ||
|
||
## Add Vue to an existing workspace | ||
|
||
There are a number of ways to use Vue in your existing workspace. | ||
|
||
### Install the `@nx/vue` plugin | ||
|
||
{% tabs %} | ||
{% tab label="npm" %} | ||
|
||
```shell | ||
npm install -D @nx/vue | ||
``` | ||
|
||
{% /tab %} | ||
{% tab label="yarn" %} | ||
|
||
```shell | ||
yarn add -D @nx/vue | ||
``` | ||
|
||
{% /tab %} | ||
{% tab label="pnpm" %} | ||
|
||
```shell | ||
pnpm install -D @nx/vue | ||
``` | ||
|
||
{% /tab %} | ||
{% /tabs %} | ||
|
||
### Generate a new project using Vue | ||
|
||
To generate a Vue application, run the following: | ||
|
||
```bash | ||
nx g @nx/vue:app my-app | ||
``` | ||
|
||
To generate a Vue library, run the following: | ||
|
||
```bash | ||
nx g @nx/vue:lib my-lib | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { | ||
cleanupProject, | ||
killPorts, | ||
newProject, | ||
runCLI, | ||
runE2ETests, | ||
uniq, | ||
} from '@nx/e2e/utils'; | ||
|
||
describe('Vue Plugin', () => { | ||
let proj: string; | ||
|
||
beforeAll(() => { | ||
proj = newProject({ | ||
unsetProjectNameAndRootFormat: false, | ||
}); | ||
}); | ||
|
||
afterAll(() => cleanupProject()); | ||
|
||
it('should serve application in dev mode', async () => { | ||
const app = uniq('app'); | ||
|
||
runCLI( | ||
`generate @nx/vue:app ${app} --unitTestRunner=vitest --e2eTestRunner=playwright` | ||
); | ||
let result = runCLI(`test ${app}`); | ||
expect(result).toContain(`Successfully ran target test for project ${app}`); | ||
|
||
result = runCLI(`build ${app}`); | ||
expect(result).toContain( | ||
`Successfully ran target build for project ${app}` | ||
); | ||
|
||
if (runE2ETests()) { | ||
const e2eResults = runCLI(`e2e ${app}-e2e --no-watch`); | ||
expect(e2eResults).toContain('Successfully ran target e2e'); | ||
expect(await killPorts()).toBeTruthy(); | ||
} | ||
}, 200_000); | ||
|
||
it('should build library', async () => { | ||
const lib = uniq('lib'); | ||
|
||
runCLI( | ||
`generate @nx/vue:lib ${lib} --bundler=vite --unitTestRunner=vitest` | ||
); | ||
|
||
const result = runCLI(`build ${lib}`); | ||
expect(result).toContain( | ||
`Successfully ran target build for project ${lib}` | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
769974b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nx-dev – ./
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx.dev