-
-
Notifications
You must be signed in to change notification settings - Fork 197
feat: interactive app creation #3969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lib/commands/create-project.ts
Outdated
} | ||
|
||
private getNgFlavors() { | ||
const templates: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const templates = [
{
key: CreateProjectCommand.HelloWorldTemplateKey,
value: "tns-template-hello-world-ng",
description: CreateProjectCommand.HelloWorldTemplateDescription
},
{
key: CreateProjectCommand.DrawerTemplateKey,
value: "tns-template-drawer-navigation-ng",
description: CreateProjectCommand.DrawerTemplateDescription
},
{
key: CreateProjectCommand.TabsTemplateKey,
value: "tns-template-tab-navigation-ng",
description: CreateProjectCommand.TabsTemplateDescription
}
];
return templates;
b2e3a57
to
807f1cc
Compare
807f1cc
to
b470c6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Add more tests for each of the combination of choices in the prompters.
- New
--
options should be described in the help oftns create
command - New behavior should be described in the help of
tns create
command. I suggest to place there the names of the templates that we are using for each option.
lib/services/project-service.ts
Outdated
@exported("projectService") | ||
public async createProject(projectOptions: IProjectSettings): Promise<ICreateProjectData> { | ||
let projectName = projectOptions.projectName; | ||
projectName = await this.validateProjectName({ projectName, force: projectOptions.force, pathToProject: projectOptions.pathToProject }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const projectName = await this.validateProjectName({ projectName: projectOptions.projectName, force: projectOptions.force, pathToProject: projectOptions.pathToProject });
lib/commands/create-project.ts
Outdated
|
||
export class CreateProjectCommand implements ICommand { | ||
public enableHooks = false; | ||
public allowedParameters: ICommandParameter[] = [this.$stringParameterBuilder.createMandatoryParameter("Project name cannot be empty.")]; | ||
public allowedParameters: ICommandParameter[] = [this.$stringParameter]; | ||
private static NgFlavor = "Angular"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move some of these in constants and reuse them here, in the tests and here
lib/commands/create-project.ts
Outdated
private getTsTemplates() { | ||
const templates = [{ | ||
key: CreateProjectCommand.HelloWorldTemplateKey, | ||
value: "tns-template-hello-world-ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RESERVED_TEMPLATE_NAMES.typescript
lib/commands/create-project.ts
Outdated
private getJsTemplates() { | ||
const templates = [{ | ||
key: CreateProjectCommand.HelloWorldTemplateKey, | ||
value: "tns-template-hello-world", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RESERVED_TEMPLATE_NAMES.javascript
lib/commands/create-project.ts
Outdated
private getNgFlavors() { | ||
const templates = [{ | ||
key: CreateProjectCommand.HelloWorldTemplateKey, | ||
value: "tns-template-hello-world-ng", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RESERVED_TEMPLATE_NAMES.angular
lib/services/project-service.ts
Outdated
|
||
const selectedPath = path.resolve(projectOptions.pathToProject || "."); | ||
private getValidProjectDir(pathToProject: string, projectName: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private methods should be below public ones
d654e44
to
1cb0323
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Please describe the behavior and new options in the related issue.
PR Checklist
Related to #3829
BREAKING CHANGES:
tns create
without any framework or template flags (--ng, --tsc or --template) will now ask a few questions for selecting the proper template.