Skip to content

Commit

Permalink
fix: update deps 20230324 (#1404)
Browse files Browse the repository at this point in the history
* refactor: i18n thai language

* chore: rename renderer app name

* refactor: remove svg-innerhtml import

* refactor: update deps

* fix: protocol config save error

* fix: arch engine path copy

* chore: build arm64 arch aria2 v1.36.0
  • Loading branch information
agalwood authored Mar 27, 2023
1 parent 6039a89 commit a8846ea
Show file tree
Hide file tree
Showing 51 changed files with 4,613 additions and 5,737 deletions.
9 changes: 4 additions & 5 deletions .electron-vue/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ process.env.NODE_ENV = 'production'
const { say } = require('cfonts')
const chalk = require('chalk')
const del = require('del')
const { spawn } = require('child_process')
const webpack = require('webpack')
const Webpack = require('webpack')
const Multispinner = require('@motrix/multispinner')

const mainConfig = require('./webpack.main.config')
Expand Down Expand Up @@ -76,7 +75,7 @@ function build () {
function pack (config) {
return new Promise((resolve, reject) => {
config.mode = 'production'
webpack(config, (err, stats) => {
Webpack(config, (err, stats) => {
if (err) {
reject(err.stack || err)
} else if (stats.hasErrors()) {
Expand All @@ -103,9 +102,9 @@ function pack (config) {
}

function web () {
del.sync(['dist/web/*', '!.gitkeep'])
deleteSync(['dist/web/*', '!.gitkeep'])
webConfig.mode = 'production'
webpack(webConfig, (err, stats) => {
Webpack(webConfig, (err, stats) => {
if (err || stats.hasErrors()) console.log(err)

console.log(stats.toString({
Expand Down
56 changes: 17 additions & 39 deletions .electron-vue/dev-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ const electron = require('electron')
const path = require('path')
const { say } = require('cfonts')
const { spawn } = require('child_process')
const webpack = require('webpack')
const Webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
const webpackHotMiddleware = require('webpack-hot-middleware')
const HtmlWebpackPlugin = require('html-webpack-plugin');

const mainConfig = require('./webpack.main.config')
const rendererConfig = require('./webpack.renderer.config')

let electronProcess = null
let manualRestart = false
let hotMiddleware

function logStats (proc, data) {
let log = ''
Expand All @@ -40,53 +37,34 @@ function logStats (proc, data) {
}

function startRenderer () {
return new Promise((resolve, reject) => {
rendererConfig.entry.index = [path.join(__dirname, 'dev-client')].concat(rendererConfig.entry.index)
return new Promise(async (resolve, reject) => {
rendererConfig.entry.index = rendererConfig.entry.index
rendererConfig.mode = 'development'
const compiler = webpack(rendererConfig)
hotMiddleware = webpackHotMiddleware(compiler, {
log: false,
heartbeat: 2500
})

compiler.hooks.compilation.tap('compilation', compilation => {
HtmlWebpackPlugin.getHooks(compilation).afterEmit.tapAsync('html-webpack-plugin-after-emit', (data, cb) => {
hotMiddleware.publish({ action: 'reload' })
cb()
})
})

compiler.hooks.done.tap('done', stats => {
logStats('Renderer', stats)
})

const server = new WebpackDevServer(
compiler,
{
contentBase: path.join(__dirname, '../'),
quiet: true,
before (app, ctx) {
app.use(hotMiddleware)
ctx.middleware.waitUntilValid(() => {
resolve()
})
}
}
)

server.listen(9080)
const compiler = Webpack(rendererConfig)
const devServerOptions = {
...rendererConfig.devServer,
port: 9080,
static: {
directory: path.resolve(__dirname, "../"),
},
};

const server = new WebpackDevServer(devServerOptions, compiler)
await server.start()
resolve()
})
}

function startMain () {
return new Promise((resolve, reject) => {
mainConfig.entry.main = [path.join(__dirname, '../src/main/index.dev.js')].concat(mainConfig.entry.main)
mainConfig.mode = 'development'
const compiler = webpack(mainConfig)
const compiler = Webpack(mainConfig)

compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => {
logStats('Main', chalk.white.bold('compiling...'))
hotMiddleware.publish({ action: 'compiling' })
// hotMiddleware.publish({ action: 'compiling' })
done()
})

Expand Down
15 changes: 8 additions & 7 deletions .electron-vue/webpack.main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ process.env.BABEL_ENV = 'main'

const devMode = process.env.NODE_ENV !== 'production'
const path = require('path')
const { dependencies, build } = require('../package.json')
const webpack = require('webpack')
const { dependencies } = require('../package.json')
const { appId } = require('../electron-builder.json')
const Webpack = require('webpack')
const TerserPlugin = require('terser-webpack-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');

Expand Down Expand Up @@ -39,7 +40,7 @@ let mainConfig = {
path: path.join(__dirname, '../dist/electron')
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new Webpack.NoEmitOnErrorsPlugin(),
new ESLintPlugin({
formatter: require('eslint-friendly-formatter')
})
Expand Down Expand Up @@ -67,9 +68,9 @@ let mainConfig = {
*/
if (devMode) {
mainConfig.plugins.push(
new webpack.DefinePlugin({
new Webpack.DefinePlugin({
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`,
'appId': `"${build.appId}"`
'appId': `"${appId}"`
})
)
}
Expand All @@ -79,9 +80,9 @@ if (devMode) {
*/
if (!devMode) {
mainConfig.plugins.push(
new webpack.DefinePlugin({
new Webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"',
'appId': `"${build.appId}"`
'appId': `"${appId}"`
})
)
}
Expand Down
34 changes: 9 additions & 25 deletions .electron-vue/webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ process.env.BABEL_ENV = 'renderer'
const devMode = process.env.NODE_ENV !== 'production'
const path = require('path')
const { dependencies } = require('../package.json')
const webpack = require('webpack')
const Webpack = require('webpack')
const TerserPlugin = require('terser-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
Expand Down Expand Up @@ -114,31 +114,15 @@ let rendererConfig = {
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
name: 'imgs/[name]--[folder].[ext]'
}
}
type: 'asset/inline'
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: 'media/[name]--[folder].[ext]'
}
type: 'asset/resource'
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
name: 'fonts/[name]--[folder].[ext]'
}
}
type: 'asset/inline'
}
]
},
Expand Down Expand Up @@ -168,8 +152,8 @@ let rendererConfig = {
? path.resolve(__dirname, '../node_modules')
: false
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new Webpack.HotModuleReplacementPlugin(),
new Webpack.NoEmitOnErrorsPlugin(),
new ESLintPlugin({
extensions: ['js', 'vue'],
formatter: require('eslint-friendly-formatter')
Expand Down Expand Up @@ -209,7 +193,7 @@ if (devMode) {
rendererConfig.devtool = 'eval-cheap-module-source-map'

rendererConfig.plugins.push(
new webpack.DefinePlugin({
new Webpack.DefinePlugin({
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
})
)
Expand All @@ -227,10 +211,10 @@ if (!devMode) {
globOptions: { ignore: [ '.*' ] }
}]
}),
new webpack.DefinePlugin({
new Webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new webpack.LoaderOptionsPlugin({
new Webpack.LoaderOptionsPlugin({
minimize: false
})
)
Expand Down
28 changes: 8 additions & 20 deletions .electron-vue/webpack.web.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ process.env.BABEL_ENV = 'web'
const devMode = process.env.NODE_ENV !== 'production'
const path = require('path')
const { dependencies } = require('../package.json')
const webpack = require('webpack')
const Webpack = require('webpack')
const TerserPlugin = require('terser-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
Expand Down Expand Up @@ -111,23 +111,11 @@ let webConfig = {
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
name: 'imgs/[name].[ext]'
}
}
type: 'asset/inline'
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
name: 'fonts/[name].[ext]'
}
}
type: 'asset/inline'
}
]
},
Expand All @@ -153,11 +141,11 @@ let webConfig = {
? path.resolve(__dirname, '../node_modules')
: false
}),
new webpack.DefinePlugin({
new Webpack.DefinePlugin({
'process.env.IS_WEB': 'true'
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new Webpack.HotModuleReplacementPlugin(),
new Webpack.NoEmitOnErrorsPlugin(),
new ESLintPlugin({
extensions: ['js', 'vue'],
formatter: require('eslint-friendly-formatter')
Expand Down Expand Up @@ -208,10 +196,10 @@ if (!devMode) {
globOptions: { ignore: [ '.*' ] }
}]
}),
new webpack.DefinePlugin({
new Webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new webpack.LoaderOptionsPlugin({
new Webpack.LoaderOptionsPlugin({
minimize: true
})
)
Expand Down
5 changes: 3 additions & 2 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,17 @@ yarn run build
| it | Italiano | ✔️ [@blackcat-917](https://github.com/blackcat-917) |
| ja | 日本語 | ✔️ [@hbkrkzk](https://github.com/hbkrkzk) |
| ko | 한국어 | ✔️ [@KOZ39](https://github.com/KOZ39) |
| nb | Norsk Bokmål | [@rubjo](https://github.com/rubjo) |
| nb | Norsk Bokmål | ✔️ [@rubjo](https://github.com/rubjo) |
| pl | Polski | ✔️ [@KanarekLife](https://github.com/KanarekLife) |
| pt-BR | Portuguese (Brazil) | ✔️ [@andrenoberto](https://github.com/andrenoberto) |
| ro | Română | ✔️ [@alyn3d](https://github.com/alyn3d) |
| ru | Русский | ✔️ [@bladeaweb](https://github.com/bladeaweb) |
| th | แบบไทย | ✔️ [@nxanywhere](https://github.com/nxanywhere) |
| tr | Türkçe | ✔️ [@abdullah](https://github.com/abdullah) |
| uk | Українська | ✔️ [@bladeaweb](https://github.com/bladeaweb) |
| vi | Tiếng Việt | ✔️ [@duythanhvn](https://github.com/duythanhvn) |
| zh-CN | 简体中文 | ✔️ |
| zh-TW | 繁體中文 | ✔️ [@Yukaii](https://github.com/Yukaii) |
| zh-TW | 繁體中文 | ✔️ [@Yukaii](https://github.com/Yukaii) [@5idereal](https://github.com/5idereal) |

## 📜 开源许可

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,18 @@ Translations into versions for other languages are welcome 🧐! Please read the
| it | Italiano | ✔️ [@blackcat-917](https://github.com/blackcat-917) |
| ja | 日本語 | ✔️ [@hbkrkzk](https://github.com/hbkrkzk) |
| ko | 한국어 | ✔️ [@KOZ39](https://github.com/KOZ39) |
| nb | Norsk Bokmål | [@rubjo](https://github.com/rubjo) |
| nb | Norsk Bokmål | ✔️ [@rubjo](https://github.com/rubjo) |
| nl | Nederlands | ✔️ [@nickbouwhuis](https://github.com/nickbouwhuis) |
| pl | Polski | ✔️ [@KanarekLife](https://github.com/KanarekLife) |
| pt-BR | Portuguese (Brazil) | ✔️ [@andrenoberto](https://github.com/andrenoberto) |
| ro | Română | ✔️ [@alyn3d](https://github.com/alyn3d) |
| ru | Русский | ✔️ [@bladeaweb](https://github.com/bladeaweb) |
| th | แบบไทย | ✔️ [@nxanywhere](https://github.com/nxanywhere) |
| tr | Türkçe | ✔️ [@abdullah](https://github.com/abdullah) |
| uk | Українська | ✔️ [@bladeaweb](https://github.com/bladeaweb) |
| vi | Tiếng Việt | ✔️ [@duythanhvn](https://github.com/duythanhvn) |
| zh-CN | 简体中文 | ✔️ |
| zh-TW | 繁體中文 | ✔️ [@Yukaii](https://github.com/Yukaii) |
| zh-TW | 繁體中文 | ✔️ [@Yukaii](https://github.com/Yukaii) [@5idereal](https://github.com/5idereal) |

## 📜 License

Expand Down
4 changes: 2 additions & 2 deletions build/afterSignHook.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('dotenv').config()
const { notarize } = require('electron-notarize')
const pkg = require('../package.json')
const { appId } = require('../electron-builder.json')

exports.default = async function (context) {
const { electronPlatformName, appOutDir } = context
Expand All @@ -14,7 +14,7 @@ exports.default = async function (context) {
return
}

const appBundleId = pkg.build.appId
const appBundleId = appId
const appName = context.packager.appInfo.productFilename

return await notarize({
Expand Down
Loading

0 comments on commit a8846ea

Please sign in to comment.