From fcbf84269d2b44db11769a037c89b48aff143148 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 8 Aug 2024 16:22:37 +0700 Subject: [PATCH] fix: set namespace for js module (#999) --- cortex-js/package.json | 5 ++++- cortex-js/src/index.ts | 1 + cortex-js/src/infrastructure/commanders/base.command.ts | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cortex-js/package.json b/cortex-js/package.json index ad405c5a5..7aea006a7 100644 --- a/cortex-js/package.json +++ b/cortex-js/package.json @@ -14,7 +14,10 @@ "dev": "nest dev", "compile": "npx ncc build ./dist/src/command.js -o command", "build": "nest build", - "build:binary": "yarn build && yarn compile && npx -q patch-package && npx @yao-pkg/pkg .", + "build:binary": "yarn build && yarn compile && npx -q patch-package && run-script-os", + "build:binary:windows": "npx @yao-pkg/pkg . --targets node20-win", + "build:binary:linux": "npx @yao-pkg/pkg . --targets node20-linux", + "build:binary:macos": "npx @yao-pkg/pkg . --targets node20-macos", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "build:extensions": "run-script-os", "build:extensions:windows": "powershell -command \"$jobs = Get-ChildItem -Path './src/extensions' -Directory | ForEach-Object { Start-Job -Name ($_.Name) -ScriptBlock { param($_dir); try { Set-Location $_dir; yarn; yarn build; 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 }\"", diff --git a/cortex-js/src/index.ts b/cortex-js/src/index.ts index 34a1cef2a..24dfa6d73 100644 --- a/cortex-js/src/index.ts +++ b/cortex-js/src/index.ts @@ -23,6 +23,7 @@ export async function start( dataFolder?: string, ) { if (name) { + fileManagerService.setConfigProfile(name); const isProfileConfigExists = fileManagerService.profileConfigExists(name); if (!isProfileConfigExists) { await fileManagerService.writeConfigFile({ diff --git a/cortex-js/src/infrastructure/commanders/base.command.ts b/cortex-js/src/infrastructure/commanders/base.command.ts index 5d3be2b98..e6b23463f 100644 --- a/cortex-js/src/infrastructure/commanders/base.command.ts +++ b/cortex-js/src/infrastructure/commanders/base.command.ts @@ -3,7 +3,6 @@ import { Injectable } from '@nestjs/common'; import { CortexUsecases } from '@/usecases/cortex/cortex.usecases'; import ora from 'ora'; import { CortexClient } from './services/cortex.client'; -import { fileManagerService } from '../services/file-manager/file-manager.service'; @Injectable() export abstract class BaseCommand extends CommandRunner {