Reorganize the codebase a bit for a cleaner layout
This commit is contained in:
parent
64b0cdc951
commit
fd264d3d41
@ -2,12 +2,12 @@
|
|||||||
"name": "kredens",
|
"name": "kredens",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "Where I keep my spoons",
|
"description": "Where I keep my spoons",
|
||||||
"main": "src/index.ts",
|
"main": "src/server/index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"tsc": "tsc --incremental ",
|
"tsc": "tsc --incremental ",
|
||||||
"dev": "ts-node-dev -r dotenv/config --watch src/**/*.sql -r tsconfig-paths/register --respawn --transpile-only ./src/index.ts",
|
"dev": "ts-node-dev -r dotenv/config --watch src/**/*.sql -r tsconfig-paths/register --respawn --transpile-only ./src/server/index.ts",
|
||||||
"prod": "tsc --incremental && node ./dist/src/index.js",
|
"prod": "tsc --incremental && node ./dist/src/server/index.js",
|
||||||
"tslint-check": "tslint-config-prettier-check ./tslint.json",
|
"tslint-check": "tslint-config-prettier-check ./tslint.json",
|
||||||
"migrate": "tsc --incremental && node ./dist/src/scripts/migrate.js"
|
"migrate": "tsc --incremental && node ./dist/src/scripts/migrate.js"
|
||||||
},
|
},
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { db } from "@kredens/db";
|
import { db } from "@kredens/server/db";
|
||||||
import { User } from "@kredens/db/models";
|
import { User } from "@kredens/server/db/models";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import { None } from "monet";
|
import { None } from "monet";
|
2
src/custom.d.ts → src/server/custom.d.ts
vendored
2
src/custom.d.ts → src/server/custom.d.ts
vendored
@ -13,7 +13,7 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { User } from "@kredens/db/models";
|
import { User } from "@kredens/server/db/models";
|
||||||
import { Cookie } from "@holdyourwaffle/express-session";
|
import { Cookie } from "@holdyourwaffle/express-session";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
@ -19,7 +19,7 @@ import {
|
|||||||
SessionRepository,
|
SessionRepository,
|
||||||
TaskRepository,
|
TaskRepository,
|
||||||
UserRepository
|
UserRepository
|
||||||
} from "@kredens/db/repos";
|
} from "@kredens/server/db/repos";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import pg from "pg";
|
import pg from "pg";
|
||||||
import pgPromise, { IDatabase, IInitOptions } from "pg-promise";
|
import pgPromise, { IDatabase, IInitOptions } from "pg-promise";
|
@ -13,10 +13,10 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { MigrationRepository } from "@kredens/db/repos/migrations";
|
import { MigrationRepository } from "@kredens/server/db/repos/migrations";
|
||||||
import { SessionRepository } from "@kredens/db/repos/sessions";
|
import { SessionRepository } from "@kredens/server/db/repos/sessions";
|
||||||
import { TaskRepository } from "@kredens/db/repos/tasks";
|
import { TaskRepository } from "@kredens/server/db/repos/tasks";
|
||||||
import { UserRepository } from "@kredens/db/repos/users";
|
import { UserRepository } from "@kredens/server/db/repos/users";
|
||||||
|
|
||||||
export interface Extensions {
|
export interface Extensions {
|
||||||
migrations: MigrationRepository;
|
migrations: MigrationRepository;
|
@ -13,9 +13,9 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { Migration } from "@kredens/db/models";
|
import { Migration } from "@kredens/server/db/models";
|
||||||
import { migrations as sql } from "@kredens/db/sql";
|
import { migrations as sql } from "@kredens/server/db/sql";
|
||||||
import logger from "@kredens/logger";
|
import logger from "@kredens/server/logger";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import { IDatabase, IMain } from "pg-promise";
|
import { IDatabase, IMain } from "pg-promise";
|
||||||
|
|
@ -13,8 +13,8 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { Session } from "@kredens/db/models";
|
import { Session } from "@kredens/server/db/models";
|
||||||
import { sessions as sql } from "@kredens/db/sql";
|
import { sessions as sql } from "@kredens/server/db/sql";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import { Maybe } from "monet";
|
import { Maybe } from "monet";
|
||||||
import { IDatabase, IMain } from "pg-promise";
|
import { IDatabase, IMain } from "pg-promise";
|
@ -13,8 +13,8 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { ScheduleType, Task } from "@kredens/db/models";
|
import { ScheduleType, Task } from "@kredens/server/db/models";
|
||||||
import { tasks as sql } from "@kredens/db/sql";
|
import { tasks as sql } from "@kredens/server/db/sql";
|
||||||
import { IDatabase, IMain } from "pg-promise";
|
import { IDatabase, IMain } from "pg-promise";
|
||||||
|
|
||||||
function rowToTask(row: any): Task {
|
function rowToTask(row: any): Task {
|
@ -13,8 +13,8 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { User } from "@kredens/db/models";
|
import { User } from "@kredens/server/db/models";
|
||||||
import { users as sql } from "@kredens/db/sql";
|
import { users as sql } from "@kredens/server/db/sql";
|
||||||
import argon2 from "argon2";
|
import argon2 from "argon2";
|
||||||
import { Maybe, None, Some } from "monet";
|
import { Maybe, None, Some } from "monet";
|
||||||
import { IDatabase, IMain } from "pg-promise";
|
import { IDatabase, IMain } from "pg-promise";
|
@ -14,12 +14,12 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import session, { SessionOptions } from "@holdyourwaffle/express-session";
|
import session, { SessionOptions } from "@holdyourwaffle/express-session";
|
||||||
import { authMiddleware } from "@kredens/auth";
|
import { authMiddleware } from "@kredens/server/auth";
|
||||||
import { db } from "@kredens/db";
|
import { db } from "@kredens/server/db";
|
||||||
import logger from "@kredens/logger";
|
import logger from "@kredens/server/logger";
|
||||||
import indexRouter from "@kredens/routes/";
|
import indexRouter from "@kredens/server/routes";
|
||||||
import bootstrapRouter from "@kredens/routes/bootstrap";
|
import bootstrapRouter from "@kredens/server/routes/bootstrap";
|
||||||
import { PgStore } from "@kredens/sessions";
|
import { PgStore } from "@kredens/server/sessions";
|
||||||
import cookieParser from "cookie-parser";
|
import cookieParser from "cookie-parser";
|
||||||
import csrf from "csurf";
|
import csrf from "csurf";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
@ -44,7 +44,7 @@ async function main() {
|
|||||||
const webpackDevMiddleware = await import("webpack-dev-middleware").then(
|
const webpackDevMiddleware = await import("webpack-dev-middleware").then(
|
||||||
p => p.default
|
p => p.default
|
||||||
);
|
);
|
||||||
const config = await import("../webpack.config").then(p => p.default);
|
const config = await import("../../webpack.config").then(p => p.default);
|
||||||
|
|
||||||
const compiler = webpack(config);
|
const compiler = webpack(config);
|
||||||
app.use(
|
app.use(
|
@ -13,7 +13,7 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { db } from "@kredens/db";
|
import { db } from "@kredens/server/db";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
@ -13,8 +13,8 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { box, unbox } from "@kredens/crypto";
|
import { box, unbox } from "@kredens/server/crypto";
|
||||||
import { db } from "@kredens/db";
|
import { db } from "@kredens/server/db";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
@ -14,7 +14,7 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { Store } from "@holdyourwaffle/express-session";
|
import { Store } from "@holdyourwaffle/express-session";
|
||||||
import { db } from "@kredens/db";
|
import { db } from "@kredens/server/db";
|
||||||
import { DateTime, Duration } from "luxon";
|
import { DateTime, Duration } from "luxon";
|
||||||
|
|
||||||
export class PgStore extends Store {
|
export class PgStore extends Store {
|
13
src/server/tslint.json
Normal file
13
src/server/tslint.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tslint.json",
|
||||||
|
"rules": {
|
||||||
|
"no-implicit-dependencies": [
|
||||||
|
true,
|
||||||
|
["@kredens/server"]
|
||||||
|
],
|
||||||
|
"no-submodule-imports": [
|
||||||
|
true,
|
||||||
|
"@kredens/server"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -4,14 +4,7 @@
|
|||||||
"jsRules": {},
|
"jsRules": {},
|
||||||
"rules": {
|
"rules": {
|
||||||
"interface-name": [true, "never-prefix"],
|
"interface-name": [true, "never-prefix"],
|
||||||
"no-submodule-imports": [
|
"no-implicit-dependencies": [true, ["@kredens"]],
|
||||||
true,
|
|
||||||
"graphql/language",
|
|
||||||
"graphql/type",
|
|
||||||
"vue-loader/lib/plugin",
|
|
||||||
"@kredens"
|
|
||||||
],
|
|
||||||
"no-implicit-dependencies": [true, ["@kredens", "@kredens/frontend"]],
|
|
||||||
"object-literal-sort-keys": [
|
"object-literal-sort-keys": [
|
||||||
true,
|
true,
|
||||||
"match-declaration-order-only",
|
"match-declaration-order-only",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user