Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bin.han committed Aug 6, 2021
0 parents commit 83e4b82
Show file tree
Hide file tree
Showing 27 changed files with 4,790 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
14 changes: 14 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"targets": {
"esmodules": true
}
}
],
"@babel/preset-typescript"
]
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist/

.DS_Store

*.log

.vscode
59 changes: 59 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module.exports = {
root: true,
env: { es6: true, node: true },
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.eslint.json',
},
plugins: ['import', 'prettier'],
extends: [
'airbnb-typescript/base',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
globals: {
$log: false,
$info: false,
$option: false,
$http: false,
$file: false,
$data: false,
},
rules: {
'no-var': 'off',
'vars-on-top': 'off',
'prefer-const': 'off',
'no-return-assign': 'off',
'consistent-return': 'off',
'prefer-destructuring': 'off',
'no-underscore-dangle': 'off',
'object-curly-newline': 'off',
// 'import/no-unresolved': 'error',
'import/no-mutable-exports': 'off',
'import/prefer-default-export': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-named-as-default-member': 'off',
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'max-len': ['error', { ignoreComments: true, code: 120, ignoreStrings: true }],
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-throw-literal': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/quotes': ['error', 'single', { allowTemplateLiterals: true }],
},
};
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release
on:
push:
tags:
- '*'

jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GIT_TOKEN }}

- uses: actions/setup-node@v2-beta
with:
node-version: '14'

- name: Install Dependencies And Build
run: |
yarn install
yarn run build
- name: Commit files
run: |
git config --global user.name 'robbinhan'
git config --global user.email '[email protected]'
git commit -am "chore: 更新版本文件"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GIT_TOKEN }}

- uses: ncipollo/release-action@v1
with:
artifacts: 'release/*.bobplugin'
token: ${{ secrets.GIT_TOKEN }}
107 changes: 107 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# 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
banner.user.js

release
42 changes: 42 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// .prettierrc.js
module.exports = {
// 一行最多 120 字符
printWidth: 120,
// 使用 2 个空格缩进
tabWidth: 2,
// 不使用缩进符,而使用空格
useTabs: false,
// 行尾需要有分号
semi: true,
// 使用单引号
singleQuote: true,
// 对象的 key 仅在必要时用引号
quoteProps: 'as-needed',
// jsx 不使用单引号,而使用双引号
jsxSingleQuote: false,
// 末尾需要有逗号
trailingComma: 'all',
// 大括号内的首尾需要空格
bracketSpacing: true,
// jsx 标签的反尖括号需要换行
jsxBracketSameLine: false,
// 箭头函数,只有一个参数的时候,也需要括号
arrowParens: 'always',
// 每个文件格式化的范围是文件的全部内容
rangeStart: 0,
rangeEnd: Infinity,
// 不需要写文件开头的 @prettier
requirePragma: false,
// 不需要自动在文件开头插入 @prettier
insertPragma: false,
// 使用默认的折行标准
proseWrap: 'preserve',
// 根据显示样式决定 html 要不要折行
htmlWhitespaceSensitivity: 'css',
// vue 文件中的 script 和 style 内不用缩进
vueIndentScriptAndStyle: false,
// 换行符使用 lf
endOfLine: 'lf',
// 格式化嵌入的内容
embeddedLanguageFormatting: 'auto',
};
Empty file added CHANGELOG.md
Empty file.
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) 2021 robbinhan

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.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# anki

> 这是 [Bob](https://ripperhe.gitee.io/bob/#/) 的一个插件
## 特性

- 支持缓存查询结果(默认缓存过期时间为一周);

## 安装

1. 安装 [Bob](https://ripperhe.gitee.io/bob/#/general/quickstart/install) (version >= 0.50)
2. 下载插件: [anki](https://github.com/robbinhan/anki/releases)
3. 插件安装: [Bob 插件安装文档说明](https://ripperhe.gitee.io/bob/#/general/quickstart/plugin?id=%e5%ae%89%e8%a3%85%e6%8f%92%e4%bb%b6)
61 changes: 61 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "anki",
"version": "0.0.1",
"description": "生成anki卡片",
"homepage": "https://github.com/robbinhan/bob-anki",
"repository": "https://github.com/robbinhan/bob-anki.git",
"author": "robbinhan",
"license": "MIT",
"main": "src/main.js",
"keywords": [
"bobplugin",
"translate"
],
"scripts": {
"clear": "rimraf ./dist && rimraf ./release",
"initInfo": "node ./scripts/init-info.js",
"install": "npm run initInfo",
"dev": "cross-env NODE_ENV=development rollup -c rollup.config.js --watch",
"build": "npm run clear && npm run initInfo && cross-env NODE_ENV=production rollup -c && node ./scripts/build-zip.js",
"type-check": "tsc --noEmit --allowJs",
"type-check:watch": "tsc --noEmit --allowJs --watch",
"prettier:fix": "prettier --config .prettierrc.js --write .",
"eslint": "eslint . -c .eslintrc.js --ext .ts,.tsx,.js",
"eslint:fix": "eslint . -c .eslintrc.js --fix --ext .ts,.tsx,.js",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"version": "npm run initInfo && npm run changelog && git add CHANGELOG.md src/info.json"
},
"dependencies": {
"@bob-plug/core": "^0.1.3",
"querystring": "^0.2.1"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@babel/preset-typescript": "^7.14.5",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@types/eslint-plugin-prettier": "^3.1.0",
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.2",
"adm-zip": "^0.5.5",
"conventional-changelog-cli": "^2.1.1",
"cross-env": "^7.0.3",
"esbuild": "^0.12.15",
"eslint": "^7.30.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-prettier": "^3.4.0",
"fs-extra": "^10.0.0",
"prettier": "^2.3.2",
"rimraf": "^3.0.2",
"rollup": "^2.52.8",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-esbuild": "^4.5.0",
"rollup-plugin-polyfill-node": "^0.6.2",
"typescript": "^4.3.5"
}
}
Loading

0 comments on commit 83e4b82

Please sign in to comment.