Browse Source

swaf rename: rename project to swaf-boilerplate

develop
Alice Gaudon 3 months ago
parent
commit
ba5b90a4f9
11 changed files with 42 additions and 37 deletions
  1. +3
    -0
      README.md
  2. +7
    -4
      app.service
  3. +0
    -1
      assets/img/logo.svg
  4. +1
    -1
      assets/ts/forms.ts
  5. +1
    -1
      config/test.json5
  6. +3
    -3
      package.json
  7. +19
    -19
      src/App.ts
  8. +2
    -2
      src/controllers/HomeController.ts
  9. +3
    -3
      src/main.ts
  10. +1
    -1
      tsconfig.json
  11. +2
    -2
      views/about.njk

+ 3
- 0
README.md View File

@ -0,0 +1,3 @@
# swaf boilerplate
Boilerplate for a quickstart with [swaf](https://eternae.ink/arisu/swaf)

+ 7
- 4
app.service View File

@ -1,13 +1,16 @@
# Please customize values i.e. paths, user, group, WorkingDirectory based on your environment. Do not use the same
# user and group for different applications.
[Unit]
Description=WMS website
Description=swaf based website
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=wms
Group=wms
WorkingDirectory=/home/wms/live
User=swaf
Group=swaf
WorkingDirectory=/home/swaf/live
Restart=on-success
Environment=NODE_ENV=production
ExecStart=/bin/node .


+ 0
- 1
assets/img/logo.svg View File

@ -19,7 +19,6 @@
id="svg6"
sodipodi:docname="logo.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
inkscape:export-filename="/r/arisu/dev/streams/wms/assets/img/logox1024.png"
inkscape:export-xdpi="4096"
inkscape:export-ydpi="4096">
<metadata


+ 1
- 1
assets/ts/forms.ts View File

@ -1,7 +1,7 @@
/*
* For labels to update their state (css selectors based on the value attribute)
*/
import {ValidationError} from "wms-core/db/Validator";
import {ValidationError} from "swaf/db/Validator";
export function updateInputs(): void {
document.querySelectorAll<HTMLInputElement | HTMLTextAreaElement>('input, textarea').forEach(el => {


+ 1
- 1
config/test.json5 View File

@ -3,7 +3,7 @@
host: "localhost",
user: "root",
password: "",
database: "wms2_test",
database: "swaf_test",
create_database_automatically: true
}
}

+ 3
- 3
package.json View File

@ -1,8 +1,8 @@
{
"name": "example-app",
"version": "0.1.0",
"description": "Example App based on wms-core",
"repository": "https://gitlab.com/ArisuOngaku/wms-boilerplate",
"description": "Example App based on swaf",
"repository": "https://eternae.ink/arisu/swaf-boilerplate",
"author": "Alice Gaudon <alice@gaudon.pro>",
"private": true,
"main": "dist/src/main.js",
@ -60,6 +60,6 @@
"dependencies": {
"config": "^3.3.1",
"express": "^4.17.1",
"wms-core": "^0.22.0"
"swaf": "^0.22.5"
}
}

+ 19
- 19
src/App.ts View File

@ -1,24 +1,24 @@
import Application from "wms-core/Application";
import Migration, {MigrationType} from "wms-core/db/Migration";
import CreateMigrationsTable from "wms-core/migrations/CreateMigrationsTable";
import ExpressAppComponent from "wms-core/components/ExpressAppComponent";
import NunjucksComponent from "wms-core/components/NunjucksComponent";
import MysqlComponent from "wms-core/components/MysqlComponent";
import LogRequestsComponent from "wms-core/components/LogRequestsComponent";
import RedisComponent from "wms-core/components/RedisComponent";
import ServeStaticDirectoryComponent from "wms-core/components/ServeStaticDirectoryComponent";
import MaintenanceComponent from "wms-core/components/MaintenanceComponent";
import MailComponent from "wms-core/components/MailComponent";
import SessionComponent from "wms-core/components/SessionComponent";
import RedirectBackComponent from "wms-core/components/RedirectBackComponent";
import FormHelperComponent from "wms-core/components/FormHelperComponent";
import CsrfProtectionComponent from "wms-core/components/CsrfProtectionComponent";
import WebSocketServerComponent from "wms-core/components/WebSocketServerComponent";
import Application from "swaf/Application";
import Migration, {MigrationType} from "swaf/db/Migration";
import CreateMigrationsTable from "swaf/migrations/CreateMigrationsTable";
import ExpressAppComponent from "swaf/components/ExpressAppComponent";
import NunjucksComponent from "swaf/components/NunjucksComponent";
import MysqlComponent from "swaf/components/MysqlComponent";
import LogRequestsComponent from "swaf/components/LogRequestsComponent";
import RedisComponent from "swaf/components/RedisComponent";
import ServeStaticDirectoryComponent from "swaf/components/ServeStaticDirectoryComponent";
import MaintenanceComponent from "swaf/components/MaintenanceComponent";
import MailComponent from "swaf/components/MailComponent";
import SessionComponent from "swaf/components/SessionComponent";
import RedirectBackComponent from "swaf/components/RedirectBackComponent";
import FormHelperComponent from "swaf/components/FormHelperComponent";
import CsrfProtectionComponent from "swaf/components/CsrfProtectionComponent";
import WebSocketServerComponent from "swaf/components/WebSocketServerComponent";
import HomeController from "./controllers/HomeController";
import AutoUpdateComponent from "wms-core/components/AutoUpdateComponent";
import AutoUpdateComponent from "swaf/components/AutoUpdateComponent";
import packageJson = require('../package.json');
import DummyMigration from "wms-core/migrations/DummyMigration";
import DropLegacyLogsTable from "wms-core/migrations/DropLegacyLogsTable";
import DummyMigration from "swaf/migrations/DummyMigration";
import DropLegacyLogsTable from "swaf/migrations/DropLegacyLogsTable";
export default class App extends Application {
public constructor(


+ 2
- 2
src/controllers/HomeController.ts View File

@ -1,4 +1,4 @@
import Controller from "wms-core/Controller";
import Controller from "swaf/Controller";
import {Request, Response} from "express";
export default class HomeController extends Controller {
@ -17,7 +17,7 @@ export default class HomeController extends Controller {
}
/**
* This is to test and assert that wms-core extended types are available
* This is to test and assert that swaf extended types are available
*/
protected async goBack(req: Request, res: Response): Promise<void> {
res.redirectBack();


+ 3
- 3
src/main.ts View File

@ -1,12 +1,12 @@
import {delimiter} from "path";
// Load config from specified path or default + wms-core/config (default defaults)
// Load config from specified path or default + swaf/config (default defaults)
process.env['NODE_CONFIG_DIR'] =
__dirname + '/../../node_modules/wms-core/config/'
__dirname + '/../../node_modules/swaf/config/'
+ delimiter
+ (process.env['NODE_CONFIG_DIR'] || __dirname + '/../../config/');
import {log} from "wms-core/Logger";
import {log} from "swaf/Logger";
import App from "./App";
import config from "config";


+ 1
- 1
tsconfig.json View File

@ -16,6 +16,6 @@
},
"include": [
"src/**/*",
"node_modules/wms-core/types"
"node_modules/swaf/types"
]
}

+ 2
- 2
views/about.njk View File

@ -8,7 +8,7 @@
<div class="container">
<section class="panel">
<h2>This is us</h2>
<p class="center">And we like wms!</p>
<p class="center">And we like swaf!</p>
</section>
</div>
{% endblock %}
{% endblock %}

Loading…
Cancel
Save