Skip to content

Commit eff57e0

Browse files
authored
fix(deploy-cli): Fixed bugs related to ESM conversion (#119)
Also Improved CLI text formatting
1 parent a395c2d commit eff57e0

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

cli/config-manage.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ import { type DeployConfig } from '../lib/shared/common/deploy-config'
33
import { formatText } from './consts'
44
import prompt from 'prompt-sync'
55
import { CONFIG_VERSION } from './config-version'
6-
import path from 'path'
6+
import path, { dirname } from 'path'
77
import figlet from 'figlet'
8+
import { fileURLToPath } from 'url'
9+
const __filename = fileURLToPath(import.meta.url)
10+
const __dirname = dirname(__filename)
11+
812
const deployConfig = path.join(__dirname, '../bin/config.json')
913

1014
const prompter = prompt({ sigint: true })

cli/consts.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as ansi from 'ansi-escape-sequences'
1+
import ansi from 'ansi-escape-sequences'
22

33
interface FormattingOptions {
44
bigHeader?: boolean
@@ -59,7 +59,7 @@ export const formatText = (
5959
let outputText = ''
6060
const styles: ansi.Style[] = []
6161
if (formatting.bold === true) {
62-
styles.push(ansi.style.bold as ansi.Style)
62+
styles.push('bold')
6363
}
6464
if (formatting.textColor !== undefined) {
6565
styles.push(formatting.textColor)
@@ -68,10 +68,10 @@ export const formatText = (
6868
styles.push(formatting.backgroundColor)
6969
}
7070
if (formatting.italic === true) {
71-
styles.push(ansi.style.italic as ansi.Style)
71+
styles.push('italic')
7272
}
7373
if (formatting.underline === true) {
74-
styles.push(ansi.style.underline as ansi.Style)
74+
styles.push('underline')
7575
}
7676
if (styles.length > 0) {
7777
outputText = ansi.format(text, styles)

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.2.0",
44
"type": "module",
55
"scripts": {
6-
"config": "node -r ts-node/register ./cli/config.ts",
6+
"config": "tsx ./cli/config.ts",
77
"build": "tsc && npm run codegen && npm run build:appsync && npm run build:ui",
88
"build:ui": "cd lib/user-interface/genai-newsletter-ui/ && vite build",
99
"build:appsync": "tsx ./lib/api/functions/bundle.ts",

0 commit comments

Comments
 (0)