mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-09-29 16:57:06 +08:00
feat(GeneratorAPI): accept multiple arguments for the resolve method (#4715)
* feat(GeneratorAPI): accept multiple arguments for the resolve method To make its signature conform to the standard `path.resolve`, avoid confusions. There's already a bug in the downstream plugin that was caused by such confusion: https://github.com/Akryum/vue-cli-plugin-ssr/blob/a742953b8376817950a01ad79967b9aa02da5388/generator/index.js#L163-L171 * docs: update descriptions of the `resolve` api [ci skip]
This commit is contained in:
@@ -44,10 +44,10 @@ The version string for the **project local** `@vue/cli-service` version that is
|
||||
## resolve
|
||||
|
||||
- **Arguments**
|
||||
- `{string} _path` - relative path from project root
|
||||
- `{string} ..._paths` - A sequence of relative paths or path segments
|
||||
|
||||
- **Returns**
|
||||
- `{string}`- the resolved absolute path
|
||||
- `{string}`- the resolved absolute path, caculated based on the current project root
|
||||
|
||||
- **Usage**:
|
||||
Resolve a path for the current project
|
||||
|
||||
@@ -68,11 +68,11 @@ class GeneratorAPI {
|
||||
/**
|
||||
* Resolve path for a project.
|
||||
*
|
||||
* @param {string} _path - Relative path from project root
|
||||
* @return {string} The resolved absolute path.
|
||||
* @param {string} _paths - A sequence of relative paths or path segments
|
||||
* @return {string} The resolved absolute path, caculated based on the current project root.
|
||||
*/
|
||||
resolve (_path) {
|
||||
return path.resolve(this.generator.context, _path)
|
||||
resolve (..._paths) {
|
||||
return path.resolve(this.generator.context, ..._paths)
|
||||
}
|
||||
|
||||
get cliVersion () {
|
||||
|
||||
Reference in New Issue
Block a user