2023-07-27 14:31:52 +09:00
|
|
|
/*
|
2024-02-20 16:08:12 +09:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 14:31:52 +09:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-12-20 13:05:36 +09:00
|
|
|
const fs = require('fs');
|
2023-12-14 20:16:02 +09:00
|
|
|
const packageJsonPath = __dirname + '/../package.json'
|
2022-12-20 13:05:36 +09:00
|
|
|
|
2023-12-14 20:16:02 +09:00
|
|
|
function build() {
|
|
|
|
try {
|
|
|
|
const json = fs.readFileSync(packageJsonPath, 'utf-8')
|
|
|
|
const meta = JSON.parse(json);
|
|
|
|
fs.mkdirSync(__dirname + '/../built', { recursive: true });
|
2023-12-15 02:48:07 +09:00
|
|
|
fs.writeFileSync(__dirname + '/../built/meta.json', JSON.stringify({ version: meta.version, basedMisskeyVersion: meta.basedMisskeyVersion }), 'utf-8');
|
2023-12-14 20:16:02 +09:00
|
|
|
} catch (e) {
|
|
|
|
console.error(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
build();
|
|
|
|
|
|
|
|
if (process.argv.includes("--watch")) {
|
|
|
|
fs.watch(packageJsonPath, (event, filename) => {
|
|
|
|
console.log(`update ${filename} ...`)
|
|
|
|
build()
|
|
|
|
})
|
|
|
|
}
|