15005c4266
# Conflicts: # .config/docker_example.env # .config/docker_example.yml # CHANGELOG.md # locales/index.d.ts # locales/ja-JP.yml # packages/backend/package.json # packages/backend/src/core/entities/UserEntityService.ts # packages/backend/src/server/api/endpoints/i/update.ts # packages/frontend/package.json # packages/frontend/src/components/MkChannelFollowButton.vue # packages/frontend/src/components/MkFollowButton.vue # packages/frontend/src/components/MkMediaAudio.vue # packages/frontend/src/components/MkMenu.vue # packages/frontend/src/components/MkNote.vue # packages/frontend/src/components/MkNoteDetailed.vue # packages/frontend/src/components/MkPostForm.vue # packages/frontend/src/components/MkRadio.vue # packages/frontend/src/components/MkSuperMenu.vue # packages/frontend/src/components/MkSwitch.vue # packages/frontend/src/components/MkVisitorDashboard.vue # packages/frontend/src/os.ts # packages/frontend/src/pages/about.vue # packages/frontend/src/pages/admin/roles.editor.vue # packages/frontend/src/pages/admin/roles.vue # packages/frontend/src/pages/custom-emojis-manager.vue # packages/frontend/src/pages/follow.vue # packages/frontend/src/pages/timeline.vue # packages/frontend/src/pages/user/home.vue # packages/frontend/src/scripts/get-note-menu.ts # packages/frontend/src/scripts/keycode.ts # packages/frontend/src/ui/_common_/navbar-for-mobile.vue # packages/frontend/src/ui/_common_/navbar.vue # pnpm-lock.yaml
64 lines
1.9 KiB
JavaScript
64 lines
1.9 KiB
JavaScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project , Type4ny-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { execa, execaNode } from 'execa';
|
|
|
|
/** @type {import('execa').ExecaChildProcess | undefined} */
|
|
let backendProcess;
|
|
|
|
async function execBuildAssets() {
|
|
await execa('pnpm', ['run', 'build-assets'], {
|
|
cwd: '../../',
|
|
stdout: process.stdout,
|
|
stderr: process.stderr,
|
|
})
|
|
}
|
|
|
|
function execStart() {
|
|
// pnpm run start を呼び出したいが、windowsだとプロセスグループ単位でのkillが出来ずゾンビプロセス化するので
|
|
// 上記と同等の動きをするコマンドで子・孫プロセスを作らないようにしたい
|
|
backendProcess = execaNode('./built/boot/entry.js', [], {
|
|
stdout: process.stdout,
|
|
stderr: process.stderr,
|
|
env: {
|
|
'NODE_ENV': 'development',
|
|
},
|
|
});
|
|
}
|
|
|
|
async function killProc() {
|
|
if (backendProcess) {
|
|
backendProcess.catch(() => {}); // backendProcess.kill()によって発生する例外を無視するためにcatch()を呼び出す
|
|
backendProcess.kill();
|
|
await new Promise(resolve => backendProcess.on('exit', resolve));
|
|
backendProcess = undefined;
|
|
}
|
|
}
|
|
|
|
(async () => {
|
|
execaNode(
|
|
'./node_modules/nodemon/bin/nodemon.js',
|
|
[
|
|
'-w', 'src',
|
|
'-e', 'ts,js,mjs,cjs,json',
|
|
'--exec', 'pnpm', 'run', 'build',
|
|
],
|
|
{
|
|
stdio: [process.stdin, process.stdout, process.stderr, 'ipc'],
|
|
serialization: "json",
|
|
})
|
|
.on('message', async (message) => {
|
|
if (message.type === 'exit') {
|
|
// かならずbuild->build-assetsの順番で呼び出したいので、
|
|
// 少々トリッキーだがnodemonからのexitイベントを利用してbuild-assets->startを行う。
|
|
// pnpm restartをbuildが終わる前にbuild-assetsが動いてしまうので、バラバラに呼び出す必要がある
|
|
|
|
await killProc();
|
|
await execBuildAssets();
|
|
execStart();
|
|
}
|
|
})
|
|
})();
|