pake-cli 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -0
- package/package.json +10 -4
- package/.ecrc.json +0 -3
- package/.editorconfig +0 -24
- package/.github/FUNDING.yml +0 -2
- package/.github/ISSUE_TEMPLATE/bug.md +0 -13
- package/.github/workflows/editorconfig-check.yml +0 -23
- package/.github/workflows/main.yml +0 -17
- package/.github/workflows/rust-code-quality-check.yml +0 -89
- package/.prettierignore +0 -4
- package/.vscode/settings.json +0 -4
- package/CODE_OF_CONDUCT.md +0 -128
- package/CONTRIBUTING.md +0 -26
- package/README_EN.md +0 -148
- package/app.csv +0 -9
- package/bin/README.md +0 -72
- package/bin/builders/BuilderFactory.ts +0 -12
- package/bin/builders/LinuxBuilder.ts +0 -0
- package/bin/builders/MacBuilder.ts +0 -65
- package/bin/builders/WinBulider.ts +0 -0
- package/bin/builders/base.ts +0 -16
- package/bin/builders/common.ts +0 -11
- package/bin/cli.ts +0 -36
- package/bin/defaults.ts +0 -13
- package/bin/helpers/rust.ts +0 -21
- package/bin/helpers/tauriConfig.ts +0 -8
- package/bin/options/icon.ts +0 -91
- package/bin/options/index.ts +0 -22
- package/bin/types.ts +0 -29
- package/bin/utils/platform.ts +0 -5
- package/bin/utils/shell.ts +0 -13
- package/bin/utils/tlds.ts +0 -1489
- package/bin/utils/url.ts +0 -47
- package/bin/utils/validate.ts +0 -18
- package/icns2png.py +0 -38
- package/rollup.config.js +0 -24
- package/script/build.bat +0 -80
- package/script/build.sh +0 -122
- package/script/sd-apple-x64 +0 -0
- package/script/sd-linux-x64 +0 -0
- package/script/sd.exe +0 -0
- package/tsconfig.json +0 -17
package/bin/utils/url.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import url from 'url';
|
|
2
|
-
import isurl from 'is-url';
|
|
3
|
-
import tlds from './tlds.js';
|
|
4
|
-
|
|
5
|
-
export function getDomain(inputUrl: string) {
|
|
6
|
-
const parsed = url.parse(inputUrl).host;
|
|
7
|
-
var parts = parsed.split('.');
|
|
8
|
-
if (parts[0] === 'www' && parts[1] !== 'com') {
|
|
9
|
-
parts.shift();
|
|
10
|
-
}
|
|
11
|
-
var ln = parts.length,
|
|
12
|
-
i = ln,
|
|
13
|
-
minLength = parts[parts.length - 1].length,
|
|
14
|
-
part;
|
|
15
|
-
|
|
16
|
-
// iterate backwards
|
|
17
|
-
while ((part = parts[--i])) {
|
|
18
|
-
// stop when we find a non-TLD part
|
|
19
|
-
if (
|
|
20
|
-
i === 0 || // 'asia.com' (last remaining must be the SLD)
|
|
21
|
-
i < ln - 2 || // TLDs only span 2 levels
|
|
22
|
-
part.length < minLength || // 'www.cn.com' (valid TLD as second-level domain)
|
|
23
|
-
tlds.indexOf(part) < 0 // officialy not a TLD
|
|
24
|
-
) {
|
|
25
|
-
return part;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function appendProtocol(inputUrl: string): string {
|
|
31
|
-
const parsed = url.parse(inputUrl);
|
|
32
|
-
if (!parsed.protocol) {
|
|
33
|
-
const urlWithProtocol = `https://${inputUrl}`;
|
|
34
|
-
return urlWithProtocol;
|
|
35
|
-
}
|
|
36
|
-
return inputUrl;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function normalizeUrl(urlToNormalize: string): string {
|
|
40
|
-
const urlWithProtocol = appendProtocol(urlToNormalize);
|
|
41
|
-
|
|
42
|
-
if (isurl(urlWithProtocol)) {
|
|
43
|
-
return urlWithProtocol;
|
|
44
|
-
} else {
|
|
45
|
-
throw new Error(`Your url "${urlWithProtocol}" is invalid`);
|
|
46
|
-
}
|
|
47
|
-
}
|
package/bin/utils/validate.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as Commander from 'commander';
|
|
2
|
-
import { normalizeUrl } from './url.js';
|
|
3
|
-
|
|
4
|
-
export function validateNumberInput(value: string) {
|
|
5
|
-
const parsedValue = Number(value);
|
|
6
|
-
if (isNaN(parsedValue)) {
|
|
7
|
-
throw new Commander.InvalidArgumentError('Not a number.');
|
|
8
|
-
}
|
|
9
|
-
return parsedValue;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function validateUrlInput(url: string) {
|
|
13
|
-
try {
|
|
14
|
-
return normalizeUrl(url);
|
|
15
|
-
} catch (error) {
|
|
16
|
-
throw new Commander.InvalidArgumentError(error.message);
|
|
17
|
-
}
|
|
18
|
-
}
|
package/icns2png.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
批量将icns文件转成png文件
|
|
3
|
-
Batch convert ICNS files to PNG files
|
|
4
|
-
"""
|
|
5
|
-
import os
|
|
6
|
-
|
|
7
|
-
try:
|
|
8
|
-
from PIL import Image
|
|
9
|
-
except ImportError:
|
|
10
|
-
os.system("pip install Pillow")
|
|
11
|
-
from PIL import Image
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if __name__ == "__main__":
|
|
15
|
-
now_dir = os.path.dirname(os.path.abspath(__file__))
|
|
16
|
-
icons_dir = os.path.join(now_dir, "src-tauri", "icons")
|
|
17
|
-
png_dir = os.path.join(now_dir, "src-tauri", "png")
|
|
18
|
-
if not os.path.exists(png_dir):
|
|
19
|
-
os.mkdir(png_dir)
|
|
20
|
-
file_list = os.listdir(icons_dir)
|
|
21
|
-
file_list = [file for file in file_list if file.endswith(".icns")]
|
|
22
|
-
for file in file_list:
|
|
23
|
-
icns_path = os.path.join(icons_dir, file)
|
|
24
|
-
image = Image.open(icns_path)
|
|
25
|
-
image_512 = image.copy().resize((512, 512))
|
|
26
|
-
image_256 = image.copy().resize((256, 256))
|
|
27
|
-
image_32 = image.copy().resize((32, 32))
|
|
28
|
-
image_name = os.path.splitext(file)[0]
|
|
29
|
-
image_512_path = os.path.join(png_dir, image_name + "_512.png")
|
|
30
|
-
image_256_path = os.path.join(png_dir, image_name + "_256.ico")
|
|
31
|
-
image_32_path = os.path.join(png_dir, image_name + "_32.ico")
|
|
32
|
-
image_512.save(image_512_path, "PNG")
|
|
33
|
-
image_256.save(image_256_path, "ICO")
|
|
34
|
-
image_32.save(image_32_path, "ICO")
|
|
35
|
-
print("png file write success.")
|
|
36
|
-
print(f"There are {len(os.listdir(png_dir))} png picture in ", png_dir)
|
|
37
|
-
|
|
38
|
-
|
package/rollup.config.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import appRootPath from 'app-root-path';
|
|
3
|
-
import typescript from '@rollup/plugin-typescript';
|
|
4
|
-
import alias from '@rollup/plugin-alias';
|
|
5
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
6
|
-
import json from '@rollup/plugin-json';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
input: 'bin/cli.ts',
|
|
10
|
-
output: {
|
|
11
|
-
file: 'dist/cli.js',
|
|
12
|
-
format: 'es'
|
|
13
|
-
},
|
|
14
|
-
plugins: [
|
|
15
|
-
json(),
|
|
16
|
-
typescript({
|
|
17
|
-
sourceMap: false,
|
|
18
|
-
}),
|
|
19
|
-
commonjs(),
|
|
20
|
-
alias({
|
|
21
|
-
entries: [{ find: '@', replacement: path.join(appRootPath.path, 'bin') }],
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
24
|
-
};
|
package/script/build.bat
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
chcp 65001
|
|
3
|
-
|
|
4
|
-
if not exist node_modules (
|
|
5
|
-
call npm i
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
if not exist output (
|
|
9
|
-
mkdir output
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if not exist output\windows (
|
|
14
|
-
mkdir output\windows
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
echo.
|
|
18
|
-
echo =======================
|
|
19
|
-
echo "build for windows"
|
|
20
|
-
echo =======================
|
|
21
|
-
echo.
|
|
22
|
-
|
|
23
|
-
:: total package number
|
|
24
|
-
set /A index=1
|
|
25
|
-
for /f %%a in (' find /c /v "" ^<"app.csv" ') do set /A total=%%a
|
|
26
|
-
:: ignore first header line
|
|
27
|
-
set /A total=total-1
|
|
28
|
-
|
|
29
|
-
set old_name=weread
|
|
30
|
-
set old_title=WeRead
|
|
31
|
-
set old_zh_name=微信阅读
|
|
32
|
-
set old_url=https://weread.qq.com/
|
|
33
|
-
|
|
34
|
-
:: for windows, we need replace package name to title
|
|
35
|
-
.\script\sd.exe "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri\tauri.conf.json
|
|
36
|
-
|
|
37
|
-
for /f "skip=1 tokens=1-4 delims=," %%i in (app.csv) do (
|
|
38
|
-
setlocal enabledelayedexpansion
|
|
39
|
-
set name=%%i
|
|
40
|
-
set title=%%j
|
|
41
|
-
set name_zh=%%k
|
|
42
|
-
set url=%%l
|
|
43
|
-
@echo on
|
|
44
|
-
|
|
45
|
-
::echo name is !name! !name_zh! !url!
|
|
46
|
-
:: replace url
|
|
47
|
-
.\script\sd.exe !old_url! !url! src-tauri\tauri.conf.json
|
|
48
|
-
::replace pacakge name
|
|
49
|
-
.\script\sd.exe !old_title! !title! src-tauri\tauri.conf.json
|
|
50
|
-
.\script\sd.exe !old_name! !name! src-tauri\tauri.conf.json
|
|
51
|
-
echo update ico with 32x32 pictue
|
|
52
|
-
.\script\sd.exe !old_name! !name! src-tauri\src\main.rs
|
|
53
|
-
::copy src-tauri\png\!name!_32.ico src-tauri\icons\icon.ico
|
|
54
|
-
echo.
|
|
55
|
-
::update package info
|
|
56
|
-
set old_zh_name=!name_zh!
|
|
57
|
-
set old_name=!name!
|
|
58
|
-
set old_title=!title!
|
|
59
|
-
set old_url=!url!
|
|
60
|
-
::build package
|
|
61
|
-
echo building package !index!/!total!
|
|
62
|
-
echo package name is !name! !name_zh!
|
|
63
|
-
echo npm run build:windows
|
|
64
|
-
@echo off
|
|
65
|
-
call npm run tauri build -- --target x86_64-pc-windows-msvc
|
|
66
|
-
move src-tauri\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi output\windows
|
|
67
|
-
|
|
68
|
-
@echo on
|
|
69
|
-
echo package build success!
|
|
70
|
-
echo.
|
|
71
|
-
echo.
|
|
72
|
-
|
|
73
|
-
set /A index=index+1
|
|
74
|
-
@echo off
|
|
75
|
-
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
:: for windows, we need replace package name to lower again
|
|
79
|
-
.\script\sd.exe "\"productName\": \"WeRead\"" "\"productName\": \"weread\"" src-tauri\tauri.conf.json
|
|
80
|
-
echo "output dir is output\windows"
|
package/script/build.sh
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
if [ ! -d "node_modules" ]; then
|
|
4
|
-
npm i
|
|
5
|
-
fi
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if [ ! -d "output" ]; then
|
|
9
|
-
mkdir output
|
|
10
|
-
fi
|
|
11
|
-
|
|
12
|
-
if [[ "$OSTYPE" =~ ^linux ]]; then
|
|
13
|
-
if [ ! -d "output/linux" ]; then
|
|
14
|
-
mkdir output/linux
|
|
15
|
-
fi
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
|
20
|
-
if [ ! -d "output/macos" ]; then
|
|
21
|
-
mkdir output/macos
|
|
22
|
-
fi
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
SHELL_FOLDER=$(cd "$(dirname "$0")" || exit 1; pwd)
|
|
26
|
-
# total app number, ignore first line
|
|
27
|
-
total=$(sed -n '$=' app.csv)
|
|
28
|
-
export total=$((total-1))
|
|
29
|
-
export index=1
|
|
30
|
-
|
|
31
|
-
old_name="weread"
|
|
32
|
-
old_title="WeRead"
|
|
33
|
-
old_zh_name="微信阅读"
|
|
34
|
-
old_url="https://weread.qq.com/"
|
|
35
|
-
package_prefix="com-tw93"
|
|
36
|
-
|
|
37
|
-
if [[ "$OSTYPE" =~ ^linux ]]; then
|
|
38
|
-
echo "==============="
|
|
39
|
-
echo "Build for Linux"
|
|
40
|
-
echo "==============="
|
|
41
|
-
export sd=${SHELL_FOLDER}/sd-linux-x64
|
|
42
|
-
chmod +x "$sd"
|
|
43
|
-
# for linux, package name may be com.xxx.xxx
|
|
44
|
-
echo "rename package name"
|
|
45
|
-
export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop"
|
|
46
|
-
# sed -i "s/\"productName\": \"weread\"/\"productName\": \"${package_prefix}-weread\"/g" src-tauri/tauri.conf.json
|
|
47
|
-
$sd "\"productName\": \"weread\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json
|
|
48
|
-
fi
|
|
49
|
-
|
|
50
|
-
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
|
51
|
-
echo "==============="
|
|
52
|
-
echo "Build for MacOS"
|
|
53
|
-
echo "==============="
|
|
54
|
-
|
|
55
|
-
export sd=${SHELL_FOLDER}/sd-apple-x64
|
|
56
|
-
chmod +x "$sd"
|
|
57
|
-
echo "rename package name"
|
|
58
|
-
$sd "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
tail -n +2 app.csv | while IFS=, read -r -a arr;
|
|
62
|
-
do
|
|
63
|
-
package_name=${arr[0]}
|
|
64
|
-
package_title=${arr[1]}
|
|
65
|
-
package_zh_name=${arr[2]}
|
|
66
|
-
url=${arr[3]}
|
|
67
|
-
echo "update package name and url"
|
|
68
|
-
# replace package info
|
|
69
|
-
$sd "${old_url}" "${url}" src-tauri/tauri.conf.json
|
|
70
|
-
$sd "${old_name}" "${package_name}" src-tauri/tauri.conf.json
|
|
71
|
-
echo "update ico with 32x32 pictue"
|
|
72
|
-
$sd "${old_name}" "${package_name}" src-tauri/src/main.rs
|
|
73
|
-
|
|
74
|
-
# for apple, need replace title
|
|
75
|
-
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
|
76
|
-
$sd "${old_title}" "${package_title}" src-tauri/tauri.conf.json
|
|
77
|
-
fi
|
|
78
|
-
|
|
79
|
-
# echo "update ico with 32x32 pictue"
|
|
80
|
-
# cp "src-tauri/png/${package_name}_32.ico" "src-tauri/icons/icon.ico"
|
|
81
|
-
|
|
82
|
-
if [[ "$OSTYPE" =~ ^linux ]]; then
|
|
83
|
-
echo "update desktop"
|
|
84
|
-
old_desktop="src-tauri/assets/${package_prefix}-${old_name}.desktop"
|
|
85
|
-
new_desktop="src-tauri/assets/${package_prefix}-${package_name}.desktop"
|
|
86
|
-
mv "${old_desktop}" "${new_desktop}"
|
|
87
|
-
$sd "${old_zh_name}" "${package_zh_name}" "${new_desktop}"
|
|
88
|
-
$sd "${old_name}" "${package_name}" "${new_desktop}"
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
|
-
# update package info
|
|
92
|
-
old_name=${package_name}
|
|
93
|
-
old_title=${package_title}
|
|
94
|
-
old_zh_name=${package_zh_name}
|
|
95
|
-
old_url=${url}
|
|
96
|
-
|
|
97
|
-
echo "building package ${index}/${total}"
|
|
98
|
-
echo "package name is ${package_name} (${package_zh_name})"
|
|
99
|
-
npm run tauri build
|
|
100
|
-
echo "package build success!"
|
|
101
|
-
index=$((index+1))
|
|
102
|
-
|
|
103
|
-
if [[ "$OSTYPE" =~ ^linux ]]; then
|
|
104
|
-
mv src-tauri/target/release/bundle/deb/*.deb output/linux
|
|
105
|
-
fi
|
|
106
|
-
|
|
107
|
-
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
|
108
|
-
mv src-tauri/target/release/bundle/dmg/*.dmg output/macos
|
|
109
|
-
echo ""
|
|
110
|
-
fi
|
|
111
|
-
done
|
|
112
|
-
|
|
113
|
-
echo "build all package success!"
|
|
114
|
-
if [[ "$OSTYPE" =~ ^linux ]]; then
|
|
115
|
-
echo "result file in output/linux"
|
|
116
|
-
fi
|
|
117
|
-
|
|
118
|
-
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
|
119
|
-
# replace again
|
|
120
|
-
$sd "\"productName\": \"WeRead\"" "\"productName\": \"weread\"" src-tauri/tauri.conf.json
|
|
121
|
-
echo "result file in output/macos"
|
|
122
|
-
fi
|
package/script/sd-apple-x64
DELETED
|
Binary file
|
package/script/sd-linux-x64
DELETED
|
Binary file
|
package/script/sd.exe
DELETED
|
Binary file
|
package/tsconfig.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "Node16",
|
|
4
|
-
"esModuleInterop": true,
|
|
5
|
-
"allowSyntheticDefaultImports": true,
|
|
6
|
-
"target": "es6",
|
|
7
|
-
"noImplicitAny": true,
|
|
8
|
-
"moduleResolution": "Node16",
|
|
9
|
-
"sourceMap": true,
|
|
10
|
-
"outDir": "dist",
|
|
11
|
-
"baseUrl": ".",
|
|
12
|
-
"paths": {
|
|
13
|
-
"@/*": ["bin/*"]
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"include": ["bin/**/*"]
|
|
17
|
-
}
|