init
This commit is contained in:
commit
4466f001a7
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
__temp/
|
||||
node_modules/
|
||||
dist/
|
||||
build/
|
||||
yarn-error.log
|
16
.prettierrc
Normal file
16
.prettierrc
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 4,
|
||||
"singleQuote": false,
|
||||
"trailingComma": "es5",
|
||||
"semi": false,
|
||||
"newline-before-return": true,
|
||||
"no-duplicate-variable": [true, "check-parameters"],
|
||||
"no-var-keyword": true,
|
||||
|
||||
"svelteSortOrder": "markup-styles-scripts",
|
||||
"svelteStrictMode": true,
|
||||
"svelteBracketNewLine": true,
|
||||
"svelteAllowShorthand": true,
|
||||
"svelteIndentScriptAndStyle": true
|
||||
}
|
11
.vscode/settings.json
vendored
Normal file
11
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"eslint.alwaysShowStatus": true,
|
||||
"tslint.autoFixOnSave": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnPaste": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"liveServer.settings.root": "/build"
|
||||
}
|
20
README.md
Normal file
20
README.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Svelte Skeleton with Typescript support and Snowpack bundler
|
||||
|
||||
## prepare
|
||||
|
||||
`yarn install`
|
||||
|
||||
## dev server
|
||||
|
||||
`yarn start`
|
||||
|
||||
## build and bundle
|
||||
|
||||
`yarn bundle`
|
||||
|
||||
## start developing
|
||||
|
||||
- in `src/` your .ts files
|
||||
- in `types/`your type definitions
|
||||
- in `src/components/` your Svelte components
|
||||
- in `public/` your index.html and static assets (relative to / on webserver)
|
35
package.json
Normal file
35
package.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "skel-svelte-snowpack",
|
||||
"version": "1.0.0",
|
||||
"main": "src/index.js",
|
||||
"author": "Sebastian Frank",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"validate": "svelte-check && tsc --noEmit",
|
||||
"start": "snowpack dev",
|
||||
"build": "snowpack build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@snowpack/plugin-dotenv": "^2.0.4",
|
||||
"@snowpack/plugin-svelte": "^3.3.0",
|
||||
"@snowpack/plugin-typescript": "^1.1.0",
|
||||
"@snowpack/plugin-webpack": "^2.1.1",
|
||||
"@snowpack/web-test-runner-plugin": "^0.1.4",
|
||||
"@tsconfig/svelte": "^1.0.10",
|
||||
"@types/snowpack-env": "^2.3.2",
|
||||
"less": "^3.12.2",
|
||||
"prettier": "^2.1.2",
|
||||
"prettier-plugin-svelte": "^1.4.1",
|
||||
"rollup": "^2.33.1",
|
||||
"snowpack": "^2.17.1",
|
||||
"svelte": "^3.29.7",
|
||||
"svelte-check": "^1.1.11",
|
||||
"svelte-hmr": "^0.11.6",
|
||||
"svelte-preprocess": "^4.0.8",
|
||||
"tslib": "^2.0.3",
|
||||
"typescript": "^4.0.0",
|
||||
"webpack-bundle-analyzer": "^4.1.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"browserslist": ">0.5%, ie 11, not dead"
|
||||
}
|
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
24
public/index.html
Normal file
24
public/index.html
Normal file
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="Web site created using create-snowpack-app" />
|
||||
<title>Snowpack App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<script type="module" src="/_dist_/index.js"></script>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
4
public/logo.svg
Normal file
4
public/logo.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98.1 118">
|
||||
<path fill="#ff3e00" d="M91.8 15.6C80.9-.1 59.2-4.7 43.6 5.2L16.1 22.8A31.25 31.25 0 001.9 43.9c-1.3 7.3-.2 14.8 3.3 21.3-2.4 3.6-4 7.6-4.7 11.8-1.6 8.9.5 18.1 5.7 25.4 11 15.7 32.6 20.3 48.2 10.4l27.5-17.5c7.5-4.7 12.7-12.4 14.2-21.1 1.3-7.3.2-14.8-3.3-21.3 2.4-3.6 4-7.6 4.7-11.8 1.7-9-.4-18.2-5.7-25.5"/>
|
||||
<path fill="#fff" d="M40.9 103.9a21.8 21.8 0 01-23.4-8.7c-3.2-4.4-4.4-9.9-3.5-15.3l.6-2.6.5-1.6 1.4 1c3.3 2.4 6.9 4.2 10.8 5.4l1 .3-.1 1c-.1 1.4.3 2.9 1.1 4.1a6.62 6.62 0 008.8 2L65.5 72c1.4-.9 2.3-2.2 2.6-3.8.3-1.6-.1-3.3-1-4.6a6.56 6.56 0 00-8.8-1.9l-10.5 6.7a18.6 18.6 0 01-5.6 2.4 21.8 21.8 0 01-23.4-8.7 20.2 20.2 0 01-3.4-15.3c.9-5.2 4.1-9.9 8.6-12.7l27.5-17.5c1.7-1.1 3.6-1.9 5.6-2.5a21.8 21.8 0 0123.4 8.7c3.2 4.4 4.4 9.9 3.5 15.3-.2.9-.4 1.7-.7 2.6l-.5 1.6-1.4-1c-3.3-2.4-6.9-4.2-10.8-5.4l-1-.3.1-1c.1-1.4-.3-2.9-1.1-4.1a6.56 6.56 0 00-8.8-1.9L32.4 46.1c-1.4.9-2.3 2.2-2.6 3.8s.1 3.3 1 4.6a6.56 6.56 0 008.8 1.9l10.5-6.7c1.7-1.1 3.6-1.9 5.6-2.5a21.8 21.8 0 0123.4 8.7c3.2 4.4 4.4 9.9 3.5 15.3-.9 5.2-4.1 9.9-8.6 12.7l-27.5 17.5c-1.7 1.1-3.6 1.9-5.6 2.5"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
3
public/robots.txt
Normal file
3
public/robots.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
49
snowpack.config.js
Normal file
49
snowpack.config.js
Normal file
@ -0,0 +1,49 @@
|
||||
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
|
||||
.BundleAnalyzerPlugin
|
||||
|
||||
/** @type {import("snowpack").SnowpackUserConfig } */
|
||||
module.exports = {
|
||||
mount: {
|
||||
public: "/",
|
||||
src: "/_dist_",
|
||||
},
|
||||
plugins: [
|
||||
"@snowpack/plugin-svelte",
|
||||
"@snowpack/plugin-dotenv",
|
||||
"@snowpack/plugin-typescript",
|
||||
[
|
||||
"@snowpack/plugin-webpack",
|
||||
{
|
||||
sourceMap: false,
|
||||
extendConfig: (config) => {
|
||||
config.plugins.push(
|
||||
new BundleAnalyzerPlugin({
|
||||
analyzerMode: "static",
|
||||
openAnalyzer: false,
|
||||
})
|
||||
)
|
||||
return config
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
install: [
|
||||
/* ... */
|
||||
],
|
||||
installOptions: {
|
||||
sourceMap: false,
|
||||
},
|
||||
devOptions: {
|
||||
/* ... */
|
||||
},
|
||||
buildOptions: {
|
||||
sourceMaps: false,
|
||||
clean: true,
|
||||
},
|
||||
proxy: {
|
||||
/* ... */
|
||||
},
|
||||
alias: {
|
||||
/* ... */
|
||||
},
|
||||
}
|
18
src/components/App.svelte
Normal file
18
src/components/App.svelte
Normal file
@ -0,0 +1,18 @@
|
||||
<svelte:head>
|
||||
<title>Svelte Skeleton</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1>Svelte Skeleton</h1>
|
||||
|
||||
{welcome}
|
||||
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
color: darkred;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="typescript">
|
||||
let welcome = "Hello World"
|
||||
</script>
|
20
src/index.ts
Normal file
20
src/index.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import App from "./components/App.svelte"
|
||||
|
||||
const app = new App({
|
||||
target: document.body,
|
||||
props: {},
|
||||
})
|
||||
|
||||
export default app
|
||||
|
||||
// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
|
||||
// Learn more: https://www.snowpack.dev/#hot-module-replacement
|
||||
// @ts-ignore
|
||||
if (import.meta?.hot) {
|
||||
// @ts-ignore
|
||||
import.meta.hot.accept()
|
||||
// @ts-ignore
|
||||
import.meta.hot.dispose(() => {
|
||||
app.$destroy()
|
||||
})
|
||||
}
|
8
svelte.config.js
Normal file
8
svelte.config.js
Normal file
@ -0,0 +1,8 @@
|
||||
const sveltePreprocess = require("svelte-preprocess")
|
||||
module.exports = {
|
||||
preprocess: sveltePreprocess({
|
||||
defaults: {
|
||||
script: "typescript",
|
||||
},
|
||||
}),
|
||||
}
|
26
tsconfig.json
Normal file
26
tsconfig.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||
|
||||
"include": ["src/**/*"],
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"typeRoots": ["./node_modules/@types", "./types"],
|
||||
|
||||
"target": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"jsx": "preserve",
|
||||
"baseUrl": "./",
|
||||
/* paths - If you configure Snowpack import aliases, add them here. */
|
||||
"paths": {},
|
||||
/* noEmit - Snowpack builds (emits) files, not tsc. */
|
||||
"noEmit": true,
|
||||
/* Additional Options */
|
||||
// "strict": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"useDefineForClassFields": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"importsNotUsedAsValues": "error"
|
||||
}
|
||||
}
|
0
types/.empty
Normal file
0
types/.empty
Normal file
Loading…
Reference in New Issue
Block a user