Skip to content

Commit

Permalink
chore(examples/with-svelte): regenerate apps with sveltekit (#6214)
Browse files Browse the repository at this point in the history
This commit generated new svelte apps and integrates the eslint
and ui packages into them. The "web" app includes typescript
and Playwrite, and Vite, but the docs app only includes linting
and prettier.
  • Loading branch information
mehulkar authored Oct 19, 2023
1 parent 7592fb9 commit 761052f
Show file tree
Hide file tree
Showing 36 changed files with 1,483 additions and 685 deletions.
3 changes: 1 addition & 2 deletions examples/with-svelte/apps/docs/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
root: true,
extends: ['custom']
extends: ['custom']
};
2 changes: 2 additions & 0 deletions examples/with-svelte/apps/docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ node_modules
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions examples/with-svelte/apps/docs/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
14 changes: 14 additions & 0 deletions examples/with-svelte/apps/docs/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
vite.config.*.timestamp-*
9 changes: 9 additions & 0 deletions examples/with-svelte/apps/docs/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
4 changes: 2 additions & 2 deletions examples/with-svelte/apps/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ If you're seeing this, you've probably already done this step. Congrats!

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

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

## Developing
Expand Down
51 changes: 24 additions & 27 deletions examples/with-svelte/apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
{
"name": "docs",
"version": "0.0.0",
"scripts": {
"dev": "vite dev --port 3001 --open",
"build": "vite build",
"package": "vite package",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check --ignore-path=../../.prettierignore . && eslint \"src\"",
"format": "prettier --write --ignore-path=../../.prettierignore ."
},
"dependencies": {
"ui": "workspace:*"
},
"devDependencies": {
"@sveltejs/adapter-auto": "latest",
"@sveltejs/kit": "latest",
"eslint-config-custom": "workspace:*",
"svelte": "^3.44.0",
"svelte-check": "^2.7.1",
"svelte-preprocess": "^4.10.6",
"tslib": "^2.3.1",
"typescript": "^4.7.2",
"vite": "^4.0.0"
},
"type": "module"
"name": "docs",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"dependencies": {
"ui": "workspace:*"
},
"devDependencies": {
"eslint-config-custom": "workspace:*",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"eslint": "^8.28.0",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^4.0.5",
"vite": "^4.4.2"
},
"type": "module"
}
11 changes: 0 additions & 11 deletions examples/with-svelte/apps/docs/src/app.d.ts

This file was deleted.

18 changes: 9 additions & 9 deletions examples/with-svelte/apps/docs/src/app.html
Original file line number Diff line number Diff line change
@@ -1,12 +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>
<div>%sveltekit.body%</div>
</body>
<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 examples/with-svelte/apps/docs/src/lib/index.js
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.
3 changes: 1 addition & 2 deletions examples/with-svelte/apps/docs/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script lang="ts">
import { MyCounterButton } from 'ui';
import { MyCounterButton } from 'ui';
</script>

<h1>Docs</h1>
<MyCounterButton />

<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
14 changes: 6 additions & 8 deletions examples/with-svelte/apps/docs/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import adapter from '@sveltejs/adapter-auto';
import preprocess from 'svelte-preprocess';

/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: preprocess(),

kit: {
adapter: adapter()
}
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;
13 changes: 0 additions & 13 deletions examples/with-svelte/apps/docs/tsconfig.json

This file was deleted.

10 changes: 4 additions & 6 deletions examples/with-svelte/apps/docs/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()]
};

export default config;
export default defineConfig({
plugins: [sveltekit()]
});
2 changes: 1 addition & 1 deletion examples/with-svelte/apps/web/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['custom']
extends: ['custom']
};
2 changes: 2 additions & 0 deletions examples/with-svelte/apps/web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ node_modules
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions examples/with-svelte/apps/web/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
14 changes: 14 additions & 0 deletions examples/with-svelte/apps/web/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
vite.config.*.timestamp-*
9 changes: 9 additions & 0 deletions examples/with-svelte/apps/web/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
4 changes: 2 additions & 2 deletions examples/with-svelte/apps/web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ If you're seeing this, you've probably already done this step. Congrats!

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

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

## Developing
Expand Down
63 changes: 36 additions & 27 deletions examples/with-svelte/apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
{
"name": "web",
"version": "0.0.0",
"scripts": {
"dev": "vite dev --port 3000 --open",
"build": "vite build",
"package": "vite package",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check --ignore-path=../../.prettierignore . && eslint \"src\"",
"format": "prettier --write --ignore-path=../../.prettierignore ."
},
"dependencies": {
"ui": "workspace:*"
},
"devDependencies": {
"@sveltejs/adapter-auto": "latest",
"@sveltejs/kit": "latest",
"eslint-config-custom": "workspace:*",
"svelte": "^3.44.0",
"svelte-check": "^2.7.1",
"svelte-preprocess": "^4.10.6",
"tslib": "^2.3.1",
"typescript": "^4.7.2",
"vite": "^4.0.0"
},
"type": "module"
"name": "web",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"test:integration": "playwright test",
"test:unit": "vitest"
},
"dependencies": {
"ui": "workspace:*"
},
"devDependencies": {
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.28.0",
"eslint-config-custom": "workspace:*",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^4.0.5",
"svelte-check": "^3.4.3",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.4.2",
"vitest": "^0.32.2"
},
"type": "module"
}
12 changes: 12 additions & 0 deletions examples/with-svelte/apps/web/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run build && npm run preview',
port: 4173
},
testDir: 'tests',
testMatch: /(.+\.)?(test|spec)\.[jt]s/
};

export default config;
17 changes: 9 additions & 8 deletions examples/with-svelte/apps/web/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/// <reference types="@sveltejs/kit" />

// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Locals {}
// interface Platform {}
// interface Session {}
// interface Stuff {}
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}

export {};
18 changes: 9 additions & 9 deletions examples/with-svelte/apps/web/src/app.html
Original file line number Diff line number Diff line change
@@ -1,12 +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>
<div>%sveltekit.body%</div>
</body>
<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>
7 changes: 7 additions & 0 deletions examples/with-svelte/apps/web/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest';

describe('sum test', () => {
it('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
});
1 change: 1 addition & 0 deletions examples/with-svelte/apps/web/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.
3 changes: 1 addition & 2 deletions examples/with-svelte/apps/web/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script lang="ts">
import { MyCounterButton } from 'ui';
import { MyCounterButton } from 'ui';
</script>

<h1>Web</h1>
<MyCounterButton />

<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
Loading

1 comment on commit 761052f

@vercel
Copy link

@vercel vercel bot commented on 761052f Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

examples-svelte-web – ./examples/with-svelte/apps/web

examples-svelte-web.vercel.sh
turborepo-examples-svelte-web.vercel.sh
examples-svelte-web-git-main.vercel.sh

Please sign in to comment.