2022-10-20 03:18:35 +02:00
|
|
|
/*
|
|
|
|
* The Peacock Project - a HITMAN server replacement.
|
2023-01-23 19:37:33 +01:00
|
|
|
* Copyright (C) 2021-2023 The Peacock Project Team
|
2022-10-20 03:18:35 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import picocolors from "picocolors"
|
2023-04-16 20:11:49 +02:00
|
|
|
import { generateRequireTable, packResources } from "./buildTasks.mjs"
|
2022-11-25 21:18:03 +01:00
|
|
|
import { createRequire, Module } from "module"
|
|
|
|
import { readFileSync } from "fs"
|
2022-10-20 03:18:35 +02:00
|
|
|
|
|
|
|
// this `require` instance will be hijacked by `esbuild-register` so we can load
|
|
|
|
// TS files as if they were JS in a CommonJS environment
|
|
|
|
const require = createRequire(import.meta.url)
|
|
|
|
|
2023-04-16 20:11:49 +02:00
|
|
|
await generateRequireTable()
|
2023-01-20 22:00:20 +01:00
|
|
|
await packResources()
|
2022-10-20 03:18:35 +02:00
|
|
|
|
|
|
|
const { version, revisionIdent } = require("../package.json")
|
|
|
|
|
|
|
|
global.PEACOCK_DEV = true
|
|
|
|
global.HUMAN_VERSION = version
|
|
|
|
global.REV_IDENT = revisionIdent
|
|
|
|
|
|
|
|
process.env.DEBUG = "peacock"
|
2023-03-26 20:59:57 +02:00
|
|
|
process.env.LOG_MAX_FILES = ""
|
2022-10-20 03:18:35 +02:00
|
|
|
|
|
|
|
// now we launch the server
|
|
|
|
|
|
|
|
console.log(
|
|
|
|
`${picocolors.greenBright(
|
|
|
|
">>> PeacockDev",
|
|
|
|
)} Spawning development server in ${process.cwd()}.`,
|
|
|
|
)
|
|
|
|
|
|
|
|
const { register } = require("esbuild-register/dist/node")
|
|
|
|
|
|
|
|
register()
|
|
|
|
|
2022-11-25 21:18:03 +01:00
|
|
|
const resolveTextFile = function (module, path) {
|
|
|
|
const content = readFileSync(path).toString()
|
|
|
|
|
|
|
|
module.exports = content
|
|
|
|
}
|
|
|
|
|
|
|
|
Module._extensions[".json"] = resolveTextFile
|
|
|
|
|
2022-10-20 03:18:35 +02:00
|
|
|
require("../components/index.ts")
|