Skip to content

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

Merged
merged 4 commits into from
Oct 8, 2018
Merged

Conversation

DimitarTachev
Copy link
Contributor

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.

}

private getNgFlavors() {
const templates: {
Copy link
Contributor

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;

@DimitarTachev DimitarTachev force-pushed the tachev/interactive-create branch 2 times, most recently from b2e3a57 to 807f1cc Compare October 3, 2018 11:43
@DimitarTachev DimitarTachev force-pushed the tachev/interactive-create branch from 807f1cc to b470c6c Compare October 3, 2018 11:51
Copy link
Contributor

@rosen-vladimirov rosen-vladimirov left a 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 of tns 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.

@exported("projectService")
public async createProject(projectOptions: IProjectSettings): Promise<ICreateProjectData> {
let projectName = projectOptions.projectName;
projectName = await this.validateProjectName({ projectName, force: projectOptions.force, pathToProject: projectOptions.pathToProject });
Copy link
Contributor

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 });


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";
Copy link
Contributor

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

private getTsTemplates() {
const templates = [{
key: CreateProjectCommand.HelloWorldTemplateKey,
value: "tns-template-hello-world-ts",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RESERVED_TEMPLATE_NAMES.typescript

private getJsTemplates() {
const templates = [{
key: CreateProjectCommand.HelloWorldTemplateKey,
value: "tns-template-hello-world",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RESERVED_TEMPLATE_NAMES.javascript

private getNgFlavors() {
const templates = [{
key: CreateProjectCommand.HelloWorldTemplateKey,
value: "tns-template-hello-world-ng",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RESERVED_TEMPLATE_NAMES.angular


const selectedPath = path.resolve(projectOptions.pathToProject || ".");
private getValidProjectDir(pathToProject: string, projectName: string): string {
Copy link
Contributor

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

@DimitarTachev DimitarTachev force-pushed the tachev/interactive-create branch from d654e44 to 1cb0323 Compare October 4, 2018 08:24
Copy link
Contributor

@rosen-vladimirov rosen-vladimirov left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants