Organize imports better
This commit is contained in:
parent
e2bdaf6603
commit
b4f707da19
35
package-lock.json
generated
35
package-lock.json
generated
@ -235,6 +235,12 @@
|
|||||||
"integrity": "sha512-mzJX3tIbtadNZQIDbfA9eW+mAjww7GY7WYcfKDGB5SSXMAzI8KD+5fvyX5FqcKtns346+WGwAJJ8cPsDxMz0lw==",
|
"integrity": "sha512-mzJX3tIbtadNZQIDbfA9eW+mAjww7GY7WYcfKDGB5SSXMAzI8KD+5fvyX5FqcKtns346+WGwAJJ8cPsDxMz0lw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/json5": {
|
||||||
|
"version": "0.0.29",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||||
|
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/keygrip": {
|
"@types/keygrip": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.1.tgz",
|
||||||
@ -1492,6 +1498,15 @@
|
|||||||
"esprima": "^4.0.0"
|
"esprima": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"json5": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"minimist": "^1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"leven": {
|
"leven": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz",
|
||||||
@ -2504,6 +2519,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"tsconfig-paths": {
|
||||||
|
"version": "3.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz",
|
||||||
|
"integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/json5": "^0.0.29",
|
||||||
|
"json5": "^1.0.1",
|
||||||
|
"minimist": "^1.2.0",
|
||||||
|
"strip-bom": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"strip-bom": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"tslib": {
|
"tslib": {
|
||||||
"version": "1.10.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"tsc": "tsc",
|
"tsc": "tsc",
|
||||||
"dev": "ts-node-dev -r dotenv/config --respawn --transpile-only ./src/index.ts",
|
"dev": "ts-node-dev -r dotenv/config -r tsconfig-paths/register --respawn --transpile-only ./src/index.ts",
|
||||||
"prod": "tsc && node ./dist/index.js",
|
"prod": "tsc && node ./dist/index.js",
|
||||||
"tslint-check": "tslint-config-prettier-check ./tslint.json"
|
"tslint-check": "tslint-config-prettier-check ./tslint.json"
|
||||||
},
|
},
|
||||||
@ -43,6 +43,7 @@
|
|||||||
"@types/pino": "^5.8.10",
|
"@types/pino": "^5.8.10",
|
||||||
"pino-pretty": "^3.2.1",
|
"pino-pretty": "^3.2.1",
|
||||||
"ts-node-dev": "^1.0.0-pre.43",
|
"ts-node-dev": "^1.0.0-pre.43",
|
||||||
|
"tsconfig-paths": "^3.9.0",
|
||||||
"tslint": "^5.20.0",
|
"tslint": "^5.20.0",
|
||||||
"tslint-config-prettier": "^1.18.0",
|
"tslint-config-prettier": "^1.18.0",
|
||||||
"typescript": "^3.6.3"
|
"typescript": "^3.6.3"
|
||||||
|
@ -13,13 +13,12 @@
|
|||||||
// 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 { ApolloServer, gql } from "apollo-server-express";
|
import { ApolloServer, gql } from "apollo-server-express";
|
||||||
import { Kind } from "graphql/language";
|
import { Kind } from "graphql/language";
|
||||||
import { GraphQLScalarType, GraphQLScalarTypeConfig } from "graphql/type";
|
import { GraphQLScalarType, GraphQLScalarTypeConfig } from "graphql/type";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
import { db } from "./db";
|
|
||||||
|
|
||||||
const typeDefs = gql`
|
const typeDefs = gql`
|
||||||
type Query {
|
type Query {
|
||||||
"A simple type for getting started"
|
"A simple type for getting started"
|
@ -13,8 +13,12 @@
|
|||||||
// 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 {
|
||||||
|
Extensions,
|
||||||
|
MigrationRepository,
|
||||||
|
UserRepository
|
||||||
|
} from "@kredens/db/repos";
|
||||||
import pgPromise, { IDatabase, IInitOptions } from "pg-promise";
|
import pgPromise, { IDatabase, IInitOptions } from "pg-promise";
|
||||||
import { Extensions, MigrationRepository, UserRepository } from "./repos";
|
|
||||||
|
|
||||||
type ExtendedProtocol = IDatabase<Extensions> & Extensions;
|
type ExtendedProtocol = IDatabase<Extensions> & Extensions;
|
||||||
|
|
||||||
|
@ -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 { MigrationRepository } from "./migrations";
|
import { MigrationRepository } from "@kredens/db/repos/migrations";
|
||||||
import { UserRepository } from "./users";
|
import { UserRepository } from "@kredens/db/repos/users";
|
||||||
|
|
||||||
export interface Extensions {
|
export interface Extensions {
|
||||||
migrations: MigrationRepository;
|
migrations: MigrationRepository;
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
// 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 { migrations as sql } from "@kredens/db/sql";
|
||||||
|
import logger from "@kredens/logger";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import { IDatabase, IMain } from "pg-promise";
|
import { IDatabase, IMain } from "pg-promise";
|
||||||
import logger from "../../logger";
|
|
||||||
import { Migration } from "../models";
|
|
||||||
import { migrations as sql } from "../sql";
|
|
||||||
|
|
||||||
export class MigrationRepository {
|
export class MigrationRepository {
|
||||||
private db: IDatabase<any>;
|
private db: IDatabase<any>;
|
||||||
|
@ -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 { users as sql } from "@kredens/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";
|
||||||
import { users as sql } from "../sql";
|
|
||||||
|
|
||||||
export class UserRepository {
|
export class UserRepository {
|
||||||
private db: IDatabase<any>;
|
private db: IDatabase<any>;
|
||||||
|
10
src/index.ts
10
src/index.ts
@ -13,16 +13,16 @@
|
|||||||
// 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 { server as graphqlServer } from "@kredens/api";
|
||||||
|
import { db } from "@kredens/db";
|
||||||
|
import logger from "@kredens/logger";
|
||||||
|
import authRouter from "@kredens/routes/auth";
|
||||||
|
import indexRouter from "@kredens/routes/index";
|
||||||
import cookieParser from "cookie-parser";
|
import cookieParser from "cookie-parser";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import pinoExpress from "express-pino-logger";
|
import pinoExpress from "express-pino-logger";
|
||||||
import helmet from "helmet";
|
import helmet from "helmet";
|
||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import { db } from "./db";
|
|
||||||
import { server as graphqlServer } from "./graphql";
|
|
||||||
import logger from "./logger";
|
|
||||||
import authRouter from "./routes/auth";
|
|
||||||
import indexRouter from "./routes/index";
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
await db.tx(async t => {
|
await db.tx(async t => {
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
// 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 { db } from "@kredens/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";
|
||||||
import { box, unbox } from "../crypto";
|
|
||||||
import { db } from "../db";
|
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
|
@ -6,6 +6,11 @@
|
|||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"baseUrl": "./src",
|
"baseUrl": "./src",
|
||||||
|
"paths": {
|
||||||
|
"@kredens/*": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
},
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
"jsRules": {},
|
"jsRules": {},
|
||||||
"rules": {
|
"rules": {
|
||||||
"interface-name": [ true, "never-prefix"],
|
"interface-name": [ true, "never-prefix"],
|
||||||
"no-submodule-imports": [true, "graphql/language", "graphql/type"]
|
"no-submodule-imports": [true, "graphql/language", "graphql/type", "@kredens"],
|
||||||
|
"no-implicit-dependencies": [true, ["@kredens"]]
|
||||||
},
|
},
|
||||||
"rulesDirectory": []
|
"rulesDirectory": []
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user