lsp-yggdrasil/build.js

47 lines
1.8 KiB
JavaScript
Raw Normal View History

import esbuild from 'esbuild'
import exec from 'shelljs.exec'
const productionVersion = "1.0"
const build = exec('git log -n 1 --pretty=format:"%h-%GK"', { async: false }).stdout
const type = exec('git log -n 1 --pretty=format:"%D"', { async: false }).stdout
const buildDate = new Date().toTimeString()
const banner = `
==========================================================================
__ _____ ______ __ __ _ __
/ / / ___// __ \\ \\/ /___ _____ _____/ /________ ______(_) /
/ / \\__ \\/ /_/ /\\ / __ \`/ __ \`/ __ / ___/ __ \`/ ___/ / /
/ /______/ / ____/ / / /_/ / /_/ / /_/ / / / /_/ (__ ) / /
/_____/____/_/ /_/\\__, /\\__, /\\__,_/_/ \\__,_/____/_/_/
/____//____/
A high performance mojang yggdrasil and authlib-injector implmentation
Version ${productionVersion} ${build}
Build on ${buildDate}
THIS PROGRAM IS FREE AND OPENSOURCE UNDER THE Anti-996 LICENSE (996.icu)
Copyright (c) 2022-present, Qumolama.d
==========================================================================
`
console.log(banner)
if(type.indexOf('stable') === -1) {
console.warn("⚠ 警告: 此版本不是正式版,运行可能会存在性能、安全、稳定度等严重风险,请谨慎使用!\n")
}
console.log("正在创建运行时文件...")
esbuild.build({
entryPoints: ['./src/index.js'],
outfile: './production/lsp-yggdrasil.full.cjs',
bundle: true,
platform: 'node',
target: 'es2018',
banner: {
js: `/*\n${banner}\n*/;const PROGRAM_PRODUCTION = true;`
},
}).then(() => {
console.log("一份运行时文件已保存在 production/lsp-yggdrasil.full.js您可以尽情的体验和LSP一样快的世界树服务器了")
})