diff --git a/.env_dev b/.env_dev
deleted file mode 100644
index a6640b8..0000000
--- a/.env_dev
+++ /dev/null
@@ -1,5 +0,0 @@
-DB_HOST=localhost
-DB_PORT=3306
-DB_USER=mm_admin
-DB_PASSWORD=god_not_mammon
-DB_CONNECTION_LIMIT=3
\ No newline at end of file
diff --git a/rollup.config.js b/rollup.config.js
deleted file mode 100644
index c0a9787..0000000
--- a/rollup.config.js
+++ /dev/null
@@ -1,127 +0,0 @@
-import path from 'path';
-import resolve from '@rollup/plugin-node-resolve';
-import replace from '@rollup/plugin-replace';
-import commonjs from '@rollup/plugin-commonjs';
-import url from '@rollup/plugin-url';
-import svelte from 'rollup-plugin-svelte';
-import babel from '@rollup/plugin-babel';
-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 legacy = !!process.env.SAPPER_LEGACY_BUILD;
-
-const onwarn = (warning, onwarn) =>
- (warning.code === 'MISSING_EXPORT' && /'preload'/.test(warning.message)) ||
- (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) ||
- onwarn(warning);
-
-export default {
- client: {
- input: config.client.input(),
- output: config.client.output(),
- plugins: [
- replace({
- preventAssignment: true,
- values:{
- 'process.browser': true,
- 'process.env.NODE_ENV': JSON.stringify(mode)
- },
- }),
- svelte({
- compilerOptions: {
- dev,
- hydratable: true
- }
- }),
- url({
- sourceDir: path.resolve(__dirname, 'src/node_modules/images'),
- publicPath: '/client/'
- }),
- resolve({
- browser: true,
- dedupe: ['svelte']
- }),
- commonjs(),
-
- legacy && babel({
- extensions: ['.js', '.mjs', '.html', '.svelte'],
- babelHelpers: 'runtime',
- exclude: ['node_modules/@babel/**'],
- presets: [
- ['@babel/preset-env', {
- targets: '> 0.25%, not dead'
- }]
- ],
- plugins: [
- '@babel/plugin-syntax-dynamic-import',
- ['@babel/plugin-transform-runtime', {
- useESModules: true
- }]
- ]
- }),
-
- !dev && terser({
- module: true
- })
- ],
-
- preserveEntrySignatures: false,
- onwarn,
- },
-
- server: {
- input: config.server.input(),
- output: config.server.output(),
- plugins: [
- replace({
- preventAssignment: true,
- values:{
- 'process.browser': false,
- 'process.env.NODE_ENV': JSON.stringify(mode)
- },
- }),
- svelte({
- compilerOptions: {
- dev,
- generate: 'ssr',
- hydratable: true
- },
- emitCss: false
- }),
- url({
- sourceDir: path.resolve(__dirname, 'src/node_modules/images'),
- publicPath: '/client/',
- emitFiles: false // already emitted by client build
- }),
- resolve({
- dedupe: ['svelte']
- }),
- commonjs()
- ],
- external: Object.keys(pkg.dependencies).concat(require('module').builtinModules),
- preserveEntrySignatures: 'strict',
- onwarn,
- },
-
- serviceworker: {
- input: config.serviceworker.input(),
- output: config.serviceworker.output(),
- plugins: [
- resolve(),
- replace({
- preventAssignment: true,
- values:{
- 'process.browser': true,
- 'process.env.NODE_ENV': JSON.stringify(mode)
- },
- }),
- commonjs(),
- !dev && terser()
- ],
- preserveEntrySignatures: false,
- onwarn,
- }
-};
diff --git a/scripts/setupTypeScript.js b/scripts/setupTypeScript.js
deleted file mode 100644
index fb5cbdf..0000000
--- a/scripts/setupTypeScript.js
+++ /dev/null
@@ -1,304 +0,0 @@
-/**
- * Run this script to convert the project to TypeScript. This is only guaranteed to work
- * on the unmodified default template; if you have done code changes you are likely need
- * to touch up the generated project manually.
- */
-
-// @ts-check
-const fs = require('fs');
-const path = require('path');
-const { argv } = require('process');
-
-const projectRoot = argv[2] || path.join(__dirname, '..');
-
-const isRollup = fs.existsSync(path.join(projectRoot, "rollup.config.js"));
-
-function warn(message) {
- console.warn('Warning: ' + message);
-}
-
-function replaceInFile(fileName, replacements) {
- if (fs.existsSync(fileName)) {
- let contents = fs.readFileSync(fileName, 'utf8');
- let hadUpdates = false;
-
- replacements.forEach(([from, to]) => {
- const newContents = contents.replace(from, to);
-
- const isAlreadyApplied = typeof to !== 'string' || contents.includes(to);
-
- if (newContents !== contents) {
- contents = newContents;
- hadUpdates = true;
- } else if (!isAlreadyApplied) {
- warn(`Wanted to update "${from}" in ${fileName}, but did not find it.`);
- }
- });
-
- if (hadUpdates) {
- fs.writeFileSync(fileName, contents);
- } else {
- console.log(`${fileName} had already been updated.`);
- }
- } else {
- warn(`Wanted to update ${fileName} but the file did not exist.`);
- }
-}
-
-function createFile(fileName, contents) {
- if (fs.existsSync(fileName)) {
- warn(`Wanted to create ${fileName}, but it already existed. Leaving existing file.`);
- } else {
- fs.writeFileSync(fileName, contents);
- }
-}
-
-function addDepsToPackageJson() {
- const pkgJSONPath = path.join(projectRoot, 'package.json');
- const packageJSON = JSON.parse(fs.readFileSync(pkgJSONPath, 'utf8'));
- packageJSON.devDependencies = Object.assign(packageJSON.devDependencies, {
- ...(isRollup ? { '@rollup/plugin-typescript': '^6.0.0' } : { 'ts-loader': '^8.0.4' }),
- '@tsconfig/svelte': '^1.0.10',
- '@types/compression': '^1.7.0',
- '@types/node': '^14.11.1',
- '@types/polka': '^0.5.1',
- 'svelte-check': '^1.0.46',
- 'svelte-preprocess': '^4.3.0',
- tslib: '^2.0.1',
- typescript: '^4.0.3'
- });
-
- // Add script for checking
- packageJSON.scripts = Object.assign(packageJSON.scripts, {
- validate: 'svelte-check --ignore src/node_modules/@sapper'
- });
-
- // Write the package JSON
- fs.writeFileSync(pkgJSONPath, JSON.stringify(packageJSON, null, ' '));
-}
-
-function changeJsExtensionToTs(dir) {
- const elements = fs.readdirSync(dir, { withFileTypes: true });
-
- for (let i = 0; i < elements.length; i++) {
- if (elements[i].isDirectory()) {
- changeJsExtensionToTs(path.join(dir, elements[i].name));
- } else if (elements[i].name.match(/^[^_]((?!json).)*js$/)) {
- fs.renameSync(path.join(dir, elements[i].name), path.join(dir, elements[i].name).replace('.js', '.ts'));
- }
- }
-}
-
-function updateSingleSvelteFile({ view, vars, contextModule }) {
- replaceInFile(path.join(projectRoot, 'src', `${view}.svelte`), [
- [/(?:
-
-
- ```
- */
-declare module "*.gif" {
- const value: string;
- export default value;
-}
-
-declare module "*.jpg" {
- const value: string;
- export default value;
-}
-
-declare module "*.jpeg" {
- const value: string;
- export default value;
-}
-
-declare module "*.png" {
- const value: string;
- export default value;
-}
-
-declare module "*.svg" {
- const value: string;
- export default value;
-}
-
-declare module "*.webp" {
- const value: string;
- export default value;
-}
diff --git a/src/client.js b/src/client.js
deleted file mode 100644
index cec9172..0000000
--- a/src/client.js
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index 49a94ed..0000000
--- a/src/components/Nav.svelte
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
diff --git a/src/db.js b/src/db.js
deleted file mode 100644
index bf80949..0000000
--- a/src/db.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import mariadb from 'mariadb';
-import dotenv from 'dotenv';
-
-dotenv.config();
-const {
- DB_HOST,
- DB_PORT,
- DB_USER,
- DB_PASSWORD,
- DB_CONNECTION_LIMIT,
-} = process.env;
-
-const pool = mariadb.createPool({
- host: DB_HOST,
- port: DB_PORT,
- user: DB_USER,
- password: DB_PASSWORD,
- connectionLimit: DB_CONNECTION_LIMIT,
-});
-
-export default pool;
diff --git a/src/node_modules/images/successkid.jpg b/src/node_modules/images/successkid.jpg
deleted file mode 100644
index 5ad19cc..0000000
Binary files a/src/node_modules/images/successkid.jpg and /dev/null differ
diff --git a/src/routes/_error.svelte b/src/routes/_error.svelte
deleted file mode 100644
index 320e587..0000000
--- a/src/routes/_error.svelte
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
{error.message}
- -{#if dev && error.stack} -{error.stack}-{/if} diff --git a/src/routes/_layout.svelte b/src/routes/_layout.svelte deleted file mode 100644 index 8432299..0000000 --- a/src/routes/_layout.svelte +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - -
First, you have to know what Svelte is. Svelte is a UI framework with a bold new idea: rather than providing a library that you write code with (like React or Vue, for example), it's a compiler that turns your components into highly optimized vanilla JavaScript. If you haven't already read the introductory blog post, you should!
- -Sapper is a Next.js-style framework (more on that here) built around Svelte. It makes it embarrassingly easy to create extremely high performance web apps. Out of the box, you get:
- -It's implemented as Express middleware. Everything is set up and waiting for you to get started, but you keep complete control over the server, service worker, webpack config and everything else, so it's as flexible as you need it to be.
- ` - }, - - { - title: 'How to use Sapper', - slug: 'how-to-use-sapper', - html: ` -Create a new project, using degit:
- -npx degit "sveltejs/sapper-template#rollup" my-app
- cd my-app
- npm install # or yarn!
- npm run dev
-
-
- Go to localhost:3000. Open my-app
in your editor. Edit the files in the src/routes
directory or add new ones.
...
- -Resist overdone joke formats.
- ` - }, - - { - title: 'Why the name?', - slug: 'why-the-name', - html: ` -In war, the soldiers who build bridges, repair roads, clear minefields and conduct demolitions — all under combat conditions — are known as sappers.
- -For web developers, the stakes are generally lower than those for combat engineers. But we face our own hostile environment: underpowered devices, poor network connections, and the complexity inherent in front-end engineering. Sapper, which is short for Svelte app maker, is your courageous and dutiful ally.
- ` - }, - - { - title: 'How is Sapper different from Next.js?', - slug: 'how-is-sapper-different-from-next', - html: ` -Next.js is a React framework from Vercel, and is the inspiration for Sapper. There are a few notable differences, however:
- -src/routes/blog/[slug].svelte
routes
directory. These are just .js
files that export functions corresponding to HTTP methods, and receive Express request
and response
objects as arguments. This makes it very easy to, for example, add a JSON API such as the one powering this very page<a>
elements, rather than framework-specific <Link>
components. That means, for example, that this link right here, despite being inside a blob of HTML, works with the router as you'd expect.We're so glad you asked! Come on over to the Svelte and Sapper repos, and join us in the Discord chatroom. Everyone is welcome, especially you!
- ` - } -]; - -posts.forEach(post => { - post.html = post.html.replace(/^\t{3}/gm, ''); -}); - -export default posts; diff --git a/src/routes/api/addTransaction.js b/src/routes/api/addTransaction.js deleted file mode 100644 index 2199c8f..0000000 --- a/src/routes/api/addTransaction.js +++ /dev/null @@ -1,22 +0,0 @@ -import pool from '$lib/db'; - -export async function post(req) { - const { name, amount, date } = req.body; - - let conn; - try { - conn = await pool.getConnection(); - const result = await conn.query( - `INSERT INTO mammon_manager.transaction(name, amount, date) VALUES("${name}", "${amount}", "${date}")` - ); - return { - status: 201, - body: { data: result, message: 'Successfully created transaction'}, - } - } catch (err) { - console.log('err :>> ', err); - return { status: 400, body: { message: 'Failed to create transaction' }}; - } finally { - if (conn) conn.end(); - } -} \ No newline at end of file diff --git a/src/routes/api/index.json.js b/src/routes/api/index.json.js deleted file mode 100644 index bfd9389..0000000 --- a/src/routes/api/index.json.js +++ /dev/null @@ -1,16 +0,0 @@ -import posts from './_posts.js'; - -const contents = JSON.stringify(posts.map(post => { - return { - title: post.title, - slug: post.slug - }; -})); - -export function get(req, res) { - res.writeHead(200, { - 'Content-Type': 'application/json' - }); - - res.end(contents); -} \ No newline at end of file diff --git a/src/routes/api/index.svelte b/src/routes/api/index.svelte deleted file mode 100644 index 2b7d64c..0000000 --- a/src/routes/api/index.svelte +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - -