fix: incompatible browser dependency (#2439)

* fix: incompatible browser dependency

* fix: update model extension to use rollup

* fix: test timeout
This commit is contained in:
Louis 2024-03-21 16:54:42 +07:00 committed by GitHub
parent 5b1b730f2b
commit ff7ec39915
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
40 changed files with 174 additions and 145 deletions

View File

@ -53,15 +53,17 @@ build: check-file-counts
clean: clean:
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
powershell -Command "Get-ChildItem -Path . -Include node_modules, .next, dist, build, out -Recurse -Directory | Remove-Item -Recurse -Force" powershell -Command "Get-ChildItem -Path . -Include node_modules, .next, dist, build, out -Recurse -Directory | Remove-Item -Recurse -Force"
powershell -Command "Get-ChildItem -Path . -Include package-lock.json -Recurse -File | Remove-Item -Recurse -Force"
powershell -Command "Remove-Item -Recurse -Force ./pre-install/*.tgz" powershell -Command "Remove-Item -Recurse -Force ./pre-install/*.tgz"
powershell -Command "Remove-Item -Recurse -Force ./electron/pre-install/*.tgz" powershell -Command "Remove-Item -Recurse -Force ./electron/pre-install/*.tgz"
rmdir /s /q "%USERPROFILE%\jan\extensions" powershell -Command "if (Test-Path \"$($env:USERPROFILE)\jan\extensions\") { Remove-Item -Path \"$($env:USERPROFILE)\jan\extensions\" -Recurse -Force }"
else ifeq ($(shell uname -s),Linux) else ifeq ($(shell uname -s),Linux)
find . -name "node_modules" -type d -prune -exec rm -rf '{}' + find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
find . -name ".next" -type d -exec rm -rf '{}' + find . -name ".next" -type d -exec rm -rf '{}' +
find . -name "dist" -type d -exec rm -rf '{}' + find . -name "dist" -type d -exec rm -rf '{}' +
find . -name "build" -type d -exec rm -rf '{}' + find . -name "build" -type d -exec rm -rf '{}' +
find . -name "out" -type d -exec rm -rf '{}' + find . -name "out" -type d -exec rm -rf '{}' +
find . -name "packake-lock.json" -type f -exec rm -rf '{}' +
rm -rf ./pre-install/*.tgz rm -rf ./pre-install/*.tgz
rm -rf ./electron/pre-install/*.tgz rm -rf ./electron/pre-install/*.tgz
rm -rf "~/jan/extensions" rm -rf "~/jan/extensions"
@ -72,6 +74,7 @@ else
find . -name "dist" -type d -exec rm -rf '{}' + find . -name "dist" -type d -exec rm -rf '{}' +
find . -name "build" -type d -exec rm -rf '{}' + find . -name "build" -type d -exec rm -rf '{}' +
find . -name "out" -type d -exec rm -rf '{}' + find . -name "out" -type d -exec rm -rf '{}' +
find . -name "packake-lock.json" -type f -exec rm -rf '{}' +
rm -rf ./pre-install/*.tgz rm -rf ./pre-install/*.tgz
rm -rf ./electron/pre-install/*.tgz rm -rf ./electron/pre-install/*.tgz
rm -rf ~/jan/extensions rm -rf ~/jan/extensions

View File

@ -8,8 +8,8 @@
], ],
"homepage": "https://jan.ai", "homepage": "https://jan.ai",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "dist/core.umd.js", "main": "dist/core.es5.js",
"module": "dist/core.es5.js", "module": "dist/core.cjs.js",
"typings": "dist/types/index.d.ts", "typings": "dist/types/index.d.ts",
"files": [ "files": [
"dist", "dist",
@ -17,8 +17,7 @@
], ],
"author": "Jan <service@jan.ai>", "author": "Jan <service@jan.ai>",
"exports": { "exports": {
".": "./dist/core.umd.js", ".": "./dist/core.es5.js",
"./sdk": "./dist/core.umd.js",
"./node": "./dist/node/index.cjs.js" "./node": "./dist/node/index.cjs.js"
}, },
"typesVersions": { "typesVersions": {
@ -27,10 +26,6 @@
"./dist/core.es5.js.map", "./dist/core.es5.js.map",
"./dist/types/index.d.ts" "./dist/types/index.d.ts"
], ],
"sdk": [
"./dist/core.es5.js.map",
"./dist/types/index.d.ts"
],
"node": [ "node": [
"./dist/node/index.cjs.js.map", "./dist/node/index.cjs.js.map",
"./dist/types/node/index.d.ts" "./dist/types/node/index.d.ts"
@ -38,13 +33,14 @@
} }
}, },
"scripts": { "scripts": {
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'", "lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"test": "jest", "test": "jest",
"prebuild": "rimraf dist", "prebuild": "rimraf dist",
"build": "tsc --module commonjs && rollup -c rollup.config.ts", "build": "tsc --module commonjs && rollup -c rollup.config.ts",
"start": "rollup -c rollup.config.ts -w" "start": "rollup -c rollup.config.ts -w"
}, },
"devDependencies": { "devDependencies": {
"@rollup/plugin-replace": "^5.0.5",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/node": "^20.11.4", "@types/node": "^20.11.4",
"eslint": "8.57.0", "eslint": "8.57.0",
@ -63,6 +59,6 @@
}, },
"dependencies": { "dependencies": {
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"ulid": "^2.3.0" "ulidx": "^2.3.0"
} }
} }

View File

@ -3,17 +3,16 @@ import commonjs from 'rollup-plugin-commonjs'
import sourceMaps from 'rollup-plugin-sourcemaps' import sourceMaps from 'rollup-plugin-sourcemaps'
import typescript from 'rollup-plugin-typescript2' import typescript from 'rollup-plugin-typescript2'
import json from 'rollup-plugin-json' import json from 'rollup-plugin-json'
import replace from '@rollup/plugin-replace'
const pkg = require('./package.json') const pkg = require('./package.json')
const libraryName = 'core'
export default [ export default [
{ {
input: `src/index.ts`, input: `src/index.ts`,
output: [ output: [
{ file: pkg.main, name: libraryName, format: 'umd', sourcemap: true }, // { file: pkg.main, name: libraryName, format: 'umd', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true }, { file: pkg.main, format: 'es', sourcemap: true },
], ],
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash') // Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
external: ['path'], external: ['path'],
@ -30,7 +29,13 @@ export default [
// Allow node_modules resolution, so you can use 'external' to control // Allow node_modules resolution, so you can use 'external' to control
// which external modules to include in the bundle // which external modules to include in the bundle
// https://github.com/rollup/rollup-plugin-node-resolve#usage // https://github.com/rollup/rollup-plugin-node-resolve#usage
resolve(), replace({
'node:crypto': 'crypto',
'delimiters': ['"', '"'],
}),
resolve({
browser: true,
}),
// Resolve source maps to the original source // Resolve source maps to the original source
sourceMaps(), sourceMaps(),
@ -46,7 +51,7 @@ export default [
'pacote', 'pacote',
'@types/pacote', '@types/pacote',
'@npmcli/arborist', '@npmcli/arborist',
'ulid', 'ulidx',
'node-fetch', 'node-fetch',
'fs', 'fs',
'request', 'request',
@ -64,7 +69,7 @@ export default [
// Allow json resolution // Allow json resolution
json(), json(),
// Compile TypeScript files // Compile TypeScript files
typescript({ useTsconfigDeclarationDir: true, exclude: ['src/*.ts', 'src/extensions/**'] }), typescript({ useTsconfigDeclarationDir: true }),
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs) // Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs(), commonjs(),
// Allow node_modules resolution, so you can use 'external' to control // Allow node_modules resolution, so you can use 'external' to control

View File

@ -13,7 +13,7 @@ const executeOnMain: (extension: string, method: string, ...args: any[]) => Prom
extension, extension,
method, method,
...args ...args
) => global.core?.api?.invokeExtensionFunc(extension, method, ...args) ) => globalThis.core?.api?.invokeExtensionFunc(extension, method, ...args)
/** /**
* Downloads a file from a URL and saves it to the local file system. * Downloads a file from a URL and saves it to the local file system.
@ -26,7 +26,7 @@ const executeOnMain: (extension: string, method: string, ...args: any[]) => Prom
const downloadFile: (downloadRequest: DownloadRequest, network?: NetworkConfig) => Promise<any> = ( const downloadFile: (downloadRequest: DownloadRequest, network?: NetworkConfig) => Promise<any> = (
downloadRequest, downloadRequest,
network network
) => global.core?.api?.downloadFile(downloadRequest, network) ) => globalThis.core?.api?.downloadFile(downloadRequest, network)
/** /**
* Aborts the download of a specific file. * Aborts the download of a specific file.
@ -34,14 +34,14 @@ const downloadFile: (downloadRequest: DownloadRequest, network?: NetworkConfig)
* @returns {Promise<any>} A promise that resolves when the download has been aborted. * @returns {Promise<any>} A promise that resolves when the download has been aborted.
*/ */
const abortDownload: (fileName: string) => Promise<any> = (fileName) => const abortDownload: (fileName: string) => Promise<any> = (fileName) =>
global.core.api?.abortDownload(fileName) globalThis.core.api?.abortDownload(fileName)
/** /**
* Gets Jan's data folder path. * Gets Jan's data folder path.
* *
* @returns {Promise<string>} A Promise that resolves with Jan's data folder path. * @returns {Promise<string>} A Promise that resolves with Jan's data folder path.
*/ */
const getJanDataFolderPath = (): Promise<string> => global.core.api?.getJanDataFolderPath() const getJanDataFolderPath = (): Promise<string> => globalThis.core.api?.getJanDataFolderPath()
/** /**
* Opens the file explorer at a specific path. * Opens the file explorer at a specific path.
@ -49,21 +49,21 @@ const getJanDataFolderPath = (): Promise<string> => global.core.api?.getJanDataF
* @returns {Promise<any>} A promise that resolves when the file explorer is opened. * @returns {Promise<any>} A promise that resolves when the file explorer is opened.
*/ */
const openFileExplorer: (path: string) => Promise<any> = (path) => const openFileExplorer: (path: string) => Promise<any> = (path) =>
global.core.api?.openFileExplorer(path) globalThis.core.api?.openFileExplorer(path)
/** /**
* Joins multiple paths together. * Joins multiple paths together.
* @param paths - The paths to join. * @param paths - The paths to join.
* @returns {Promise<string>} A promise that resolves with the joined path. * @returns {Promise<string>} A promise that resolves with the joined path.
*/ */
const joinPath: (paths: string[]) => Promise<string> = (paths) => global.core.api?.joinPath(paths) const joinPath: (paths: string[]) => Promise<string> = (paths) => globalThis.core.api?.joinPath(paths)
/** /**
* Retrive the basename from an url. * Retrive the basename from an url.
* @param path - The path to retrieve. * @param path - The path to retrieve.
* @returns {Promise<string>} A promise that resolves with the basename. * @returns {Promise<string>} A promise that resolves with the basename.
*/ */
const baseName: (paths: string) => Promise<string> = (path) => global.core.api?.baseName(path) const baseName: (paths: string) => Promise<string> = (path) => globalThis.core.api?.baseName(path)
/** /**
* Opens an external URL in the default web browser. * Opens an external URL in the default web browser.
@ -72,20 +72,20 @@ const baseName: (paths: string) => Promise<string> = (path) => global.core.api?.
* @returns {Promise<any>} - A promise that resolves when the URL has been successfully opened. * @returns {Promise<any>} - A promise that resolves when the URL has been successfully opened.
*/ */
const openExternalUrl: (url: string) => Promise<any> = (url) => const openExternalUrl: (url: string) => Promise<any> = (url) =>
global.core.api?.openExternalUrl(url) globalThis.core.api?.openExternalUrl(url)
/** /**
* Gets the resource path of the application. * Gets the resource path of the application.
* *
* @returns {Promise<string>} - A promise that resolves with the resource path. * @returns {Promise<string>} - A promise that resolves with the resource path.
*/ */
const getResourcePath: () => Promise<string> = () => global.core.api?.getResourcePath() const getResourcePath: () => Promise<string> = () => globalThis.core.api?.getResourcePath()
/** /**
* Gets the user's home path. * Gets the user's home path.
* @returns return user's home path * @returns return user's home path
*/ */
const getUserHomePath = (): Promise<string> => global.core.api?.getUserHomePath() const getUserHomePath = (): Promise<string> => globalThis.core.api?.getUserHomePath()
/** /**
* Log to file from browser processes. * Log to file from browser processes.
@ -93,7 +93,7 @@ const getUserHomePath = (): Promise<string> => global.core.api?.getUserHomePath(
* @param message - Message to log. * @param message - Message to log.
*/ */
const log: (message: string, fileName?: string) => void = (message, fileName) => const log: (message: string, fileName?: string) => void = (message, fileName) =>
global.core.api?.log(message, fileName) globalThis.core.api?.log(message, fileName)
/** /**
* Check whether the path is a subdirectory of another path. * Check whether the path is a subdirectory of another path.
@ -104,14 +104,14 @@ const log: (message: string, fileName?: string) => void = (message, fileName) =>
* @returns {Promise<boolean>} - A promise that resolves with a boolean indicating whether the path is a subdirectory. * @returns {Promise<boolean>} - A promise that resolves with a boolean indicating whether the path is a subdirectory.
*/ */
const isSubdirectory: (from: string, to: string) => Promise<boolean> = (from: string, to: string) => const isSubdirectory: (from: string, to: string) => Promise<boolean> = (from: string, to: string) =>
global.core.api?.isSubdirectory(from, to) globalThis.core.api?.isSubdirectory(from, to)
/** /**
* Get system information * Get system information
* @returns {Promise<any>} - A promise that resolves with the system information. * @returns {Promise<any>} - A promise that resolves with the system information.
*/ */
const systemInformation: () => Promise<SystemInformation> = () => const systemInformation: () => Promise<SystemInformation> = () =>
global.core.api?.systemInformation() globalThis.core.api?.systemInformation()
/** /**
* Show toast message from browser processes. * Show toast message from browser processes.
@ -120,7 +120,7 @@ const systemInformation: () => Promise<SystemInformation> = () =>
* @returns * @returns
*/ */
const showToast: (title: string, message: string) => void = (title, message) => const showToast: (title: string, message: string) => void = (title, message) =>
global.core.api?.showToast(title, message) globalThis.core.api?.showToast(title, message)
/** /**
* Register extension point function type definition * Register extension point function type definition
*/ */

View File

@ -5,7 +5,7 @@
* @param handler The handler function to call when the event is observed. * @param handler The handler function to call when the event is observed.
*/ */
const on: (eventName: string, handler: Function) => void = (eventName, handler) => { const on: (eventName: string, handler: Function) => void = (eventName, handler) => {
global.core?.events?.on(eventName, handler) globalThis.core?.events?.on(eventName, handler)
} }
/** /**
@ -15,7 +15,7 @@ const on: (eventName: string, handler: Function) => void = (eventName, handler)
* @param handler The handler function to call when the event is observed. * @param handler The handler function to call when the event is observed.
*/ */
const off: (eventName: string, handler: Function) => void = (eventName, handler) => { const off: (eventName: string, handler: Function) => void = (eventName, handler) => {
global.core?.events?.off(eventName, handler) globalThis.core?.events?.off(eventName, handler)
} }
/** /**
@ -25,7 +25,7 @@ const off: (eventName: string, handler: Function) => void = (eventName, handler)
* @param object The object to pass to the event callback. * @param object The object to pass to the event callback.
*/ */
const emit: (eventName: string, object: any) => void = (eventName, object) => { const emit: (eventName: string, object: any) => void = (eventName, object) => {
global.core?.events?.emit(eventName, object) globalThis.core?.events?.emit(eventName, object)
} }
export const events = { export const events = {

View File

@ -1,5 +1,5 @@
import { requestInference } from './helpers/sse' import { requestInference } from './helpers/sse'
import { ulid } from 'ulid' import { ulid } from 'ulidx'
import { AIEngine } from './AIEngine' import { AIEngine } from './AIEngine'
import { import {
ChatCompletionRole, ChatCompletionRole,

View File

@ -4,7 +4,7 @@ import { FileStat } from './types'
* Writes data to a file at the specified path. * Writes data to a file at the specified path.
* @returns {Promise<any>} A Promise that resolves when the file is written successfully. * @returns {Promise<any>} A Promise that resolves when the file is written successfully.
*/ */
const writeFileSync = (...args: any[]) => global.core.api?.writeFileSync(...args) const writeFileSync = (...args: any[]) => globalThis.core.api?.writeFileSync(...args)
/** /**
* Writes blob data to a file at the specified path. * Writes blob data to a file at the specified path.
@ -13,52 +13,52 @@ const writeFileSync = (...args: any[]) => global.core.api?.writeFileSync(...args
* @returns * @returns
*/ */
const writeBlob: (path: string, data: string) => Promise<any> = (path, data) => const writeBlob: (path: string, data: string) => Promise<any> = (path, data) =>
global.core.api?.writeBlob(path, data) globalThis.core.api?.writeBlob(path, data)
/** /**
* Reads the contents of a file at the specified path. * Reads the contents of a file at the specified path.
* @returns {Promise<any>} A Promise that resolves with the contents of the file. * @returns {Promise<any>} A Promise that resolves with the contents of the file.
*/ */
const readFileSync = (...args: any[]) => global.core.api?.readFileSync(...args) const readFileSync = (...args: any[]) => globalThis.core.api?.readFileSync(...args)
/** /**
* Check whether the file exists * Check whether the file exists
* @param {string} path * @param {string} path
* @returns {boolean} A boolean indicating whether the path is a file. * @returns {boolean} A boolean indicating whether the path is a file.
*/ */
const existsSync = (...args: any[]) => global.core.api?.existsSync(...args) const existsSync = (...args: any[]) => globalThis.core.api?.existsSync(...args)
/** /**
* List the directory files * List the directory files
* @returns {Promise<any>} A Promise that resolves with the contents of the directory. * @returns {Promise<any>} A Promise that resolves with the contents of the directory.
*/ */
const readdirSync = (...args: any[]) => global.core.api?.readdirSync(...args) const readdirSync = (...args: any[]) => globalThis.core.api?.readdirSync(...args)
/** /**
* Creates a directory at the specified path. * Creates a directory at the specified path.
* @returns {Promise<any>} A Promise that resolves when the directory is created successfully. * @returns {Promise<any>} A Promise that resolves when the directory is created successfully.
*/ */
const mkdirSync = (...args: any[]) => global.core.api?.mkdirSync(...args) const mkdirSync = (...args: any[]) => globalThis.core.api?.mkdirSync(...args)
const mkdir = (...args: any[]) => global.core.api?.mkdir(...args) const mkdir = (...args: any[]) => globalThis.core.api?.mkdir(...args)
/** /**
* Removes a directory at the specified path. * Removes a directory at the specified path.
* @returns {Promise<any>} A Promise that resolves when the directory is removed successfully. * @returns {Promise<any>} A Promise that resolves when the directory is removed successfully.
*/ */
const rmdirSync = (...args: any[]) => const rmdirSync = (...args: any[]) =>
global.core.api?.rmdirSync(...args, { recursive: true, force: true }) globalThis.core.api?.rmdirSync(...args, { recursive: true, force: true })
const rm = (path: string) => global.core.api?.rm(path) const rm = (path: string) => globalThis.core.api?.rm(path)
/** /**
* Deletes a file from the local file system. * Deletes a file from the local file system.
* @param {string} path - The path of the file to delete. * @param {string} path - The path of the file to delete.
* @returns {Promise<any>} A Promise that resolves when the file is deleted. * @returns {Promise<any>} A Promise that resolves when the file is deleted.
*/ */
const unlinkSync = (...args: any[]) => global.core.api?.unlinkSync(...args) const unlinkSync = (...args: any[]) => globalThis.core.api?.unlinkSync(...args)
/** /**
* Appends data to a file at the specified path. * Appends data to a file at the specified path.
*/ */
const appendFileSync = (...args: any[]) => global.core.api?.appendFileSync(...args) const appendFileSync = (...args: any[]) => globalThis.core.api?.appendFileSync(...args)
/** /**
* Synchronizes a file from a source path to a destination path. * Synchronizes a file from a source path to a destination path.
@ -67,15 +67,15 @@ const appendFileSync = (...args: any[]) => global.core.api?.appendFileSync(...ar
* @returns {Promise<any>} - A promise that resolves when the file has been successfully synchronized. * @returns {Promise<any>} - A promise that resolves when the file has been successfully synchronized.
*/ */
const syncFile: (src: string, dest: string) => Promise<any> = (src, dest) => const syncFile: (src: string, dest: string) => Promise<any> = (src, dest) =>
global.core.api?.syncFile(src, dest) globalThis.core.api?.syncFile(src, dest)
/** /**
* Copy file sync. * Copy file sync.
*/ */
const copyFileSync = (...args: any[]) => global.core.api?.copyFileSync(...args) const copyFileSync = (...args: any[]) => globalThis.core.api?.copyFileSync(...args)
const copyFile: (src: string, dest: string) => Promise<void> = (src, dest) => const copyFile: (src: string, dest: string) => Promise<void> = (src, dest) =>
global.core.api?.copyFile(src, dest) globalThis.core.api?.copyFile(src, dest)
/** /**
* Gets the file's stats. * Gets the file's stats.
@ -87,7 +87,7 @@ const copyFile: (src: string, dest: string) => Promise<void> = (src, dest) =>
const fileStat: (path: string, outsideJanDataFolder?: boolean) => Promise<FileStat | undefined> = ( const fileStat: (path: string, outsideJanDataFolder?: boolean) => Promise<FileStat | undefined> = (
path, path,
outsideJanDataFolder outsideJanDataFolder
) => global.core.api?.fileStat(path, outsideJanDataFolder) ) => globalThis.core.api?.fileStat(path, outsideJanDataFolder)
// TODO: Export `dummy` fs functions automatically // TODO: Export `dummy` fs functions automatically
// Currently adding these manually // Currently adding these manually

View File

@ -216,7 +216,7 @@ export const createMessage = async (threadId: string, message: any) => {
const threadMessagesFileName = 'messages.jsonl' const threadMessagesFileName = 'messages.jsonl'
try { try {
const { ulid } = require('ulid') const { ulid } = require('ulidx')
const msgId = ulid() const msgId = ulid()
const createdAt = Date.now() const createdAt = Date.now()
const threadMessage: ThreadMessage = { const threadMessage: ThreadMessage = {

View File

@ -4,3 +4,5 @@ export * from './extension/manager'
export * from './extension/store' export * from './extension/store'
export * from './api' export * from './api'
export * from './helper' export * from './helper'
export * from './../types'
export * from './../api'

View File

@ -6,8 +6,8 @@ import {
getJanDataFolderPath, getJanDataFolderPath,
getJanExtensionsPath, getJanExtensionsPath,
init, init,
AppEvent, NativeRoute,
} from '@janhq/core/node' } from '@janhq/core/node'
import { AppEvent, NativeRoute } from '@janhq/core'
export function handleAppIPCs() { export function handleAppIPCs() {
/** /**

View File

@ -6,7 +6,7 @@ import {
UpdateInfo, UpdateInfo,
autoUpdater, autoUpdater,
} from 'electron-updater' } from 'electron-updater'
import { AppEvent } from '@janhq/core' import { AppEvent } from '@janhq/core/node'
import { trayManager } from '../managers/tray' import { trayManager } from '../managers/tray'
export let waitingToInstallVersion: string | undefined = undefined export let waitingToInstallVersion: string | undefined = undefined

View File

@ -1,8 +1,7 @@
import { BrowserWindow, app, shell } from 'electron' import { BrowserWindow, app, shell } from 'electron'
import { quickAskWindowConfig } from './quickAskWindowConfig' import { quickAskWindowConfig } from './quickAskWindowConfig'
import { AppEvent } from '@janhq/core'
import { mainWindowConfig } from './mainWindowConfig' import { mainWindowConfig } from './mainWindowConfig'
import { getAppConfigurations } from '@janhq/core/node' import { getAppConfigurations, AppEvent } from '@janhq/core/node'
/** /**
* Manages the current window instance. * Manages the current window instance.

View File

@ -90,7 +90,7 @@
"pacote": "^17.0.4", "pacote": "^17.0.4",
"request": "^2.88.2", "request": "^2.88.2",
"request-progress": "^3.0.0", "request-progress": "^3.0.0",
"ulid": "^2.3.0", "ulidx": "^2.3.0",
"@nut-tree/nut-js": "^4.0.0" "@nut-tree/nut-js": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -3,7 +3,7 @@
* @module preload * @module preload
*/ */
import { APIEvents, APIRoutes } from '@janhq/core' import { APIEvents, APIRoutes } from '@janhq/core/node'
import { contextBridge, ipcRenderer } from 'electron' import { contextBridge, ipcRenderer } from 'electron'
const interfaces: { [key: string]: (...args: any[]) => any } = {} const interfaces: { [key: string]: (...args: any[]) => any } = {}

View File

@ -22,6 +22,8 @@ export let appInfo: ElectronAppInfo
export const TIMEOUT = parseInt(process.env.TEST_TIMEOUT || Constants.TIMEOUT) export const TIMEOUT = parseInt(process.env.TEST_TIMEOUT || Constants.TIMEOUT)
export async function setupElectron() { export async function setupElectron() {
console.log(`TEST TIMEOUT: ${TIMEOUT}`)
process.env.CI = 'e2e' process.env.CI = 'e2e'
const latestBuild = findLatestBuild('dist') const latestBuild = findLatestBuild('dist')
@ -101,11 +103,11 @@ export const test = base.extend<
}, },
{ auto: true }, { auto: true },
], ],
}) })
test.setTimeout(TIMEOUT)
test.beforeAll(async () => { test.beforeAll(async () => {
test.setTimeout(TIMEOUT)
await setupElectron() await setupElectron()
await page.waitForSelector('img[alt="Jan - Logo"]', { await page.waitForSelector('img[alt="Jan - Logo"]', {
state: 'visible', state: 'visible',

View File

@ -9,9 +9,9 @@
"scripts": { "scripts": {
"clean:modules": "rimraf node_modules/pdf-parse/test && cd node_modules/pdf-parse/lib/pdf.js && rimraf v1.9.426 v1.10.88 v2.0.550", "clean:modules": "rimraf node_modules/pdf-parse/test && cd node_modules/pdf-parse/lib/pdf.js && rimraf v1.9.426 v1.10.88 v2.0.550",
"build": "yarn clean:modules && tsc --module commonjs && rollup -c rollup.config.ts", "build": "yarn clean:modules && tsc --module commonjs && rollup -c rollup.config.ts",
"build:publish:linux": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install", "build:publish:linux": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install",
"build:publish:darwin": "rimraf *.tgz --glob && npm run build && ../../.github/scripts/auto-sign.sh && npm pack && cpx *.tgz ../../pre-install", "build:publish:darwin": "rimraf *.tgz --glob && yarn build && ../../.github/scripts/auto-sign.sh && npm pack && cpx *.tgz ../../pre-install",
"build:publish:win32": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install", "build:publish:win32": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install",
"build:publish": "run-script-os" "build:publish": "run-script-os"
}, },
"devDependencies": { "devDependencies": {

View File

@ -36,6 +36,7 @@ export default [
// https://github.com/rollup/rollup-plugin-node-resolve#usage // https://github.com/rollup/rollup-plugin-node-resolve#usage
resolve({ resolve({
extensions: ['.js', '.ts', '.svelte'], extensions: ['.js', '.ts', '.svelte'],
browser: true
}), }),
// Resolve source maps to the original source // Resolve source maps to the original source

View File

@ -10,7 +10,6 @@ import {
executeOnMain, executeOnMain,
AssistantExtension, AssistantExtension,
AssistantEvent, AssistantEvent,
ChatCompletionMessageContentType,
} from '@janhq/core' } from '@janhq/core'
export default class JanAssistantExtension extends AssistantExtension { export default class JanAssistantExtension extends AssistantExtension {

View File

@ -7,7 +7,7 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"build": "tsc -b . && webpack --config webpack.config.js", "build": "tsc -b . && webpack --config webpack.config.js",
"build:publish": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install" "build:publish": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install"
}, },
"exports": { "exports": {
".": "./dist/index.js", ".": "./dist/index.js",

View File

@ -24,7 +24,7 @@ module.exports = {
extensions: ['.ts', '.js'], extensions: ['.ts', '.js'],
fallback: { fallback: {
path: require.resolve('path-browserify'), path: require.resolve('path-browserify'),
}, }
}, },
// Do not minify the output, otherwise it breaks the class registration // Do not minify the output, otherwise it breaks the class registration
optimization: { optimization: {

View File

@ -1,8 +1,7 @@
import { PythonShell } from 'python-shell' import { PythonShell } from 'python-shell'
import { spawn, ChildProcess } from 'child_process' import { spawn, ChildProcess } from 'child_process'
import { resolve as presolve, join as pjoin } from 'path' import { resolve as presolve, join as pjoin } from 'path'
import type { Quantization } from '@janhq/core' import { log, Quantization } from '@janhq/core/node'
import { log } from '@janhq/core/node'
import { statSync } from 'fs' import { statSync } from 'fs'
export { renameSync } from 'fs' export { renameSync } from 'fs'

View File

@ -12,9 +12,9 @@
"downloadnitro:darwin": "NITRO_VERSION=$(cat ./bin/version.txt) && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-mac-arm64.tar.gz -e --strip 1 -o ./bin/mac-arm64 && chmod +x ./bin/mac-arm64/nitro && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-mac-amd64.tar.gz -e --strip 1 -o ./bin/mac-x64 && chmod +x ./bin/mac-x64/nitro", "downloadnitro:darwin": "NITRO_VERSION=$(cat ./bin/version.txt) && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-mac-arm64.tar.gz -e --strip 1 -o ./bin/mac-arm64 && chmod +x ./bin/mac-arm64/nitro && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-mac-amd64.tar.gz -e --strip 1 -o ./bin/mac-x64 && chmod +x ./bin/mac-x64/nitro",
"downloadnitro:win32": "download.bat", "downloadnitro:win32": "download.bat",
"downloadnitro": "run-script-os", "downloadnitro": "run-script-os",
"build:publish:darwin": "rimraf *.tgz --glob && npm run build && npm run downloadnitro && ../../.github/scripts/auto-sign.sh && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install", "build:publish:darwin": "rimraf *.tgz --glob && yarn build && npm run downloadnitro && ../../.github/scripts/auto-sign.sh && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install",
"build:publish:win32": "rimraf *.tgz --glob && npm run build && npm run downloadnitro && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install", "build:publish:win32": "rimraf *.tgz --glob && yarn build && npm run downloadnitro && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install",
"build:publish:linux": "rimraf *.tgz --glob && npm run build && npm run downloadnitro && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install", "build:publish:linux": "rimraf *.tgz --glob && yarn build && npm run downloadnitro && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install",
"build:publish": "run-script-os" "build:publish": "run-script-os"
}, },
"exports": { "exports": {
@ -45,7 +45,7 @@
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"tcp-port-used": "^1.0.2", "tcp-port-used": "^1.0.2",
"ulid": "^2.3.0" "ulidx": "^2.3.0"
}, },
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"

View File

@ -43,6 +43,7 @@ export default [
// https://github.com/rollup/rollup-plugin-node-resolve#usage // https://github.com/rollup/rollup-plugin-node-resolve#usage
resolve({ resolve({
extensions: ['.js', '.ts', '.svelte'], extensions: ['.js', '.ts', '.svelte'],
browser: true,
}), }),
// Resolve source maps to the original source // Resolve source maps to the original source

View File

@ -29,7 +29,7 @@ import {
getJanDataFolderPath, getJanDataFolderPath,
} from '@janhq/core' } from '@janhq/core'
import { requestInference } from './helpers/sse' import { requestInference } from './helpers/sse'
import { ulid } from 'ulid' import { ulid } from 'ulidx'
/** /**
* A class that implements the InferenceExtension interface from the @janhq/core package. * A class that implements the InferenceExtension interface from the @janhq/core package.

View File

@ -3,13 +3,14 @@ import path from 'path'
import { ChildProcessWithoutNullStreams, spawn } from 'child_process' import { ChildProcessWithoutNullStreams, spawn } from 'child_process'
import tcpPortUsed from 'tcp-port-used' import tcpPortUsed from 'tcp-port-used'
import fetchRT from 'fetch-retry' import fetchRT from 'fetch-retry'
import { log, getSystemResourceInfo } from '@janhq/core/node'
import { import {
log,
getSystemResourceInfo,
Model, Model,
InferenceEngine, InferenceEngine,
ModelSettingParams, ModelSettingParams,
PromptTemplate, PromptTemplate,
} from '@janhq/core' } from '@janhq/core/node'
import { executableNitroFile } from './execute' import { executableNitroFile } from './execute'
// Polyfill fetch with retry // Polyfill fetch with retry

View File

@ -8,7 +8,7 @@
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
"build": "tsc -b . && webpack --config webpack.config.js", "build": "tsc -b . && webpack --config webpack.config.js",
"build:publish": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install" "build:publish": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install"
}, },
"exports": { "exports": {
".": "./dist/index.js", ".": "./dist/index.js",
@ -25,7 +25,7 @@
"@janhq/core": "file:../../core", "@janhq/core": "file:../../core",
"fetch-retry": "^5.0.6", "fetch-retry": "^5.0.6",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"ulid": "^2.3.0" "ulidx": "^2.3.0"
}, },
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"

View File

@ -25,7 +25,7 @@ import {
joinPath, joinPath,
} from '@janhq/core' } from '@janhq/core'
import { requestInference } from './helpers/sse' import { requestInference } from './helpers/sse'
import { ulid } from 'ulid' import { ulid } from 'ulidx'
import { join } from 'path' import { join } from 'path'
/** /**

View File

@ -8,7 +8,7 @@
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
"build": "tsc -b . && webpack --config webpack.config.js", "build": "tsc -b . && webpack --config webpack.config.js",
"build:publish": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install" "build:publish": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install"
}, },
"exports": { "exports": {
".": "./dist/index.js", ".": "./dist/index.js",
@ -17,16 +17,17 @@
"devDependencies": { "devDependencies": {
"cpx": "^1.5.0", "cpx": "^1.5.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"ts-loader": "^9.5.0",
"typescript": "5.3.3",
"webpack": "^5.88.2", "webpack": "^5.88.2",
"webpack-cli": "^5.1.4", "webpack-cli": "^5.1.4"
"ts-loader": "^9.5.0"
}, },
"dependencies": { "dependencies": {
"@janhq/core": "file:../../core", "@janhq/core": "file:../../core",
"fetch-retry": "^5.0.6", "fetch-retry": "^5.0.6",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"ulid": "^2.3.0", "rxjs": "^7.8.1",
"rxjs": "^7.8.1" "ulidx": "^2.3.0"
}, },
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"

View File

@ -22,7 +22,7 @@ import {
ModelEvent, ModelEvent,
} from '@janhq/core' } from '@janhq/core'
import { requestInference } from './helpers/sse' import { requestInference } from './helpers/sse'
import { ulid } from 'ulid' import { ulid } from 'ulidx'
import { join } from 'path' import { join } from 'path'
import { EngineSettings } from './@types/global' import { EngineSettings } from './@types/global'

View File

@ -7,15 +7,23 @@
"author": "Jan <service@jan.ai>", "author": "Jan <service@jan.ai>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
"build": "tsc -b . && webpack --config webpack.config.js", "build": "rollup -c rollup.config.ts",
"build:publish": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install" "build:publish": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install"
}, },
"devDependencies": { "devDependencies": {
"cpx": "^1.5.0", "cpx": "^1.5.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"webpack": "^5.88.2", "ts-loader": "^9.5.0",
"webpack-cli": "^5.1.4", "typescript": "5.3.3",
"ts-loader": "^9.5.0" "@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@types/pdf-parse": "^1.1.4",
"rollup": "^2.38.5",
"rollup-plugin-define": "^1.0.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.36.0"
}, },
"files": [ "files": [
"dist/*", "dist/*",

View File

@ -0,0 +1,48 @@
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import sourceMaps from 'rollup-plugin-sourcemaps'
import typescript from 'rollup-plugin-typescript2'
import json from '@rollup/plugin-json'
import replace from '@rollup/plugin-replace'
const packageJson = require('./package.json')
const pkg = require('./package.json')
export default [
{
input: `src/index.ts`,
output: [{ file: pkg.main, format: 'es', sourcemap: true }],
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
external: [],
watch: {
include: 'src/**',
},
plugins: [
replace({
EXTENSION_NAME: JSON.stringify(packageJson.name),
MODULE_PATH: JSON.stringify(
`${packageJson.name}/${packageJson.module}`
),
VERSION: JSON.stringify(packageJson.version),
}),
// Allow json resolution
json(),
// Compile TypeScript files
typescript({ useTsconfigDeclarationDir: true }),
// Compile TypeScript files
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
// commonjs(),
// Allow node_modules resolution, so you can use 'external' to control
// which external modules to include in the bundle
// https://github.com/rollup/rollup-plugin-node-resolve#usage
resolve({
extensions: ['.js', '.ts', '.svelte'],
browser: true,
}),
// Resolve source maps to the original source
sourceMaps(),
],
},
]

View File

@ -1,40 +0,0 @@
const path = require('path')
const webpack = require('webpack')
const packageJson = require('./package.json')
module.exports = {
experiments: { outputModule: true },
entry: './src/index.ts', // Adjust the entry point to match your project's main file
mode: 'production',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
plugins: [
new webpack.DefinePlugin({
EXTENSION_NAME: JSON.stringify(packageJson.name),
MODULE_PATH: JSON.stringify(`${packageJson.name}/${packageJson.module}`),
VERSION: JSON.stringify(packageJson.version),
}),
],
output: {
filename: 'index.js', // Adjust the output file name as needed
path: path.resolve(__dirname, 'dist'),
library: { type: 'module' }, // Specify ESM output format
},
resolve: {
extensions: ['.ts', '.js'],
fallback: {
path: require.resolve('path-browserify'),
},
},
optimization: {
minimize: false,
},
// Add loaders and other configuration as needed for your project
}

View File

@ -12,7 +12,7 @@
"download-artifacts:darwin": "echo 'No artifacts to download for darwin'", "download-artifacts:darwin": "echo 'No artifacts to download for darwin'",
"download-artifacts:win32": "download.bat", "download-artifacts:win32": "download.bat",
"download-artifacts:linux": "download https://delta.jan.ai/vulkaninfo -o ./bin && chmod +x ./bin/vulkaninfo", "download-artifacts:linux": "download https://delta.jan.ai/vulkaninfo -o ./bin && chmod +x ./bin/vulkaninfo",
"build:publish": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install" "build:publish": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install"
}, },
"exports": { "exports": {
".": "./dist/index.js", ".": "./dist/index.js",

View File

@ -4,8 +4,9 @@ import {
OperatingSystemInfo, OperatingSystemInfo,
ResourceInfo, ResourceInfo,
SupportedPlatforms, SupportedPlatforms,
} from '@janhq/core' getJanDataFolderPath,
import { getJanDataFolderPath, log } from '@janhq/core/node' log,
} from '@janhq/core/node'
import { mem, cpu } from 'node-os-utils' import { mem, cpu } from 'node-os-utils'
import { exec } from 'child_process' import { exec } from 'child_process'
import { writeFileSync, existsSync, readFileSync, mkdirSync } from 'fs' import { writeFileSync, existsSync, readFileSync, mkdirSync } from 'fs'

View File

@ -22,9 +22,9 @@
"provider": "nitro-tensorrt-llm", "provider": "nitro-tensorrt-llm",
"scripts": { "scripts": {
"build": "tsc --module commonjs && rollup -c rollup.config.ts", "build": "tsc --module commonjs && rollup -c rollup.config.ts",
"build:publish:win32": "rimraf *.tgz --glob && npm run build && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install", "build:publish:win32": "rimraf *.tgz --glob && yarn build && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install",
"build:publish:linux": "rimraf *.tgz --glob && npm run build && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install", "build:publish:linux": "rimraf *.tgz --glob && yarn build && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install",
"build:publish:darwin": "rimraf *.tgz --glob && npm run build && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install", "build:publish:darwin": "rimraf *.tgz --glob && yarn build && cpx \"bin/**\" \"dist/bin\" && npm pack && cpx *.tgz ../../pre-install",
"build:publish": "run-script-os" "build:publish": "run-script-os"
}, },
"exports": { "exports": {
@ -57,7 +57,7 @@
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"tcp-port-used": "^1.0.2", "tcp-port-used": "^1.0.2",
"ulid": "^2.3.0" "ulidx": "^2.3.0"
}, },
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"

View File

@ -2,10 +2,13 @@ import path from 'path'
import { ChildProcessWithoutNullStreams, spawn } from 'child_process' import { ChildProcessWithoutNullStreams, spawn } from 'child_process'
import tcpPortUsed from 'tcp-port-used' import tcpPortUsed from 'tcp-port-used'
import fetchRT from 'fetch-retry' import fetchRT from 'fetch-retry'
import { log, getJanDataFolderPath } from '@janhq/core/node' import {
log,
getJanDataFolderPath,
SystemInformation,
PromptTemplate,
} from '@janhq/core/node'
import decompress from 'decompress' import decompress from 'decompress'
import { SystemInformation } from '@janhq/core'
import { PromptTemplate } from '@janhq/core'
// Polyfill fetch with retry // Polyfill fetch with retry
const fetchRetry = fetchRT(fetch) const fetchRetry = fetchRT(fetch)

View File

@ -34,9 +34,9 @@
"build:web": "yarn workspace jan-web build && cpx \"web/out/**\" \"electron/renderer/\"", "build:web": "yarn workspace jan-web build && cpx \"web/out/**\" \"electron/renderer/\"",
"build:electron": "yarn copy:assets && yarn workspace jan build", "build:electron": "yarn copy:assets && yarn workspace jan build",
"build:electron:test": "yarn workspace jan build:test", "build:electron:test": "yarn workspace jan build:test",
"build:extensions:windows": "rimraf ./pre-install/*.tgz && powershell -command \"$jobs = Get-ChildItem -Path './extensions' -Directory | ForEach-Object { Start-Job -Name ($_.Name) -ScriptBlock { param($_dir); try { Set-Location $_dir; npm install; npm run build:publish; Write-Output 'Build successful in ' + $_dir } catch { Write-Error 'Error in ' + $_dir; throw } } -ArgumentList $_.FullName }; $jobs | Wait-Job; $jobs | ForEach-Object { Receive-Job -Job $_ -Keep } | ForEach-Object { Write-Host $_ }; $failed = $jobs | Where-Object { $_.State -ne 'Completed' -or $_.ChildJobs[0].JobStateInfo.State -ne 'Completed' }; if ($failed) { Exit 1 }\"", "build:extensions:windows": "rimraf ./pre-install/*.tgz && powershell -command \"$jobs = Get-ChildItem -Path './extensions' -Directory | ForEach-Object { Start-Job -Name ($_.Name) -ScriptBlock { param($_dir); try { Set-Location $_dir; yarn; yarn build:publish; Write-Output 'Build successful in ' + $_dir } catch { Write-Error 'Error in ' + $_dir; throw } } -ArgumentList $_.FullName }; $jobs | Wait-Job; $jobs | ForEach-Object { Receive-Job -Job $_ -Keep } | ForEach-Object { Write-Host $_ }; $failed = $jobs | Where-Object { $_.State -ne 'Completed' -or $_.ChildJobs[0].JobStateInfo.State -ne 'Completed' }; if ($failed) { Exit 1 }\"",
"build:extensions:linux": "rimraf ./pre-install/*.tgz && find ./extensions -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n 1 -P 4 -I {} sh -c 'cd {} && npm install && npm run build:publish'", "build:extensions:linux": "rimraf ./pre-install/*.tgz && find ./extensions -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n 1 -P 4 -I {} sh -c 'cd {}; yarn; yarn build:publish'",
"build:extensions:darwin": "rimraf ./pre-install/*.tgz && find ./extensions -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n 1 -P 4 -I {} sh -c 'cd {} && npm install && npm run build:publish'", "build:extensions:darwin": "rimraf ./pre-install/*.tgz && find ./extensions -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n 1 -P 4 -I {} sh -c 'cd {}; yarn; yarn build:publish'",
"build:extensions:server": "yarn workspace build:extensions ", "build:extensions:server": "yarn workspace build:extensions ",
"build:extensions": "run-script-os", "build:extensions": "run-script-os",
"build:test": "yarn copy:assets && yarn build:web && yarn workspace jan build:test", "build:test": "yarn copy:assets && yarn build:web && yarn workspace jan build:test",

View File

@ -17,7 +17,7 @@ import {
ModelInitFailed, ModelInitFailed,
} from '@janhq/core' } from '@janhq/core'
import { useAtomValue, useSetAtom } from 'jotai' import { useAtomValue, useSetAtom } from 'jotai'
import { ulid } from 'ulid' import { ulid } from 'ulidx'
import { import {
activeModelAtom, activeModelAtom,

View File

@ -21,7 +21,7 @@ import {
} from '@janhq/core' } from '@janhq/core'
import { atom, useAtom, useAtomValue, useSetAtom } from 'jotai' import { atom, useAtom, useAtomValue, useSetAtom } from 'jotai'
import { ulid } from 'ulid' import { ulid } from 'ulidx'
import { selectedModelAtom } from '@/containers/DropdownListSidebar' import { selectedModelAtom } from '@/containers/DropdownListSidebar'
import { import {

View File

@ -44,7 +44,7 @@
"sass": "^1.69.4", "sass": "^1.69.4",
"tailwind-merge": "^2.0.0", "tailwind-merge": "^2.0.0",
"tailwindcss": "3.3.5", "tailwindcss": "3.3.5",
"ulid": "^2.3.0", "ulidx": "^2.3.0",
"uuid": "^9.0.1", "uuid": "^9.0.1",
"zod": "^3.22.4" "zod": "^3.22.4"
}, },