优化本地文件打包功能
This commit is contained in:
11
bin/options/index.ts
vendored
11
bin/options/index.ts
vendored
@@ -3,15 +3,22 @@ import { getDomain } from '@/utils/url.js';
|
||||
import { getIdentifier } from '../helpers/tauriConfig.js';
|
||||
import { PakeAppOptions, PakeCliOptions } from '../types.js';
|
||||
import { handleIcon } from './icon.js';
|
||||
import fs from 'fs/promises';
|
||||
|
||||
export default async function handleOptions(options: PakeCliOptions, url: string): Promise<PakeAppOptions> {
|
||||
const appOptions: PakeAppOptions = {
|
||||
...options,
|
||||
identifier: '',
|
||||
};
|
||||
|
||||
const url_exists = await fs.stat(url)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
if (!appOptions.name) {
|
||||
appOptions.name = await promptText('please input your application name', getDomain(url));
|
||||
if (!url_exists) {
|
||||
appOptions.name = await promptText('please input your application name', getDomain(url));
|
||||
} else {
|
||||
appOptions.name = await promptText('please input your application name', "");
|
||||
}
|
||||
}
|
||||
|
||||
appOptions.identifier = getIdentifier(appOptions.name, url);
|
||||
|
||||
Reference in New Issue
Block a user