Skip to content

Commit e1c8ebf

Browse files
author
sky
committed
feat: init
0 parents  commit e1c8ebf

11 files changed

+268
-0
lines changed

.eslintignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
test/fixtures
2+
coverage
3+
public
4+
test/web
5+
node_modules
6+
.spec.js
7+
coverage
8+
config
9+
.nyc_output
10+
*.test.js

.eslintrc

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"extends": "eslint",
3+
"env": {
4+
"node": true,
5+
"es6": true,
6+
"mocha": true
7+
},
8+
"parserOptions": {
9+
"ecmaVersion": 6,
10+
"ecmaFeatures": {
11+
"experimentalObjectRestSpread": true
12+
}
13+
},
14+
"rules": {
15+
"indent": [
16+
"error",
17+
2,
18+
{ "SwitchCase": 1 }
19+
],
20+
"no-underscore-dangle": "off",
21+
"consistent-return": "off",
22+
"no-cond-assign": "off",
23+
"lines-around-comment": "off",
24+
"arrow-body-style": "off",
25+
"no-confusing-arrow": "off",
26+
"class-methods-use-this": "off",
27+
"newline-after-var": "off",
28+
"no-invalid-this": "off",
29+
"no-nested-ternary": "off",
30+
"no-unused-vars": "off",
31+
"eol-last": "off",
32+
"quotes": [
33+
"error",
34+
"single"
35+
],
36+
"guard-for-in": "off",
37+
"no-console": "off",
38+
"no-undefined": "off",
39+
"array-bracket-spacing": "off",
40+
"no-unused-expressions": "off",
41+
"no-process-exit": "off",
42+
"func-style": [
43+
"error",
44+
"expression"
45+
],
46+
"comma-dangle": [
47+
"error",
48+
"never"
49+
]
50+
}
51+
}

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.js linguist-language=javascript
2+
*.css linguist-language=javascript
3+
*.html linguist-language=javascript

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
logs/
2+
npm-debug.log
3+
node_modules/
4+
coverage/
5+
.idea/
6+
run/
7+
dist/
8+
.DS_Store
9+
*.swp
10+
*.iml
11+
*.lock
12+
.vscode

.travis.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- '6'
5+
- '8'
6+
- '9'
7+
script:
8+
- npm test
9+
after_success:
10+
- npm run ci

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 sky.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# render-vue-package
2+
3+
Render Vue Package Source Code Demo
4+
5+
## License
6+
7+
[MIT](LICENSE)

package.json

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "render-vue-package",
3+
"version": "0.1.4",
4+
"dependencies": {},
5+
"devDependencies": {
6+
"chai": "^4.1.1",
7+
"codecov": "^3.0.0",
8+
"conventional-changelog-cli": "^1.3.5",
9+
"cross-env": "^5.0.5",
10+
"easywebpack-vue": "^4.4.0",
11+
"eslint": "^4.5.0",
12+
"eslint-config-eslint": "^4.0.0",
13+
"fs-extra": "^7.0.1",
14+
"imagemin-webpack-plugin": "^2.4.0",
15+
"md5": "^2.2.1",
16+
"mocha": "^3.5.0",
17+
"nyc": "^11.1.0",
18+
"vue": "^2.5.21",
19+
"vue-router": "^3.0.2",
20+
"vuex": "^3.0.1",
21+
"vuex-router-sync": "^5.0.0"
22+
},
23+
"engines": {
24+
"node": ">=8.0.0"
25+
},
26+
"scripts": {
27+
"dev": "easy dev",
28+
"build": "easy build",
29+
"lint": "eslint .",
30+
"fix": "eslint --fix .",
31+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
32+
"test": "nyc --reporter=html --reporter=text mocha --timeout=1000000",
33+
"cov": "nyc report --reporter=lcov && codecov --token=e971d1e7-39e2-44b1-b1ee-f4345b0adbee",
34+
"ci": "npm run lint && npm run cov",
35+
"ii": "npm install --registry https://registry.npm.taobao.org"
36+
},
37+
"nyc": {
38+
"exclude": [
39+
"**/*.spec.js",
40+
"test/*.test.js"
41+
]
42+
},
43+
"ci": {
44+
"version": "8, 9"
45+
},
46+
"repository": {
47+
"type": "git",
48+
"url": "git+https://github.com/easy-team/render-vue-package.git"
49+
},
50+
"author": "hubcarl@126.com",
51+
"license": "MIT"
52+
}

src/component/layout.vue

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<html v-if="isNode">
3+
<head>
4+
<title>{{title}}</title>
5+
<meta name="keywords" :content="keywords">
6+
<meta name="description" :content="description">
7+
<meta http-equiv="content-type" content="text/html;charset=utf-8">
8+
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
9+
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
10+
</head>
11+
<body>
12+
<div id="app"><slot></slot></div>
13+
</body>
14+
</html>
15+
<div v-else-if="!isNode" id="app"><slot></slot></div>
16+
</template>
17+
<script>
18+
export default {
19+
computed: {
20+
isNode() {
21+
return EASY_ENV_IS_NODE;
22+
},
23+
title() {
24+
return this.meta && this.meta.title || 'Render';
25+
},
26+
description() {
27+
return this.meta && this.meta.description || 'Render-Service';
28+
},
29+
keywords() {
30+
return this.meta && this.meta.keywords || 'Render, Vue Render Service, React Render Service';
31+
}
32+
}
33+
}
34+
</script>

src/page/home/index.vue

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<Layout>
3+
<h1>Render Service</h1>
4+
</Layout>
5+
</template>
6+
<script>
7+
import Layout from '../../component/layout.vue';
8+
export default {
9+
components: {
10+
Layout
11+
},
12+
data(){
13+
return {};
14+
}
15+
}
16+
</script>

webpack.config.js

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
'use strict';
2+
const path = require('path');
3+
const fs = require('fs');
4+
const md5 = require('md5');
5+
const pkg = require('./package.json');
6+
const name = pkg.name;
7+
const tag = md5(name).slice(0, 8);
8+
const v = pkg.version.split('.');
9+
v[v.length - 1] = Number(v[v.length - 1]) + 1;
10+
const version = v.join('.');
11+
12+
const dist = path.join(__dirname, `dist/${version}`);
13+
const server = path.join(dist, 'server');
14+
const client = path.join(dist, 'client');
15+
16+
module.exports = {
17+
egg: 'true',
18+
framework: 'vue',
19+
entry: {
20+
home: 'src/page/home/index.vue'
21+
},
22+
output: {
23+
publicPath: `/public/${tag}/${version}`
24+
},
25+
plugins: {
26+
manifest: {
27+
assets: true,
28+
fileName: `dist/${version}/manifest.json`
29+
}
30+
},
31+
customize(webpackConfig) {
32+
const { target } = webpackConfig;
33+
if (target === 'node') {
34+
webpackConfig.output.path = server;
35+
} else {
36+
webpackConfig.output.path = client;
37+
}
38+
return webpackConfig;
39+
},
40+
done() {
41+
const pkgInfo = {
42+
name,
43+
version,
44+
tag,
45+
time: new Date()
46+
};
47+
pkg.version = version;
48+
fs.writeFileSync(path.join(dist, 'package.json'), JSON.stringify(pkgInfo, null, 2), 'utf8');
49+
fs.writeFileSync(path.join(__dirname, 'package.json'), JSON.stringify(pkg, null, 2), 'utf8');
50+
// upload zip code
51+
}
52+
};

0 commit comments

Comments
 (0)