Skip to content

Commit 96bde2b

Browse files
halfnelsonrigor789
andauthored
feat(svelte): update template to use latest svelte, svelte-native and svelte-loader (#199)
* feat(svelte): Update template to use latest svelte-native and svelte-loader * chore: cleanup Co-authored-by: Igor Randjelovic <[email protected]>
1 parent 5055499 commit 96bde2b

File tree

11 files changed

+84
-64
lines changed

11 files changed

+84
-64
lines changed
Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
<page>
2-
<actionBar title="Svelte Native App" />
3-
<gridLayout>
4-
<label class="info" horizontalAlignment="center" verticalAlignment="middle" textWrap="true">
5-
<formattedString>
6-
<span class="fas" text="&#xf135;" />
7-
<span text=" {message}" />
8-
</formattedString>
9-
</label>
10-
</gridLayout>
11-
</page>
1+
<frame>
2+
<Home />
3+
</frame>
124

13-
<script lang="typescript">
14-
let message: string = "Blank Svelte Native App"
15-
</script>
16-
17-
<style>
18-
.info .fas {
19-
color: #3A53FF;
20-
}
21-
.info {
22-
font-size: 20;
23-
}
24-
</style>
5+
<script lang="ts">
6+
import Home from './components/Home.svelte'
7+
</script>

packages/template-blank-svelte/app/app.css

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,20 @@ The imported CSS rules must precede all other types of rules.
1212
*/
1313
@import '@nativescript/theme/css/core.css';
1414
@import '@nativescript/theme/css/default.css';
15-
@import './font-awesome.css';
15+
16+
/* Font icon class */
17+
.fab {
18+
font-family: 'Font Awesome 5 Brands', 'fa-brands-400';
19+
font-weight: 400;
20+
}
21+
22+
.fas {
23+
font-family: 'Font Awesome 5 Free', 'fa-solid-900';
24+
font-weight: 900;
25+
}
26+
27+
.far {
28+
font-family: 'Font Awesome 5 Free', 'fa-regular-400';
29+
font-weight: 400;
30+
}
31+
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*
22
In NativeScript, the app.ts file is the entry point to your application.
33
You can use this file to perform app-level initialization, but the primary
4-
purpose of the file is to pass control to the app’s first module.
4+
purpose of the file is to pass control to the app’s first page.
55
*/
66

7-
import { svelteNative } from 'svelte-native'
7+
import { svelteNativeNoFrame } from 'svelte-native'
88
import App from './App.svelte'
9-
svelteNative(App, {})
9+
10+
svelteNativeNoFrame(App, {})
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<page>
2+
<actionBar title="Home" />
3+
<gridLayout>
4+
<label class="info">
5+
<formattedString>
6+
<span class="fas" text="&#xf135;" />
7+
<span text=" {message}" />
8+
</formattedString>
9+
</label>
10+
</gridLayout>
11+
</page>
12+
13+
<script lang="ts">
14+
let message: string = "Blank Svelte Native App"
15+
</script>
16+
17+
<style>
18+
.info .fas {
19+
color: #3A53FF;
20+
}
21+
22+
.info {
23+
font-size: 20;
24+
horizontal-align: center;
25+
vertical-align: center;
26+
}
27+
</style>

packages/template-blank-svelte/app/font-awesome.css

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/template-blank-svelte/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"main": "app/app.ts",
44
"displayName": "Blank Svelte",
55
"templateType": "App template",
6-
"version": "8.1.0",
6+
"version": "8.1.1",
77
"description": "Blank template for NativeScript apps using Svelte",
88
"author": "NativeScript Team <[email protected]>",
99
"license": "Apache-2.0",
@@ -14,10 +14,10 @@
1414
"app",
1515
"App_Resources",
1616
"hooks",
17+
"types",
1718
"tools",
1819
"!tools/assets",
1920
".editorconfig",
20-
"references.d.ts",
2121
"svelte.config.js",
2222
"tsconfig.json"
2323
],
@@ -43,14 +43,14 @@
4343
"dependencies": {
4444
"@nativescript/core": "~8.1.1",
4545
"@nativescript/theme": "~3.0.1",
46-
"svelte-native": "~0.9.5"
46+
"svelte-native": "~1.0.0"
4747
},
4848
"devDependencies": {
4949
"@nativescript/types": "~8.1.1",
5050
"@nativescript/webpack": "~5.0.0",
51-
"svelte": "~3.35.0",
52-
"svelte-loader-hot": "~0.3.1",
53-
"svelte-native-preprocessor": "^0.2.0",
51+
"svelte": "~3.44.0",
52+
"svelte-loader": "^3.1.2",
53+
"svelte-native-preprocessor": "^1.0.0",
5454
"svelte-preprocess": "^4.7.0",
5555
"typescript": "~4.3.5"
5656
}

packages/template-blank-svelte/references.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
const sveltePreprocess = require('svelte-preprocess')
2+
const svelteNativePreprocessor = require('svelte-native-preprocessor')
23

34
module.exports = {
4-
preprocess: sveltePreprocess(),
5-
}
5+
compilerOptions: {
6+
namespace: "foreign"
7+
},
8+
preprocess: [ sveltePreprocess(), svelteNativePreprocessor() ]
9+
}
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
{
22
"compilerOptions": {
3-
"module": "esnext",
3+
"strict": true,
44
"target": "es2017",
5+
"module": "esnext",
56
"moduleResolution": "node",
6-
"allowSyntheticDefaultImports": true,
7-
"esModuleInterop": false,
8-
"experimentalDecorators": true,
9-
"emitDecoratorMetadata": true,
10-
"noEmitHelpers": true,
11-
"noEmitOnError": true,
12-
"skipLibCheck": true,
137
"lib": ["dom", "es2017"],
14-
"types": ["svelte"],
8+
"sourceMap": true,
9+
"noEmitHelpers": true,
10+
"importHelpers": true,
1511
"baseUrl": ".",
1612
"paths": {
1713
"~/*": ["app/*"],
1814
"@/*": ["app/*"]
19-
}
15+
},
16+
"typeRoots": ["types"],
17+
"types": ["node"],
18+
"allowSyntheticDefaultImports": true,
19+
"esModuleInterop": true,
20+
"experimentalDecorators": true,
21+
"emitDecoratorMetadata": true,
22+
"skipLibCheck": true
2023
},
21-
"include": ["app/**/*"],
22-
"files": ["./references.d.ts"],
24+
"include": ["app", "types"],
2325
"exclude": ["node_modules", "platforms"]
2426
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference path="../node_modules/@nativescript/types/index.d.ts" />

0 commit comments

Comments
 (0)