Skip to content

Commit cc0ae19

Browse files
committed
Initial commit
1 parent a7ce1f3 commit cc0ae19

File tree

11 files changed

+301
-0
lines changed

11 files changed

+301
-0
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/docs/build/
2+
/dist/

.eslintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
parserOptions: {
3+
ecmaVersion: 2018,
4+
sourceType: 'module'
5+
},
6+
env: {
7+
es6: true,
8+
browser: true,
9+
node: true
10+
},
11+
extends: [
12+
'standard'
13+
],
14+
plugins: [
15+
'svelte3'
16+
],
17+
overrides: [
18+
{
19+
files: ['**/*.svelte'],
20+
processor: 'svelte3/svelte3',
21+
rules: {
22+
'import/first': 0,
23+
'import/no-duplicates': 0,
24+
'import/no-mutable-exports': 0,
25+
'no-multiple-empty-lines': 0
26+
}
27+
}
28+
]
29+
}

.gitignore

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/macos,node
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,node
3+
4+
/dist/
5+
/docs/build/
6+
7+
### macOS ###
8+
# General
9+
.DS_Store
10+
.AppleDouble
11+
.LSOverride
12+
13+
# Icon must end with two \r
14+
Icon
15+
16+
# Thumbnails
17+
._*
18+
19+
# Files that might appear in the root of a volume
20+
.DocumentRevisions-V100
21+
.fseventsd
22+
.Spotlight-V100
23+
.TemporaryItems
24+
.Trashes
25+
.VolumeIcon.icns
26+
.com.apple.timemachine.donotpresent
27+
28+
# Directories potentially created on remote AFP share
29+
.AppleDB
30+
.AppleDesktop
31+
Network Trash Folder
32+
Temporary Items
33+
.apdisk
34+
35+
### Node ###
36+
# Logs
37+
logs
38+
*.log
39+
npm-debug.log*
40+
yarn-debug.log*
41+
yarn-error.log*
42+
lerna-debug.log*
43+
44+
# Diagnostic reports (https://nodejs.org/api/report.html)
45+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
46+
47+
# Runtime data
48+
pids
49+
*.pid
50+
*.seed
51+
*.pid.lock
52+
53+
# Directory for instrumented libs generated by jscoverage/JSCover
54+
lib-cov
55+
56+
# Coverage directory used by tools like istanbul
57+
coverage
58+
*.lcov
59+
60+
# nyc test coverage
61+
.nyc_output
62+
63+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
64+
.grunt
65+
66+
# Bower dependency directory (https://bower.io/)
67+
bower_components
68+
69+
# node-waf configuration
70+
.lock-wscript
71+
72+
# Compiled binary addons (https://nodejs.org/api/addons.html)
73+
build/Release
74+
75+
# Dependency directories
76+
node_modules/
77+
jspm_packages/
78+
79+
# TypeScript v1 declaration files
80+
typings/
81+
82+
# TypeScript cache
83+
*.tsbuildinfo
84+
85+
# Optional npm cache directory
86+
.npm
87+
88+
# Optional eslint cache
89+
.eslintcache
90+
91+
# Microbundle cache
92+
.rpt2_cache/
93+
.rts2_cache_cjs/
94+
.rts2_cache_es/
95+
.rts2_cache_umd/
96+
97+
# Optional REPL history
98+
.node_repl_history
99+
100+
# Output of 'npm pack'
101+
*.tgz
102+
103+
# Yarn Integrity file
104+
.yarn-integrity
105+
106+
# dotenv environment variables file
107+
.env
108+
.env.test
109+
110+
# parcel-bundler cache (https://parceljs.org/)
111+
.cache
112+
113+
# Next.js build output
114+
.next
115+
116+
# Nuxt.js build / generate output
117+
.nuxt
118+
dist
119+
120+
# Gatsby files
121+
.cache/
122+
# Comment in the public line in if your project uses Gatsby and not Next.js
123+
# https://nextjs.org/blog/next-9-1#public-directory-support
124+
# public
125+
126+
# vuepress build output
127+
.vuepress/dist
128+
129+
# Serverless directories
130+
.serverless/
131+
132+
# FuseBox cache
133+
.fusebox/
134+
135+
# DynamoDB Local files
136+
.dynamodb/
137+
138+
# TernJS port file
139+
.tern-port
140+
141+
# Stores VSCode versions used for testing VSCode extensions
142+
.vscode-test
143+
144+
# End of https://www.toptal.com/developers/gitignore/api/macos,node

docs/App.svelte

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script>
2+
import Component from '../src/Component.svelte'
3+
</script>
4+
5+
<Component />

docs/favicon.ico

33.7 KB
Binary file not shown.

docs/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
6+
7+
<title>Svelte Component</title>
8+
9+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/normalize.css@8">
10+
<link rel="stylesheet" href="build/bundle.css">
11+
<script defer src="build/bundle.js"></script>
12+
</head>
13+
14+
<body>
15+
</body>
16+
</html>

docs/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import App from './App.svelte'
2+
3+
const app = new App({ target: document.body })
4+
5+
export default app

package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "svelte-component",
3+
"version": "1.0.0",
4+
"svelte": "src/index.js",
5+
"module": "dist/index.mjs",
6+
"main": "dist/index.js",
7+
"scripts": {
8+
"start": "sirv docs --no-clear",
9+
"dev": "rollup -c -w",
10+
"lint": "eslint .",
11+
"build": "rollup -c",
12+
"prepublishOnly": "npm run build"
13+
},
14+
"devDependencies": {
15+
"@rollup/plugin-commonjs": "^18.0.0",
16+
"@rollup/plugin-node-resolve": "^11.2.1",
17+
"eslint": "^7.24.0",
18+
"eslint-config-standard": "^16.0.2",
19+
"eslint-plugin-import": "^2.22.1",
20+
"eslint-plugin-node": "^11.1.0",
21+
"eslint-plugin-promise": "^4.2.1",
22+
"eslint-plugin-standard": "^4.1.0",
23+
"eslint-plugin-svelte3": "^3.1.2",
24+
"rollup": "^2.45.1",
25+
"rollup-plugin-livereload": "^2.0.0",
26+
"rollup-plugin-svelte": "^7.1.0",
27+
"rollup-plugin-terser": "^7.0.2",
28+
"sirv-cli": "^1.0.11",
29+
"svelte": "^3.37.0"
30+
},
31+
"files": [
32+
"src",
33+
"dist"
34+
],
35+
"keywords": [
36+
"svelte"
37+
]
38+
}

rollup.config.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import svelte from 'rollup-plugin-svelte'
2+
import resolve from '@rollup/plugin-node-resolve'
3+
import commonjs from '@rollup/plugin-commonjs'
4+
import livereload from 'rollup-plugin-livereload'
5+
import { terser } from 'rollup-plugin-terser'
6+
import pkg from './package.json'
7+
8+
const production = !process.env.ROLLUP_WATCH
9+
10+
const name = pkg.name
11+
.replace(/^(@\S+\/)?(svelte-)?(\S+)/, '$3')
12+
.replace(/^\w/, m => m.toUpperCase())
13+
.replace(/-\w/g, m => m[1].toUpperCase())
14+
15+
function serve () {
16+
let server
17+
function toExit () {
18+
if (server) server.kill(0)
19+
}
20+
return {
21+
writeBundle () {
22+
if (server) return
23+
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
24+
stdio: ['ignore', 'inherit', 'inherit'],
25+
shell: true
26+
})
27+
process.on('SIGTERM', toExit)
28+
process.on('exit', toExit)
29+
}
30+
}
31+
}
32+
33+
export default {
34+
input: 'docs/main.js',
35+
output: [
36+
{ sourcemap: true, format: 'iife', name: 'app', file: 'docs/build/bundle.js' },
37+
production && { file: pkg.module, format: 'es' },
38+
production && { file: pkg.main, format: 'umd', name }
39+
],
40+
plugins: [
41+
svelte({
42+
compilerOptions: {
43+
dev: !production,
44+
css: true
45+
},
46+
emitCss: false
47+
}),
48+
resolve({
49+
browser: true,
50+
dedupe: ['svelte']
51+
}),
52+
commonjs(),
53+
!production && serve(),
54+
!production && livereload('docs'),
55+
production && terser()
56+
],
57+
watch: {
58+
clearScreen: false
59+
}
60+
}

src/Component.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- your code here -->

0 commit comments

Comments
 (0)