Skip to content

Commit

Permalink
feat(svelte-app): add svelte example
Browse files Browse the repository at this point in the history
  • Loading branch information
oktaysenkan committed Oct 5, 2024
1 parent 60ddf67 commit 8b516db
Show file tree
Hide file tree
Showing 13 changed files with 198 additions and 1 deletion.
21 changes: 21 additions & 0 deletions apps/svelte-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules

# Output
.output
.vercel
/.svelte-kit
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions apps/svelte-app/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
38 changes: 38 additions & 0 deletions apps/svelte-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# create-svelte

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npm create svelte@latest

# create a new project in my-app
npm create svelte@latest my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
26 changes: 26 additions & 0 deletions apps/svelte-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@oktaytest/svelte-app",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^4.2.7",
"svelte-check": "^4.0.0",
"typescript": "^5.0.0",
"vite": "^5.0.3"
},
"dependencies": {
"@oktaytest/vite": "*",
"@oktaytest/svelte": "*"
},
"type": "module"
}
13 changes: 13 additions & 0 deletions apps/svelte-app/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}

export {};
12 changes: 12 additions & 0 deletions apps/svelte-app/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
1 change: 1 addition & 0 deletions apps/svelte-app/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.
27 changes: 27 additions & 0 deletions apps/svelte-app/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script>
import { Iconify } from "@oktaytest/svelte";
</script>

<main>
<Iconify name="mdi:home" size={24} />
<Iconify name="logos:active-campaign" />
<Iconify name="logos:apache-superset-icon" />
<Iconify name="invalid:icon" color="red" />
</main>

<style>
:global(html),
:global(body) {
margin: 0;
padding: 0;
}
main {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #242424;
color: rgba(255, 255, 255, 0.87);
}
</style>
Binary file added apps/svelte-app/static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions apps/svelte-app/svelte.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),

kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
}
};

export default config;
19 changes: 19 additions & 0 deletions apps/svelte-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
21 changes: 21 additions & 0 deletions apps/svelte-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import { IconifyPlugin } from "@oktaytest/vite";

export default defineConfig({
plugins: [
sveltekit(),
IconifyPlugin({
icons: [
"mdi:home",
"mdi:account",
"mdi:account-badge-outline",
"feather:activity",
"feather:alert-circle",
"logos:active-campaign",
"logos:apache-superset-icon",
],
outputFileName: "svelte-app",
}),
],
});
2 changes: 1 addition & 1 deletion packages/svelte/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineConfig({
"logos:active-campaign",
"logos:apache-superset-icon",
],
outputFileName: "vite-vue",
outputFileName: "svelte-library",
})
]
});

0 comments on commit 8b516db

Please sign in to comment.