From f04be203f05ef5d323f646b38057e4d6c773e00d Mon Sep 17 00:00:00 2001 From: Shawn Taylor Date: Tue, 27 Jun 2023 16:04:21 -0400 Subject: [PATCH] Add Angular TS option --- _templates/playground/new/angular.md.ejs.t | 4 ++-- .../new/angular_example_component_ts.md.ejs.t | 15 +++++++++++++++ _templates/playground/new/prompt.js | 7 +++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 _templates/playground/new/angular_example_component_ts.md.ejs.t diff --git a/_templates/playground/new/angular.md.ejs.t b/_templates/playground/new/angular.md.ejs.t index bb0a5ffb2a2..ab2bc1a81d7 100644 --- a/_templates/playground/new/angular.md.ejs.t +++ b/_templates/playground/new/angular.md.ejs.t @@ -1,6 +1,6 @@ --- -# this file's location depends on whether or not the css option is selected via the prompt -to: "<%= `static/usage/v${version}/${name.replace('ion-', '')}/${path}/${css ? 'angular/example_component_html.md' : 'angular.md'}` %>" +# this file's location depends on whether or not the css option or angular_ts option is selected via the prompt +to: "<%= `static/usage/v${version}/${name.replace('ion-', '')}/${path}/${(css || angular_ts) ? 'angular/example_component_html.md' : 'angular.md'}` %>" --- ```html <<%= name %>>> diff --git a/_templates/playground/new/angular_example_component_ts.md.ejs.t b/_templates/playground/new/angular_example_component_ts.md.ejs.t new file mode 100644 index 00000000000..4fba3916f7a --- /dev/null +++ b/_templates/playground/new/angular_example_component_ts.md.ejs.t @@ -0,0 +1,15 @@ +--- +# this file only gets generated if `angular_ts` (from the command line prompt) is true +to: "<%= angular_ts ? `static/usage/v${version}/${name.replace('ion-', '')}/${path}/angular/example_component_ts.md` : null %>" +--- +```ts +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-example', + templateUrl: 'example.component.html',<% if (css){ %> + styleUrls: ['./example.component.css'],<% } %> +}) +export class ExampleComponent { +} +``` diff --git a/_templates/playground/new/prompt.js b/_templates/playground/new/prompt.js index 9fd81647c07..ab0927ee414 100644 --- a/_templates/playground/new/prompt.js +++ b/_templates/playground/new/prompt.js @@ -30,4 +30,11 @@ module.exports = [ enabled: 'Yes', disabled: 'No', }, + { + type: 'toggle', + name: 'angular_ts', + message: 'Generate an Angular TypeScript file?', + enabled: 'Yes', + disabled: 'No', + }, ];