Skip to content

Commit e1d1f88

Browse files
authored
fix(fragments/angular): run angular.json through the template enginge (#531)
* fix(fragments/angular): run `angular.json` through the template enginge closes #530 * fmt and fix app.component * fix angular tauri.conf.json * fix out of bounds access
1 parent 1388ade commit e1d1f88

6 files changed

Lines changed: 24 additions & 3 deletions

File tree

.changes/angular-config-file.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"create-tauri-app": "patch"
3+
"create-tauri-app-js": "patch"
4+
---
5+
6+
Fix `angluar` template generated with a malformed `angluar.json`
7+

.scripts/generate-templates-matrix.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const nodeJsTemplates = [
1414
"vanilla-ts",
1515
"preact",
1616
"preact-ts",
17+
"angular",
1718
];
1819

1920
const matrixConfig = [

packages/cli/fragments/fragment-angular/angular.json renamed to packages/cli/fragments/fragment-angular/angular.json.lts

File renamed without changes.

packages/cli/fragments/fragment-angular/src/app/%app.component.ts renamed to packages/cli/fragments/fragment-angular/src/app/app.component.ts.lts

File renamed without changes.

packages/cli/src/lte.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ impl<'a> Parser<'a> {
253253
while self.current_token() == Token::OBracket || self.current_token() == Token::CBracket
254254
{
255255
self.cursor += 1;
256+
257+
if self.cursor >= self.len {
258+
break;
259+
}
256260
}
257261
}
258262
}

packages/cli/src/template.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ impl<'a> Template {
237237

238238
let manifest_template_data: HashMap<&str, &str> = [
239239
("pkg_manager_run_command", pkg_manager.run_cmd()),
240+
("lib_name", &lib_name),
241+
("project_name", project_name),
242+
("package_name", package_name),
240243
(
241244
"double_dash_with_space",
242245
if pkg_manager == PackageManager::Npm {
@@ -252,7 +255,6 @@ impl<'a> Template {
252255
("stable", (!alpha).to_string()),
253256
("alpha", alpha.to_string()),
254257
("mobile", mobile.to_string()),
255-
("lib_name", lib_name),
256258
("project_name", project_name.to_string()),
257259
("package_name", package_name.to_string()),
258260
(
@@ -271,16 +273,23 @@ impl<'a> Template {
271273
),
272274
(
273275
"dev_path",
274-
manifest.dev_path.unwrap_or_default().to_string(),
276+
crate::lte::render(
277+
manifest.dev_path.unwrap_or_default(),
278+
&manifest_template_data,
279+
)?,
275280
),
276281
(
277282
"dist_dir",
278-
manifest.dist_dir.unwrap_or_default().to_string(),
283+
crate::lte::render(
284+
manifest.dist_dir.unwrap_or_default(),
285+
&manifest_template_data,
286+
)?,
279287
),
280288
(
281289
"with_global_tauri",
282290
manifest.with_global_tauri.unwrap_or_default().to_string(),
283291
),
292+
("lib_name", lib_name),
284293
]
285294
.into();
286295

0 commit comments

Comments
 (0)