-
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(platform): add Vite dev-server/build and Vitest executors (#719)
- Loading branch information
1 parent
2e47410
commit ff168ff
Showing
20 changed files
with
426 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"builders": { | ||
"vite-dev-server": { | ||
"implementation": "./src/executors/vite-dev-server/compat", | ||
"schema": "./src/executors/vite-dev-server/schema.json", | ||
"description": "Vite dev server." | ||
}, | ||
"vite": { | ||
"implementation": "./src/executors/vite/compat", | ||
"schema": "./src/executors/vite/schema.json", | ||
"description": "Build with Vite." | ||
}, | ||
"vitest": { | ||
"implementation": "./src/executors/vitest/compat", | ||
"schema": "./src/executors/vitest/schema.json", | ||
"description": "Test with Vitest" | ||
} | ||
}, | ||
"executors": { | ||
"vite-dev-server": { | ||
"implementation": "./src/executors/vite-dev-server/vite-dev-server.impl", | ||
"schema": "./src/executors/vite-dev-server/schema.json", | ||
"description": "Vite dev server." | ||
}, | ||
"vite": { | ||
"implementation": "./src/executors/vite/vite.impl", | ||
"schema": "./src/executors/vite/schema.json", | ||
"description": "Build with Vite." | ||
}, | ||
"vitest": { | ||
"implementation": "./src/executors/vitest/vitest.impl", | ||
"schema": "./src/executors/vitest/schema.json", | ||
"description": "Test with Vitest" | ||
} | ||
} | ||
} |
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,5 @@ | ||
import { convertNxExecutor } from '@nx/devkit'; | ||
|
||
import viteDevServerExecutor from './vite-dev-server.impl'; | ||
|
||
export default convertNxExecutor(viteDevServerExecutor); |
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 @@ | ||
export { ViteDevServerExecutorOptions } from '@nx/vite/executors'; |
101 changes: 101 additions & 0 deletions
101
packages/nx-plugin/src/executors/vite-dev-server/schema.json
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,101 @@ | ||
{ | ||
"version": 2, | ||
"outputCapture": "direct-nodejs", | ||
"title": "Vite Dev Server", | ||
"cli": "nx", | ||
"description": "Starts a dev server using Vite.", | ||
"type": "object", | ||
"presets": [ | ||
{ | ||
"name": "Default minimum setup", | ||
"keys": ["buildTarget"] | ||
}, | ||
{ | ||
"name": "Using a Different Port", | ||
"keys": ["buildTarget", "port"] | ||
} | ||
], | ||
"properties": { | ||
"buildTarget": { | ||
"type": "string", | ||
"description": "Target which builds the application. Only used to retrieve the configuration as the dev-server does not build the code.", | ||
"x-priority": "important" | ||
}, | ||
"buildLibsFromSource": { | ||
"type": "boolean", | ||
"description": "Read buildable libraries from source instead of building them separately.", | ||
"default": true | ||
}, | ||
"proxyConfig": { | ||
"type": "string", | ||
"description": "Path to the proxy configuration file.", | ||
"x-completion-type": "file" | ||
}, | ||
"port": { | ||
"type": "number", | ||
"description": "Port to listen on.", | ||
"x-priority": "important" | ||
}, | ||
"host": { | ||
"description": "Specify which IP addresses the server should listen on.", | ||
"oneOf": [ | ||
{ | ||
"type": "boolean" | ||
}, | ||
{ | ||
"type": "string" | ||
} | ||
] | ||
}, | ||
"https": { | ||
"oneOf": [ | ||
{ | ||
"type": "boolean" | ||
}, | ||
{ | ||
"type": "object" | ||
} | ||
], | ||
"description": "Serve using HTTPS. https://vitejs.dev/config/server-options.html#server-https" | ||
}, | ||
"hmr": { | ||
"description": "Enable hot module replacement. For more options, use the 'hmr' option in the Vite configuration file.", | ||
"type": "boolean" | ||
}, | ||
"open": { | ||
"description": "Automatically open the app in the browser on server start. When the value is a string, it will be used as the URL's pathname.", | ||
"oneOf": [ | ||
{ | ||
"type": "boolean" | ||
}, | ||
{ | ||
"type": "string" | ||
} | ||
] | ||
}, | ||
"cors": { | ||
"description": "Configure CORS for the dev server.", | ||
"type": "boolean" | ||
}, | ||
"logLevel": { | ||
"type": "string", | ||
"description": "Adjust console output verbosity.", | ||
"enum": ["info", "warn", "error", "silent"] | ||
}, | ||
"mode": { | ||
"type": "string", | ||
"description": "Mode to run the server in." | ||
}, | ||
"clearScreen": { | ||
"description": "Set to false to prevent Vite from clearing the terminal screen when logging certain messages.", | ||
"type": "boolean" | ||
}, | ||
"force": { | ||
"description": "Force the optimizer to ignore the cache and re-bundle", | ||
"type": "boolean" | ||
} | ||
}, | ||
"definitions": {}, | ||
"required": ["buildTarget"], | ||
"examplesFile": "../../../docs/dev-server-examples.md" | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/nx-plugin/src/executors/vite-dev-server/vite-dev-server.impl.ts
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,3 @@ | ||
import { viteDevServerExecutor } from '@nx/vite/executors'; | ||
|
||
export default viteDevServerExecutor; |
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,5 @@ | ||
import { convertNxExecutor } from '@nx/devkit'; | ||
|
||
import viteBuildExecutor from './vite.impl'; | ||
|
||
export default convertNxExecutor(viteBuildExecutor); |
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,2 @@ | ||
import type { FileReplacement } from '@nx/vite/plugins/rollup-replace-files.plugin'; | ||
export { ViteBuildExecutorOptions } from '@nx/vite/executors'; |
Oops, something went wrong.