Skip to content

Commit

Permalink
feat(core): first version
Browse files Browse the repository at this point in the history
  • Loading branch information
imaegoo committed Sep 5, 2020
0 parents commit ccf3b00
Show file tree
Hide file tree
Showing 48 changed files with 2,063 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[!{node_modules}/**]
end_of_line = lf
charset = utf-8

[{*.js,*.ts,*.html,*.gql,*.graqhql}]
indent_style = space
indent_size = 2

19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
env: {
browser: true,
es6: true
},
extends: [
'standard'
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parserOptions: {
ecmaVersion: 11,
sourceType: 'module'
},
rules: {
}
}
105 changes: 105 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
stats.json

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
16 changes: 16 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.lock
*.log
.DS_Store
.babelrc
.editorconfig
.eslintrc.js
.github
.gitignore
.npmignore
_config.js
cloudbaserc.js
node_modules
public
src
stats.json
webpack.config.js
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 iMaeGoo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Twikoo

一个(仍处于开发初期的)简洁、安全、无后端的静态网站评论系统,基于腾讯云开发。<br>
A simple, safe, serverless comment system based on Tencent CloudBase (tcb).

![Demo](./docs/demo.png)

## 特色 | Features

* 评论 | Comment
* 点赞 | Like
* 纯静态 | Static pages
* 可嵌入 | Embedded
* 免费搭建 | Free deploy
* 存储安全 | Security
* 反垃圾评论 | Akismet
* 邮件 / 微信通知 | Email / WeChat notify

## 快速开始 | Quick Start

**此部分尚未完善,请关注后续更新**

1. 注册 https://console.cloud.tencent.com/tcb/
2. 部署云函数
```
npm install
npx tcb login
npx tcb functions:deploy
```
3. HTML 片段
``` html
...
<div id="twikoo"></div>
<script src="./twikoo.all.min.js"></script>
<script>
twikoo.init({
envId: 'imaegoo-16fe3d'
});
</script>
...
```

<!-- ## 贡献者 | Contributors -->

<!-- ## 捐赠 | Donate -->

## 开发 | Development

```
npm run serve
npm run build
```

## 国际化 | I18N

鉴于腾讯云在中国以外地区的支持程度,本项目暂无国际化计划。

## 许可 | License

[MIT License](./LICENSE)
3 changes: 3 additions & 0 deletions _config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
envId: 'imaegoo-16fe3d'
}
25 changes: 25 additions & 0 deletions cloudbaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const config = require('./_config')

const defaultFunctionConfig = {
// 超时时间
timeout: 10,
// 环境变量
envVariables: {},
runtime: 'Nodejs10.15',
// 内存 128
memorySize: 128,
handler: 'index.main'
}

module.exports = {
envId: config.envId,
functionRoot: './src/function',
functions: [
{ name: 'migrate', ...defaultFunctionConfig },
{ name: 'comment-get', ...defaultFunctionConfig },
{ name: 'comment-like', ...defaultFunctionConfig },
{ name: 'comment-submit', ...defaultFunctionConfig },
{ name: 'counter-get', ...defaultFunctionConfig },
{ name: 'counter-inc', ...defaultFunctionConfig }
]
}
Binary file added docs/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "twikoo",
"version": "0.1.1",
"description": "A simple comment system based on Tencent CloudBase (tcb).",
"author": "imaegoo <[email protected]> (https://github.com/imaegoo)",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/imaegoo/twikoo.git"
},
"homepage": "https://github.com/imaegoo/twikoo",
"scripts": {
"dev": "webpack-dev-server",
"serve": "webpack-dev-server",
"build": "webpack",
"analyze": "webpack --profile --json > stats.json && webpack-bundle-analyzer stats.json",
"deploy": "tcb functions:deploy",
"lint": "eslint"
},
"devDependencies": {
"@cloudbase/cli": "^0.9.5",
"copy-webpack-plugin": "^6.0.3",
"css-loader": "^3.6.0",
"eslint": "^7.6.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"svg-inline-loader": "^0.8.2",
"vue-loader": "^15.9.3",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.44.1",
"webpack-bundle-analyzer": "^3.8.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"@cloudbase/js-sdk": "^1.0.4",
"@fortawesome/fontawesome-free": "^5.14.0",
"blueimp-md5": "^2.17.0",
"element-ui": "^2.13.2",
"marked": "^1.1.1",
"vue": "^2.6.11"
}
}
6 changes: 6 additions & 0 deletions public/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.section {
background-color: hsl(0, 0%, 96%);
}
.footer {
background: none;
}
Loading

0 comments on commit ccf3b00

Please sign in to comment.