Pārlūkot izejas kodu

新增Travis CI构建

zhaihaoyi 6 gadi atpakaļ
vecāks
revīzija
001c599bce
7 mainītis faili ar 43 papildinājumiem un 11 dzēšanām
  1. 6 2
      .gitignore
  2. 6 4
      .npmignore
  3. 14 0
      .travis.yml
  4. 6 3
      README.md
  5. 7 1
      docs/.vuepress/config.js
  6. 1 1
      package.json
  7. 3 0
      vue.config.js

+ 6 - 2
.gitignore

@@ -1,6 +1,4 @@
 .DS_Store
-node_modules
-/dist/demo
 
 # local env files
 .env.local
@@ -19,3 +17,9 @@ yarn-error.log*
 *.njsproj
 *.sln
 *.sw*
+
+# npm 包
+node_modules
+
+# 发布输出目录
+dist/docs

+ 6 - 4
.npmignore

@@ -1,5 +1,7 @@
-# 忽略目录
+# 忽略目录/文件
 node_modules
+dist/docs
+dist/lib/**.html
 docs/
 public/
 src/
@@ -10,7 +12,7 @@ babel.config.js
 tsconfig.json
 tslint.json
 vue.config.js
-.editorconfig
-*.map
 
-dist/lib/**.html
+.editorconfig
+.travis.yml
+*.map

+ 14 - 0
.travis.yml

@@ -0,0 +1,14 @@
+language: node_js
+node_js:
+  - lts/*
+script:
+  - npm run docs:build
+  - npm run demo:build
+deploy:
+  provider: pages
+  skip-cleanup: true
+  local_dir: dist/docs
+  github-token: $GITHUB_TOKEN # a token generated on github allowing travis to push code on you repository
+  keep-history: true
+  on:
+    branch: dev

+ 6 - 3
README.md

@@ -2,13 +2,16 @@
 <p align="center"><a href="https://bhuh12.github.io/vue-router-tab/" target="_blank" rel="noopener noreferrer"><img width="100" src="./src/assets/img/logo.png" alt="Vue Router Tab logo"></a></p>
 
 <p align="center">
-  <a href="https://www.npmjs.com/package/vue-router-tab">
+  <a target="_blank" href="https://www.travis-ci.org/bhuh12/vue-router-tab">
+    <img src="https://www.travis-ci.org/bhuh12/vue-router-tab.svg?branch=dev" alt="Build">
+  </a>
+  <a target="_blank" href="https://www.npmjs.com/package/vue-router-tab">
     <img src="https://img.shields.io/npm/v/vue-router-tab.svg" alt="Version">
   </a>
-  <a href="https://npmcharts.com/compare/vue-router-tab?minimal=true">
+  <a target="_blank" href="https://npmcharts.com/compare/vue-router-tab?minimal=true">
     <img src="https://img.shields.io/npm/dm/vue-router-tab.svg" alt="Downloads">
   </a>
-  <a href="https://www.npmjs.com/package/vue-router-tab">
+  <a target="_blank" href="https://www.npmjs.com/package/vue-router-tab">
     <img src="https://img.shields.io/npm/l/vue-router-tab.svg" alt="License">
   </a>
 </p>

+ 7 - 1
docs/.vuepress/config.js

@@ -2,6 +2,12 @@ module.exports = {
   title: 'Vue Router Tab',
   description: '基于 Vue Router 的路由页签组件',
 
+  // 基础路径
+  base: '/vue-router-tab/',
+
+  // 输出目录
+  dest: 'dist/docs',
+
   // 主题配置
   themeConfig: {
     // 页头
@@ -26,7 +32,7 @@ module.exports = {
     // 假如文档放在一个特定的分支下:
     docsBranch: 'dev',
     
-    lastUpdated: '上次更新: ',
+    lastUpdated: '上次更新',
   },
 
   // markdow 配置

+ 1 - 1
package.json

@@ -22,7 +22,7 @@
     "docs:dev": "vuepress dev docs",
     "docs:build": "vuepress build docs",
     "demo:dev": "vue-cli-service serve",
-    "demo:build": "vue-cli-service build --dest dist/demo",
+    "demo:build": "vue-cli-service build",
     "lib:build": "vue-cli-service build --target lib --dest dist/lib ./src/lib/RouterTab/index.js",
     "lib:build:report": "vue-cli-service build --report --target lib --dest dist/lib ./src/lib/RouterTab/index.js",
     "lib:publish": "npm run lib:build && npm publish",

+ 3 - 0
vue.config.js

@@ -1,6 +1,9 @@
 module.exports = {
   publicPath: '', // 相对路径
 
+  // 输出目录
+  outputDir: 'dist/docs/demo',
+
   // webpack 链式配置
   chainWebpack: config => {
     // 移除 prefetch 插件