在create时增加了Example的框架(未完成)
This commit is contained in:
parent
6b01e3718b
commit
0ba50f58a1
|
|
@ -35,12 +35,19 @@ const prompt = [
|
|||
type: 'confirm',
|
||||
message: 'add oak-general-business into dependency?',
|
||||
default: true,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: 'moreDeps',
|
||||
type: 'input',
|
||||
message: 'do you have more dependent oak-family libraries? type their names, use comma as separator.',
|
||||
default: '',
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'example',
|
||||
type: 'confirm',
|
||||
message: 'load an initial example about personal blog? It will load correspond Entities/Pages/Components/Checkers and etc.',
|
||||
default: true,
|
||||
},
|
||||
];
|
||||
/**
|
||||
* 将项目的依赖关系加入
|
||||
|
|
@ -152,7 +159,7 @@ async function create(dirName, cmd) {
|
|||
prompt.unshift(nameOption, titleOption);
|
||||
const isDev = cmd.dev ? true : false;
|
||||
const isModule = cmd.module ? true : false;
|
||||
const { name, version, title, description, useOgb, moreDeps } = await inquirer_1.default.prompt(prompt);
|
||||
const { name, version, title, description, useOgb, moreDeps, example } = await inquirer_1.default.prompt(prompt);
|
||||
// 获取tsconfig.json内容
|
||||
const tsconfigJson = (0, template_1.tsConfigJsonContent)();
|
||||
const tsConfigBuildJson = (0, template_1.tsConfigBuildJsonContent)();
|
||||
|
|
@ -244,6 +251,9 @@ async function create(dirName, cmd) {
|
|||
// 创建package.json
|
||||
(0, file_handle_1.checkFileExistsAndCreate)(packageJsonPath, packageJson, enum_1.checkFileExistsAndCreateType.FILE);
|
||||
(0, rename_1.renameProject)(rootPath, name, title, DEFAULT_PROJECT_NAME, DEFAULT_PROJECT_TITLE);
|
||||
if (example) {
|
||||
// todo: copy template example files
|
||||
}
|
||||
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`Ok, type 'npm install' to install libs, then start!`)}`);
|
||||
}
|
||||
catch (err) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ export interface PromptInput {
|
|||
description: string;
|
||||
title: string;
|
||||
useOgb: boolean;
|
||||
example: boolean;
|
||||
moreDeps: string;
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -66,12 +66,19 @@ const prompt = [
|
|||
type: 'confirm',
|
||||
message: 'add oak-general-business into dependency?',
|
||||
default: true,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: 'moreDeps',
|
||||
type: 'input',
|
||||
message: 'do you have more dependent oak-family libraries? type their names, use comma as separator.',
|
||||
default: '',
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'example',
|
||||
type: 'confirm',
|
||||
message: 'load an initial example about personal blog? It will load correspond Entities/Pages/Components/Checkers and etc.',
|
||||
default: true,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -236,7 +243,7 @@ export async function create(dirName: string, cmd: any) {
|
|||
const isDev = cmd.dev ? true : false;
|
||||
const isModule = cmd.module ? true : false;
|
||||
|
||||
const { name, version, title, description, useOgb, moreDeps }: PromptInput = await inquirer.prompt(
|
||||
const { name, version, title, description, useOgb, moreDeps, example }: PromptInput = await inquirer.prompt(
|
||||
prompt
|
||||
);
|
||||
|
||||
|
|
@ -380,6 +387,11 @@ export async function create(dirName: string, cmd: any) {
|
|||
);
|
||||
|
||||
renameProject(rootPath, name, title, DEFAULT_PROJECT_NAME, DEFAULT_PROJECT_TITLE);
|
||||
|
||||
if (example) {
|
||||
// todo: copy template example files
|
||||
|
||||
}
|
||||
Success(
|
||||
`${success(
|
||||
`Ok, type 'npm install' to install libs, then start!`
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ export interface PromptInput {
|
|||
description: string,
|
||||
title: string,
|
||||
useOgb: boolean;
|
||||
example: boolean;
|
||||
moreDeps: string;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue