Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
#	package.json
  • Loading branch information
oldj committed Apr 15, 2023
2 parents 4cf607c + a51e15f commit d4da0e8
Show file tree
Hide file tree
Showing 161 changed files with 1,031 additions and 1,180 deletions.
16 changes: 0 additions & 16 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Homepage: [https://switchhosts.vercel.app](https://switchhosts.vercel.app)

SwitchHosts is an App for managing hosts file, it is based on [Electron](http://electron.atom.io/)
, [React](https://facebook.github.io/react/), [UmiJS](https://umijs.org/)
, [React](https://facebook.github.io/react/), [Jotai](https://jotai.org/)
, [Chakra UI](https://chakra-ui.com/), [CodeMirror](http://codemirror.net/), etc.

## Screenshot
Expand Down
2 changes: 1 addition & 1 deletion README.zh_hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
项目主页:[https://switchhosts.vercel.app](https://switchhosts.vercel.app)

SwitchHosts 是一个管理 hosts 文件的应用,基于 [Electron](http://electron.atom.io/)
[React](https://facebook.github.io/react/)[UmiJS](https://umijs.org/)
[React](https://facebook.github.io/react/)[Jotai](https://jotai.org/)
[Chakra UI](https://chakra-ui.com/)[CodeMirror](http://codemirror.net/) 等技术开发。

## 截图
Expand Down
2 changes: 1 addition & 1 deletion README.zh_hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
項目主頁:[https://switchhosts.vercel.app](https://switchhosts.vercel.app)

SwitchHosts 是一個管理 hosts 檔案的應用程式,基於 [Electron](http://electron.atom.io/)
[React](https://facebook.github.io/react/)[UmiJS](https://umijs.org/)
[React](https://facebook.github.io/react/)[Jotai](https://jotai.org/)
[Chakra UI](https://chakra-ui.com/)[CodeMirror](http://codemirror.net/) 等技術開發。

## 螢幕截圖
Expand Down
7 changes: 3 additions & 4 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "switchhosts",
"productName": "SwitchHosts",
"version": "4.0.0",
"version": "4.2.0.6105",
"description": "Switch hosts quickly!",
"main": "./main.js",
"author": {
Expand All @@ -10,8 +10,7 @@
"url": "https://github.com/oldj/SwitchHosts"
},
"homepage": "https://switchhosts.vercel.app",
"scripts": {
},
"scripts": {},
"license": "Apache-2.0",
"dependencies": {}
}
}
150 changes: 73 additions & 77 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,92 +1,88 @@
{
"private": true,
"scripts": {
"start": "electron ./build/main.js",
"postinstall": "umi generate tmp",
"test:umi": "umi-test",
"test:coverage": "umi-test --coverage",
"start": "cross-env NODE_ENV=development electron ./build/main.js",
"test": "rm -rf ./test/tmp/* && mocha -r espower-typescript/guess -r tsconfig-paths/register \"test/**/*.test.ts\"",
"dev": "concurrently \"npm run dev:main\" \"npm run dev:renderer\"",
"dev:main": "webpack --config scripts/webpack.main.config.js -w",
"dev:renderer": "cross-env APP_ROOT=src/renderer umi dev",
"clean:dist": "rimraf ./dist/*",
"clean:build": "rimraf ./build/*",
"dev": "npm run clean:build && concurrently \"npm run dev:main\" \"npm run dev:renderer\"",
"dev:main": "vite build --watch --config ./vite.main.config.ts",
"dev:renderer": "vite --config ./vite.render.config.ts",
"version:up": "node ./scripts/version_up.js",
"build": "npm run version:up && concurrently \"npm run build:main\" \"npm run build:renderer\"",
"build:main": "cross-env NODE_ENV=production webpack --config scripts/webpack.main.prod.config.js",
"build:renderer": "cross-env APP_ROOT=src/renderer umi build",
"_build": "npm run clean:build && npm run version:up && concurrently \"npm run build:main\" \"npm run build:renderer\"",
"build:main": "cross-env NODE_ENV=production vite build --config ./vite.main.config.ts",
"build:renderer": "cross-env NODE_ENV=production vite build --config ./vite.render.config.ts",
"build": "npm run _build",
"make": "node scripts/make.js",
"make:dev": "cross-env SKIP_NOTARIZATION=1 cross-env MAKE_FOR=dev npm run make",
"make:linux": "cross-env SKIP_NOTARIZATION=1 cross-env MAKE_FOR=linux npm run make",
"make:win": "cross-env SKIP_NOTARIZATION=1 cross-env MAKE_FOR=win npm run make"
"make:win": "cross-env SKIP_NOTARIZATION=1 cross-env MAKE_FOR=win npm run make",
"publish": "electron-builder --mac --win --linux -p always"
},
"dependencies": {
"axios": "^0.27.2",
"compare-versions": "^4.1.3",
"dayjs": "^1.11.2",
"electron-window-state": "^5.0.3",
"express": "^4.18.1",
"lodash": "^4.17.21",
"md5": "^2.3.0",
"md5-file": "^5.0.0",
"mkdirp": "^1.0.4",
"potdb": "^2.3.3",
"tslib": "^2.4.0",
"uuid": "^8.3.2"
"axios": "1.3.5",
"compare-versions": "5.0.3",
"dayjs": "1.11.7",
"electron-updater": "5.3.0",
"electron-window-state": "5.0.3",
"express": "4.18.2",
"lodash": "4.17.21",
"md5": "2.3.0",
"md5-file": "5.0.0",
"mkdirp": "3.0.0",
"potdb": "2.5.5",
"tslib": "2.5.0",
"uuid": "9.0.0"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.17.12",
"@babel/plugin-proposal-decorators": "^7.18.2",
"@babel/preset-env": "^7.18.2",
"@babel/preset-typescript": "^7.17.12",
"@chakra-ui/react": "^2.1.2",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@types/assert": "^1.5.6",
"@types/codemirror": "^5.60.5",
"@types/express": "^4.17.13",
"@types/lodash": "^4.14.182",
"@types/md5": "^2.3.2",
"@types/mkdirp": "^1.0.2",
"@types/mocha": "^9.1.1",
"@types/node": "^17.0.35",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.5",
"@types/react-window": "^1.8.5",
"@types/uuid": "^8.3.4",
"@umijs/preset-react": "2.x",
"@umijs/test": "^3.5.24",
"ahooks": "^3.4.0",
"babel-loader": "^8.2.5",
"clsx": "^1.1.1",
"codemirror": "^5.65.4",
"concurrently": "^7.2.1",
"copy-webpack-plugin": "^11.0.0",
"cross-env": "^7.0.3",
"dotenv": "^16.0.1",
"electron": "^19.1.8",
"electron-builder": "^24.0.0",
"electron-notarize": "^1.2.1",
"espower-typescript": "^10.0.0",
"execa": "^6.1.0",
"fork-ts-checker-webpack-plugin": "^7.2.11",
"fs-extra": "^10.1.0",
"mocha": "^10.0.0",
"power-assert": "^1.6.1",
"prettier": "^2.6.2",
"pretty-bytes": "^6.0.0",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-icons": "^4.3.1",
"react-window": "^1.8.7",
"smooth-scroll-into-view-if-needed": "^1.1.33",
"ts-node": "^10.8.0",
"tsconfig-paths-webpack-plugin": "^3.5.2",
"typescript": "^4.7.2",
"umi": "^3.5.35",
"webpack": "^5.76.0",
"webpack-cli": "^4.9.2",
"webpack-merge": "^5.8.0",
"webpack-node-externals": "^3.0.0",
"yorkie": "^2.0.0"
"@chakra-ui/react": "2.5.5",
"@emotion/react": "11.10.6",
"@emotion/styled": "11.10.6",
"@tabler/icons-react": "2.16.0",
"@types/assert": "1.5.6",
"@types/codemirror": "5.60.7",
"@types/express": "4.17.17",
"@types/lodash": "4.14.194",
"@types/md5": "2.3.2",
"@types/mkdirp": "1.0.2",
"@types/mocha": "10.0.1",
"@types/node": "18.15.11",
"@types/react": "18.0.35",
"@types/react-dom": "18.0.11",
"@types/react-window": "1.8.5",
"@types/uuid": "9.0.1",
"@vitejs/plugin-react": "3.1.0",
"ahooks": "3.7.6",
"clsx": "1.2.1",
"codemirror": "5.65.11",
"concurrently": "8.0.1",
"cross-env": "7.0.3",
"dotenv": "16.0.3",
"electron": "24.1.2",
"electron-builder": "23.6.0",
"electron-notarize": "1.2.1",
"espower-typescript": "10.0.1",
"execa": "7.1.1",
"fs-extra": "11.1.1",
"jotai": "2.0.4",
"mocha": "10.2.0",
"power-assert": "1.6.1",
"prettier": "2.8.7",
"pretty-bytes": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "4.8.0",
"react-router-dom": "6.10.0",
"react-window": "1.8.8",
"rimraf": "^5.0.0",
"sass": "1.62.0",
"smooth-scroll-into-view-if-needed": "2.0.0",
"ts-node": "10.9.1",
"typescript": "5.0.4",
"vite": "4.2.1",
"vite-plugin-static-copy": "0.13.1",
"vite-plugin-svgr": "2.4.0",
"vite-tsconfig-paths": "4.2.0"
},
"build": {
"afterSign": "scripts/notarize.js"
Expand Down
2 changes: 2 additions & 0 deletions scripts/entitlements.mac.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
</dict>
</plist>
24 changes: 18 additions & 6 deletions scripts/make.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const TARGET_PLATFORMS_configs = {
win: ['nsis:ia32', 'nsis:x64', 'portable:ia32'],
},
all: {
mac: ['dmg:x64', 'dmg:arm64', 'dmg:universal'],
mac: ['dmg:x64', 'dmg:arm64'],
linux: [
'AppImage:x64',
'deb:x64',
Expand Down Expand Up @@ -100,14 +100,21 @@ const afterMake = async () => {
const doMake = async () => {
console.log('-> make...')

const { MAKE_FOR } = process.env
let targets = TARGET_PLATFORMS_configs.all
if (process.env.MAKE_FOR === 'dev') {
targets = TARGET_PLATFORMS_configs.macs
} else if (process.env.MAKE_FOR === 'mac') {

cfg_common.compression = 'maximum'
if (MAKE_FOR && MAKE_FOR !== 'all') {
cfg_common.compression = 'store'
}

if (MAKE_FOR === 'dev') {
targets = TARGET_PLATFORMS_configs.mac
} else if (process.env.MAKE_FOR === 'win') {
} else if (MAKE_FOR === 'mac') {
targets = TARGET_PLATFORMS_configs.macs
} else if (MAKE_FOR === 'win') {
targets = TARGET_PLATFORMS_configs.win
} else if (process.env.MAKE_FOR === 'linux') {
} else if (MAKE_FOR === 'linux') {
targets = TARGET_PLATFORMS_configs.linux
}

Expand Down Expand Up @@ -182,6 +189,11 @@ const doMake = async () => {
GenericName: 'An App for hosts management and switching.',
},
},
publish: {
provider: 'github',
owner: 'oldj',
repo: 'SwitchHosts',
},
},
})

Expand Down
14 changes: 13 additions & 1 deletion scripts/version_up.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@ const path = require('path')

const version_file = path.join(path.dirname(__dirname), 'src', 'version.json')
const version = require(version_file)
const app_package = require('../app/package.json')

version[3]++
const versionInc = (v) => {
return ++v
}

version[3] = versionInc(version[3])

console.log(`version -> ${version.slice(0, 3).join('.')}(${version[3]})`)
fs.writeFileSync(version_file, `[${version.join(', ')}]`)

app_package.version = version.slice(0, 3).join('.') + '.' + version[3]
fs.writeFileSync(
path.join(path.dirname(__dirname), 'app', 'package.json'),
JSON.stringify(app_package, null, 2),
'utf8',
)
20 changes: 0 additions & 20 deletions scripts/webpack.base.config.js

This file was deleted.

55 changes: 0 additions & 55 deletions scripts/webpack.main.config.js

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/webpack.main.prod.config.js

This file was deleted.

Loading

0 comments on commit d4da0e8

Please sign in to comment.