Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantou132/GoogleTranslate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.1.8
Choose a base ref
...
head repository: mantou132/GoogleTranslate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
8 changes: 6 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -5,19 +5,23 @@ module.exports = {
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
'no-console': 1,
'import/no-named-as-default': 0,
// https://github.com/benmosher/eslint-plugin-import/blob/HEAD/docs/rules/order.md
'import/order': ['error', { 'newlines-between': 'always-and-inside-groups' }],
'import/order': ['error', { 'newlines-between': 'always' }],
'import/newline-after-import': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
process.env.NODE_ENV === 'production' ? 2 : 1,
23 changes: 17 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -11,25 +11,36 @@ jobs:

strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
# os: [macos-11, ubuntu-20.04, windows-2019]
os: [ubuntu-20.04, windows-2019]

steps:
- name: Check out Git repository
uses: actions/checkout@v2
with:
submodules: true

- name: Install robotjs deps
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install libxtst-dev libpng++-dev

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v2-beta
with:
node-version: '14'

- name: Install robotjs
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install libxtst-dev libpng++-dev

# Credentials are no longer valid for the Snap Store.
# - name: Install and login Snapcraft
# uses: samuelmeuli/action-snapcraft@v1
# if: startsWith(matrix.os, 'ubuntu')
# with:
# snapcraft_token: ${{ secrets.snapcraft_token }}

- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
github_token: ${{ secrets.github_token }}
release: ${{ startsWith(github.ref, 'refs/tags/') }}
release: ${{ startsWith(github.ref, 'refs/tags/') }}

mac_certs: ${{ secrets.mac_certs }}
mac_certs_password: ${{ secrets.mac_certs_password }}
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test

on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '40 7,19 * * *'
workflow_dispatch:

jobs:
test:
runs-on: macos-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2
with:
submodules: true

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v2-beta
with:
node-version: '14'

- name: Install deps
run: pnpm i --ignore-scripts && pnpm i -D puppeteer

- name: Test
run: pnpm run test
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -9,6 +9,6 @@
"editor.renderWhitespace": "all",
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
}
}
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -34,14 +34,16 @@ A:可能被 OS 禁止了,试试重新为应用授权。如:<a href="./scre
## 开发

```bash
# 同步子模块
git submodule update --remote --init
# 安装 rust 环境

# 安装项目依赖
npm i
pnpm i
# 将 ts 转成 js
npm run watch
pnpm run watch
# 以开发模式启动项目
npm start
pnpm start
```

如有网络问题不能 `build`, 可以为 `npm` 设置代理:
@@ -51,9 +53,9 @@ npm start
# https://www.npmjs.com/package/http-proxy-to-socks
hpts -s 127.0.0.1:10808 -p 1080

npm config set proxy http://127.0.0.1:1080
npm run build
npm config delete proxy
pnpm config set proxy http://127.0.0.1:1080
pnpm run build
pnpm config delete proxy
```

## TODO
5 changes: 5 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
preset: 'ts-jest',
testEnvironment: 'node',
testPathIgnorePatterns: ['/node_modules/', 'src/bridge'],
};
Loading