From 9caf6a49665eb5e8d67279670bd27cfc5688d955 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Fri, 27 Mar 2026 15:32:46 +0800 Subject: [PATCH] chore(ci): should directly import config --- apps/stage-tamagotchi/scripts/utils.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/stage-tamagotchi/scripts/utils.ts b/apps/stage-tamagotchi/scripts/utils.ts index d5ff0bca4..a4a6d3633 100644 --- a/apps/stage-tamagotchi/scripts/utils.ts +++ b/apps/stage-tamagotchi/scripts/utils.ts @@ -2,20 +2,17 @@ import type { Configuration } from 'electron-builder' import process from 'node:process' -import { readFile } from 'node:fs/promises' -import { resolve } from 'node:path' - import { x } from 'tinyexec' -import * as yaml from 'yaml' - import packageJSON from '../package.json' assert { type: 'json' } export async function getVersion(options: { release: boolean, autoTag: boolean, tag: string[] }) { if (!options.release || !options.tag) { // Otherwise, fetch from the latest git ref const res = await x('git', ['log', '-1', '--pretty=format:"%H"']) + // eslint-disable-next-line e18e/prefer-static-regex const date = new Date().toISOString().split('T')[0].replace(/-/g, '') + // eslint-disable-next-line e18e/prefer-static-regex return `nightly-${date}-${String(res.stdout.replace(/"/g, '')).trim().substring(0, 7)}` } @@ -24,6 +21,7 @@ export async function getVersion(options: { release: boolean, autoTag: boolean, // If --tag is specified, use the provided tag if (options.tag[0] !== 'true') { + // eslint-disable-next-line e18e/prefer-static-regex version = String(options.tag[0]).replace(/^v/, '').trim() } // Otherwise, even for --tag option (true / enabled), ignore the input @@ -44,6 +42,7 @@ export async function getVersion(options: { release: boolean, autoTag: boolean, // fetch the latest git ref try { const res = await x('git', ['describe', '--tags', '--abbrev=0']) + // eslint-disable-next-line e18e/prefer-static-regex return String(res.stdout).replace(/^v/, '').trim() } catch { @@ -53,8 +52,9 @@ export async function getVersion(options: { release: boolean, autoTag: boolean, } } -export async function getElectronBuilderConfig() { - return yaml.parse(await readFile(resolve(import.meta.dirname, '..', 'electron-builder.yml'), 'utf-8')) as Configuration +export async function getElectronBuilderConfig(): Promise { + const config = await import ('../electron-builder.config') + return config.default } export function applyTemplateOfArtifactName(