2023-07-27 08:31:52 +03:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2024-02-09 15:42:08 +02:00
|
|
|
// eslint-disable detect-non-literal-fs-filename
|
|
|
|
|
2022-12-20 06:05:36 +02:00
|
|
|
const fs = require('fs');
|
2023-12-14 13:16:02 +02:00
|
|
|
const packageJsonPath = __dirname + '/../package.json'
|
2022-12-20 06:05:36 +02:00
|
|
|
|
2023-12-14 13:16:02 +02:00
|
|
|
function build() {
|
|
|
|
try {
|
|
|
|
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 }), 'utf-8');
|
|
|
|
} catch (e) {
|
2024-02-09 16:04:11 +02:00
|
|
|
console.error(e) // njsscan-ignore:generic_error_disclosure
|
2023-12-14 13:16:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
build();
|
|
|
|
|
|
|
|
if (process.argv.includes("--watch")) {
|
|
|
|
fs.watch(packageJsonPath, (event, filename) => {
|
|
|
|
console.log(`update ${filename} ...`)
|
|
|
|
build()
|
|
|
|
})
|
|
|
|
}
|