feat: implement version-related APIs for GeneratorAPI (#4000)

closes #2336

(cherry picked from commit 77092b2223)
This commit is contained in:
Haoqun Jiang
2019-06-26 18:25:21 +08:00
parent de2f68d96d
commit 818e5ddccd
3 changed files with 91 additions and 2 deletions
+39
View File
@@ -1,5 +1,44 @@
# Generator API
## cliVersion
Type: `string`
The version string for the **global** `@vue/cli` version that is invoking the plugin.
## assertCliVersion
- **Arguments**
- `{integer | string} range` - a semver range that `@vue/cli` needs to satisfy
- **Usage**
While api.version can be useful in general, it's sometimes nice to just declare your version.
This API exposes a simple way to do that.
Nothing happens if the provided version is satified. Otherwise, an error will be thrown.
## cliServiceVersion
Type: `string`
The version string for the **project local** `@vue/cli-service` version that is invoking the plugin.
## assertCliServiceVersion
- **Arguments**
- `{integer | string} range` - a semver range that `@vue/cli-service` needs to satisfy
- **Usage**
This API exposes a simple way to declare the required project local `@vue/cli-service` version.
Nothing happens if the provided version is satified. Otherwise, an error will be thrown.
## resolve
- **Arguments**
+1 -1
View File
@@ -7,7 +7,7 @@ Type: `string`
The version string for the `@vue/cli-service` version that is loading the plugin.
## assertVersion(range)
## assertVersion
- **Arguments**
- `{integer | string} range` - a semver range that `@vue/cli-service` needs to satisfy