feat(create-turbo): apply official-starter transform

This commit is contained in:
Turbobot
2025-10-06 16:18:41 +02:00
committed by Andras Bacsai
parent 84da487a0c
commit 5d8a02f127
56 changed files with 3465 additions and 0 deletions

32
turbo-svelte/.gitignore vendored Normal file
View File

@@ -0,0 +1,32 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
node_modules
.pnp
.pnp.js
# testing
coverage
# svelte
.svelte-kit
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# turbo
.turbo
dist

1
turbo-svelte/.npmrc Normal file
View File

@@ -0,0 +1 @@
auto-install-peers = true

View File

@@ -0,0 +1,15 @@
.DS_Store
.svelte-kit
node_modules
/build
/package
.env
.env.*
!.env.example
vite.config.js*
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
pnpm-workspace.yaml
package-lock.json
yarn.lock

5
turbo-svelte/.prettierrc Normal file
View File

@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100
}

32
turbo-svelte/README.md Normal file
View File

@@ -0,0 +1,32 @@
# Turborepo Svelte starter
This Turborepo starter is maintained by the Turborepo core team.
## Using this example
Run the following command:
```sh
npx create-turbo@latest -e with-svelte
```
## What's inside?
This Turborepo includes the following packages/apps:
### Apps and Packages
- `docs`: a [svelte-kit](https://kit.svelte.dev/) app
- `web`: another [svelte-kit](https://kit.svelte.dev/) app
- `ui`: a stub Svelte component library shared by both `web` and `docs` applications
- `eslint-config-custom`: `eslint` configurations (includes `eslint-plugin-svelte` and `eslint-config-prettier`)
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
### Utilities
This Turborepo has some additional tools already setup for you:
- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
- [Prettier](https://prettier.io) for code formatting

10
turbo-svelte/apps/docs/.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

View File

@@ -0,0 +1 @@
engine-strict=true

View File

@@ -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-*

View File

@@ -0,0 +1,8 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

View File

@@ -0,0 +1,38 @@
# create-svelte
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/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.

View File

@@ -0,0 +1,8 @@
import { config } from '@repo/eslint-config/index.js';
export default [
...config,
{
ignores: ['.svelte-kit/*']
}
];

View File

@@ -0,0 +1,37 @@
{
"name": "docs",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "svelte-kit sync && vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check-types": "tsc --noEmit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint .",
"test:integration": "playwright test",
"test:unit": "vitest"
},
"dependencies": {
"@repo/ui": "workspace:*"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@sveltejs/adapter-auto": "^4.0.0",
"@sveltejs/kit": "^2.36.1",
"@sveltejs/vite-plugin-svelte": "^5.1.0",
"prettier": "^3.6.0",
"eslint": "^9.34.0",
"prettier-plugin-svelte": "^3.4.0",
"svelte": "^5.38.0",
"svelte-check": "^4.3.0",
"tslib": "^2.8.1",
"typescript": "5.9.2",
"vite": "^6.3.2",
"vitest": "^3.2.0"
}
}

View File

@@ -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;

12
turbo-svelte/apps/docs/src/app.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}
export {};

View File

@@ -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>

View File

@@ -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);
});
});

View File

@@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.

View File

@@ -0,0 +1,7 @@
<script lang="ts">
import { MyCounterButton } from '@repo/ui';
</script>
<h1>Docs</h1>
<MyCounterButton />
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,17 @@
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;

View File

@@ -0,0 +1,3 @@
{
"extends": ["@repo/typescript-config/svelte.json", "./.svelte-kit/tsconfig.json"]
}

View File

@@ -0,0 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
});

10
turbo-svelte/apps/web/.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

View File

@@ -0,0 +1 @@
engine-strict=true

View File

@@ -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-*

View File

@@ -0,0 +1,8 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

View File

@@ -0,0 +1,38 @@
# create-svelte
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/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.

View File

@@ -0,0 +1,8 @@
import { config } from '@repo/eslint-config/index.js';
export default [
...config,
{
ignores: ['.svelte-kit/*']
}
];

View File

@@ -0,0 +1,37 @@
{
"name": "web",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "svelte-kit sync && vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check-types": "tsc --noEmit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint .",
"test:integration": "playwright test",
"test:unit": "vitest"
},
"dependencies": {
"@repo/ui": "workspace:*"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@sveltejs/adapter-auto": "^4.0.0",
"@sveltejs/kit": "^2.36.1",
"@sveltejs/vite-plugin-svelte": "^5.1.0",
"prettier": "^3.6.0",
"eslint": "^9.34.0",
"prettier-plugin-svelte": "^3.4.0",
"svelte": "^5.38.0",
"svelte-check": "^4.3.0",
"tslib": "^2.8.1",
"typescript": "5.9.2",
"vite": "^6.3.2",
"vitest": "^3.2.0"
}
}

View File

@@ -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;

12
turbo-svelte/apps/web/src/app.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}
export {};

View File

@@ -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>

View File

@@ -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);
});
});

View File

@@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.

View File

@@ -0,0 +1,7 @@
<script lang="ts">
import { MyCounterButton } from '@repo/ui';
</script>
<h1>Web</h1>
<MyCounterButton />
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,17 @@
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;

View File

@@ -0,0 +1,3 @@
{
"extends": ["@repo/typescript-config/svelte.json", "./.svelte-kit/tsconfig.json"]
}

View File

@@ -0,0 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
});

20
turbo-svelte/package.json Normal file
View File

@@ -0,0 +1,20 @@
{
"name": "with-svelte",
"private": true,
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
"lint": "turbo run lint",
"format": "prettier --write .",
"check-types": "turbo run check-types"
},
"devDependencies": {
"prettier": "^3.6.0",
"prettier-plugin-svelte": "^3.4.0",
"turbo": "^2.5.8"
},
"packageManager": "pnpm@10.0.0",
"engines": {
"node": ">=18"
}
}

View File

@@ -0,0 +1,27 @@
import js from '@eslint/js';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import ts from 'typescript-eslint';
export const config = ts.config(
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['**/*.svelte'],
ignores: ['.svelte-kit/*'],
languageOptions: {
parserOptions: {
parser: ts.parser
}
}
}
);

View File

@@ -0,0 +1,17 @@
{
"name": "@repo/eslint-config",
"version": "0.0.0",
"type": "module",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.34.0",
"eslint-config-prettier": "^10.1.1",
"eslint-config-turbo": "^2.5.0",
"eslint-plugin-svelte": "^2.46.1",
"globals": "^15.15.0",
"typescript-eslint": "^8.40.0"
}
}

View File

@@ -0,0 +1,10 @@
{
"name": "@repo/typescript-config",
"version": "0.0.0",
"private": true,
"type": "module",
"license": "MIT",
"publishConfig": {
"access": "public"
}
}

View File

@@ -0,0 +1,18 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "NodeNext",
"module": "NodeNext",
"target": "ESNext",
"verbatimModuleSyntax": true,
"isolatedModules": true,
"lib": ["esnext", "DOM", "DOM.Iterable"]
}
}

View File

@@ -0,0 +1,8 @@
import { config } from '@repo/eslint-config/index.js';
export default [
...config,
{
ignores: ['.svelte-kit/**', 'dist/**']
}
];

View File

@@ -0,0 +1 @@
export { default as MyCounterButton } from './components/MyCounterButton.svelte';

View File

@@ -0,0 +1,43 @@
{
"name": "@repo/ui",
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "svelte-kit sync && svelte-package --watch --input=src",
"build": "svelte-kit sync && svelte-package --input=src",
"lint": "eslint .",
"check-types": "svelte-check --tsconfig ./tsconfig.json"
},
"files": [
"dist",
"!dist/**/*.test.*",
"!dist/**/*.spec.*",
"src",
"!src/**/*.test.*",
"!src/**/*.spec.*"
],
"sideEffects": [
"**/*.css"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"svelte": "./dist/index.js"
}
},
"peerDependencies": {
"svelte": "^5.0.0"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@sveltejs/kit": "^2.36.1",
"@sveltejs/package": "^2.5.0",
"@sveltejs/vite-plugin-svelte": "^5.1.0",
"eslint": "^9.34.0",
"svelte": "^5.38.0",
"svelte-check": "^4.3.0",
"typescript": "5.9.2",
"vite": "^6.3.2"
}
}

View File

@@ -0,0 +1,11 @@
<script lang="ts">
let count = $state(0);
function handleClick() {
count += 1;
}
</script>
<button onclick={handleClick}>
clicks: {count}
</button>

View File

@@ -0,0 +1,2 @@
export { Counter } from './my-counter-class.svelte';
export { default as MyCounterButton } from './MyCounterButton.svelte';

View File

@@ -0,0 +1,11 @@
export class Counter {
count = $state(0);
increment = () => {
this.count++;
};
decrement = () => {
this.count--;
};
}

View File

@@ -0,0 +1,10 @@
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()
};
export default config;

View File

@@ -0,0 +1,10 @@
{
"extends": ["@repo/typescript-config/svelte.json", "./.svelte-kit/tsconfig.json"],
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"allowArbitraryExtensions": true
},
"include": ["dist", "./src/**/*.svelte", "./src/**/*.ts"],
"exclude": ["node_modules", ".svelte-kit"]
}

View File

@@ -0,0 +1,8 @@
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
export default defineConfig({
plugins: [
svelte()
]
});

2774
turbo-svelte/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
packages:
- "apps/*"
- "packages/*"

21
turbo-svelte/turbo.json Normal file
View File

@@ -0,0 +1,21 @@
{
"$schema": "https://turborepo.com/schema.json",
"ui": "tui",
"tasks": {
"build": {
"dependsOn": ["^build"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": [".svelte-kit/**", ".vercel/**"]
},
"lint": {
"dependsOn": ["^lint"]
},
"check-types": {
"dependsOn": ["^check-types"]
},
"dev": {
"cache": false,
"persistent": true
}
}
}