From 7828514ac96fb068d4bbcacfc895617ee42a3391 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 11 Feb 2024 14:00:55 -0800 Subject: [PATCH] chore: wip --- config/ai.ts | 2 +- storage/framework/core/actions/src/bump.ts | 8 ++++---- .../framework/core/actions/src/helpers/utils.ts | 13 +++++++++---- storage/framework/core/actions/src/release.ts | 5 ++++- storage/framework/core/cli/src/exec.ts | 16 ++++++++-------- storage/framework/core/cli/src/run.ts | 2 +- 6 files changed, 27 insertions(+), 19 deletions(-) diff --git a/config/ai.ts b/config/ai.ts index 01de1a0874..9a37b0def9 100644 --- a/config/ai.ts +++ b/config/ai.ts @@ -26,5 +26,5 @@ export default { 'meta.llama2-70b-chat-v1', ], - deploy: true, + deploy: true, // deploys AI endpoints } satisfies AiConfig diff --git a/storage/framework/core/actions/src/bump.ts b/storage/framework/core/actions/src/bump.ts index fc9441e7ab..c453a057a0 100644 --- a/storage/framework/core/actions/src/bump.ts +++ b/storage/framework/core/actions/src/bump.ts @@ -12,7 +12,7 @@ const bumpCommand = options?.dryRun ? 'bunx bumpp ./package.json ./core/**/package.json ./ide/vscode/package.json --no-push' : 'bunx bumpp ./package.json ./core/**/package.json ./ide/vscode/package.json --all' -await runCommand( - bumpCommand, - { cwd: p.frameworkPath(), stdin: 'inherit' }, -) +await runCommand(bumpCommand, { + cwd: p.frameworkPath(), + stdin: 'inherit', +}) diff --git a/storage/framework/core/actions/src/helpers/utils.ts b/storage/framework/core/actions/src/helpers/utils.ts index 67d5ae199d..4e205e3585 100644 --- a/storage/framework/core/actions/src/helpers/utils.ts +++ b/storage/framework/core/actions/src/helpers/utils.ts @@ -1,5 +1,5 @@ import * as storage from '@stacksjs/storage' -import { buddyOptions, italic, parseOptions, runCommand, runCommands, underline } from '@stacksjs/cli' +import { buddyOptions, runCommand, runCommands } from '@stacksjs/cli' import { log } from '@stacksjs/logging' import * as p from '@stacksjs/path' import type { ActionOptions, StacksError, Subprocess } from '@stacksjs/types' @@ -22,8 +22,8 @@ export async function runAction(action: string, options?: ActionOptions): Promis ...options, } - log.debug('runAction:', underline(italic(cmd))) - log.debug('runAction Options:', optionsWithCwd) + log.debug('runAction:', cmd) + log.debug('action options:', optionsWithCwd) if (!hasAction(action)) return err(handleError(`The specified action "${action}" does not exist`)) @@ -39,6 +39,9 @@ export async function runAction(action: string, options?: ActionOptions): Promis * @returns The result of the command. */ export async function runActions(actions: string[], options?: ActionOptions) { + log.debug('runActions:', actions) + log.debug('actions options:', options) + if (!actions.length) return err('No actions were specified') @@ -51,11 +54,13 @@ export async function runActions(actions: string[], options?: ActionOptions) { const o = { cwd: options?.cwd || p.projectPath(), - ...parseOptions(), + ...options, } const commands = actions.map(action => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`) + // eslint-disable-next-line no-console + console.log('this should have inherit:', o) return await runCommands(commands, o) } diff --git a/storage/framework/core/actions/src/release.ts b/storage/framework/core/actions/src/release.ts index 7c32c8aae9..48d37bce8c 100644 --- a/storage/framework/core/actions/src/release.ts +++ b/storage/framework/core/actions/src/release.ts @@ -10,6 +10,9 @@ await runActions([ Action.LintFix, // ensure there are no lint errors // Action.Test, // run the tests Action.Bump, // bump the versions, create the git tag, generate the changelog, commit & push the changes -], { cwd: projectPath(), stdin: 'inherit' }) // debug mode needs to be enabled to see the output due to the interactive prompts +], { // debug mode needs to be enabled to see the output due to the interactive prompts + cwd: projectPath(), + stdin: 'inherit', +}) log.success(`Successfully released ${app.name}`) diff --git a/storage/framework/core/cli/src/exec.ts b/storage/framework/core/cli/src/exec.ts index 953b042cc2..4a2af837e5 100644 --- a/storage/framework/core/cli/src/exec.ts +++ b/storage/framework/core/cli/src/exec.ts @@ -33,9 +33,9 @@ export async function exec(command: string | string[], options?: CliOptions): Pr if (!cmd) return err(handleError(`Failed to parse command: ${cmd}`, options)) - log.debug('Running exec:', Array.isArray(command) ? command.join(' ') : command) + log.debug('exec:', Array.isArray(command) ? command.join(' ') : command) log.debug('cmd:', cmd) - log.debug('Options:', options) + log.debug('exec options:', options) const proc = Bun.spawn(cmd, { ...options, @@ -51,12 +51,12 @@ export async function exec(command: string | string[], options?: CliOptions): Pr }) // Check if we need to write to stdin - if (options?.stdin === 'pipe' && options.input) { - if (proc.stdin) { - proc.stdin.write(options.input) - proc.stdin.end() - } - } + // if (options?.stdin === 'pipe' && options.input) { + // if (proc.stdin) { + // proc.stdin.write(options.input) + // proc.stdin.end() + // } + // } const exited = await proc.exited if (exited === ExitCode.Success) diff --git a/storage/framework/core/cli/src/run.ts b/storage/framework/core/cli/src/run.ts index e52b270b52..176f6ed092 100644 --- a/storage/framework/core/cli/src/run.ts +++ b/storage/framework/core/cli/src/run.ts @@ -31,7 +31,7 @@ import { log } from './console' */ export async function runCommand(command: string, options?: CliOptions): Promise> { log.debug('runCommand:', command) - log.debug('runCommand Options:', options) + log.debug('options:', options) return await exec(command, options) }