Skip to content

Commit

Permalink
vite script
Browse files Browse the repository at this point in the history
  • Loading branch information
DileSoft committed Dec 12, 2024
1 parent c5f1c53 commit c25d017
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 87 deletions.
1 change: 1 addition & 0 deletions src-editor/public/index.html → src-editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<script type="module" src="/src/index.tsx"></script>
<script>
if ((window.localStorage && window.localStorage.getItem('App.theme')) === 'dark') {
window.document.body.style.background = 'black';
Expand Down
12 changes: 9 additions & 3 deletions src-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "js",
"version": "8.8.3",
"private": true,
"type": "module",
"dependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@blockly/field-colour": "^5.0.12",
Expand All @@ -19,6 +20,7 @@
"@types/react": "^18.3.16",
"@types/react-dom": "^18.3.5",
"@types/reactour": "^1.18.5",
"@vitejs/plugin-react": "^4.3.4",
"blockly": "^11.1.1",
"craco-module-federation": "^1.1.0",
"lodash": "^4.17.21",
Expand All @@ -45,12 +47,16 @@
"reactour": "^1.19.4",
"sass": "^1.82.0",
"styled-components": "^6.1.13",
"suncalc2": "^1.8.1"
"suncalc2": "^1.8.1",
"vite": "^6.0.3",
"vite-plugin-commonjs": "^0.10.4",
"vite-plugin-svgr": "^4.3.0",
"vite-tsconfig-paths": "^5.1.4"
},
"scripts": {
"start": "craco start",
"start": "vite",
"lint": "eslint -c eslint.config.mjs",
"build": "craco build",
"build": "tsc && vite build",
"tsc": "tsc -p tsconfig.json",
"npm": "npm i -f"
},
Expand Down
4 changes: 2 additions & 2 deletions src-editor/src/OpenAi/OpenAiPrompt.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ChannelDetector, { type DetectOptions, Types } from '@iobroker/type-detector';
import { type AdminConnection, I18n } from '@iobroker/adapter-react-v5';
import docs from './docs.md';
import type { PatternControl } from '@iobroker/type-detector';
const docs = import(`./docs.md?raw`);

interface DeviceState {
id: string;
Expand Down Expand Up @@ -270,5 +270,5 @@ async function detectDevices(socket: AdminConnection): Promise<DeviceObject[]> {
return result;
}

const systemPrompt: () => Promise<string> = async (): Promise<string> => (await fetch(docs)).text();
const systemPrompt: () => Promise<string> = async (): Promise<string> => (await docs).default;
export { systemPrompt, detectDevices };
1 change: 0 additions & 1 deletion src-editor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Specialized tsconfig for the admin directory,
// includes DOM typings and configures the admin build
{
"extends": "../tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"allowSyntheticDefaultImports": true,
Expand Down
1 change: 1 addition & 0 deletions src-editor/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
81 changes: 0 additions & 81 deletions src-editor/vite.config.js

This file was deleted.

21 changes: 21 additions & 0 deletions src-editor/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { defineConfig, transformWithEsbuild } from 'vite';
import react from '@vitejs/plugin-react';
import commonjs from 'vite-plugin-commonjs';
import svgr from 'vite-plugin-svgr';
import vitetsConfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
plugins: [
react(),
vitetsConfigPaths(),
commonjs(),
svgr({
include: [
'src/**/*.svg',
],
}),
],
server: {
port: 3000
}
});

0 comments on commit c25d017

Please sign in to comment.