Merge branch 'main' into dev
This commit is contained in:
25
README.md
25
README.md
@@ -329,6 +329,13 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
||||
<sub><b>Yi Xin</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/g1eny0ung">
|
||||
<img src="https://avatars.githubusercontent.com/u/15034155?v=4" width="90;" alt="g1eny0ung"/>
|
||||
<br />
|
||||
<sub><b>Yue Yang</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/lkieryan">
|
||||
<img src="https://avatars.githubusercontent.com/u/187804088?v=4" width="90;" alt="lkieryan"/>
|
||||
@@ -349,15 +356,15 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
||||
<br />
|
||||
<sub><b>2nthony</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/ACGNnsj">
|
||||
<img src="https://avatars.githubusercontent.com/u/22112141?v=4" width="90;" alt="ACGNnsj"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/imabutahersiddik">
|
||||
<img src="https://avatars.githubusercontent.com/u/138387257?v=4" width="90;" alt="imabutahersiddik"/>
|
||||
@@ -399,15 +406,15 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
||||
<br />
|
||||
<sub><b>Imgbot</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/droid-Q">
|
||||
<img src="https://avatars.githubusercontent.com/u/708277?v=4" width="90;" alt="droid-Q"/>
|
||||
<br />
|
||||
<sub><b>Jiaqi Gu</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Milo123459">
|
||||
<img src="https://avatars.githubusercontent.com/u/50248166?v=4" width="90;" alt="Milo123459"/>
|
||||
@@ -449,15 +456,15 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
||||
<br />
|
||||
<sub><b>Hyzhao</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/lakca">
|
||||
<img src="https://avatars.githubusercontent.com/u/16255922?v=4" width="90;" alt="lakca"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/liudonghua123">
|
||||
<img src="https://avatars.githubusercontent.com/u/2276718?v=4" width="90;" alt="liudonghua123"/>
|
||||
|
||||
11
bin/cli.ts
vendored
11
bin/cli.ts
vendored
@@ -22,7 +22,16 @@ program.addHelpText('beforeAll', logo).usage(`[url] [options]`).showHelpAfterErr
|
||||
|
||||
program
|
||||
.argument('[url]', 'The web URL you want to package', validateUrlInput)
|
||||
.option('--name <string>', 'Application name')
|
||||
// Refer to https://github.com/tj/commander.js#custom-option-processing, turn string array into a string connected with custom connectors.
|
||||
// If the platform is Linux, use `-` as the connector, and convert all characters to lowercase.
|
||||
// For example, Google Translate will become google-translate.
|
||||
.option('--name <string...>', 'Application name', (value, previous) => {
|
||||
const platform = process.platform
|
||||
const connector = platform === 'linux' ? '-' : ' '
|
||||
const name = previous === undefined ? value : `${previous}${connector}${value}`
|
||||
|
||||
return platform === 'linux' ? name.toLowerCase() : name
|
||||
})
|
||||
.option('--icon <string>', 'Application icon', DEFAULT.icon)
|
||||
.option('--width <number>', 'Window width', validateNumberInput, DEFAULT.width)
|
||||
.option('--height <number>', 'Window height', validateNumberInput, DEFAULT.height)
|
||||
|
||||
8
bin/options/index.ts
vendored
8
bin/options/index.ts
vendored
@@ -13,8 +13,8 @@ function resolveAppName(name: string, platform: NodeJS.Platform): string {
|
||||
|
||||
function isValidName(name: string, platform: NodeJS.Platform): boolean {
|
||||
const platformRegexMapping: PlatformMap = {
|
||||
linux: /^[a-z0-9]+(-[a-z0-9]+)*$/,
|
||||
default: /^[a-zA-Z0-9]+([-a-zA-Z0-9])*$/,
|
||||
linux: /^[a-z0-9][a-z0-9-]*$/,
|
||||
default: /^[a-zA-Z0-9][a-zA-Z0-9- ]*$/,
|
||||
};
|
||||
const reg = platformRegexMapping[platform] || platformRegexMapping.default;
|
||||
return !!name && reg.test(name);
|
||||
@@ -34,8 +34,8 @@ export default async function handleOptions(options: PakeCliOptions, url: string
|
||||
}
|
||||
|
||||
if (!isValidName(name, platform)) {
|
||||
const LINUX_NAME_ERROR = `✕ name should only include lowercase letters, numbers, and dashes, and must contain at least one lowercase letter. Examples: com-123-xxx, 123pan, pan123, weread, we-read.`;
|
||||
const DEFAULT_NAME_ERROR = `✕ Name should only include letters and numbers, and dashes (dashes must not at the beginning), and must contain at least one letter. Examples: 123pan, 123Pan, Pan123, weread, WeRead, WERead, we-read.`;
|
||||
const LINUX_NAME_ERROR = `✕ Name should only include lowercase letters, numbers, and dashes (not leading dashes), and must contain at least one lowercase letter or number. Examples: com-123-xxx, 123pan, pan123, weread, we-read.`;
|
||||
const DEFAULT_NAME_ERROR = `✕ Name should only include letters, numbers, dashes, and spaces (not leading dashes and spaces), and must contain at least one letter or number. Examples: 123pan, 123Pan, Pan123, weread, WeRead, WERead, we-read, We Read.`;
|
||||
const errorMsg = platform === 'linux' ? LINUX_NAME_ERROR : DEFAULT_NAME_ERROR;
|
||||
logger.error(errorMsg);
|
||||
if (isActions) {
|
||||
|
||||
18
dist/cli.js
vendored
18
dist/cli.js
vendored
@@ -909,8 +909,8 @@ function resolveAppName(name, platform) {
|
||||
}
|
||||
function isValidName(name, platform) {
|
||||
const platformRegexMapping = {
|
||||
linux: /^[a-z0-9]+(-[a-z0-9]+)*$/,
|
||||
default: /^[a-zA-Z0-9]+([-a-zA-Z0-9])*$/,
|
||||
linux: /^[a-z0-9][a-z0-9-]*$/,
|
||||
default: /^[a-zA-Z0-9][a-zA-Z0-9- ]*$/,
|
||||
};
|
||||
const reg = platformRegexMapping[platform] || platformRegexMapping.default;
|
||||
return !!name && reg.test(name);
|
||||
@@ -927,8 +927,8 @@ async function handleOptions(options, url) {
|
||||
name = namePrompt || defaultName;
|
||||
}
|
||||
if (!isValidName(name, platform)) {
|
||||
const LINUX_NAME_ERROR = `✕ name should only include lowercase letters, numbers, and dashes, and must contain at least one lowercase letter. Examples: com-123-xxx, 123pan, pan123, weread, we-read.`;
|
||||
const DEFAULT_NAME_ERROR = `✕ Name should only include letters and numbers, and dashes (dashes must not at the beginning), and must contain at least one letter. Examples: 123pan, 123Pan, Pan123, weread, WeRead, WERead, we-read.`;
|
||||
const LINUX_NAME_ERROR = `✕ Name should only include lowercase letters, numbers, and dashes (not leading dashes), and must contain at least one lowercase letter or number. Examples: com-123-xxx, 123pan, pan123, weread, we-read.`;
|
||||
const DEFAULT_NAME_ERROR = `✕ Name should only include letters, numbers, dashes, and spaces (not leading dashes and spaces), and must contain at least one letter or number. Examples: 123pan, 123Pan, Pan123, weread, WeRead, WERead, we-read, We Read.`;
|
||||
const errorMsg = platform === 'linux' ? LINUX_NAME_ERROR : DEFAULT_NAME_ERROR;
|
||||
logger.error(errorMsg);
|
||||
if (isActions) {
|
||||
@@ -978,7 +978,15 @@ ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app with
|
||||
program.addHelpText('beforeAll', logo).usage(`[url] [options]`).showHelpAfterError();
|
||||
program
|
||||
.argument('[url]', 'The web URL you want to package', validateUrlInput)
|
||||
.option('--name <string>', 'Application name')
|
||||
// Refer to https://github.com/tj/commander.js#custom-option-processing, turn string array into a string connected with custom connectors.
|
||||
// If the platform is Linux, use `-` as the connector, and convert all characters to lowercase.
|
||||
// For example, Google Translate will become google-translate.
|
||||
.option('--name <string...>', 'Application name', (value, previous) => {
|
||||
const platform = process.platform;
|
||||
const connector = platform === 'linux' ? '-' : ' ';
|
||||
const name = previous === undefined ? value : `${previous}${connector}${value}`;
|
||||
return platform === 'linux' ? name.toLowerCase() : name;
|
||||
})
|
||||
.option('--icon <string>', 'Application icon', DEFAULT_PAKE_OPTIONS.icon)
|
||||
.option('--width <number>', 'Window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
|
||||
.option('--height <number>', 'Window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
|
||||
|
||||
Reference in New Issue
Block a user