From 1a837bbef436f2d909c135ad273c3a84d6d32164 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 4 Jun 2022 08:01:02 +0000 Subject: [PATCH] wip --- .yarnrc.yml | 2 +- CONTRIBUTING.md | 4 ++-- package.json | 8 +++---- packages/backend/package.json | 9 +++++++- scripts/dev.js | 18 +++++++-------- yarn.lock | 42 ++++++++++++++++++++++++++--------- 6 files changed, 56 insertions(+), 27 deletions(-) diff --git a/.yarnrc.yml b/.yarnrc.yml index 270f7a611..a88a5811a 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -15,4 +15,4 @@ progressBarStyle: "patrick" packageExtensions: "chartjs-adapter-date-fns@*": peerDependencies: - date-fns: "*" + "date-fns": "*" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 67ffbfe40..c8fea1e02 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -117,7 +117,7 @@ yarn test #### Run specify test ``` -npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT="./test/tsconfig.json" npx mocha test/foo.ts --require ts-node/register +TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT="./test/tsconfig.json" yarn dlx mocha test/foo.ts --require ts-node/register ``` ### e2e tests @@ -222,7 +222,7 @@ MongoDBは`null`で返してきてたので、その感覚で`if (x === null)` ### Migration作成方法 packages/backendで: ```sh -npx typeorm migration:generate -d ormconfig.js -o +yarn dlx typeorm migration:generate -d ormconfig.js -o ``` - 生成後、ファイルをmigration下に移してください diff --git a/package.json b/package.json index 122bf79e8..4bda1ed9e 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,10 @@ "private": true, "scripts": { "build": "yarn workspaces foreach run build", - "start": "cd packages/backend && yarn node --experimental-json-modules ./built/index.js", - "start:test": "cd packages/backend && cross-env NODE_ENV=test yarn node --experimental-json-modules ./built/index.js", + "start": "yarn workspace backend run start", + "start:test": "yarn workspace backend run start:test", "init": "yarn migrate", - "migrate": "cd packages/backend && npx typeorm migration:run -d ormconfig.js", + "migrate": "yarn workspace backend run migrate", "migrateandstart": "yarn migrate && yarn start", "gulp": "gulp build", "watch": "yarn dev", @@ -27,7 +27,7 @@ "cy:open": "cypress open", "cy:run": "cypress run", "e2e": "start-server-and-test start:test http://localhost:61812 cy:run", - "mocha": "cd packages/backend && cross-env NODE_ENV=test TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" npx mocha", + "mocha": "yarn workspace backend run mocha", "test": "yarn mocha", "format": "gulp format", "clean": "node ./scripts/clean.js", diff --git a/packages/backend/package.json b/packages/backend/package.json index 0cca8e446..1053282d0 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -4,10 +4,13 @@ "private": true, "type": "module", "scripts": { + "start": "yarn node --experimental-json-modules ./built/index.js", + "start:test": "NODE_ENV=test yarn node --experimental-json-modules ./built/index.js", + "migrate": "typeorm migration:run -d ormconfig.js", "build": "tsc -p tsconfig.json || echo done. && tsc-alias -p tsconfig.json", "watch": "node watch.mjs", "lint": "eslint --quiet \"src/**/*.ts\"", - "mocha": "cross-env NODE_ENV=test TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha", + "mocha": "NODE_ENV=test TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha", "test": "yarn mocha" }, "packageManager": "yarn@3.2.1", @@ -16,7 +19,9 @@ "lodash": "^4.17.21" }, "dependencies": { + "@bull-board/api": "^3.11.1", "@bull-board/koa": "3.11.0", + "@bull-board/ui": "^3.11.1", "@discordapp/twemoji": "14.0.2", "@elastic/elasticsearch": "7.17.0", "@koa/cors": "3.3.0", @@ -76,6 +81,7 @@ "nested-property": "4.0.0", "node-fetch": "3.2.4", "nodemailer": "6.7.5", + "oauth": "^0.9.15", "os-utils": "0.0.14", "parse5": "6.0.1", "pg": "8.7.3", @@ -175,6 +181,7 @@ "eslint": "8.16.0", "eslint-plugin-import": "2.26.0", "execa": "6.1.0", + "form-data": "^4.0.0", "typescript": "4.7.2" } } diff --git a/scripts/dev.js b/scripts/dev.js index c5dbb7b35..b0fe12ee3 100644 --- a/scripts/dev.js +++ b/scripts/dev.js @@ -1,39 +1,39 @@ const execa = require('execa'); (async () => { - await execa('npm', ['run', 'clean'], { + await execa('yarn', ['clean'], { cwd: __dirname + '/../', stdout: process.stdout, stderr: process.stderr, }); - execa('npx', ['gulp', 'watch'], { + execa('yarn', ['dlx', 'gulp', 'watch'], { cwd: __dirname + '/../', stdout: process.stdout, stderr: process.stderr, }); - execa('npm', ['run', 'watch'], { - cwd: __dirname + '/../packages/backend', + execa('yarn', ['workspace', 'backend', 'watch'], { + cwd: __dirname + '/../', stdout: process.stdout, stderr: process.stderr, }); - execa('npm', ['run', 'watch'], { - cwd: __dirname + '/../packages/client', + execa('yarn', ['workspace', 'client', 'watch'], { + cwd: __dirname + '/../', stdout: process.stdout, stderr: process.stderr, }); - execa('npm', ['run', 'watch'], { - cwd: __dirname + '/../packages/sw', + execa('yarn', ['workspace', 'sw', 'watch'], { + cwd: __dirname + '/../', stdout: process.stdout, stderr: process.stderr, }); const start = async () => { try { - await execa('npm', ['run', 'start'], { + await execa('yarn', ['start'], { cwd: __dirname + '/../', stdout: process.stdout, stderr: process.stderr, diff --git a/yarn.lock b/yarn.lock index 9354e4190..beecf5ebb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -49,6 +49,15 @@ __metadata: languageName: node linkType: hard +"@bull-board/api@npm:3.11.1, @bull-board/api@npm:^3.11.1": + version: 3.11.1 + resolution: "@bull-board/api@npm:3.11.1" + dependencies: + redis-info: ^3.0.8 + checksum: 2dddd9847cc3b15030f07129068b0cfa3352b0c45e4de1c622634a0854ab9ec0fe06433f63eaa62d48ab7b5775cf8aad390711b25d44a24da11d567173ec47fa + languageName: node + linkType: hard + "@bull-board/koa@npm:3.11.0": version: 3.11.0 resolution: "@bull-board/koa@npm:3.11.0" @@ -74,6 +83,15 @@ __metadata: languageName: node linkType: hard +"@bull-board/ui@npm:^3.11.1": + version: 3.11.1 + resolution: "@bull-board/ui@npm:3.11.1" + dependencies: + "@bull-board/api": 3.11.1 + checksum: 316c7e53cdea8b0aa169d6390199e2ed682765facf345d94501c07cd28e8fd42a1601cc9893fcf7b9b00dfdf752e0941befb15738a2d4c34c77ef8b8c8dec827 + languageName: node + linkType: hard + "@colors/colors@npm:1.5.0": version: 1.5.0 resolution: "@colors/colors@npm:1.5.0" @@ -2478,7 +2496,9 @@ __metadata: version: 0.0.0-use.local resolution: "backend@workspace:packages/backend" dependencies: + "@bull-board/api": ^3.11.1 "@bull-board/koa": 3.11.0 + "@bull-board/ui": ^3.11.1 "@discordapp/twemoji": 14.0.2 "@elastic/elasticsearch": 7.17.0 "@koa/cors": 3.3.0 @@ -2562,6 +2582,7 @@ __metadata: feed: 4.2.2 file-type: 17.1.1 fluent-ffmpeg: 2.1.2 + form-data: ^4.0.0 got: 12.1.0 hpagent: 0.1.2 ip-cidr: 3.0.10 @@ -2590,6 +2611,7 @@ __metadata: nested-property: 4.0.0 node-fetch: 3.2.4 nodemailer: 6.7.5 + oauth: ^0.9.15 os-utils: 0.0.14 parse5: 6.0.1 pg: 8.7.3 @@ -7224,6 +7246,15 @@ __metadata: languageName: node linkType: hard +"iconv-lite@npm:*, iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2": + version: 0.6.3 + resolution: "iconv-lite@npm:0.6.3" + dependencies: + safer-buffer: ">= 2.1.2 < 3.0.0" + checksum: 3f60d47a5c8fc3313317edfd29a00a692cc87a19cac0159e2ce711d0ebc9019064108323b5e493625e25594f11c6236647d8e256fbe7a58f4a3b33b89e6d30bf + languageName: node + linkType: hard + "iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.4": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" @@ -7233,15 +7264,6 @@ __metadata: languageName: node linkType: hard -"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2": - version: 0.6.3 - resolution: "iconv-lite@npm:0.6.3" - dependencies: - safer-buffer: ">= 2.1.2 < 3.0.0" - checksum: 3f60d47a5c8fc3313317edfd29a00a692cc87a19cac0159e2ce711d0ebc9019064108323b5e493625e25594f11c6236647d8e256fbe7a58f4a3b33b89e6d30bf - languageName: node - linkType: hard - "idb-keyval@npm:6.1.0, idb-keyval@npm:^6.1.0": version: 6.1.0 resolution: "idb-keyval@npm:6.1.0" @@ -10044,7 +10066,7 @@ __metadata: languageName: node linkType: hard -"oauth@npm:0.9.15": +"oauth@npm:0.9.15, oauth@npm:^0.9.15": version: 0.9.15 resolution: "oauth@npm:0.9.15" checksum: 957c0d8d85300398dcb0e293953650c0fc3facc795bee8228238414f19f59cef5fd4ee8d17a972c142924c10c5f6ec50ef80f77f4a6cc6e3c98f9d22c027801c