Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed Jul 5, 2019
2 parents 3c52efe + ea2fe36 commit 2244b34
Show file tree
Hide file tree
Showing 11 changed files with 1,377 additions and 136 deletions.
10 changes: 0 additions & 10 deletions .babelrc

This file was deleted.

15 changes: 15 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = api => {
return {
presets: [['@babel/env', {modules: api.env('test') ? 'commonjs' : false}]],
plugins: [
[
'@babel/transform-runtime',
{
regenerator: true,
// https://babeljs.io/docs/en/babel-plugin-transform-runtime#absoluteruntime
absoluteRuntime: true
}
]
]
}
}
10 changes: 10 additions & 0 deletions .github/badge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
types:
feat: 'enhancement'
fix: 'bug'
docs: 'documentation'
refactor: 'refactor'
test: 'test'
perf: 'performance'
chore:
deps: 'dependencies'
default: 'chore'
10 changes: 9 additions & 1 deletion .grenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ module.exports = {
issue: '- {{name}} [{{text}}]({{url}})',
group: '\n### {{heading}}\n'
},
// https://github.com/nuxt/nuxt.js/releases
// https://gitmoji.carloscuesta.me
groupBy: {
'✨ New Features:': ['enhancement'],
'🐛 Bug Fixes:': ['bug']
'🐛 Bug Fixes:': ['bug'],
'📖 Documentation:': ['documentation'],
'💅 Refactors:': ['refactor'],
'♻️ Tests:': ['test'],
'🚀 Performance:': ['performance'],
'⚓ Dependency upgrades:': ['dependencies'],
'🏡 Chore:': ['chore']
}
}
46 changes: 0 additions & 46 deletions docs/ali-oss-guide.md

This file was deleted.

60 changes: 60 additions & 0 deletions docs/guide-ali-oss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 阿里云OSS配置指南

对于新建的bucket,需要做一些设置
<style>
.guide-ali-oss-img {
max-width: 100%;
}
</style>

### 绑定域名
<img class="guide-ali-oss-img" src="https://cdn.nlark.com/yuque/0/2019/png/160590/1562047369483-bd5f19e1-251c-46bb-b5a0-f344b2ad79e3.png#align=left&display=inline&height=254&name=image.png&originHeight=508&originWidth=2544&size=508458&status=done&width=1272">

假设用户域名为:static.deepexi.top<br />
<img class="guide-ali-oss-img" src="https://cdn.nlark.com/yuque/0/2019/png/160590/1562047202179-52f89729-e7f6-493e-8601-cb436712c056.png#align=left&display=inline&height=220&name=image.png&originHeight=440&originWidth=1502&size=193827&status=done&width=751">

则使用自定义域名访问,可以解决html变成下载的问题

### CNAME设置
如果绑定的是同一个阿里云账号下的域名,则可以自动添加CNAME记录。否则需要手动添加。

查看bucket外网地址:deepexi-serverless.oss-cn-shenzhen.aliyuncs.com<br />
<img class="guide-ali-oss-img" src="https://cdn.nlark.com/yuque/0/2019/png/160590/1562047414581-2ef41ac9-fa17-432a-9fd6-bf162ef8de72.png#align=left&display=inline&height=519&name=image.png&originHeight=1038&originWidth=2536&size=526883&status=done&width=1268">

则去域名解析供应商设置:

static.deepexi.top   -> CNAME -> deepexi-serverless.oss-cn-shenzhen.aliyuncs.com


### 证书托管

上传HTTPS证书,开启HTTPS

<img class="guide-ali-oss-img" src="https://cdn.nlark.com/yuque/0/2019/png/160590/1562120215793-b8274561-3941-40ee-a163-ca9ed2a9595f.png?x-oss-process=image/resize,w_1492">

<img class="guide-ali-oss-img" src="https://cdn.nlark.com/yuque/0/2019/png/160590/1562120344835-7b8f8f7e-4bb0-4ec3-b0d6-88047080806e.png?x-oss-process=image/resize,w_1492/watermark,type_d3F5LW1pY3JvaGVp,size_14,text_5ru05pmu56eR5oqA,color_FFFFFF,shadow_50,t_80,g_se,x_10,y_10">

如果没有证书,查看教程获取:[🔒免费开启HTTPS](https://github.com/levy9527/blog/issues/5)

### 公共读

点击基础设置,设置读写权限为公共读<br />
<img src="https://cdn.nlark.com/yuque/0/2019/png/160590/1562047562541-751e73b6-1b02-446e-b929-2faab48cdda2.png#align=left&display=inline&height=283&name=image.png&originHeight=566&originWidth=2468&size=365147&status=done&width=1234" style="max-width: 100%">

这样可以解决访问链接超时的问题

### 跨域设置
在基础设置下,找到跨域设置
<img class="guide-ali-oss-img" src="https://cdn.nlark.com/yuque/0/2019/png/160590/1547111265557-dd3885fc-1007-4dfe-bef9-1e70a3578f0f.png#align=left&display=inline&height=116&originHeight=314&originWidth=2022&status=done&width=747">
<img class="guide-ali-oss-img" src="https://cdn.nlark.com/yuque/0/2019/png/160590/1547111287199-072507c0-02d4-4cdb-8be7-0bccc13c096c.png#align=left&display=inline&height=159&originHeight=438&originWidth=2058&status=done&width=747">

在来源中设置域名,或ip地址。下面给出最简单的示例为 `*`,实际可以根据需要填写允许的域名,一行一个。

- 将allowed origins设置成 `*`
- 将allowed methods设置成`GET, POST, PUT, DELETE, HEAD`
- 将allowed headers设置成 `*`
- 将expose headers设置成 
- `etag`
- `x-oss-request-id`

这样可以解决字体无法显示的问题
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"scripts": {
"dev": "vue-styleguidist server",
"test": "jest",
"doc": "vue-styleguidist build",
"build": "npm run build:unpkg & npm run build:es & npm run build:umd & npm run doc",
"build:umd": "rollup --config build/rollup.config.js --format umd --file dist/upload-to-ali.umd.js",
Expand All @@ -49,6 +50,7 @@
"github-release-notes": "^0.17.0",
"glob": "^7.1.3",
"husky": "^0.14.3",
"jest": "^24.8.0",
"minimist": "^1.2.0",
"prettier": "1.12.1",
"pretty-quick": "^1.4.1",
Expand All @@ -69,7 +71,7 @@
"publishConfig": {
"access": "public"
},
"vue-sfc-cli": "1.10.0",
"vue-sfc-cli": "1.10.1",
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
Expand Down
51 changes: 36 additions & 15 deletions styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,50 @@ const env = Object.assign({}, require('dotenv').config().parsed, {
OSS_REGION: process.env.OSS_REGION
})

const demos = ['docs/basic.md', ...glob.sync('docs/!(basic).md')]
const demoSections = demos.map(filePath => ({
name: path.basename(filePath, '.md'),
content: filePath
}))

module.exports = {
styleguideDir: 'docs',
pagePerSection: true,
ribbon: {
url: 'https://github.com/FEMessage/upload-to-ali'
},
sections: [
const sections = (() => {
const docs = glob
.sync('docs/*.md')
.map(p => ({name: path.basename(p, '.md'), content: p}))
const demos = []
let faq = '' // 约定至多只有一个faq.md
const guides = []
docs.forEach(d => {
if (/^faq$/.test(d.name)) {
faq = d
} else if (/^guide-/.test(d.name)) {
guides.push(d)
} else {
demos.push(d)
}
})
return [
{
name: 'Components',
components: 'src/*.vue',
usageMode: 'expand'
},
{
name: 'Demo',
sections: demoSections
sections: demos
},
...(faq ? [faq] : []),
{
name: 'Guide',
sections: guides
}
],
]
})()

module.exports = {
styleguideDir: 'docs',
pagePerSection: true,
ribbon: {
url: 'https://github.com/FEMessage/upload-to-ali'
},
sections,
editorConfig: {
readOnly: process.env.NODE_ENV === 'development' ? false : 'nocursor'
},
webpackConfig: {
module: {
rules: [
Expand Down
5 changes: 5 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sum from './sum'

test('main', () => {
expect(sum(1, 2)).toBe(3)
})
3 changes: 3 additions & 0 deletions test/sum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function sum(a, b) {
return a + b
}
Loading

0 comments on commit 2244b34

Please sign in to comment.