Don't build internal TS packages

This commit is contained in:
Gregory Schier
2024-09-23 07:22:25 -07:00
parent 164865c845
commit 9bb1e1232f
17 changed files with 57 additions and 74 deletions

View File

@@ -40,6 +40,6 @@
"nodejs-file-downloader": "^4.13.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.3.3",
"typescript": "^5.6.0"
"typescript": "^5.6.2"
}
}

View File

@@ -17,9 +17,7 @@
"@types/intercept-stdout": "^0.1.3",
"grpc-tools": "^1.12.4",
"nodemon": "^3.1.4",
"npm-run-all": "^4.1.5",
"ts-node": "^10.9.2",
"ts-proto": "^2.2.0",
"typescript": "^5.6.0"
"ts-proto": "^2.2.0"
}
}

View File

@@ -24,6 +24,7 @@ async function initialize() {
const pathPkg = path.join(pluginDir, 'package.json');
const pathMod = path.posix.join(pluginDir, 'build', 'index.js');
async function importModule() {
const id = require.resolve(pathMod);
delete require.cache[id];
@@ -247,7 +248,9 @@ async function initialize() {
payload.type === 'call_http_request_action_request' &&
Array.isArray(mod.plugin?.httpRequestActions)
) {
const action = mod.plugin.httpRequestActions.find((a) => a.key === payload.key);
const action = mod.plugin.httpRequestActions.find(
(a: HttpRequestActionPlugin) => a.key === payload.key,
);
if (typeof action?.onSelect === 'function') {
await action.onSelect(ctx, payload.args);
sendEmpty(replyId);
@@ -259,7 +262,9 @@ async function initialize() {
payload.type === 'call_template_function_request' &&
Array.isArray(mod.plugin?.templateFunctions)
) {
const action = mod.plugin.templateFunctions.find((a) => a.name === payload.name);
const action = mod.plugin.templateFunctions.find(
(a: TemplateFunctionPlugin) => a.name === payload.name,
);
if (typeof action?.onRender === 'function') {
const result = await action.onRender(ctx, payload.args);
sendPayload({ type: 'call_template_function_response', value: result ?? null }, replyId);

View File

@@ -1 +0,0 @@
lib

View File

@@ -2,9 +2,5 @@
"name": "@yaakapp-internal/models",
"private": true,
"version": "1.0.0",
"main": "lib/index.js",
"typings": "./lib/index.d.ts",
"scripts": {
"build": "tsc"
}
"main": "index.ts"
}

View File

@@ -1,15 +0,0 @@
{
"compilerOptions": {
"module": "node16",
"target": "es6",
"lib": ["es2021"],
"declaration": true,
"declarationDir": "./lib",
"outDir": "./lib",
"strict": true,
"types": ["node"]
},
"files": [
"index.ts"
]
}

View File

@@ -1 +0,0 @@
lib

View File

@@ -1,2 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -1,3 +0,0 @@
"use strict";
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -2,9 +2,5 @@
"name": "@yaakapp-internal/plugin",
"private": true,
"version": "1.0.0",
"main": "lib/index.js",
"typings": "./lib/index.d.ts",
"scripts": {
"build": "tsc"
}
"main": "index.ts"
}

View File

@@ -1,15 +0,0 @@
{
"compilerOptions": {
"module": "node16",
"target": "es6",
"lib": ["es2021"],
"declaration": true,
"declarationDir": "./lib",
"outDir": "./lib",
"strict": true,
"types": ["node"]
},
"files": [
"index.ts"
]
}

View File

@@ -1 +1,4 @@
export * from './bindings/parser';
export type COOL = {
bar: string;
};

View File

@@ -2,9 +2,5 @@
"name": "@yaakapp-internal/template",
"private": true,
"version": "1.0.0",
"main": "lib/index.js",
"typings": "./lib/index.d.ts",
"scripts": {
"build": "tsc"
}
"main": "index.ts"
}

View File

@@ -1,15 +0,0 @@
{
"compilerOptions": {
"module": "node16",
"target": "es6",
"lib": ["es2021"],
"declaration": true,
"declarationDir": "./lib",
"outDir": "./lib",
"strict": true,
"types": ["node"]
},
"files": [
"index.ts"
]
}

View File

@@ -1,6 +1,6 @@
import { useQuery } from '@tanstack/react-query';
import { invokeCmd } from '../lib/tauri';
import type { Tokens } from '@yaakapp-internal/template';
import { invokeCmd } from '../lib/tauri';
export function useParseTemplate(template: string) {
return useQuery<Tokens>({

31
tsconfig.json Normal file
View File

@@ -0,0 +1,31 @@
{
"compilerOptions": {
"target": "es2021",
"lib": [
"DOM",
"DOM.Iterable",
"ESNext"
],
"useDefineForClassFields": true,
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"."
],
"exclude": [
"vite.config.ts"
],
"references": [{ "path": "./tsconfig.node.json" }]
}

10
tsconfig.node.json Normal file
View File

@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"noUncheckedIndexedAccess": true
},
"include": ["vite.config.ts"]
}