| 4 | const BaseCommand = require('../base-cmd.js') |
| 5 | |
| 6 | class Version extends BaseCommand { |
| 7 | static description = 'Bump a package version' |
| 8 | static name = 'version' |
| 9 | static params = [ |
| 10 | 'allow-same-version', |
| 11 | 'commit-hooks', |
| 12 | 'git-tag-version', |
| 13 | 'json', |
| 14 | 'preid', |
| 15 | 'sign-git-tag', |
| 16 | 'save', |
| 17 | 'workspace', |
| 18 | 'workspaces', |
| 19 | 'workspaces-update', |
| 20 | 'include-workspace-root', |
| 21 | 'ignore-scripts', |
| 22 | ] |
| 23 | |
| 24 | static workspaces = true |
| 25 | static ignoreImplicitWorkspace = false |
| 26 | |
| 27 | static usage = ['[<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]'] |
| 28 | |
| 29 | static async completion (opts) { |
| 30 | const { |
| 31 | conf: { |
| 32 | argv: { remain }, |
| 33 | }, |
| 34 | } = opts |
| 35 | if (remain.length > 2) { |
| 36 | return [] |
| 37 | } |
| 38 | |
| 39 | return [ |
| 40 | 'major', |
| 41 | 'minor', |
| 42 | 'patch', |
| 43 | 'premajor', |
| 44 | 'preminor', |
| 45 | 'prepatch', |
| 46 | 'prerelease', |
| 47 | 'from-git', |
| 48 | ] |
| 49 | } |
| 50 | |
| 51 | async exec (args) { |
| 52 | switch (args.length) { |
| 53 | case 0: |
| 54 | return this.list() |
| 55 | case 1: |
| 56 | return this.change(args) |
| 57 | default: |
| 58 | throw this.usageError() |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | async execWorkspaces (args) { |
| 63 | switch (args.length) { |
no outgoing calls
no test coverage detected