yumechi-no-kuni/scripts/build-pre.js
eternal-flame-AD 8652fd27b9
All checks were successful
Lint / pnpm_install (pull_request) Successful in 1m43s
Publish Docker image / Build (pull_request) Successful in 4m40s
Test (production install and build) / production (20.16.0) (pull_request) Successful in 1m8s
Test (backend) / unit (20.16.0) (pull_request) Successful in 7m13s
Lint / lint (backend) (pull_request) Successful in 2m31s
Lint / lint (frontend) (pull_request) Successful in 2m45s
Lint / lint (frontend-embed) (pull_request) Successful in 2m21s
Lint / lint (frontend-shared) (pull_request) Successful in 2m19s
Test (backend) / e2e (20.16.0) (pull_request) Successful in 11m14s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m24s
Lint / lint (misskey-js) (pull_request) Successful in 2m33s
Lint / lint (sw) (pull_request) Successful in 2m39s
Lint / lint (misskey-reversi) (pull_request) Successful in 3m7s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m34s
Lint / typecheck (backend) (pull_request) Successful in 2m38s
Lint / typecheck (sw) (pull_request) Successful in 2m2s
add git info to build
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
2024-11-10 00:41:40 -06:00

36 lines
974 B
JavaScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
const fs = require('fs');
const child_process = require('child_process');
const packageJsonPath = __dirname + '/../package.json'
function build() {
try {
const gitDescribe = child_process.execSync('git describe --tags --always').toString().trim();
const gitCommit = child_process.execSync('git rev-parse HEAD').toString().trim();
const json = fs.readFileSync(packageJsonPath, 'utf-8')
const meta = JSON.parse(json);
fs.mkdirSync(__dirname + '/../built', { recursive: true });
fs.writeFileSync(__dirname + '/../built/meta.json',
JSON.stringify(
{
version: meta.version,
gitCommit: gitCommit,
gitDescribe: gitDescribe,
}), 'utf-8');
} catch (e) {
console.error(e)
}
}
build();
if (process.argv.includes("--watch")) {
fs.watch(packageJsonPath, (event, filename) => {
console.log(`update ${filename} ...`)
build()
})
}