Skip to content

Commit fe637e3

Browse files
committed
init
0 parents  commit fe637e3

16 files changed

+247
-0
lines changed

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
node_modules
2+
3+
# Output
4+
.output
5+
.vercel
6+
/.svelte-kit
7+
/build
8+
/dist
9+
10+
# OS
11+
.DS_Store
12+
Thumbs.db
13+
14+
# Env
15+
.env
16+
.env.*
17+
!.env.example
18+
!.env.test
19+
20+
# Vite
21+
vite.config.js.timestamp-*
22+
vite.config.ts.timestamp-*

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Package Managers
2+
package-lock.json
3+
pnpm-lock.yaml
4+
yarn.lock

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"useTabs": true,
3+
"singleQuote": true,
4+
"trailingComma": "none",
5+
"printWidth": 100,
6+
"plugins": ["prettier-plugin-svelte"],
7+
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
8+
}

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# create-svelte
2+
3+
Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
4+
5+
Read more about creating a library [in the docs](https://kit.svelte.dev/docs/packaging).
6+
7+
## Creating a project
8+
9+
If you're seeing this, you've probably already done this step. Congrats!
10+
11+
```bash
12+
# create a new project in the current directory
13+
npm create svelte@latest
14+
15+
# create a new project in my-app
16+
npm create svelte@latest my-app
17+
```
18+
19+
## Developing
20+
21+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
22+
23+
```bash
24+
npm run dev
25+
26+
# or start the server and open the app in a new browser tab
27+
npm run dev -- --open
28+
```
29+
30+
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
31+
32+
## Building
33+
34+
To build your library:
35+
36+
```bash
37+
npm run package
38+
```
39+
40+
To create a production version of your showcase app:
41+
42+
```bash
43+
npm run build
44+
```
45+
46+
You can preview the production build with `npm run preview`.
47+
48+
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
49+
50+
## Publishing
51+
52+
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
53+
54+
To publish your library to [npm](https://www.npmjs.com):
55+
56+
```bash
57+
npm publish
58+
```

bun.lockb

93.5 KB
Binary file not shown.

eslint.config.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import eslint from '@eslint/js';
2+
import prettier from 'eslint-config-prettier';
3+
import svelte from 'eslint-plugin-svelte';
4+
import globals from 'globals';
5+
import tseslint from 'typescript-eslint';
6+
7+
export default tseslint.config(
8+
eslint.configs.recommended,
9+
...tseslint.configs.recommended,
10+
...svelte.configs['flat/recommended'],
11+
prettier,
12+
...svelte.configs['flat/prettier'],
13+
{
14+
languageOptions: {
15+
globals: {
16+
...globals.browser,
17+
...globals.node
18+
}
19+
}
20+
},
21+
{
22+
files: ['**/*.svelte'],
23+
languageOptions: {
24+
parserOptions: {
25+
parser: tseslint.parser
26+
}
27+
}
28+
},
29+
{
30+
ignores: ['build/', '.svelte-kit/', 'dist/']
31+
}
32+
);

package.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "svelte-knobs",
3+
"version": "0.0.1",
4+
"scripts": {
5+
"dev": "vite dev",
6+
"build": "vite build && npm run package",
7+
"preview": "vite preview",
8+
"package": "svelte-kit sync && svelte-package && publint",
9+
"prepublishOnly": "npm run package",
10+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
11+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
12+
"lint": "prettier --check . && eslint .",
13+
"format": "prettier --write ."
14+
},
15+
"exports": {
16+
".": {
17+
"types": "./dist/index.d.ts",
18+
"svelte": "./dist/index.js"
19+
}
20+
},
21+
"sideEffects": [
22+
"**/*.css"
23+
],
24+
"files": [
25+
"dist",
26+
"!dist/**/*.test.*",
27+
"!dist/**/*.spec.*"
28+
],
29+
"peerDependencies": {
30+
"svelte": "^4.0.0"
31+
},
32+
"devDependencies": {
33+
"@sveltejs/adapter-auto": "^3.0.0",
34+
"@sveltejs/kit": "^2.0.0",
35+
"@sveltejs/package": "^2.0.0",
36+
"@sveltejs/vite-plugin-svelte": "^3.0.0",
37+
"@types/eslint": "^9.6.0",
38+
"eslint": "^9.0.0",
39+
"eslint-config-prettier": "^9.1.0",
40+
"eslint-plugin-svelte": "^2.36.0",
41+
"globals": "^15.0.0",
42+
"prettier": "^3.1.1",
43+
"prettier-plugin-svelte": "^3.1.2",
44+
"publint": "^0.2.0",
45+
"svelte": "^4.2.7",
46+
"svelte-check": "^4.0.0",
47+
"typescript": "^5.0.0",
48+
"typescript-eslint": "^8.0.0",
49+
"vite": "^5.0.11"
50+
},
51+
"svelte": "./dist/index.js",
52+
"types": "./dist/index.d.ts",
53+
"type": "module"
54+
}

src/app.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// See https://kit.svelte.dev/docs/types#app
2+
// for information about these interfaces
3+
declare global {
4+
namespace App {
5+
// interface Error {}
6+
// interface Locals {}
7+
// interface PageData {}
8+
// interface PageState {}
9+
// interface Platform {}
10+
}
11+
}
12+
13+
export {};

src/app.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
%sveltekit.head%
8+
</head>
9+
<body data-sveltekit-preload-data="hover">
10+
<div>%sveltekit.body%</div>
11+
</body>
12+
</html>

src/lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Reexport your entry components here

src/routes/+page.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>Welcome to your library project</h1>
2+
<p>Create your package using @sveltejs/package and preview/showcase your work with SvelteKit</p>
3+
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>

static/favicon.png

1.53 KB
Loading

svelte.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import adapter from '@sveltejs/adapter-auto';
2+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
3+
4+
/** @type {import('@sveltejs/kit').Config} */
5+
const config = {
6+
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
7+
// for more information about preprocessors
8+
preprocess: vitePreprocess(),
9+
10+
kit: {
11+
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
12+
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
13+
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
14+
adapter: adapter()
15+
}
16+
};
17+
18+
export default config;

tsconfig.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "./.svelte-kit/tsconfig.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"checkJs": true,
6+
"esModuleInterop": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"resolveJsonModule": true,
9+
"skipLibCheck": true,
10+
"sourceMap": true,
11+
"strict": true,
12+
"module": "NodeNext",
13+
"moduleResolution": "NodeNext"
14+
}
15+
}

vite.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { sveltekit } from '@sveltejs/kit/vite';
2+
import { defineConfig } from 'vite';
3+
4+
export default defineConfig({
5+
plugins: [sveltekit()]
6+
});

0 commit comments

Comments
 (0)