Skip to content

Instantly share code, notes, and snippets.

import { timestamp, files, shell, routes } from '@sapper/service-worker';
const ASSETS = `cache${timestamp}`;
// `shell` is an array of all the files generated by the bundler,
// `files` is an array of everything in the `static` directory
const to_cache = shell.concat(files);
const cached = new Set(to_cache);
self.addEventListener('install', event => {
@evdama
evdama / server.js
Created September 29, 2019 19:01
reading IP address from request in order to reuse inside server route
// @ts-nocheck
// TODO: remove once there are typings in place
import './css/tailwind.css'
import * as sapper from '@sapper/server'
import compression from 'compression'
import express from 'express'
import helmet from 'helmet'
import requestIP from 'request-ip'
import session from 'express-session'
@evdama
evdama / server.js
Created September 24, 2019 07:33
What's the smartest way to use clientIPAddress to make geoIP checks?
// @ts-nocheck
// TODO: remove once there are typings in place
import './css/tailwind.css';
import * as sapper from '@sapper/server';
import compression from 'compression';
import express from 'express';
import helmet from 'helmet';
import sirv from 'sirv';
import uuidv4 from 'uuid/v4';
// @ts-nocheck //TODO: enable remove once there are typings in place
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess
import { eslint } from 'rollup-plugin-eslint'
import { terser } from 'rollup-plugin-terser'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import config from 'sapper/config/rollup.js'
import environmentVariables from './config/env'
@evdama
evdama / rollup.config.js
Created September 22, 2019 07:42
visualizer only shows stats for service worker, not client or server sections
// @ts-nocheck //TODO: enable remove once there are typings in place
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess
import { eslint } from 'rollup-plugin-eslint'
import { terser } from 'rollup-plugin-terser'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import config from 'sapper/config/rollup.js'
import environmentVariables from './config/env'
// @ts-nocheck //TODO: enable remove once there are typings in place
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import config from 'sapper/config/rollup.js'
import getPreprocessor from 'svelte-preprocess'
import getTime from 'date-fns/getTime'
import path from 'path'
@evdama
evdama / package.json
Last active September 16, 2019 14:47
{
"dependencies": {
"axios": "^0.19.0",
"compression": "^1.7.4",
"express": "^4.17.1",
"sirv": "^0.4.2"
},
"description": "This is the source code repository for Everyday Market.",
"devDependencies": {
"@babel/core": "^7.6.0",
// @ts-nocheck //TODO: enable remove once there are typings in place
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import config from 'sapper/config/rollup.js'
import getPreprocessor from 'svelte-preprocess'
import getTime from 'date-fns/getTime'
import path from 'path'
@evdama
evdama / rollup.config.js
Created September 8, 2019 16:39
svelte 3.10 broke my tailwind css build
// @ts-nocheck //TODO: enable remove once there are typings in place
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import config from 'sapper/config/rollup.js'
import getPreprocessor from 'svelte-preprocess'
import getTime from 'date-fns/getTime'
import path from 'path'
@evdama
evdama / .eslintrc.js
Created August 11, 2019 08:37
add json to plugins
module.exports = {
extends: [
'airbnb-base',
'eslint:recommended',
'plugin:import/errors',
'plugin:import/typescript',
'plugin:import/warnings',
'prettier'
],
parser: 'babel-eslint',