Skip to content

Commit f8949c0

Browse files
fix(playground): update template generator to support Angular standalone (#3983)
1 parent af0d981 commit f8949c0

6 files changed

+17
-34
lines changed

_templates/playground/new/angular.md.ejs.t

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
to: "<%= `static/usage/v${version}/${name}/${path}/angular/example_component_html.md` %>"
3+
---
4+
```html
5+
<<%= component %>></<%= component %>>
6+
```
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
---
2-
# this file only gets generated if `angular_ts` (from the command line prompt) is true
3-
to: "<%= angular_ts ? `static/usage/v${version}/${name}/${path}/angular/example_component_ts.md` : null %>"
2+
arbitrary: <% pascalComponent = h.changeCase.pascal(component) %>
3+
to: "<%= `static/usage/v${version}/${name}/${path}/angular/example_component_ts.md` %>"
44
---
55
```ts
66
import { Component } from '@angular/core';
7+
import { <%= pascalComponent %> } from '@ionic/angular/standalone';
78

89
@Component({
910
selector: 'app-example',
1011
templateUrl: 'example.component.html',
11-
<% if (css){ -%>
1212
styleUrls: ['./example.component.css'],
13-
<% } -%>
13+
imports: [<%= pascalComponent %>],
1414
})
15-
export class ExampleComponent {
16-
}
15+
export class ExampleComponent {}
1716
```

_templates/playground/new/index.js

-5
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ module.exports = {
6262
name: 'css',
6363
message: 'Generate custom CSS files?',
6464
},
65-
{
66-
type: 'toggle',
67-
name: 'angular_ts',
68-
message: 'Generate an Angular TypeScript file?',
69-
},
7065
])
7166
.then((answers) => {
7267
answers.name = answers.name || answers.component.replace('ion-', '');

_templates/playground/new/index.md.ejs.t

+3-14
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,12 @@ import react_main_css from './react/main_css.md';
1212
import react from './react.md';
1313
<% } -%>
1414
import vue from './vue.md';
15-
<% if (css || angular_ts){ %>
15+
1616
import angular_example_component_html from './angular/example_component_html.md';
17-
<% } else { -%>
18-
import angular from './angular.md';
19-
<% } -%>
20-
<% if (angular_ts){ -%>
21-
import angular_example_component_ts from './angular/example_component_ts.md';
22-
<% } -%>
2317
<% if (css){ -%>
2418
import angular_example_component_css from './angular/example_component_css.md';
2519
<% } -%>
20+
import angular_example_component_ts from './angular/example_component_ts.md';
2621

2722
<Playground
2823
version="<%= version %>"
@@ -39,21 +34,15 @@ import angular_example_component_css from './angular/example_component_css.md';
3934
react,
4035
<% } -%>
4136
vue,
42-
<% if (angular_ts || css){ -%>
4337
angular: {
4438
files: {
4539
'src/app/example.component.html': angular_example_component_html,
46-
<% if (angular_ts){ -%>
47-
'src/app/example.component.ts': angular_example_component_ts,
48-
<% } -%>
4940
<% if (css){ -%>
5041
'src/app/example.component.css': angular_example_component_css,
5142
<% } -%>
43+
'src/app/example.component.ts': angular_example_component_ts,
5244
},
5345
},
54-
<% } else { -%>
55-
angular,
56-
<% } -%>
5746
}}
5847
src="usage/v<%= version %>/<%= name %>/<%= path %>/demo.html"
5948
/>

_templates/playground/new/react.md.ejs.t

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import './main.css';<% } %>
1111

1212
function Example() {
1313
return (
14-
<<%= pascalComponent %>></<%= pascalComponent %>>
14+
<>
15+
<<%= pascalComponent %>></<%= pascalComponent %>>
16+
</>
1517
);
1618
}
1719
export default Example;
1820
```
19-

0 commit comments

Comments
 (0)