Skip to content

Commit 459228f

Browse files
authored
Add Angular template (#167)
* Add Angular template * changes * other changes * run pnpm format * cargo fmt * change file
1 parent a61619e commit 459228f

20 files changed

Lines changed: 405 additions & 1 deletion

.changes/angular.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"create-tauri-app": patch
3+
"create-tauri-app-js": patch
4+
---
5+
6+
Add `angluar` tempalte

.scripts/generate-templates-matrix.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const changedFiles = process.argv.slice(2);
22

33
const nodeJsTemplates = [
4+
"angular",
45
"svelte",
56
"svelte-ts",
67
"vue",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"tauri-apps.tauri-vscode",
4+
"rust-lang.rust-analyzer",
5+
"angular.ng-template"
6+
]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Tauri + Angular
2+
3+
This template should help get you started developing with Tauri and Angular.
4+
5+
## Recommended IDE Setup
6+
7+
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) + [Angular Language Service](https://marketplace.visualstudio.com/items?itemName=Angular.ng-template)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
2+
# SPDX-License-Identifier: Apache-2.0
3+
# SPDX-License-Identifier: MIT
4+
5+
beforeDevCommand = {{pkg_manager_run_command}} dev
6+
beforeBuildCommand = {{pkg_manager_run_command}} build
7+
devPath = http://localhost:1420
8+
distDir = ../dist
9+
10+
[files]
11+
tauri.svg = src/assets/tauri.svg
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
.angular
15+
16+
# Editor directories and files
17+
.vscode/*
18+
!.vscode/extensions.json
19+
.idea
20+
.DS_Store
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"cli": {
6+
"analytics": false
7+
},
8+
"projects": {
9+
"{{package_name}}": {
10+
"projectType": "application",
11+
"root": "",
12+
"sourceRoot": "src",
13+
"prefix": "app",
14+
"architect": {
15+
"build": {
16+
"builder": "@angular-devkit/build-angular:browser",
17+
"options": {
18+
"outputPath": "dist/",
19+
"index": "src/index.html",
20+
"main": "src/main.ts",
21+
"polyfills": "src/polyfills.ts",
22+
"tsConfig": "tsconfig.app.json",
23+
"inlineStyleLanguage": "scss",
24+
"assets": ["src/favicon.ico", "src/assets"],
25+
"styles": ["src/style.css"],
26+
"scripts": []
27+
},
28+
"configurations": {
29+
"production": {
30+
"budgets": [
31+
{
32+
"type": "initial",
33+
"maximumWarning": "500kb",
34+
"maximumError": "1mb"
35+
},
36+
{
37+
"type": "anyComponentStyle",
38+
"maximumWarning": "2kb",
39+
"maximumError": "4kb"
40+
}
41+
],
42+
"fileReplacements": [
43+
{
44+
"replace": "src/environments/environment.ts",
45+
"with": "src/environments/environment.prod.ts"
46+
}
47+
],
48+
"outputHashing": "all"
49+
},
50+
"development": {
51+
"buildOptimizer": false,
52+
"optimization": false,
53+
"vendorChunk": true,
54+
"extractLicenses": false,
55+
"sourceMap": true,
56+
"namedChunks": true
57+
}
58+
},
59+
"defaultConfiguration": "production"
60+
},
61+
"serve": {
62+
"builder": "@angular-devkit/build-angular:dev-server",
63+
"configurations": {
64+
"production": {
65+
"browserTarget": "{{package_name}}:build:production"
66+
},
67+
"development": {
68+
"browserTarget": "{{package_name}}:build:development"
69+
}
70+
},
71+
"defaultConfiguration": "development"
72+
},
73+
"extract-i18n": {
74+
"builder": "@angular-devkit/build-angular:extract-i18n",
75+
"options": {
76+
"browserTarget": "{{package_name}}:build"
77+
}
78+
}
79+
}
80+
}
81+
}
82+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "{{package_name}}",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"tauri": "tauri",
8+
"ng": "ng",
9+
"dev": "ng serve --port 1420",
10+
"build": "ng build",
11+
"watch": "ng build --watch --configuration development"
12+
},
13+
"dependencies": {
14+
"@tauri-apps/api": "^1.0.2",
15+
"@angular/animations": "^14.2.0",
16+
"@angular/common": "^14.2.0",
17+
"@angular/compiler": "^14.2.0",
18+
"@angular/core": "^14.2.0",
19+
"@angular/forms": "^14.2.0",
20+
"@angular/platform-browser": "^14.2.0",
21+
"@angular/platform-browser-dynamic": "^14.2.0",
22+
"@angular/router": "^14.2.0",
23+
"rxjs": "~7.5.0",
24+
"tslib": "^2.3.0",
25+
"zone.js": "~0.11.4"
26+
},
27+
"devDependencies": {
28+
"@tauri-apps/cli": "^1.0.5",
29+
"@angular-devkit/build-angular": "^14.2.2",
30+
"@angular/cli": "~14.2.2",
31+
"@angular/compiler-cli": "^14.2.0",
32+
"typescript": "~4.7.2"
33+
}
34+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { Component } from "@angular/core";
2+
import { invoke } from "@tauri-apps/api/tauri";
3+
4+
@Component({
5+
selector: "app-root",
6+
template: `
7+
<div class="container">
8+
<h1>Welcome to Tauri + Angular!</h1>
9+
10+
<div class="row">
11+
<a href="https://tauri.app" target="_blank">
12+
<img src="/assets/tauri.svg" class="logo tauri" alt="Tauri logo" />
13+
</a>
14+
<a href="https://angular.io" target="_blank">
15+
<img
16+
src="/assets/angular.svg"
17+
class="logo angular"
18+
alt="Angular logo"
19+
/>
20+
</a>
21+
</div>
22+
23+
<p>Click on the logos to learn more about the frameworks</p>
24+
25+
<div class="row">
26+
<div>
27+
<input #greetInput id="greet-input" placeholder="Enter a name..." />
28+
<button type="button" (click)="greet(greetInput.value)">Greet</button>
29+
</div>
30+
</div>
31+
32+
<p>{{ greetingMessage }}</p>
33+
</div>
34+
`,
35+
styles: [
36+
`
37+
.logo.angular:hover {
38+
filter: drop-shadow(0 0 2em #e32727);
39+
}
40+
`,
41+
],
42+
standalone: true,
43+
})
44+
export class AppComponent {
45+
greetingMessage = "";
46+
47+
greet(name: string): void {
48+
invoke<string>("greet", { name }).then((text) => {
49+
this.greetingMessage = text;
50+
});
51+
}
52+
}

0 commit comments

Comments
 (0)