This fixes it - it's the stupid library version

This commit is contained in:
Brandon Thomas committed 2025-05-06 17:43:32 -04:00
1 parent 378ecfec48
commit 0eee109bdd
16 files changed
+306

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
+36
View File
@@ -0,0 +1,36 @@
{
"extends": [
"plugin:@nx/react",
"../../.eslintrc.json"
],
"ignorePatterns": [
"!**/*",
"**/vite.config.*.timestamp*",
"**/vitest.config.*.timestamp*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
}
]
}
+7
View File
@@ -0,0 +1,7 @@
# @frontend/tauri-api
This library was generated with [Nx](https://nx.dev).
## Running unit tests
Run `nx test @frontend/tauri-api` to execute the unit tests via [Vitest](https://vitest.dev/).
+20
View File
@@ -0,0 +1,20 @@
{
"name": "@storyteller/tauri-api",
"version": "0.0.1",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"development": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
}
},
"dependencies": {
"@tauri-apps/api": "^2.4.0"
}
}
+2
View File
@@ -0,0 +1,2 @@
export * from './lib/settings/GetAppPreferences.js';
@@ -0,0 +1,36 @@
import { invoke } from "@tauri-apps/api/core";
export interface GetAppPreferencesResult {
preferences: AppPreferencesPayload,
}
export interface AppPreferencesPayload {
// Preferred download directory
preferred_download_directory: PreferredDownloadDirectory,
// Play sounds on events.
play_sounds: boolean,
// Sound names to play.
// These are keys, not filenames, and are defined by the frontend.
generation_success_sound?: string,
generation_failure_sound?: string,
generation_enqueue_sound?: string,
}
export type PreferredDownloadDirectory = SystemDirectory | CustomDirectory;
export interface SystemDirectory {
// If the directory is a system directory.
system: string,
}
export interface CustomDirectory {
// If the directory is a custom user directory.
custom: string,
}
export const GetAppPreferences = async () : Promise<GetAppPreferencesResult> => {
let result = await invoke("get_app_preferences_command");
return (result as GetAppPreferencesResult);
}
@@ -0,0 +1,30 @@
import { invoke } from "@tauri-apps/api/core";
import { PreferredDownloadDirectory } from "./GetAppPreferences";
export interface UpdateAppPreferencesRequest {
preference: PreferenceName,
value: undefined | string | boolean | PreferredDownloadDirectory,
}
export enum PreferenceName {
PreferredDownloadDirectory = "preferred_download_directory",
PlaySounds = "play_sounds",
GenerationSuccessSound = "generation_success_sound",
GenerationFailureSound = "generation_failure_sound",
GenerationEnqueueSound = "generation_enqueue_sound",
}
export interface UpdateAppPreferencesResult {
success: boolean
}
export const UpdateAppPreferences = async (request: UpdateAppPreferencesRequest) : Promise<UpdateAppPreferencesResult> => {
let result = await invoke("update_app_preferences_command", {
request: {
preference: request.preference,
value: request.value,
}
});
return (result as UpdateAppPreferencesResult);
}
+1
View File
@@ -0,0 +1 @@
// This file should be used to export ONLY server-code from the library.
@@ -0,0 +1,3 @@
import { installGlobals } from '@remix-run/node';
import "@testing-library/jest-dom/matchers";
installGlobals();
+13
View File
@@ -0,0 +1,13 @@
{
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../../tsconfig.base.json"
}
+48
View File
@@ -0,0 +1,48 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"types": [
"node",
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts",
"vite/client"
],
"rootDir": "src",
"jsx": "react-jsx",
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo"
},
"exclude": [
"out-tsc",
"dist",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
"**/*.spec.js",
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx",
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"eslint.config.js",
"eslint.config.cjs",
"eslint.config.mjs"
],
"include": [
"src/**/*.js",
"src/**/*.jsx",
"src/**/*.ts",
"src/**/*.tsx"
]
}
@@ -0,0 +1,34 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./out-tsc/vitest",
"types": [
"vitest/globals",
"vitest/importMeta",
"vite/client",
"node",
"vitest"
],
"jsx": "react-jsx"
},
"include": [
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
+49
View File
@@ -0,0 +1,49 @@
/// <reference types='vitest' />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import dts from 'vite-plugin-dts';
import * as path from 'path';
export default defineConfig(() => ({
root: __dirname,
cacheDir: '../../node_modules/.vite/libs/tauri-api',
plugins: [react(), dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
outDir: './dist',
emptyOutDir: true,
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
name: '@frontend/tauri-api',
fileName: 'index',
// Change this to the formats you want to support.
// Don't forget to update your package.json as well.
formats: ['es' as const]
},
rollupOptions: {
// External packages that should not be bundled into your library.
external: ['react','react-dom','react/jsx-runtime']
},
},
test: {setupFiles: ['./src/test-setup.ts'],
watch: false,
globals: true,
environment: 'jsdom',
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: './test-output/vitest/coverage',
provider: 'v8' as const,
}
},
}));
@@ -0,0 +1,2 @@
export const TEST = 1;
@@ -0,0 +1,2 @@
export * from './GetAppPreferences';
+11
View File
@@ -2253,6 +2253,13 @@
"@types/howler": "^2.2.12"
}
},
"libs/tauri-api": {
"name": "@storyteller/tauri-api",
"version": "0.0.1",
"dependencies": {
"@tauri-apps/api": "^2.4.0"
}
},
"libs/tauri-utils": {
"name": "@storyteller/tauri-utils",
"version": "0.0.1"
@@ -10267,6 +10274,10 @@
"resolved": "libs/soundboard",
"link": true
},
"node_modules/@storyteller/tauri-api": {
"resolved": "libs/tauri-api",
"link": true
},
"node_modules/@storyteller/tauri-utils": {
"resolved": "libs/tauri-utils",
"link": true