Explorar el Código

update release scripts

Leopoldthecoder hace 7 años
padre
commit
cee3154304

+ 2 - 3
build/deploy-ci.sh

@@ -42,11 +42,10 @@ if [ "$TRAVIS_TAG" ]; then
 
   SUB_FOLDER='2.0'
   mkdir $SUB_FOLDER
-  # rm -rf *.js *.css *.map static
+  rm -rf *.js *.css *.map static
   rm -rf $SUB_FOLDER/**
-  # cp -rf ../../examples/element-ui/** .
+  cp -rf ../../examples/element-ui/** .
   cp -rf ../../examples/element-ui/** $SUB_FOLDER/
-  cp -rf ../../examples/element-ui/versions.json .
   git add -A .
   git commit -m "$TRAVIS_COMMIT_MSG"
   git push origin gh-pages

+ 2 - 3
build/deploy-faas.sh

@@ -7,11 +7,10 @@ git clone -b gh-pages https://github.com/ElemeFE/element.git && cd element
 # build sub folder
 SUB_FOLDER='2.0'
 mkdir $SUB_FOLDER
-# rm -rf *.js *.css *.map static
+rm -rf *.js *.css *.map static
 rm -rf $SUB_FOLDER/**
-# cp -rf ../../examples/element-ui/** .
+cp -rf ../../examples/element-ui/** .
 cp -rf ../../examples/element-ui/** $SUB_FOLDER/
-cp -rf ../../examples/element-ui/versions.json .
 cd ../..
 
 # deploy domestic site

+ 1 - 1
build/git-release.sh

@@ -1,5 +1,5 @@
 #!/usr/bin/env sh
-git checkout carbon
+git checkout dev
 
 if test -n "$(git status --porcelain)"; then
   echo 'Unclean working tree. Commit or stash changes first.' >&2;

+ 19 - 3
build/release.sh

@@ -1,3 +1,6 @@
+git checkout master
+git merge dev
+
 #!/usr/bin/env sh
 set -e
 echo "Enter release version: "
@@ -16,7 +19,12 @@ then
   echo "Releasing theme-chalk $VERSION ..."
   cd packages/theme-chalk
   npm version $VERSION --message "[release] $VERSION"
-  npm publish
+  if [[ $VERSION =~ "beta" ]]
+  then
+    npm publish --tag beta
+  else
+    npm publish
+  fi
   cd ../..
 
   # commit
@@ -25,8 +33,16 @@ then
   npm version $VERSION --message "[release] $VERSION"
 
   # publish
-  git push eleme carbon
+  git push eleme master
   git push eleme refs/tags/v$VERSION
+  git checkout dev
+  git rebase master
+  git push eleme dev
 
-  npm publish --tag next
+  if [[ $VERSION =~ "beta" ]]
+  then
+    npm publish --tag beta
+  else
+    npm publish
+  fi
 fi

+ 3 - 2
examples/components/demo-block.vue

@@ -178,6 +178,7 @@
 
 <script type="text/babel">
   import compoLang from '../i18n/component.json';
+  import { version } from 'main/index.js';
 
   export default {
     data() {
@@ -200,10 +201,10 @@
       goJsfiddle() {
         const { script, html, style } = this.jsfiddle;
         const resourcesTpl = '<scr' + 'ipt src="//unpkg.com/vue/dist/vue.js"></scr' + 'ipt>' +
-        '\n<scr' + 'ipt src="//unpkg.com/element-ui@next/lib/index.js"></scr' + 'ipt>';
+        '\n<scr' + `ipt src="//unpkg.com/element-ui@${ version }/lib/index.js"></scr` + 'ipt>';
         let jsTpl = (script || '').replace(/export default/, 'var Main =').trim();
         let htmlTpl = `${resourcesTpl}\n<div id="app">\n${html.trim()}\n</div>`;
-        let cssTpl = `@import url("//unpkg.com/element-ui@next/lib/theme-chalk/index.css");\n${(style || '').trim()}\n`;
+        let cssTpl = `@import url("//unpkg.com/element-ui@${ version }/lib/theme-chalk/index.css");\n${(style || '').trim()}\n`;
         jsTpl = jsTpl
           ? jsTpl + '\nvar Ctor = Vue.extend(Main)\nnew Ctor().$mount(\'#app\')'
           : 'new Vue().$mount(\'#app\')';

+ 5 - 1
examples/components/header.vue

@@ -390,7 +390,11 @@
       const xhr = new XMLHttpRequest();
       xhr.onreadystatechange = _ => {
         if (xhr.readyState === 4 && xhr.status === 200) {
-          this.versions = JSON.parse(xhr.responseText);
+          const versions = JSON.parse(xhr.responseText);
+          this.versions = Object.keys(versions).slice(-2).reduce((prev, next) => {
+            prev[next] = versions[next];
+            return prev;
+          }, {});
         }
       };
       xhr.open('GET', '/versions.json');

+ 7 - 7
examples/docs/en-US/installation.md

@@ -4,21 +4,21 @@
 Installing with npm is recommended and it works seamlessly with [webpack](https://webpack.js.org/).
 
 ```shell
-npm i element-ui@next -S
+npm i element-ui -S
 ```
 
 ### CDN
-Get the latest version from [unpkg.com/element-ui](https://unpkg.com/element-ui@next/) , and import JavaScript and CSS file in your page.
+Get the latest version from [unpkg.com/element-ui](https://unpkg.com/element-ui/) , and import JavaScript and CSS file in your page.
 
 ```html
 <!-- import CSS -->
-<link rel="stylesheet" href="https://unpkg.com/element-ui@next/lib/theme-chalk/index.css">
+<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
 <!-- import JavaScript -->
-<script src="https://unpkg.com/element-ui@next/lib/index.js"></script>
+<script src="https://unpkg.com/element-ui/lib/index.js"></script>
 ```
 
 ### Hello world
-If you are using CDN, a hello-world page is easy with Element. [Online Demo](https://jsfiddle.net/leopoldthecuber/hzfpyvg6/1/)
+If you are using CDN, a hello-world page is easy with Element. [Online Demo](https://jsfiddle.net/hzfpyvg6/14/)
 
 ```html
 <!DOCTYPE html>
@@ -26,7 +26,7 @@ If you are using CDN, a hello-world page is easy with Element. [Online Demo](htt
 <head>
   <meta charset="UTF-8">
   <!-- import CSS -->
-  <link rel="stylesheet" href="https://unpkg.com/element-ui@next/lib/theme-chalk/index.css">
+  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
 </head>
 <body>
   <div id="app">
@@ -39,7 +39,7 @@ If you are using CDN, a hello-world page is easy with Element. [Online Demo](htt
   <!-- import Vue before Element -->
   <script src="https://unpkg.com/vue/dist/vue.js"></script>
   <!-- import JavaScript -->
-  <script src="https://unpkg.com/element-ui@next/lib/index.js"></script>
+  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
   <script>
     new Vue({
       el: '#app',

+ 7 - 115
examples/docs/en-US/quickstart.md

@@ -6,123 +6,15 @@ This part walks you through the process of using Element in a webpack project.
 
 Under construction.
 
-### Config files
-
-Create a new project, and its structure should be
-```text
-|- src/  --------------------- source code
-    |- App.vue
-    |- main.js  -------------- entry
-|- .babelrc  ----------------- babel config
-|- index.html  --------------- HTML template
-|- package.json  ------------- npm config
-|- README.md  ---------------- readme
-|- webpack.config.js  -------- webpack config
-```
+### Use vue-cli
 
-Typical configurations for these config files are:
+It is recommended to start a project using [vue-cli](https://github.com/vuejs/vue-cli):
 
-**.babelrc**
-```json
-{
-  "presets": ["vue-app"]
-}
-```
-
-<br>
-
-**package.json**
-```json
-{
-  "name": "element-starter",
-  "scripts": {
-    "dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --port 8086",
-    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
-  },
-  "dependencies": {
-    "element-ui": "next",
-    "vue": "^2.4.2"
-  },
-  "devDependencies": {
-    "babel-core": "^6.0.0",
-    "babel-loader": "^6.0.0",
-    "babel-preset-vue-app": "^1.2.0",
-    "cross-env": "^1.0.6",
-    "css-loader": "^0.23.1",
-    "file-loader": "^0.8.5",
-    "style-loader": "^0.13.1",
-    "vue-loader": "^9.8.0",
-    "webpack": "beta",
-    "webpack-dev-server": "beta"
-  }
-}
-```
-
-<br>
-
-**webpack.config.js**
-```javascript
-var path = require('path')
-var webpack = require('webpack')
-
-module.exports = {
-  entry: './src/main.js',
-  output: {
-    path: path.resolve(__dirname, './dist'),
-    publicPath: '/dist/',
-    filename: 'build.js'
-  },
-  module: {
-    loaders: [
-      {
-        test: /\.vue$/,
-        loader: 'vue-loader'
-      },
-      {
-        test: /\.js$/,
-        loader: 'babel-loader',
-        exclude: /node_modules/
-      },
-      {
-        test: /\.css$/,
-        loader: 'style-loader!css-loader'
-      },
-      {
-        test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/,
-        loader: 'file-loader'
-      },
-      {
-        test: /\.(png|jpe?g|gif|svg)(\?\S*)?$/,
-        loader: 'file-loader',
-        query: {
-          name: '[name].[ext]?[hash]'
-        }
-      }
-    ]
-  },
-  devServer: {
-    historyApiFallback: true,
-    noInfo: true
-  },
-  devtool: '#eval-source-map'
-}
-
-if (process.env.NODE_ENV === 'production') {
-  module.exports.devtool = '#source-map'
-  // http://vue-loader.vuejs.org/en/workflow/production.html
-  module.exports.plugins = (module.exports.plugins || []).concat([
-    new webpack.DefinePlugin({
-      'process.env': {
-        NODE_ENV: '"production"'
-      }
-    }),
-    new webpack.optimize.UglifyJsPlugin({
-      compress: {
-        warnings: false
-      }
-    })
-  ])
-}
+```shell
+> npm i -g vue-cli
+> mkdir my-project && cd my-project
+> vue init webpack
+> npm i && npm i element-ui
 ```
 
 ### Import Element

+ 7 - 7
examples/docs/zh-CN/installation.md

@@ -4,21 +4,21 @@
 推荐使用 npm 的方式安装,它能更好地和 [webpack](https://webpack.js.org/) 打包工具配合使用。
 
 ```shell
-npm i element-ui@next -S
+npm i element-ui -S
 ```
 
 ### CDN
-目前可以通过 [unpkg.com/element-ui](https://unpkg.com/element-ui@next/) 获取到最新版本的资源,在页面上引入 js 和 css 文件即可开始使用。
+目前可以通过 [unpkg.com/element-ui](https://unpkg.com/element-ui/) 获取到最新版本的资源,在页面上引入 js 和 css 文件即可开始使用。
 
 ```html
 <!-- 引入样式 -->
-<link rel="stylesheet" href="https://unpkg.com/element-ui@next/lib/theme-chalk/index.css">
+<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
 <!-- 引入组件库 -->
-<script src="https://unpkg.com/element-ui@next/lib/index.js"></script>
+<script src="https://unpkg.com/element-ui/lib/index.js"></script>
 ```
 
 ### Hello world
-通过 CDN 的方式我们可以很容易地使用 Element 写出一个 Hello world 页面。[在线演示](https://jsfiddle.net/leopoldthecuber/hzfpyvg6/1/)
+通过 CDN 的方式我们可以很容易地使用 Element 写出一个 Hello world 页面。[在线演示](https://jsfiddle.net/hzfpyvg6/14/)
 
 ```html
 <!DOCTYPE html>
@@ -26,7 +26,7 @@ npm i element-ui@next -S
 <head>
   <meta charset="UTF-8">
   <!-- 引入样式 -->
-  <link rel="stylesheet" href="https://unpkg.com/element-ui@next/lib/theme-chalk/index.css">
+  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
 </head>
 <body>
   <div id="app">
@@ -39,7 +39,7 @@ npm i element-ui@next -S
   <!-- 先引入 Vue -->
   <script src="https://unpkg.com/vue/dist/vue.js"></script>
   <!-- 引入组件库 -->
-  <script src="https://unpkg.com/element-ui@next/lib/index.js"></script>
+  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
   <script>
     new Vue({
       el: '#app',

+ 7 - 115
examples/docs/zh-CN/quickstart.md

@@ -6,123 +6,15 @@
 
 整理中。
 
-### 配置文件
-
-新建项目,项目结构为
-```text
-|- src/  --------------------- 项目源代码
-    |- App.vue
-    |- main.js  -------------- 入口文件
-|- .babelrc  ----------------- babel 配置文件
-|- index.html  --------------- HTML 模板
-|- package.json  ------------- npm 配置文件
-|- README.md  ---------------- 项目帮助文档
-|- webpack.config.js  -------- webpack 配置文件
-```
+### 使用 vue-cli
 
-几个配置文件的典型配置如下:
+我们推荐使用 [vue-cli](https://github.com/vuejs/vue-cli) 初始化项目,命令如下:
 
-**.babelrc**
-```json
-{
-  "presets": ["vue-app"]
-}
-```
-
-<br>
-
-**package.json**
-```json
-{
-  "name": "element-starter",
-  "scripts": {
-    "dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --port 8086",
-    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
-  },
-  "dependencies": {
-    "element-ui": "next",
-    "vue": "^2.4.2"
-  },
-  "devDependencies": {
-    "babel-core": "^6.0.0",
-    "babel-loader": "^6.0.0",
-    "babel-preset-vue-app": "^1.2.0",
-    "cross-env": "^1.0.6",
-    "css-loader": "^0.23.1",
-    "file-loader": "^0.8.5",
-    "style-loader": "^0.13.1",
-    "vue-loader": "^9.8.0",
-    "webpack": "beta",
-    "webpack-dev-server": "beta"
-  }
-}
-```
-
-<br>
-
-**webpack.config.js**
-```javascript
-var path = require('path')
-var webpack = require('webpack')
-
-module.exports = {
-  entry: './src/main.js',
-  output: {
-    path: path.resolve(__dirname, './dist'),
-    publicPath: '/dist/',
-    filename: 'build.js'
-  },
-  module: {
-    loaders: [
-      {
-        test: /\.vue$/,
-        loader: 'vue-loader'
-      },
-      {
-        test: /\.js$/,
-        loader: 'babel-loader',
-        exclude: /node_modules/
-      },
-      {
-        test: /\.css$/,
-        loader: 'style-loader!css-loader'
-      },
-      {
-        test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/,
-        loader: 'file-loader'
-      },
-      {
-        test: /\.(png|jpe?g|gif|svg)(\?\S*)?$/,
-        loader: 'file-loader',
-        query: {
-          name: '[name].[ext]?[hash]'
-        }
-      }
-    ]
-  },
-  devServer: {
-    historyApiFallback: true,
-    noInfo: true
-  },
-  devtool: '#eval-source-map'
-}
-
-if (process.env.NODE_ENV === 'production') {
-  module.exports.devtool = '#source-map'
-  // http://vue-loader.vuejs.org/en/workflow/production.html
-  module.exports.plugins = (module.exports.plugins || []).concat([
-    new webpack.DefinePlugin({
-      'process.env': {
-        NODE_ENV: '"production"'
-      }
-    }),
-    new webpack.optimize.UglifyJsPlugin({
-      compress: {
-        warnings: false
-      }
-    })
-  ])
-}
+```shell
+> npm i -g vue-cli
+> mkdir my-project && cd my-project
+> vue init webpack
+> npm i && npm i element-ui
 ```
 
 ### 引入 Element