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/clineeds 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 satisfied. 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-serviceneeds to satisfy
Usage
This API exposes a simple way to declare the required project local
@vue/cli-serviceversion.Nothing happens if the provided version is satisfied. Otherwise, an error will be thrown.
Note: It's recommended to use the
peerDependenciesfield inpackage.jsonunder most circumstances.
resolve
Arguments
{string} ..._paths- A sequence of relative paths or path segments
Returns
{string}- the resolved absolute path, caculated based on the current project root
Usage: Resolve a path for the current project
hasPlugin
Arguments
{string} id- plugin id, can omit the (@vue/|vue-|@scope/vue)-cli-plugin- prefix{string} version- semver version range, optional
Returns
{boolean}
Usage: Check if the project has a plugin with given id. If version range is given, then the plugin version should satisfy it