Skip to content

build: upgrade toolchain #1825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jquery": true
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jquery": true
},
"root": true,
"extends": [
"plugin:vue/essential",
"eslint:recommended",
"@vue/typescript"
],
"rules": {
"no-console": 0
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2022,
"parser": "@typescript-eslint/parser"
}
}
}
33 changes: 12 additions & 21 deletions .github/workflows/build_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '20'
cache: yarn

- name: Get yarn cache
id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn

- run: yarn build
continue-on-error: true

- name: Upload Built to action
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build-dist-folder
path: dist
Expand All @@ -69,7 +60,7 @@ jobs:
outputs:
version: ${{ steps.zip.outputs.extensionVersion }}
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: build-dist-folder
path: dist
Expand All @@ -82,7 +73,7 @@ jobs:
zipFilePath: 'artifact/extension.zip'

- name: Upload Built Zip to action
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dev-build-${{ steps.zip.outputs.extensionVersion }}-zip
path: artifact/*
Expand All @@ -101,7 +92,7 @@ jobs:
USER_INPUT=${{ inputs.auto_update_file }}
echo "value=${USER_INPUT:-"stable.xml"}" >> $GITHUB_OUTPUT

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
env:
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }}
if: ${{ env.CRX_PRIVATE_KEY != '' }}
Expand Down Expand Up @@ -141,7 +132,7 @@ jobs:
env:
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }}
if: ${{ env.CRX_PRIVATE_KEY != '' }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dev-build-${{ steps.zip.outputs.extensionVersion }}-crx
path: artifact/*
Expand All @@ -154,7 +145,7 @@ jobs:
outputs:
exist_xpi_file: ${{ steps.addonsDeploy.outcome }}
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: dev-build-${{ needs.zip.outputs.version }}-zip

Expand All @@ -173,7 +164,7 @@ jobs:
jwtSecret: ${{ secrets.FF_JWT_SECRET }}

- name: Upload Built Xpi to action
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ steps.addonsDeploy.outcome == 'success' }}
with:
name: dev-build-${{ needs.zip.outputs.version }}-xpi
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/build_canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ jobs:
run: mkdir build

- name: Get And rename Zip build
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name:
dev-build-${{ needs.action.outputs.version }}-zip
name: dev-build-${{ needs.action.outputs.version }}-zip

- run: mv extension.zip build/PT-Plugin-Plus-${{ needs.action.outputs.version }}.zip

- name: Get And remove Crx Build
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name:
dev-build-${{ needs.action.outputs.version }}-crx
Expand All @@ -53,19 +52,18 @@ jobs:
mv extension.crx build/PT-Plugin-Plus-${{ needs.action.outputs.version }}.crx

- name: Get And move Xpi Build
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
if: ${{ needs.action.outputs.buildXPI == 'success' }}
with:
name:
dev-build-${{ needs.action.outputs.version }}-xpi
name: dev-build-${{ needs.action.outputs.version }}-xpi

- if: ${{ needs.action.outputs.buildXPI == 'success' }}
run: |
mv extension.signed.xpi build/PT-Plugin-Plus-${{ needs.action.outputs.version }}.xpi
echo $(jq '.addons[].updates += [{"version": "${{ needs.action.outputs.version }}", "update_link": "https://github.com/pt-plugins/PT-Plugin-Plus/releases/download/v${{ needs.action.outputs.version }}/PT-Plugin-Plus-${{ needs.action.outputs.version }}.xpi"}]' pages/update/firefox.json) > pages/update/firefox.json

- name: Deploy update xml and json
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./pages
Expand Down
21 changes: 21 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en" translate="no">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<meta name="google" content="notranslate" />
<title>PT-Plugin-Plus</title>
<link rel="stylesheet" href="./public/libs/materialIcons/style.css" />
<link rel="stylesheet" href="./public/assets/options.css" />
<link rel="icon" type="image/x-icon" href="./public/assets/icon-19.png" />
<script src="./libs/jquery/jquery-3.3.1.min.js"></script>
<script src="./libs/Base64.js"></script>
<script type="module" src="./src/options/main.ts"></script>
</head>

<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
103 changes: 38 additions & 65 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "pt-plugin-plus",
"version": "1.6.1",
"packageManager": "[email protected]",
"packageManager": "[email protected]",
"type": "module",
"author": {
"name": "ronggang",
"url": "https://github.com/ronggang"
Expand All @@ -10,26 +11,24 @@
"displayName": "PT 助手 Plus",
"homepage": "https://github.com/pt-plugins/PT-Plugin-Plus",
"scripts": {
"serve": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service serve --mode=test",
"build": "set NODE_OPTIONS=--openssl-legacy-provider & yarn build:index && yarn build:background && yarn build:content && yarn resource",
"lint": "vue-cli-service lint",
"background": "webpack --config webpack/prod-background.js && webpack --config webpack/prod-content.js",
"build": "yarn build:index && yarn build:background && yarn build:content && yarn resource",
"lint": "eslint ./src/ --ext ts,vue,js",
"background": "webpack --config webpack/prod-background.cjs && webpack --config webpack/prod-content.cjs",
"dev": "yarn dev:index && yarn dev:background && yarn dev:content && yarn resource",
"dev-s": "cd debug && yarn install && tsc && node ./dist/index.js",
"dev:index": "yarn install && vue-cli-service build --mode=development",
"dev:background": "webpack --config webpack/dev-background.js --progress",
"dev:content": "webpack --config webpack/dev-content.js --progress",
"dev:index": "vite build --watch",
"dev:background": "webpack --config webpack/dev-background.cjs --progress",
"dev:content": "webpack --config webpack/dev-content.cjs --progress",
"dev:bc": "yarn dev:background && yarn dev:content",
"resource": "cd debug && yarn install && tsc && node ./dist/buildResource.js",
"build:index": "yarn install && vue-cli-service build",
"build:background": "webpack --config webpack/prod-background.js --progress",
"build:content": "webpack --config webpack/prod-content.js --progress"
"build:index": "vite build",
"build:background": "webpack --config webpack/prod-background.cjs --progress",
"build:content": "webpack --config webpack/prod-content.cjs --progress"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^4.4.0",
"@typescript-eslint/parser": "^4.4.0",
"basiccontext": "^3.5.1",
"blueimp-md5": "^2.19.0",
"caniuse-lite": "^1.0.30001612",
"crypto-js": "^3.1.9-1",
"dayjs": "^1.11.5",
"dom-to-image": "^2.6.0",
Expand All @@ -38,19 +37,23 @@
"file-saver": "^2.0.5",
"highcharts": "^10.2.1",
"highcharts-vue": "^1.4.0",
"https-browserify": "^1.0.0",
"i18next": "^21.9.1",
"jszip": "^3.10.1",
"parse-torrent": "^7.0.1",
"parse-torrent": "^11.0.16",
"path-browserify": "^1.0.1",
"stream-http": "^3.2.0",
"ua-parser-js": "^1.0.2",
"url-parse": "^1.5.10",
"vue": "~2.6.14",
"util": "^0.12.5",
"vue": "~2.7.0",
"vue-class-component": "^6.3.2",
"vue-i18n": "^8.11.2",
"vue-property-decorator": "^7.0.0",
"vue-router": "~3.5.4",
"vuetify": "^1.3.0",
"vuex": "^3.0.1",
"webdav": "^3.6.2"
"webdav": "^5.6.0"
},
"devDependencies": {
"@types/blueimp-md5": "^2.18.0",
Expand All @@ -60,59 +63,29 @@
"@types/extend": "^3.0.1",
"@types/file-saver": "^2.0.5",
"@types/jquery": "^3.5.14",
"@types/parse-torrent": "^5.8.4",
"@types/node": "20",
"@types/parse-torrent": "^5.8.7",
"@types/ua-parser-js": "^0.7.36",
"@types/url-parse": "^1.4.8",
"@vue/cli-plugin-babel": "^3.0.5",
"@vue/cli-plugin-eslint": "^5.0.0",
"@vue/cli-plugin-typescript": "^3.2.0",
"@vue/cli-service": "^3.0.5",
"@vue/eslint-config-typescript": "^11.0.0",
"babel-eslint": "^10.0.1",
"copy-webpack-plugin": "^4.6.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"@vitejs/plugin-vue2": "^2.3.1",
"@vue/eslint-config-typescript": "^13.0.0",
"copy-webpack-plugin": "^12.0.2",
"esbuild-loader": "^4.1.0",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.25.0",
"git-rev-sync": "^3.0.2",
"sass": "^1.54.8",
"sass-loader": "~7.3.1",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"terser-webpack-plugin": "^2.2.1",
"ts-loader": "^5.3.1",
"ts-node": "^8.5.2",
"typescript": "^3.0.0",
"uglifyjs-webpack-plugin": "~2.1.3",
"vue-cli-plugin-vuetify": "^0.4.6",
"vue-template-compiler": "~2.6.14",
"sass": "^1.75.0",
"sass-loader": "^14.2.1",
"terser-webpack-plugin": "^5.3.10",
"typescript": "^5.4.5",
"vite": "^5.2.10",
"vue-template-compiler": "~2.7.0",
"vuetify-loader": "~1.7.3",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"webpack-merge": "^4.2.2"
},
"resolutions": {
"@types/node": "~18.11.9"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended",
"@vue/typescript"
],
"rules": {
"no-console": 0
},
"parserOptions": {
"parser": "@typescript-eslint/parser"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.10.0"
},
"browserslist": [
"> 1%",
Expand Down
13 changes: 5 additions & 8 deletions src/background/plugins/WebDAV.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {
IBackupServer,
EResourceOrderBy,
EResourceOrderMode
} from "@/interface/common";
import { createClient as WebDAVClient } from "webdav";
import {EResourceOrderBy, EResourceOrderMode, IBackupServer} from "@/interface/common";
import {AuthType, createClient as WebDAVClient} from "webdav";

export class WebDAV {
private service: any;

constructor(public options: IBackupServer) {
this.initServer();
}
Expand All @@ -16,9 +13,9 @@ export class WebDAV {
*/
private initServer() {
this.service = WebDAVClient(this.options.address, {
authType: this.options.digest ? AuthType.Digest : AuthType.Password,
username: this.options.loginName,
password: this.options.loginPwd,
digest: this.options.digest ? true : undefined
});
}

Expand All @@ -29,7 +26,7 @@ export class WebDAV {
public list(options: any = {}): Promise<any> {
return new Promise<any>((resolve?: any, reject?: any) => {
this.service
.getDirectoryContents("/", { glob: "*.zip" })
.getDirectoryContents("/", {glob: "*.zip"})
.then((data: any[]) => {
console.log(data);

Expand Down
3 changes: 1 addition & 2 deletions src/options/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
</template>

<script>
import { EAction, Options } from "../interface/common";
import Navigation from "./components/Navigation.vue";
import Topbar from "./components/Topbar.vue";
import Footer from "./components/Footer.vue";
Expand Down Expand Up @@ -98,4 +97,4 @@ export default {
};
</script>

<style lang="scss" src="./assets/contextMenu.scss"></style>
<style lang="scss" src="./assets/contextMenu.scss"></style>
Loading