· 7 years ago · Aug 01, 2018, 01:56 PM
1# @vue/cli-deploy
2
3Official pluggable deployment pipeline for Vue.js applications. Inspired by ember-cli-deploy.
4
5## Installation
6
7Install core pipeline:
8```
9vue add cli-deploy
10```
11
12It will add an `vue.deploy.js` file to your project.
13
14Next, install any plugins to suit configure your deployment pipeline.
15For example:
16
17```
18vue add cli-deploy-s3
19vue add cli-deploy-rollbar
20vue add cli-deploy-slack
21```
22
23Configure your pipeline:
24```js
25import deploy from '@vue/cli-plugin-deploy'
26import s3 from '@vue/cli-plugin-deploy-s3'
27import rollbar from '@vue/cli-plugin-deploy-rollbar'
28import slack from '@vue/cli-plugin-deploy-slack'
29import sms from 'vue-cli-plugin-deploy-sms' // community plugin
30
31deploy.use(s3, {
32 accessKey: '',
33 secretKey: '',
34 bucket: '',
35 region: ''
36})
37
38deploy.use(slack)
39deploy.use(rollbar)
40deploy.use(sms)
41
42export default deploy
43```
44
45Each plugin can attach to any of the hooks that are being called by `deploy` commands.
46Sometimes it might happen that few plugins use the same hook, and you need them to be executed in specific order.
47To do so you can pass an extra argument to `.use()`:
48```js
49deploy.use(slack, { before: rollbar })
50```
51
52## Commands
53
54### vue deploy
55
56Run `vue deploy production` in order to deploy you application.
57You can optionally pass `--active` flag in order to activate the release.
58
59Hooks:
60* configure
61* setup
62* willDeploy
63* willBuild, build, didBuild,
64* willPrepare, prepare, didPrepare,
65* fetchInitialRevisions,
66* willUpload, upload, didUpload,
67* willActivate, activate, fetchRevisions, didActivate
68* fetchRevisions
69* teardown
70
71### vue deploy:list
72
73This command lists all previously deployed revisions.
74
75Hooks:
76* configure
77* setup
78* fetchRevisions
79* displayRevisions
80* teardown
81
82### vue deploy:activate --revision hash
83
84This command acticates specified revision
85
86Hooks:
87* configure
88* setup
89* fetchInitialRevisions
90* willActivate
91* activate
92* fetchRevisions
93* didActivate
94* teardown
95
96## Plugin API
97
98Example plugin:
99```js
100// vue-cli-plugin-deploy-sms
101export default {
102 id: 'sms',
103 description: 'Lorem ipsum',
104 defaultOptions: {},
105 hooks: {
106 // Attach to any hook
107 didActivate(context, options, api) {
108 // Send sms using informations from "context"
109 api.report('SMS has been sent'); // report to console
110 }
111 }
112}
113```