1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-27 14:28:59 +09:00

style(frontend-shared): lint fixes on build.js

This commit is contained in:
zyoshoka 2024-08-30 18:33:23 +09:00
parent b313da8cec
commit fae9bc89f1
No known key found for this signature in database

View File

@ -1,32 +1,32 @@
import * as esbuild from "esbuild";
import { build } from "esbuild";
import { globSync } from "glob";
import { execa } from "execa";
import fs from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname } from "node:path";
import fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import * as esbuild from 'esbuild';
import { build } from 'esbuild';
import { globSync } from 'glob';
import { execa } from 'execa';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
const _package = JSON.parse(fs.readFileSync(_dirname + '/package.json', 'utf-8'));
const entryPoints = globSync("./src/**/**.{ts,tsx}");
const entryPoints = globSync('./src/**/**.{ts,tsx}');
/** @type {import('esbuild').BuildOptions} */
const options = {
entryPoints,
minify: process.env.NODE_ENV === 'production',
outdir: "./js-built",
target: "es2022",
platform: "browser",
format: "esm",
outdir: './js-built',
target: 'es2022',
platform: 'browser',
format: 'esm',
sourcemap: 'linked',
};
// js-built配下をすべて削除する
fs.rmSync('./js-built', { recursive: true, force: true });
if (process.argv.map(arg => arg.toLowerCase()).includes("--watch")) {
if (process.argv.map(arg => arg.toLowerCase()).includes('--watch')) {
await watchSrc();
} else {
await buildSrc();
@ -36,7 +36,7 @@ async function buildSrc() {
console.log(`[${_package.name}] start building...`);
await build(options)
.then(it => {
.then(() => {
console.log(`[${_package.name}] build succeeded.`);
})
.catch((err) => {
@ -65,7 +65,7 @@ function buildDts() {
{
stdout: process.stdout,
stderr: process.stderr,
}
},
);
}
@ -86,7 +86,7 @@ async function watchSrc() {
},
}];
console.log(`[${_package.name}] start watching...`)
console.log(`[${_package.name}] start watching...`);
const context = await esbuild.context({ ...options, plugins });
await context.watch();