Comparing version 1.0.0 to 1.0.1
@@ -11,8 +11,8 @@ "use strict"; | ||
const prompts_1 = __importDefault(require("prompts")); | ||
function createConfig(options) { | ||
return prompts_1.default([{ | ||
async function createConfig(options) { | ||
let succeed = true; | ||
const data = await prompts_1.default([{ | ||
name: 'type', | ||
type: 'autocomplete', | ||
type: 'select', | ||
message: 'Connection Type', | ||
initial: 'http', | ||
choices: [ | ||
@@ -49,3 +49,6 @@ { title: 'HTTP', value: 'http' }, | ||
message: 'Token for CoolQ Server', | ||
}]); | ||
}], { | ||
onCancel: () => succeed = false, | ||
}); | ||
return succeed && data; | ||
} | ||
@@ -58,6 +61,10 @@ function default_1(cli) { | ||
if (!options.forced && fs_1.existsSync(path)) { | ||
utils_1.logger.error(`${options.output} already exists. If you want to overwrite the current file, use ${kleur_1.yellow('koishi init -f')}.`); | ||
utils_1.logger.error(`${options.output} already exists. If you want to overwrite the current file, use ${kleur_1.yellow('koishi init -f')}`); | ||
process.exit(1); | ||
} | ||
const config = await createConfig(options); | ||
if (!config) { | ||
utils_1.logger.error('initialization was canceled'); | ||
process.exit(0); | ||
} | ||
const output = ['module.exports = {']; | ||
@@ -79,3 +86,3 @@ output.push(` type: "${config.type}",`); | ||
fs_1.writeFileSync(path, output.join('\n')); | ||
utils_1.logger.success(`created config file: ${path}.`); | ||
utils_1.logger.success(`created config file: ${path}`); | ||
process.exit(0); | ||
@@ -82,0 +89,0 @@ }); |
{ | ||
"name": "koishi", | ||
"description": "A QQ bot framework based on CQHTTP", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "dist/index.js", | ||
@@ -41,7 +41,7 @@ "typings": "dist/index.d.ts", | ||
"kleur": "^3.0.3", | ||
"koishi-core": "^1.0.0", | ||
"koishi-plugin-common": "^1.0.0", | ||
"koishi-utils": "^1.0.0-alpha.4", | ||
"koishi-core": "^1.0.1", | ||
"koishi-plugin-common": "^1.0.1", | ||
"koishi-utils": "^1.0.0", | ||
"prompts": "^2.3.0" | ||
} | ||
} |
17396
316
Updatedkoishi-core@^1.0.1
Updatedkoishi-plugin-common@^1.0.1
Updatedkoishi-utils@^1.0.0