1

I have written a small Vue app and have been looking for a nice way to automate its deployment, i.e. call lint -> test -> build -> upload to some web space (stage and /or production) (sftp). Basically a simple CI/CD pipeline.

I looked a task runners such as grunt (seems to be a bit outdated and the docs didn't help me much) and gulp (see also this answer) and also thought of defining a npm script. CI tools such as Jenkins seem to be a bit oversized with some work to setup.

The npm script would probably be the simples solution, especially as I could simply chain lint / test / build:

{
  "scripts": {
    "build": "vue-cli-service build --modern",
    "lint": "vue-cli-service lint",
    "prettier": "prettier --write src/**/*.{ts,js,vue,css,less,scss,html,json,md} public/**/*.{ts,js,vue,css,less,scss,html,json,md} test/**/*.{js,vue,css,less,scss,html,json,md} build/*.js",
    "deploy": "# ...?",
    "pipeline": "yarn lint && yarn prettier && yarn test && yarn build && yarn deploy"
  },

However, I've no good idea yet for an easy way to deploy the build to my web server. For grunt I found some tasks that might fit (grunt-rsync, grunt-sftp-deploy). But grunt doesn't seem to be the first choice nowadays.

Does anyone have any recommendations or suggestions?

Additional info: I'm using Windows and I don't want to publish my source (in this case) on github.

Peter T.
  • 2,927
  • 5
  • 33
  • 40

1 Answers1

1

The easiest way to deploy static site is to use pages.github.com - just push your build in github repo.

Another simple (Mega simple) service is netlify - just install it with npm install netlify-cli -g. Details in docs

But if you need better CI you don't need to search "vue deploy', you need any CI service from github, bitbucket, gitlab, etc. For example - easy introduction by circleci


Back to your question - do you use linux/mac or windows? It's very simple on linux, just use command like scp from/local/dir to@remote/dir. On windows you maybe should try some nodejs alternatives like snippet from this answer

tynrare
  • 96
  • 3
  • Thank you for you quick answer, I extend my question above: I'm using Windows and I don't want to publish my source (in this case) on github. I'll have a look at netlify and the mentioned answer. – Peter T. Aug 04 '19 at 20:59
  • 1
    You may not deploy sources on github or anything if you don't want. You always can push only *dist* (or whatever your build folder named) with minified build and *index.html* in root. After that for github all you need to set `> Click on the Settings tab and scroll down to the GitHub Pages section. > Then select the master branch source and click on the Save button.` – tynrare Aug 09 '19 at 06:16