From 14657b07186d7d93dd3c25ca8776aa7977351f13 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Thu, 23 Jul 2020 20:30:57 +0200 Subject: [PATCH] initial commit --- .gitignore | 8 + package.json | 24 + rollup.config.js | 85 +++ src/client.js | 5 + src/components/Nav.svelte | 60 +++ src/routes/_error.svelte | 40 ++ src/routes/_layout.svelte | 22 + src/routes/about.svelte | 7 + src/routes/blog/[slug].json.js | 28 + src/routes/blog/[slug].svelte | 64 +++ src/routes/blog/_posts.js | 92 ++++ src/routes/blog/index.json.js | 16 + src/routes/blog/index.svelte | 34 ++ src/routes/index.svelte | 46 ++ src/server.js | 17 + src/service-worker.js | 82 +++ src/template.html | 33 ++ static/favicon.png | Bin 0 -> 3127 bytes static/global.css | 36 ++ static/logo-192.png | Bin 0 -> 4760 bytes static/logo-512.png | Bin 0 -> 13928 bytes static/manifest.json | 20 + static/successkid.jpg | Bin 0 -> 78652 bytes yarn.lock | 914 +++++++++++++++++++++++++++++++++ 24 files changed, 1633 insertions(+) create mode 100644 .gitignore create mode 100644 package.json create mode 100644 rollup.config.js create mode 100644 src/client.js create mode 100644 src/components/Nav.svelte create mode 100644 src/routes/_error.svelte create mode 100644 src/routes/_layout.svelte create mode 100644 src/routes/about.svelte create mode 100644 src/routes/blog/[slug].json.js create mode 100644 src/routes/blog/[slug].svelte create mode 100644 src/routes/blog/_posts.js create mode 100644 src/routes/blog/index.json.js create mode 100644 src/routes/blog/index.svelte create mode 100644 src/routes/index.svelte create mode 100644 src/server.js create mode 100644 src/service-worker.js create mode 100644 src/template.html create mode 100644 static/favicon.png create mode 100644 static/global.css create mode 100644 static/logo-192.png create mode 100644 static/logo-512.png create mode 100644 static/manifest.json create mode 100755 static/successkid.jpg create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b0eda16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# Node +/node_modules/ + +# Sapper +/src/node_modules/@sapper/ +/__sapper__/ + +.vercel \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..ad8fe6f --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "scripts": { + "dev": "sapper dev", + "build": "sapper build", + "export": "sapper export", + "start": "node __sapper__/build" + }, + "dependencies": { + "compression": "^1.7.1", + "polka": "next", + "sirv": "^0.4.0" + }, + "devDependencies": { + "npm-run-all": "^4.1.5", + "sapper": "^0.27.0", + "svelte": "^3.0.0", + "@rollup/plugin-commonjs": "^12.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "@rollup/plugin-replace": "^2.2.0", + "rollup": "^2.3.4", + "rollup-plugin-svelte": "^5.0.1", + "rollup-plugin-terser": "^5.3.0" + } +} diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..b635450 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,85 @@ +import resolve from '@rollup/plugin-node-resolve' +import replace from '@rollup/plugin-replace' +import commonjs from '@rollup/plugin-commonjs' +import svelte from 'rollup-plugin-svelte' +import { terser } from 'rollup-plugin-terser' +import config from 'sapper/config/rollup.js' +import pkg from './package.json' + +const mode = process.env.NODE_ENV +const dev = mode === 'development' + +const onwarn = (warning, onwarn) => + (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning) + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode), + }), + svelte({ + dev, + hydratable: true, + emitCss: true, + }), + resolve({ + browser: true, + dedupe: ['svelte'], + }), + commonjs(), + !dev && + terser({ + module: true, + }), + ], + + preserveEntrySignatures: false, + onwarn, + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode), + }), + svelte({ + generate: 'ssr', + dev, + }), + resolve({ + dedupe: ['svelte'], + }), + commonjs(), + ], + external: Object.keys(pkg.dependencies).concat( + require('module').builtinModules || Object.keys(process.binding('natives')) + ), + + preserveEntrySignatures: 'strict', + onwarn, + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode), + }), + commonjs(), + !dev && terser(), + ], + + preserveEntrySignatures: false, + onwarn, + }, +} diff --git a/src/client.js b/src/client.js new file mode 100644 index 0000000..cec9172 --- /dev/null +++ b/src/client.js @@ -0,0 +1,5 @@ +import * as sapper from '@sapper/app'; + +sapper.start({ + target: document.querySelector('#sapper') +}); \ No newline at end of file diff --git a/src/components/Nav.svelte b/src/components/Nav.svelte new file mode 100644 index 0000000..49a94ed --- /dev/null +++ b/src/components/Nav.svelte @@ -0,0 +1,60 @@ + + + + + diff --git a/src/routes/_error.svelte b/src/routes/_error.svelte new file mode 100644 index 0000000..320e587 --- /dev/null +++ b/src/routes/_error.svelte @@ -0,0 +1,40 @@ + + + + + + {status} + + +

{status}

+ +

{error.message}

+ +{#if dev && error.stack} +
{error.stack}
+{/if} diff --git a/src/routes/_layout.svelte b/src/routes/_layout.svelte new file mode 100644 index 0000000..8432299 --- /dev/null +++ b/src/routes/_layout.svelte @@ -0,0 +1,22 @@ + + + + +