mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-03-21 03:30:42 +00:00
migrate build scripts to esmodules (#17071)
* chore: migrate build scripts to esmodules * chore: do not use export default in build script
This commit is contained in:
30
scripts/build-pre.mjs
Normal file
30
scripts/build-pre.mjs
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as fs from 'node:fs';
|
||||
|
||||
const __dirname = import.meta.dirname;
|
||||
|
||||
const packageJsonPath = __dirname + '/../package.json'
|
||||
|
||||
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) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
build();
|
||||
|
||||
if (process.argv.includes("--watch")) {
|
||||
fs.watch(packageJsonPath, (event, filename) => {
|
||||
console.log(`update ${filename} ...`)
|
||||
build()
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user