Commit 84c0e964 authored by Emmanuel Raviart's avatar Emmanuel Raviart

Upgrade to Sapper 0.23.

parent 038ad509
/.sapper/
/app/manifest/
/assets/material-design-icons/
/assets/server.css
/build/
/__sapper__/
/data/
/export/
/templates/.*
/static/material-design-icons/
/static/server.css
.DS_Store
node_modules
yarn-error.log
yarn.lock
This diff is collapsed.
......@@ -9,7 +9,7 @@
"build": "sapper build",
"build-scripts": "babel -d build/bin scripts",
"export": "sapper export",
"start": "node build"
"start": "node __sapper__/build"
},
"dependencies": {
"body-parser": "^1.18.3",
......@@ -24,7 +24,6 @@
"plotly.js": "^1.41.3",
"polka": "^0.5.1",
"popper.js": "^1.14.4",
"sapper": "^0.20.4",
"sirv": "^0.2.2",
"slug": "^0.9.1",
"url-resolve": "^1.0.0"
......@@ -55,16 +54,17 @@
"autoprefixer": "^9.1.5",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.4",
"copy-webpack-plugin": "^4.5.2",
"copy-webpack-plugin": "^4.5.3",
"css-loader": "^1.0.0",
"eslint": "^5.6.1",
"eslint": "^5.7.0",
"eslint-loader": "^2.1.1",
"eslint-plugin-html": "^4.0.6",
"mini-css-extract-plugin": "^0.4.3",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "^4.9.3",
"npm-run-all": "^4.1.2",
"postcss-loader": "^3.0.0",
"precss": "^3.1.2",
"sapper": "^0.23.0",
"sass-loader": "^7.1.0",
"svelte": "^2.13.5",
"svelte-loader": "^2.11.0",
......
import "bootstrap"
import { init } from "sapper/runtime.js"
import { manifest } from "./manifest/client.js"
import * as sapper from "../__sapper__/client.js"
init({
manifest,
sapper.start({
target: document.querySelector("#sapper"),
})
......@@ -46,7 +46,7 @@
<div style="height: 72px;"></div>
<script>
import config from "../app/config"
import config from "../config"
export default {
helpers: {
......
......@@ -47,7 +47,7 @@
</nav>
<script>
import { buildSearchUrl } from "../app/model";
import { buildSearchUrl } from "../model";
export default {
helpers: {
......
......@@ -8,6 +8,10 @@
<h1>{status}</h1>
<p>{error.message}</p>
{#if dev && error.stack}
<pre>{error.stack}</pre>
{/if}
</main>
<style>
......@@ -37,5 +41,8 @@
components: {
Nav: "../components/Nav.html",
},
helpers: {
dev: process.env.NODE_ENV === "development",
},
}
</script>
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../app/database"
import { pool } from "../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../../../app/database"
import { pool } from "../../../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import fs from "fs"
import path from "path"
import serverConfig from "../../../../app/server-config"
import serverConfig from "../../../../server-config"
export function get(req, res) {
const { issuer: issuerId } = req.params
......
import oracledb from "oracledb"
import { pool } from "../../../../app/database"
import { pool } from "../../../../database"
export async function get(req, res) {
const sectorId = req.params.sector
......
import oracledb from "oracledb"
import { pool } from "../../../app/database"
import { pool } from "../../../database"
export async function get(req, res) {
const { stockExchange: stockExchangeId } = req.params
......
// import oracledb from "oracledb"
import { pool } from "../../../app/database"
import { pool } from "../../../database"
export async function get(req, res) {
const connection = await pool.getConnection()
......
import oracledb from "oracledb"
import { pool } from "../../../app/database"
import { pool } from "../../../database"
export async function get(req, res) {
const { stock: stockId } = req.params
......
......@@ -11,7 +11,7 @@
</main>
<script>
import config from "../app/config"
import config from "../config"
export default {
helpers: {
......
......@@ -40,7 +40,7 @@
</main>
<script>
import { objectsFromSqlResult } from "../../../app/model"
import { objectsFromSqlResult } from "../../../model"
export default {
async preload({ params /* , query */ }) {
......
......@@ -48,11 +48,11 @@
<script>
import levenshtein from "js-levenshtein"
import { goto } from "sapper/runtime.js"
import resolveUrl from "url-resolve"
import config from "../../app/config"
import { buildSearchUrl, slugify } from "../../app/model"
import { goto } from "../../../__sapper__/client"
import config from "../../config"
import { buildSearchUrl, slugify } from "../../model"
function nearestTerm(term, choices) {
const termSlug = slugify(term)
......
......@@ -2,8 +2,8 @@ import fs from "fs"
import oracledb from "oracledb"
import path from "path"
import { createPool } from "../app/database"
import { cleanUpLine, objectsFromSqlResult } from "../app/model"
import { createPool } from "../database"
import { cleanUpLine, objectsFromSqlResult } from "../model"
const dataDir = "data"
let pool = null
......
......@@ -2,8 +2,8 @@ import fs from "fs"
import oracledb from "oracledb"
import path from "path"
import { createPool } from "../app/database"
import { cleanUpLine, objectsFromSqlResult } from "../app/model"
import { createPool } from "../database"
import { cleanUpLine, objectsFromSqlResult } from "../model"
const dataDir = "data"
let pool = null
......
......@@ -3,8 +3,8 @@ import fs from "fs"
import oracledb from "oracledb"
import path from "path"
import { createPool } from "../app/database"
import { cleanUpLine, objectsFromSqlResult } from "../app/model"
import { createPool } from "../database"
import { cleanUpLine, objectsFromSqlResult } from "../model"
const dataDir = "data"
let pool = null
......
import bodyParser from "body-parser"
import compression from "compression"
import polka from "polka"
import sapper from "sapper"
// import { Store } from "svelte/store.js"
import sirv from "sirv"
import * as sapper from "../__sapper__/server.js"
import { createPool } from "./database"
import "./global.scss"
import { manifest } from "./manifest/server.js"
const { PORT, NODE_ENV } = process.env
const dev = NODE_ENV === "development"
......@@ -19,10 +18,9 @@ createPool()
polka() // You can also use Express
.use(
compression({ threshold: 0 }),
sirv("assets", { dev }),
sirv("static", { dev }),
bodyParser.json(),
sapper({
manifest,
sapper.middleware({
// store: req => {
// return new Store({})
// },
......@@ -31,7 +29,6 @@ createPool()
.listen(PORT, error => {
if (error) {
console.log(`Error when calling listen on port ${PORT}:`, error)
throw error
}
})
})
......
import { timestamp, assets, shell, routes } from "./manifest/service-worker.js"
import { timestamp, files, shell, routes } from "../__sapper__/service-worker.js"
const ASSETS = `cache${timestamp}`
// `shell` is an array of all the files generated by webpack,
// `assets` is an array of everything in the `assets` directory
const to_cache = shell.concat(assets)
// `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 => {
......
const sass = require("node-sass")
const config = require("sapper/config/webpack")
const webpack = require("webpack")
const entry = config.client.entry()
entry.main = ["@babel/polyfill", entry.main]
const mode = process.env.NODE_ENV
const dev = mode === "development"
module.exports = {
entry,
output: config.client.output(),
resolve: {
extensions: [".js", ".json", ".html"],
mainFields: ["svelte", "module", "browser", "main"],
},
module: {
rules: [
{
test: /\.html$/,
use: [
"babel-loader",
{
loader: "svelte-loader",
options: {
dev,
hydratable: true,
hotReload: true,
preprocess: {
style: ({ content, attributes }) => {
if (attributes.type !== "text/scss") return
return new Promise((fulfil, reject) => {
sass.render(
{
data: content,
includePaths: ["components", "routes"],
sourceMap: true,
importer: function(url) {
if (url.indexOf("~") === 0) {
const nodeModulePath = `./node_modules/${url.substr(1)}`
return { file: require("path").resolve(nodeModulePath) }
}
return { file: url }
},
outFile: "x", // this is necessary, but is ignored
},
(err, result) => {
if (err) {
return reject(err)
}
fulfil({
code: result.css,
map: result.map,
})
}
)
})
},
},
},
},
{
loader: "eslint-loader",
options: {
emitWarning: dev,
fix: true,
},
},
],
},
],
},
mode,
plugins: [
dev && new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
"process.browser": true,
"process.env.NODE_ENV": JSON.stringify(mode),
}),
].filter(Boolean),
devtool: dev && "inline-source-map",
}
const CopyWebpackPlugin = require("copy-webpack-plugin")
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const sass = require("node-sass")
const config = require("sapper/config/webpack")
const pkg = require("../package.json")
const dev = process.env.NODE_ENV === "development"
const entry = config.server.entry()
entry.server = ["@babel/polyfill", entry.server]
module.exports = {
entry,
output: config.server.output(),
target: "node",
resolve: {
extensions: [".js", ".json", ".html"],
mainFields: ["svelte", "module", "browser", "main"],
},
externals: Object.keys(pkg.dependencies),
module: {
rules: [
{
test: /\.html$/,
use: {
loader: "svelte-loader",
options: {
css: false,
dev,
generate: "ssr",
preprocess: {
style: ({ content, attributes }) => {
if (attributes.type !== "text/scss") return
return new Promise((fulfil, reject) => {
sass.render(
{
data: content,
includePaths: ["components", "routes"],
sourceMap: true,
importer: function(url) {
if (url.indexOf("~") === 0) {
const nodeModulePath = `./node_modules/${url.substr(1)}`
return { file: require("path").resolve(nodeModulePath) }
}
return { file: url }
},
outFile: "x", // this is necessary, but is ignored
},
(err, result) => {
if (err) {
return reject(err)
}
fulfil({
code: result.css,
map: result.map,
})
}
)
})
},
},
},
},
},
{
test: /\.(scss)$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader", // translates CSS into CommonJS modules
{
loader: "postcss-loader", // Run post css actions
options: {
plugins: function() {
// post css plugins, can be exported to postcss.config.js
return [require("precss"), require("autoprefixer")]
},
},
},
"sass-loader", // compiles Sass to CSS
],
},
],
},
plugins: [
new CopyWebpackPlugin([
{
from: "node_modules/material-design-icons/iconfont/",
to: "../assets/material-design-icons/iconfont/",
},
]),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: "../assets/[name].css",
chunkFilename: "[id].css",
}),
],
mode: process.env.NODE_ENV,
performance: {
hints: false, // it doesn't matter if server.js is large
},
}
const config = require("sapper/config/webpack")
module.exports = {
entry: config.serviceworker.entry(),
output: config.serviceworker.output(),
mode: process.env.NODE_ENV,
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment