Peter T.
Peter T.

Reputation: 3325

How to automate deploy of simple Vue WebApp (no server required)? (i.e. simple build chain with vue)

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.

Upvotes: 1

Views: 810

Answers (1)

tynrare
tynrare

Reputation: 96

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

Upvotes: 1

Related Questions