Skip to content

Commit

Permalink
fix(deploy-cli): Fixed bugs related to ESM conversion (#119)
Browse files Browse the repository at this point in the history
Also Improved CLI text formatting
  • Loading branch information
flamingquaks authored Jul 25, 2024
1 parent a395c2d commit eff57e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion cli/config-manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ import { type DeployConfig } from '../lib/shared/common/deploy-config'
import { formatText } from './consts'
import prompt from 'prompt-sync'
import { CONFIG_VERSION } from './config-version'
import path from 'path'
import path, { dirname } from 'path'
import figlet from 'figlet'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

const deployConfig = path.join(__dirname, '../bin/config.json')

const prompter = prompt({ sigint: true })
Expand Down
8 changes: 4 additions & 4 deletions cli/consts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ansi from 'ansi-escape-sequences'
import ansi from 'ansi-escape-sequences'

interface FormattingOptions {
bigHeader?: boolean
Expand Down Expand Up @@ -59,7 +59,7 @@ export const formatText = (
let outputText = ''
const styles: ansi.Style[] = []
if (formatting.bold === true) {
styles.push(ansi.style.bold as ansi.Style)
styles.push('bold')
}
if (formatting.textColor !== undefined) {
styles.push(formatting.textColor)
Expand All @@ -68,10 +68,10 @@ export const formatText = (
styles.push(formatting.backgroundColor)
}
if (formatting.italic === true) {
styles.push(ansi.style.italic as ansi.Style)
styles.push('italic')
}
if (formatting.underline === true) {
styles.push(ansi.style.underline as ansi.Style)
styles.push('underline')
}
if (styles.length > 0) {
outputText = ansi.format(text, styles)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.2.0",
"type": "module",
"scripts": {
"config": "node -r ts-node/register ./cli/config.ts",
"config": "tsx ./cli/config.ts",
"build": "tsc && npm run codegen && npm run build:appsync && npm run build:ui",
"build:ui": "cd lib/user-interface/genai-newsletter-ui/ && vite build",
"build:appsync": "tsx ./lib/api/functions/bundle.ts",
Expand Down

0 comments on commit eff57e0

Please sign in to comment.