Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
Alice Gaudon | e172bf6618 | |
Alice Gaudon | 96df637f97 | |
Alice Gaudon | 3294735968 | |
Alice Gaudon | 827e7644fa | |
Alice Gaudon | f5d135d331 | |
Alice Gaudon | 4bcee79e8a | |
Alice Gaudon | 00b1f25804 | |
Alice Gaudon | 1cdd118806 | |
Alice Gaudon | 2726fd16cc | |
Alice Gaudon | 46168c0e90 | |
Alice Gaudon | 44b32401a7 | |
Alice Gaudon | edccef4e42 | |
Alice Gaudon | db3cf2178a | |
Alice Gaudon | 8aad521014 | |
Alice Gaudon | 19224d592a |
135
.eslintrc.cjs
135
.eslintrc.cjs
|
@ -1,135 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
plugins: [
|
|
||||||
'svelte3',
|
|
||||||
'@typescript-eslint',
|
|
||||||
'import',
|
|
||||||
'simple-import-sort',
|
|
||||||
],
|
|
||||||
parserOptions: {
|
|
||||||
tsconfigRootDir: __dirname,
|
|
||||||
project: [
|
|
||||||
'./tsconfig.test.json',
|
|
||||||
'./src/tsconfig.json',
|
|
||||||
'./src/common/tsconfig.json',
|
|
||||||
'./src/assets/ts/tsconfig.eslint.json',
|
|
||||||
'./src/assets/views/tsconfig.json',
|
|
||||||
]
|
|
||||||
},
|
|
||||||
extends: [
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
indent: [
|
|
||||||
'error',
|
|
||||||
4,
|
|
||||||
{
|
|
||||||
SwitchCase: 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'no-trailing-spaces': 'error',
|
|
||||||
'max-len': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
code: 120,
|
|
||||||
ignoreTemplateLiterals: true,
|
|
||||||
ignoreRegExpLiterals: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
semi: 'off',
|
|
||||||
'@typescript-eslint/semi': [
|
|
||||||
'error'
|
|
||||||
],
|
|
||||||
'no-extra-semi': 'error',
|
|
||||||
'eol-last': 'error',
|
|
||||||
'comma-dangle': 'off',
|
|
||||||
'simple-import-sort/imports': 'error',
|
|
||||||
'no-extra-parens': 'off',
|
|
||||||
'no-nested-ternary': 'error',
|
|
||||||
'no-return-await': 'off',
|
|
||||||
'no-useless-return': 'error',
|
|
||||||
'no-useless-constructor': 'off',
|
|
||||||
'import/extensions': ['error', 'ignorePackages'],
|
|
||||||
'@typescript-eslint/comma-dangle': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
arrays: 'always-multiline',
|
|
||||||
objects: 'always-multiline',
|
|
||||||
imports: 'always-multiline',
|
|
||||||
exports: 'always-multiline',
|
|
||||||
functions: 'always-multiline',
|
|
||||||
enums: 'always-multiline',
|
|
||||||
generics: 'always-multiline',
|
|
||||||
tuples: 'always-multiline'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-extra-parens': [
|
|
||||||
'error'
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-inferrable-types': 'off',
|
|
||||||
'@typescript-eslint/explicit-module-boundary-types': 'error',
|
|
||||||
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
||||||
'@typescript-eslint/no-unused-vars': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
argsIgnorePattern: '^_'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
||||||
'@typescript-eslint/no-useless-constructor': [
|
|
||||||
'error'
|
|
||||||
],
|
|
||||||
'@typescript-eslint/return-await': [
|
|
||||||
'error',
|
|
||||||
'always'
|
|
||||||
],
|
|
||||||
'@typescript-eslint/explicit-member-accessibility': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
accessibility: 'explicit'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-floating-promises': 'error',
|
|
||||||
},
|
|
||||||
ignorePatterns: [
|
|
||||||
'.eslintrc.js',
|
|
||||||
'rollup.config.js',
|
|
||||||
'jest.config.js',
|
|
||||||
'dist/**/*',
|
|
||||||
'config/**/*',
|
|
||||||
'intermediates/**/*',
|
|
||||||
'public/**/*',
|
|
||||||
'scripts/**/*',
|
|
||||||
'src/frontend/register_svelte/register_svelte.js',
|
|
||||||
],
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: [
|
|
||||||
'test/**/*'
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
'max-len': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
code: 120,
|
|
||||||
ignoreTemplateLiterals: true,
|
|
||||||
ignoreRegExpLiterals: true,
|
|
||||||
ignoreStrings: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ['*.svelte'],
|
|
||||||
processor: 'svelte3/svelte3'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
settings: {
|
|
||||||
'svelte3/typescript': require('typescript'),
|
|
||||||
'svelte3/ignore-styles': function (attributes) {
|
|
||||||
return !!(attributes['lang'] && attributes['lang'] !== 'css');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": [
|
||||||
|
"./tsconfig.json",
|
||||||
|
"./tsconfig.test.json",
|
||||||
|
"./tsconfig.frontend.json"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
4,
|
||||||
|
{
|
||||||
|
"SwitchCase": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-trailing-spaces": "error",
|
||||||
|
"max-len": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"code": 120,
|
||||||
|
"ignoreStrings": true,
|
||||||
|
"ignoreTemplateLiterals": true,
|
||||||
|
"ignoreRegExpLiterals": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"semi": "off",
|
||||||
|
"@typescript-eslint/semi": [
|
||||||
|
"error"
|
||||||
|
],
|
||||||
|
"no-extra-semi": "error",
|
||||||
|
"eol-last": "error",
|
||||||
|
"comma-dangle": "off",
|
||||||
|
"@typescript-eslint/comma-dangle": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"arrays": "always-multiline",
|
||||||
|
"objects": "always-multiline",
|
||||||
|
"imports": "always-multiline",
|
||||||
|
"exports": "always-multiline",
|
||||||
|
"functions": "always-multiline",
|
||||||
|
"enums": "always-multiline",
|
||||||
|
"generics": "always-multiline",
|
||||||
|
"tuples": "always-multiline"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-extra-parens": "off",
|
||||||
|
"@typescript-eslint/no-extra-parens": [
|
||||||
|
"error"
|
||||||
|
],
|
||||||
|
"no-nested-ternary": "error",
|
||||||
|
"@typescript-eslint/no-inferrable-types": "off",
|
||||||
|
"@typescript-eslint/explicit-module-boundary-types": "error",
|
||||||
|
"@typescript-eslint/no-unnecessary-condition": "error",
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"argsIgnorePattern": "^_"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-non-null-assertion": "error",
|
||||||
|
"no-useless-return": "error",
|
||||||
|
"no-useless-constructor": "off",
|
||||||
|
"@typescript-eslint/no-useless-constructor": [
|
||||||
|
"error"
|
||||||
|
],
|
||||||
|
"no-return-await": "off",
|
||||||
|
"@typescript-eslint/return-await": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"accessibility": "explicit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-floating-promises": "error"
|
||||||
|
},
|
||||||
|
"ignorePatterns": [
|
||||||
|
"jest.config.js",
|
||||||
|
"scripts/**/*",
|
||||||
|
"webpack.config.js",
|
||||||
|
"dist/**/*",
|
||||||
|
"public/**/*",
|
||||||
|
"config/**/*"
|
||||||
|
],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"test/**/*"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"max-len": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"code": 120,
|
||||||
|
"ignoreTemplateLiterals": true,
|
||||||
|
"ignoreRegExpLiterals": true,
|
||||||
|
"ignoreStrings": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
22
package.json
22
package.json
|
@ -18,34 +18,32 @@
|
||||||
"start": "yarn build-production && node ."
|
"start": "yarn build-production && node ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/svelte": "^3.0.0",
|
"@tsconfig/svelte": "^2.0.1",
|
||||||
"@types/config": "^0.0.41",
|
"@types/config": "^0.0.40",
|
||||||
"@types/express": "^4.17.6",
|
"@types/express": "^4.17.6",
|
||||||
"@types/express-session": "^1.17.0",
|
"@types/express-session": "^1.17.0",
|
||||||
|
"@types/feather-icons": "^4.7.0",
|
||||||
"@types/formidable": "^2.0.0",
|
"@types/formidable": "^2.0.0",
|
||||||
"@types/jest": "^27.0.3",
|
"@types/jest": "^27.0.3",
|
||||||
"@types/mysql": "^2.15.15",
|
"@types/mysql": "^2.15.15",
|
||||||
"@types/node": "^17.0.4",
|
"@types/node": "^16.11.9",
|
||||||
"@types/nodemailer": "^6.4.0",
|
"@types/nodemailer": "^6.4.0",
|
||||||
"@types/nunjucks": "^3.1.3",
|
"@types/nunjucks": "^3.1.3",
|
||||||
"@types/ws": "^8.2.0",
|
"@types/ws": "^8.2.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||||
"@typescript-eslint/parser": "^5.4.0",
|
"@typescript-eslint/parser": "^5.4.0",
|
||||||
"concurrently": "^7.0.0",
|
"concurrently": "^6.0.0",
|
||||||
"eslint": "^8.3.0",
|
"eslint": "^8.2.0",
|
||||||
"eslint-plugin-import": "^2.25.3",
|
"feather-icons": "^4.28.0",
|
||||||
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
||||||
"eslint-plugin-svelte3": "^3.2.1",
|
|
||||||
"imagemin-gifsicle": "^7.0.0",
|
"imagemin-gifsicle": "^7.0.0",
|
||||||
"imagemin-mozjpeg": "^10.0.0",
|
"imagemin-mozjpeg": "^9.0.0",
|
||||||
"imagemin-pngquant": "^9.0.2",
|
"imagemin-pngquant": "^9.0.2",
|
||||||
"imagemin-svgo": "^10.0.0",
|
"imagemin-svgo": "^10.0.0",
|
||||||
"imagemin-webp": "^7.0.0",
|
"imagemin-webp": "^6.0.0",
|
||||||
"jest": "^27.0.4",
|
"jest": "^27.0.4",
|
||||||
"maildev": "^1.1.0",
|
"maildev": "^1.1.0",
|
||||||
"nodemon": "^2.0.3",
|
"nodemon": "^2.0.3",
|
||||||
"sass": "^1.32.12",
|
"sass": "^1.32.12",
|
||||||
"svelte": "^3.44.2",
|
|
||||||
"svgo": "^2.3.0",
|
"svgo": "^2.3.0",
|
||||||
"ts-jest": "^27.0.3",
|
"ts-jest": "^27.0.3",
|
||||||
"typescript": "^4.0.2"
|
"typescript": "^4.0.2"
|
||||||
|
@ -53,6 +51,6 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"config": "^3.3.1",
|
"config": "^3.3.1",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"swaf": "^0.25.1"
|
"swaf": "^0.24.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
39
src/App.ts
39
src/App.ts
|
@ -1,31 +1,30 @@
|
||||||
import Application from "swaf/Application";
|
import Application from "swaf/Application";
|
||||||
import AutoUpdateComponent from "swaf/components/AutoUpdateComponent";
|
import Migration, {MigrationType} from "swaf/db/Migration";
|
||||||
import CsrfProtectionComponent from "swaf/components/CsrfProtectionComponent";
|
import CreateMigrationsTable from "swaf/migrations/CreateMigrationsTable";
|
||||||
import ExpressAppComponent from "swaf/components/ExpressAppComponent";
|
import ExpressAppComponent from "swaf/components/ExpressAppComponent";
|
||||||
import FormHelperComponent from "swaf/components/FormHelperComponent";
|
|
||||||
import FrontendToolsComponent from "swaf/components/FrontendToolsComponent";
|
|
||||||
import LogRequestsComponent from "swaf/components/LogRequestsComponent";
|
|
||||||
import MailComponent from "swaf/components/MailComponent";
|
|
||||||
import MaintenanceComponent from "swaf/components/MaintenanceComponent";
|
|
||||||
import MysqlComponent from "swaf/components/MysqlComponent";
|
import MysqlComponent from "swaf/components/MysqlComponent";
|
||||||
import PreviousUrlComponent from "swaf/components/PreviousUrlComponent";
|
import LogRequestsComponent from "swaf/components/LogRequestsComponent";
|
||||||
import RedisComponent from "swaf/components/RedisComponent";
|
import RedisComponent from "swaf/components/RedisComponent";
|
||||||
import ServeStaticDirectoryComponent from "swaf/components/ServeStaticDirectoryComponent";
|
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 SessionComponent from "swaf/components/SessionComponent";
|
||||||
|
import FormHelperComponent from "swaf/components/FormHelperComponent";
|
||||||
|
import CsrfProtectionComponent from "swaf/components/CsrfProtectionComponent";
|
||||||
import WebSocketServerComponent from "swaf/components/WebSocketServerComponent";
|
import WebSocketServerComponent from "swaf/components/WebSocketServerComponent";
|
||||||
import Migration, {MigrationType} from "swaf/db/Migration";
|
import HomeController from "./controllers/HomeController";
|
||||||
import AssetCompiler from "swaf/frontend/AssetCompiler";
|
import AutoUpdateComponent from "swaf/components/AutoUpdateComponent";
|
||||||
import CopyAssetPreCompiler from "swaf/frontend/CopyAssetPreCompiler";
|
|
||||||
import MailViewEngine from "swaf/frontend/MailViewEngine";
|
|
||||||
import NunjucksViewEngine from "swaf/frontend/NunjucksViewEngine";
|
|
||||||
import ScssAssetPreCompiler from "swaf/frontend/ScssAssetPreCompiler";
|
|
||||||
import SvelteViewEngine from "swaf/frontend/SvelteViewEngine";
|
|
||||||
import TypeScriptPreCompiler from "swaf/frontend/TypeScriptPreCompiler";
|
|
||||||
import CreateMigrationsTable from "swaf/migrations/CreateMigrationsTable";
|
|
||||||
import DropLegacyLogsTable from "swaf/migrations/DropLegacyLogsTable";
|
|
||||||
import DummyMigration from "swaf/migrations/DummyMigration";
|
import DummyMigration from "swaf/migrations/DummyMigration";
|
||||||
|
import DropLegacyLogsTable from "swaf/migrations/DropLegacyLogsTable";
|
||||||
import HomeController from "./controllers/HomeController.js";
|
import PreviousUrlComponent from "swaf/components/PreviousUrlComponent";
|
||||||
|
import MailViewEngine from "swaf/frontend/MailViewEngine";
|
||||||
|
import AssetCompiler from "swaf/frontend/AssetCompiler";
|
||||||
|
import FrontendToolsComponent from "swaf/components/FrontendToolsComponent";
|
||||||
|
import CopyAssetPreCompiler from "swaf/frontend/CopyAssetPreCompiler";
|
||||||
|
import ScssAssetPreCompiler from "swaf/frontend/ScssAssetPreCompiler";
|
||||||
|
import TypeScriptPreCompiler from "swaf/frontend/TypeScriptPreCompiler";
|
||||||
|
import SvelteViewEngine from "swaf/frontend/SvelteViewEngine";
|
||||||
|
import NunjucksViewEngine from "swaf/frontend/NunjucksViewEngine";
|
||||||
|
|
||||||
export default class App extends Application {
|
export default class App extends Application {
|
||||||
public constructor(
|
public constructor(
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
console.log('common code between back and front');
|
console.log('common code between back and front');
|
|
@ -1,6 +1,6 @@
|
||||||
|
import Controller from "swaf/Controller";
|
||||||
import {Request, Response} from "express";
|
import {Request, Response} from "express";
|
||||||
import {route} from "swaf/common/Routing";
|
import {route} from "swaf/common/Routing";
|
||||||
import Controller from "swaf/Controller";
|
|
||||||
|
|
||||||
export default class HomeController extends Controller {
|
export default class HomeController extends Controller {
|
||||||
public routes(): void {
|
public routes(): void {
|
||||||
|
|
|
@ -6,11 +6,10 @@ process.env['NODE_CONFIG_DIR'] =
|
||||||
+ delimiter
|
+ delimiter
|
||||||
+ (process.env['NODE_CONFIG_DIR'] || __dirname + '/../config/');
|
+ (process.env['NODE_CONFIG_DIR'] || __dirname + '/../config/');
|
||||||
|
|
||||||
|
import {logger} from "swaf/Logger";
|
||||||
|
import App from "./App";
|
||||||
import config from "config";
|
import config from "config";
|
||||||
import {promises as fs} from "fs";
|
import {promises as fs} from "fs";
|
||||||
import {logger} from "swaf/Logger";
|
|
||||||
|
|
||||||
import App from "./App.js";
|
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
logger.debug('Config path:', process.env['NODE_CONFIG_DIR']);
|
logger.debug('Config path:', process.env['NODE_CONFIG_DIR']);
|
||||||
|
|
Loading…
Reference in New Issue