wip: monorepo化
This commit is contained in:
parent
95d763713e
commit
51879522d8
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,5 +1,5 @@
|
||||
node_modules
|
||||
built
|
||||
node_modules/
|
||||
dist/
|
||||
yarn-error.log
|
||||
config.json
|
||||
.yarn
|
||||
|
3
apps/backend/.eslintrc.js
Normal file
3
apps/backend/.eslintrc.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
"extends": ["tools-eslint-config"]
|
||||
}
|
@ -1,49 +1,47 @@
|
||||
{
|
||||
"name": "tools-backend",
|
||||
"version": "1.0.0",
|
||||
"name": "tools-backend",
|
||||
"version": "4.0.0-dev",
|
||||
"author": "Shrimpia Network",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build:backend": "run-s build:*",
|
||||
"start": "node built/app.js",
|
||||
"build:backend-source": "tsc",
|
||||
"build:views": "copyfiles -u 1 src/backend/views/*.pug ./built/",
|
||||
"build:assets": "copyfiles -u 1 assets/* ./built/assets/",
|
||||
"build:meta": "node ./build-meta.js",
|
||||
"build:styles": "sass styles/:built/assets",
|
||||
"dev": "nodemon",
|
||||
"clean": "rimraf built",
|
||||
"tsc": "tsc",
|
||||
"lint": "eslint --ext .ts,.tsx src",
|
||||
"lint:fix": "eslint --fix --ext .ts,.tsx src",
|
||||
"scripts": {
|
||||
"build": "tsup src/app.ts --format esm",
|
||||
"clean": "rimraf dist",
|
||||
"dev": "tsup src/app.ts --format esm --watch --onSuccess \"node dist/app.js\"",
|
||||
"lint": "eslint --fix \"src/**/*.ts*\"",
|
||||
"start": "node dist/app.js",
|
||||
"migrate": "prisma migrate dev",
|
||||
"test": "jest --detectOpenHandles",
|
||||
"migrate:gen": "prisma migrate dev --create-only --name"
|
||||
},
|
||||
"dependencies": {
|
||||
"tools-jest-presets": "workspace:*",
|
||||
"tools-shared": "workspace:*",
|
||||
"@koa/multer": "^3.0.2",
|
||||
"@prisma/client": "^4.12.0",
|
||||
"axios": "^0.21.2",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.14.0",
|
||||
"axios": "^0.21.2",
|
||||
"dayjs": "^1.10.7",
|
||||
"jest": "^26.6.3",
|
||||
"koa": "^2.13.0",
|
||||
"koa-bodyparser": "^4.3.0",
|
||||
"koa-router": "^9.1.0",
|
||||
"koa-send": "^5.0.1",
|
||||
"koa-session": "^6.0.0",
|
||||
"koa-views": "^6.3.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"dayjs": "^1.10.7",
|
||||
"pug": "^3.0.0",
|
||||
"routing-controllers": "^0.10.1",
|
||||
"rndstr": "^1.0.0",
|
||||
"markdown-it": "^12.3.2",
|
||||
"ms": "^2.1.3",
|
||||
"node-cron": "^2.0.3",
|
||||
"pg": "^8.3.0",
|
||||
"uuid": "^8.3.0",
|
||||
"ms": "^2.1.3",
|
||||
"typescript": "^4.9.5"
|
||||
"pug": "^3.0.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rndstr": "^1.0.0",
|
||||
"routing-controllers": "^0.10.1",
|
||||
"striptags": "^3.2.0",
|
||||
"typescript": "^5.0.2",
|
||||
"uuid": "^8.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/uuid": "^8.0.0",
|
||||
"@types/koa": "^2.11.3",
|
||||
"@types/koa-bodyparser": "^4.3.0",
|
||||
"@types/koa-router": "^7.4.1",
|
||||
@ -53,14 +51,15 @@
|
||||
"@types/ms": "^0.7.31",
|
||||
"@types/node": "^18.14.1",
|
||||
"@types/node-cron": "^2.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
||||
"@typescript-eslint/parser": "^5.53.0",
|
||||
"@types/uuid": "^8.0.0",
|
||||
"copyfiles": "^2.3.0",
|
||||
"eslint": "^8.34.0",
|
||||
"nodemon": "^2.0.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prisma": "^4.12.0",
|
||||
"rimraf": "^4.1.2",
|
||||
"ts-node": "10.9.1"
|
||||
"tools-eslint-config": "workspace:*",
|
||||
"tools-tsconfig": "workspace:*",
|
||||
"ts-node": "10.9.1",
|
||||
"tsup": "^6.2.3"
|
||||
}
|
||||
}
|
@ -4,9 +4,11 @@ import fs from 'fs';
|
||||
|
||||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
|
||||
export const config = Object.freeze(JSON.parse(fs.readFileSync(__dirname + '/../config.json', 'utf-8')));
|
||||
export const config = Object.freeze(JSON.parse(fs.readFileSync(__dirname + '/../../../config.json', 'utf-8')));
|
||||
|
||||
export const meta: MetaJson = Object.freeze(JSON.parse(fs.readFileSync(__dirname + '/meta.json', 'utf-8')));
|
||||
export const meta: MetaJson = {
|
||||
version: process.env.npm_package_version as string,
|
||||
};
|
||||
|
||||
export type MetaJson = {
|
||||
version: string;
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { BadRequestError, CurrentUser, Get, JsonController, OnUndefined, Post } from 'routing-controllers';
|
||||
import { IUser } from '../../common/types/user.js';
|
||||
import { IUser } from 'tools-shared/dist/types/user.js';
|
||||
import { config } from '../config.js';
|
||||
import { work } from '../services/worker.js';
|
||||
import * as Store from '../store.js';
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { BadRequestError, Body, CurrentUser, Delete, Get, JsonController, NotFoundError, OnUndefined, Param, Post, Put } from 'routing-controllers';
|
||||
import { IUser } from '../../common/types/user.js';
|
||||
import { IUser } from 'tools-shared/dist/types/user.js';
|
||||
import { AnnounceCreate } from './body/announce-create.js';
|
||||
import { AnnounceUpdate } from './body/announce-update.js';
|
||||
import { IdProp } from './body/id-prop.js';
|
@ -1,6 +1,6 @@
|
||||
import { IsIn, IsOptional } from 'class-validator';
|
||||
import { AlertMode, alertModes } from '../../../common/types/alert-mode.js';
|
||||
import { visibilities, Visibility } from '../../../common/types/visibility.js';
|
||||
import { AlertMode, alertModes } from '../tools-shared/dist/types/alert-mode.js';
|
||||
import { visibilities, Visibility } from '../tools-shared/dist/types/visibility.js';
|
||||
|
||||
export class UserSetting {
|
||||
@IsIn(alertModes)
|
@ -4,8 +4,8 @@
|
||||
*/
|
||||
|
||||
import { Get, JsonController } from 'routing-controllers';
|
||||
import { Meta } from '../../common/types/meta.js';
|
||||
import { currentTokenVersion } from '../const.js';
|
||||
import { Meta } from 'tools-shared/dist/types/meta.js';
|
||||
import { currentTokenVersion } from 'tools-shared/dist/const.js';
|
||||
import { meta } from '../config.js';
|
||||
|
||||
@JsonController('/meta')
|
@ -6,7 +6,7 @@ import { meta } from './config.js';
|
||||
|
||||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
|
||||
export const render = views(__dirname + '/views', {
|
||||
export const render = views(__dirname + '/../public/views', {
|
||||
extension: 'pug',
|
||||
options: { version: meta.version },
|
||||
});
|
@ -1,6 +1,6 @@
|
||||
import {User} from '@prisma/client';
|
||||
import {Count} from '../types/count.js';
|
||||
import {toSignedString} from '../../common/functions/to-signed-string.js';
|
||||
import {toSignedString} from 'tools-shared/dist/functions/to-signed-string.js';
|
||||
|
||||
/**
|
||||
* ユーザーのスコア差分を取得します。
|
@ -1,5 +1,5 @@
|
||||
import {api} from '../services/misskey/misskey.js';
|
||||
import {Score} from '../../common/types/score.js';
|
||||
import {Score} from 'tools-shared/dist/types/score.js';
|
||||
import {User} from '@prisma/client';
|
||||
import {MiUser} from '../types/mi-user.js';
|
||||
import {getDelta} from './get-delta.js';
|
@ -1,4 +1,4 @@
|
||||
import {IUser} from '../../common/types/user.js';
|
||||
import {IUser} from 'tools-shared/dist/types/user.js';
|
||||
import {prisma} from '../libs/prisma.js';
|
||||
import {packUser} from './pack-user.js';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {IUser} from '../../common/types/user.js';
|
||||
import {IUser} from 'tools-shared/dist/types/user.js';
|
||||
import {User} from '@prisma/client';
|
||||
import {prisma} from '../libs/prisma.js';
|
||||
import {DeepPartial} from '../types/deep-partial.js';
|
@ -1,5 +1,5 @@
|
||||
import {User} from '@prisma/client';
|
||||
import {IUser} from '../../common/types/user.js';
|
||||
import {IUser} from 'tools-shared/dist/types/user.js';
|
||||
import {config} from '../config.js';
|
||||
|
||||
/**
|
@ -1,5 +1,5 @@
|
||||
import {prisma} from '../libs/prisma.js';
|
||||
import {currentTokenVersion} from '../const.js';
|
||||
import {currentTokenVersion} from 'tools-shared/dist/const.js';
|
||||
import {updateUsersToolsToken} from './update-users-tools-token.js';
|
||||
import {getUser} from './get-user.js';
|
||||
|
@ -12,7 +12,7 @@ import { config } from './config.js';
|
||||
import { getUser, updateUser } from './repositories/get-user.js';
|
||||
import { api } from './services/misskey/misskey.js';
|
||||
import { die } from './die.js';
|
||||
import { misskeyAppInfo } from './const.js';
|
||||
import { misskeyAppInfo } from 'tools-shared/dist/const.js';
|
||||
import path from 'path';
|
||||
import url from 'url';
|
||||
import {prisma} from './libs/prisma.js';
|
@ -1,5 +1,5 @@
|
||||
import { api } from './misskey/misskey.js';
|
||||
import {format} from '../../common/functions/format.js';
|
||||
import {format} from '../utils/format.js';
|
||||
import {getScores} from '../repositories/get-scores.js';
|
||||
import {User} from '@prisma/client';
|
||||
|
@ -8,7 +8,7 @@ import {clearLog, printLog} from '../store.js';
|
||||
import {errorToString} from '../utils/error-to-string.js';
|
||||
import {Acct} from '../types/acct.js';
|
||||
import {Count} from '../types/count.js';
|
||||
import {format} from '../../common/functions/format.js';
|
||||
import {format} from '../utils/format.js';
|
||||
import {delay} from '../utils/delay.js';
|
||||
import {prisma} from '../libs/prisma.js';
|
||||
import {User} from '@prisma/client';
|
@ -1,11 +1,10 @@
|
||||
import { config } from '../../backend/config.js';
|
||||
import { Score } from '../types/score.js';
|
||||
import { defaultTemplate } from '../../backend/const.js';
|
||||
import { IUser } from '../types/user.js';
|
||||
import { createGacha } from './create-gacha.js';
|
||||
import {Count} from '../../backend/types/count.js';
|
||||
|
||||
import {getDelta} from '../../backend/repositories/get-delta.js';
|
||||
import { config } from '../config.js';
|
||||
import { defaultTemplate } from 'tools-shared/dist/const.js';
|
||||
import { Score } from 'tools-shared/dist/types/score.js';
|
||||
import { IUser } from 'tools-shared/dist/types/user.js';
|
||||
import { createGacha } from 'tools-shared/dist/functions/create-gacha.js';
|
||||
import { Count } from '../types/count.js';
|
||||
import { getDelta } from '../repositories/get-delta.js';
|
||||
|
||||
/**
|
||||
* 埋め込み変数の型
|
9
apps/backend/tsconfig.json
Normal file
9
apps/backend/tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2021",
|
||||
"module": "esnext",
|
||||
"outDir": "./dist/",
|
||||
"rootDir": "./src/",
|
||||
},
|
||||
"extends": "tools-tsconfig/base.json",
|
||||
}
|
3
apps/frontend/.eslintrc.js
Normal file
3
apps/frontend/.eslintrc.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
"extends": ["tools-eslint-config"]
|
||||
}
|
52
apps/frontend/package.json
Normal file
52
apps/frontend/package.json
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "tools-frontend",
|
||||
"version": "0.0.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"clean": "rimraf dist",
|
||||
"dev": "vite --host 0.0.0.0 --port 3001 --clearScreen false",
|
||||
"lint": "tsc --noEmit && eslint \"src/**/*.ts*\""
|
||||
},
|
||||
"dependencies": {
|
||||
"tools-ui": "workspace:*",
|
||||
"@babel/preset-react": "^7.14.5",
|
||||
"@reduxjs/toolkit": "^1.6.1",
|
||||
"css-loader": "^6.2.0",
|
||||
"dayjs": "^1.10.7",
|
||||
"deepmerge": "^4.2.2",
|
||||
"i18next": "^20.6.1",
|
||||
"i18next-browser-languagedetector": "^6.1.2",
|
||||
"insert-text-at-cursor": "^0.3.0",
|
||||
"json5-loader": "^4.0.1",
|
||||
"markdown-it": "^12.3.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-i18next": "^11.12.0",
|
||||
"react-image-crop": "^9.0.5",
|
||||
"react-markdown": "^8.0.0",
|
||||
"react-modal-hook": "^3.0.0",
|
||||
"react-redux": "^7.2.9",
|
||||
"react-router-dom": "^5.2.1",
|
||||
"react-twemoji": "^0.5.0",
|
||||
"sass": "^1.38.2",
|
||||
"striptags": "^3.2.0",
|
||||
"styled-components": "^5.3.1",
|
||||
"typescript": "^4.9.5",
|
||||
"xeltica-ui": "xeltica-studio/design-system"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tools-eslint-config": "workspace:*",
|
||||
"tools-tsconfig": "workspace:*",
|
||||
"@types/markdown-it": "^12.2.3",
|
||||
"@types/react": "^17.0.19",
|
||||
"@types/react-dom": "^17.0.9",
|
||||
"@types/react-router-dom": "^5.1.8",
|
||||
"@types/react-twemoji": "^0.4.0",
|
||||
"@types/styled-components": "^5.1.13",
|
||||
"@vitejs/plugin-react": "^2.1.0",
|
||||
"eslint": "^7.32.0",
|
||||
"typescript": "^4.8.3",
|
||||
"vite": "^3.1.0"
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { IAnnouncement } from '../../common/types/announcement';
|
||||
import { IAnnouncement } from 'tools-shared/dist/types/announcement';
|
||||
import { $get } from '../misc/api';
|
||||
|
||||
export const AnnouncementList: React.VFC = () => {
|
@ -1,5 +1,5 @@
|
||||
import React, {useMemo, useState} from 'react';
|
||||
import {Log} from '../../common/types/log.js';
|
||||
import {Log} from 'tools-shared/dist/types/log.js';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const LogItem: React.FC<{log: Log}> = ({log}) => {
|
@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { IAnnouncement } from '../../common/types/announcement';
|
||||
import { IAnnouncement } from 'tools-shared/dist/types/announcement';
|
||||
import { $get } from '../misc/api';
|
||||
|
||||
export const useAnnouncements = () => {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user