Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a65e55b
chore: eslint-plugin-file-progressを導入
sevenc-nanashi Mar 1, 2025
439f1cd
chore: ignoreにstorybook-staticを追加
sevenc-nanashi Mar 1, 2025
f182354
chore: type: moduleを宣言する
sevenc-nanashi Mar 1, 2025
80b9713
fix: electronが落ちてるのを直す
sevenc-nanashi Mar 1, 2025
ded7d98
feat: import/extensionsを追加
sevenc-nanashi Mar 1, 2025
12b865a
chore: .tsを追加
sevenc-nanashi Mar 1, 2025
6f65b93
chore: lockを更新
sevenc-nanashi Mar 1, 2025
8db3eca
merge: upstream/main -> chore/to-esmodule
sevenc-nanashi Mar 6, 2025
15e0225
fix: .storybookをincludeする
sevenc-nanashi Mar 6, 2025
6ce23c5
style: lintのエラーを直す
sevenc-nanashi Mar 6, 2025
cccc292
fix: vitest.workspace.tsのパスを更新
sevenc-nanashi Mar 6, 2025
7f4b88d
merge: upstream/main -> chore/to-esmodule
sevenc-nanashi Mar 7, 2025
03bbcdb
revert: 一旦戻す
sevenc-nanashi Mar 8, 2025
a93332c
fix: __dirname -> import.meta.dirname
sevenc-nanashi Mar 8, 2025
01c94db
merge: upstream/main -> chore/to-esmodule
sevenc-nanashi Mar 8, 2025
2b02204
revert: testsも戻す
sevenc-nanashi Mar 8, 2025
0d0b1cc
chore: 古いスナップショットを消す
sevenc-nanashi Mar 8, 2025
37017c4
chore: .mtsを消す
sevenc-nanashi Mar 8, 2025
d6ac483
reapply: audioRendering.tsの変更を取り込む
sevenc-nanashi Mar 8, 2025
1fd06e8
Discard changes to tests/unit/lib/splitLyricsByMoras.spec.ts
sevenc-nanashi Mar 8, 2025
57f9ca0
chore: globで全部指定する
sevenc-nanashi Mar 9, 2025
496e57b
merge: upstream/main -> chore/to-esmodule
sevenc-nanashi Mar 9, 2025
7c787b3
fix: .storybookを指定する
sevenc-nanashi Mar 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { setup, Preview } from "@storybook/vue3";
import { Quasar, Dialog, Loading, Notify } from "quasar";
import iconSet from "quasar/icon-set/material-icons";
import { withThemeByDataAttribute } from "@storybook/addon-themes";
import { addActionsWithEmits } from "./utils/argTypesEnhancers";
import { markdownItPlugin } from "@/plugins/markdownItPlugin";
import { addActionsWithEmits } from "./utils/argTypesEnhancers.ts";
import { markdownItPlugin } from "@/plugins/markdownItPlugin.ts";

import "@quasar/extras/material-icons/material-icons.css";
import "quasar/dist/quasar.sass";
import "@/styles/_index.scss";
import { UnreachableError } from "@/type/utility";
import { setThemeToCss, setFontToCss } from "@/domain/dom";
import { themes } from "@/domain/theme";
import { UnreachableError } from "@/type/utility.ts";
import { setThemeToCss, setFontToCss } from "@/domain/dom.ts";
import { themes } from "@/domain/theme/index.ts";

setup((app) => {
app.use(Quasar, {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { beforeAll } from "vitest";
import { setProjectAnnotations } from "@storybook/vue3";
import * as previewAnnotations from "./preview";
import * as previewAnnotations from "./preview.ts";

const annotations = setProjectAnnotations([previewAnnotations]);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/no-require-imports */
const afterWindowsNsisWebArtifactBuild =
require("./afterNsisWebArtifactBuild").default;
require("./afterNsisWebArtifactBuild.cjs").default;

// buildResult: electron-builder.BuildResult
exports.default = async function (buildResult) {
module.exports.default = async function (buildResult) {
for (const [platform, targets] of buildResult.platformToTargets.entries()) {
const platformName = platform.name;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-require-imports */
const splitNsisArchive = require("./splitNsisArchive").default;
const splitNsisArchive = require("./splitNsisArchive.cjs").default;

// target: electron-builder.Target
exports.default = async function (target) {
module.exports.default = async function (target) {
await splitNsisArchive(target);
};
2 changes: 1 addition & 1 deletion build/splitNsisArchive.js → build/splitNsisArchive.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const createIni = (sizes, hashes) => {
};

// target: electron-builder.Target
exports.default = async function (target) {
module.exports.default = async function (target) {
const projectName = process.env.npm_package_name;
if (projectName == undefined) {
const ErrorMessage = "Project name is undefined.";
Expand Down
41 changes: 18 additions & 23 deletions electron-builder.config.js → electron-builder.config.cjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* eslint-disable @typescript-eslint/no-require-imports */
// @ts-check
const path = require("path");
const fs = require("fs");
const dotenv = require("dotenv");
const { join, resolve } = require("path");
const { readdirSync, existsSync, rmSync } = require("fs");
const { config } = require("dotenv");
const {
default: afterAllArtifactBuild,
} = require("./build/afterAllArtifactBuild.cjs");

const dotenvPath = path.join(process.cwd(), ".env.production");
dotenv.config({ path: dotenvPath });
const dotenvPath = join(process.cwd(), ".env.production");
config({ path: dotenvPath });

const VOICEVOX_ENGINE_DIR =
process.env.VOICEVOX_ENGINE_DIR ?? "../voicevox_engine/dist/run/";
Expand Down Expand Up @@ -38,24 +40,22 @@ const isArm64 = process.arch === "arm64";
// cf: https://k-hyoda.hatenablog.com/entry/2021/10/23/000349#%E8%BF%BD%E5%8A%A0%E5%B1%95%E9%96%8B%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%85%88%E3%81%AE%E8%A8%AD%E5%AE%9A
const extraFilePrefix = isMac ? "MacOS/" : "";

const sevenZipFile = fs
.readdirSync(path.resolve(__dirname, "vendored", "7z"))
.find(
// Windows: 7za.exe, Linux: 7zzs, macOS: 7zz
(fileName) => ["7za.exe", "7zzs", "7zz"].includes(fileName),
);
const sevenZipFile = readdirSync(resolve(__dirname, "vendored", "7z")).find(
// Windows: 7za.exe, Linux: 7zzs, macOS: 7zz
(fileName) => ["7za.exe", "7zzs", "7zz"].includes(fileName),
);

if (!sevenZipFile) {
throw new Error(
"7z binary file not found. Run `node ./tools/download7z.js` first.",
"7z binary file not found. Run `node ./tools/download7z.ts` first.",
);
}

/** @type {import("electron-builder").Configuration} */
const builderOptions = {
beforeBuild: async () => {
if (fs.existsSync(path.resolve(__dirname, "dist_electron"))) {
fs.rmSync(path.resolve(__dirname, "dist_electron"), { recursive: true });
if (existsSync(resolve(__dirname, "dist_electron"))) {
rmSync(resolve(__dirname, "dist_electron"), { recursive: true });
}
},
directories: {
Expand Down Expand Up @@ -93,22 +93,18 @@ const builderOptions = {
},
{
from: VOICEVOX_ENGINE_DIR,
to: path.join(extraFilePrefix, "vv-engine"),
to: join(extraFilePrefix, "vv-engine"),
},
{
from: path.resolve(__dirname, "vendored", "7z", sevenZipFile),
from: resolve(__dirname, "vendored", "7z", sevenZipFile),
to: extraFilePrefix + sevenZipFile,
},
],
// electron-builder installer
productName: "VOICEVOX",
appId: "jp.hiroshiba.voicevox",
copyright: "Hiroshiba Kazuyuki",
afterAllArtifactBuild: path.resolve(
__dirname,
"build",
"afterAllArtifactBuild.js",
),
afterAllArtifactBuild,
win: {
icon: "public/icon.png",
target: [
Expand Down Expand Up @@ -165,5 +161,4 @@ const builderOptions = {
icon: "public/icon-dmg.icns",
},
};

module.exports = builderOptions;
5 changes: 2 additions & 3 deletions eslint.config.mjs → eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import progress from "eslint-plugin-file-progress";
import gitignore from "eslint-config-flat-gitignore";
import voicevoxPlugin from "./eslint-plugin/index.mjs";

const __dirname = import.meta.dirname;

/**
* @typedef {import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config} Config
* @typedef {import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray} ConfigArray
Expand Down Expand Up @@ -64,7 +62,7 @@ const vueParserOptions = {
/** @type {ParserOptions} */
const typeCheckedParserOptions = {
project: ["./tsconfig.json"],
tsconfigRootDir: __dirname,
tsconfigRootDir: import.meta.dirname,
};

/** @type {Rules} */
Expand Down Expand Up @@ -180,6 +178,7 @@ export default defineConfigWithVueTs(
ignoreRestSiblings: true,
},
],
"import/extensions": ["error", "ignorePackages"],
"import/order": "error",
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-constant-condition": ["error", { checkLoops: false }], // while(true) などを許可
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"author": "Hiroshiba Kazuyuki",
"private": true,
"main": "./dist/main.js",
"type": "module",
"engines": {
"node": ">=22.14.0 <23"
},
Expand All @@ -20,9 +21,9 @@
"typecheck": "vue-tsc --noEmit",
"typos": "cross-env ./vendored/typos/typos",
"// --- tools ---": "",
"license:generate": "tsx tools/generateLicenses.mts",
"license:merge": "tsx tools/mergeLicenses.mts",
"check-suspicious-imports": "tsx tools/checkSuspiciousImports.mts",
"license:generate": "tsx tools/generateLicenses.ts",
"license:merge": "tsx tools/mergeLicenses.ts",
"check-suspicious-imports": "tsx tools/checkSuspiciousImports.ts",
"// --- test ---": "",
"test:unit": "vitest --run",
"test-watch:unit": "vitest --watch",
Expand All @@ -37,7 +38,7 @@
"test-ui:storybook-vrt": "cross-env TARGET=storybook playwright test --ui",
"// --- build ---": "",
"electron:serve": "cross-env VITE_TARGET=electron vite",
"electron:build": "cross-env VITE_TARGET=electron NODE_ENV=production vite build && electron-builder --config electron-builder.config.js --publish never",
"electron:build": "cross-env VITE_TARGET=electron NODE_ENV=production vite build && electron-builder --config electron-builder.config.cjs --publish never",
"browser:serve": "cross-env VITE_TARGET=browser vite",
"browser:build": "cross-env VITE_TARGET=browser NODE_ENV=production vite build",
"storybook": "storybook dev --port 6006",
Expand All @@ -46,7 +47,7 @@
"preinstall": "npx -y only-allow pnpm",
"postinstall": "pnpm run postinstall:packages && pnpm run postinstall:download-scripts",
"postinstall:packages": "electron-builder install-app-deps && playwright install chromium",
"postinstall:download-scripts": "tsx tools/download7z.mts && tsx tools/downloadTypos.mts",
"postinstall:download-scripts": "tsx tools/download7z.ts && tsx tools/downloadTypos.ts",
"postuninstall": "electron-builder install-app-deps"
},
"dependencies": {
Expand Down
Loading
Loading