Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Mar 8, 2024
1 parent d4c203f commit c4d734c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/Models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
autoIncrement: true, // defaults to true

traits: {
authenticatable: true, // defaults to false
useAuth: true, // defaults to false
useTimestamps: true, // defaults to true
useSeeder: { // defaults to a count of 10
count: 10,
Expand Down
27 changes: 20 additions & 7 deletions storage/framework/core/cli/src/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ export async function exec(command: string | string[], options?: CliOptions): Pr
detached: options?.background || false,
cwd: options?.cwd || import.meta.dir,
// env: { ...e, ...options?.env },
onExit(_subprocess, exitCode, _signalCode, _error) {
if (exitCode && exitCode !== ExitCode.Success)
process.exit(exitCode)
onExit(subprocess, exitCode, signalCode, error) {
exitHandler('spawn', subprocess, exitCode, signalCode, error)
},
})

Expand Down Expand Up @@ -103,12 +102,26 @@ export async function execSync(command: string | string[], options?: CliOptions)
stderr: options?.stderr ?? 'inherit',
cwd: options?.cwd ?? import.meta.dir,
// env: { ...Bun.env, ...options?.env },
onExit(_subprocess, exitCode, _signalCode, _error) {
// console.log('onExit', { subprocess, exitCode, signalCode, error })
if (exitCode !== ExitCode.Success && exitCode)
process.exit(exitCode)
onExit(subprocess, exitCode, signalCode, error) {
exitHandler('spawnSync', subprocess, exitCode, signalCode, error)
},
})

return proc.stdout.toString()
}

// @ts-expect-error - missing types is okay here but can be improved later on
function exitHandler(type: 'spawn' | 'spawnSync', subprocess, exitCode, signalCode, error) {
log.debug(`exitHandler: ${type}`)
log.debug('subprocess', subprocess)
log.debug('exitCode', exitCode)
log.debug('signalCode', signalCode)

if (error) {
log.error(error)
process.exit(ExitCode.FatalError)
}

if (exitCode !== ExitCode.Success && exitCode)
process.exit(exitCode)
}
1 change: 0 additions & 1 deletion storage/framework/core/error-handling/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ await Bun.build({
external: [
'@stacksjs/cli',
'@stacksjs/path',
'@stacksjs/storage',
],

plugins: [
Expand Down
2 changes: 0 additions & 2 deletions storage/framework/core/error-handling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@
"peerDependencies": {
"@stacksjs/cli": "workspace:*",
"@stacksjs/path": "workspace:*",
"@stacksjs/storage": "workspace:*",
"@stacksjs/types": "workspace:*"
},
"dependencies": {
"@stacksjs/cli": "workspace:*",
"@stacksjs/path": "workspace:*",
"@stacksjs/storage": "workspace:*",
"@stacksjs/types": "workspace:*",
"neverthrow": "^6.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion storage/framework/core/error-handling/src/handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dirname, logsPath } from '@stacksjs/path'
import { fs } from '@stacksjs/storage'
import fs from 'fs-extra'

interface ErrorOptions {
silent?: boolean
Expand Down
2 changes: 1 addition & 1 deletion storage/framework/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { defineConfig } from 'vitepress'
import { alias } from '@stacksjs/alias'
import { path as p } from '@stacksjs/path'
import { pwaDocs as pwa } from '@stacksjs/docs'
import { server } from '@stacksjs/server'
import { transformerTwoslash } from 'vitepress-plugin-twoslash'
import { alias } from '@stacksjs/alias'
import { withPwa } from '@vite-pwa/vitepress'
import userConfig from '../../../../config/docs'
import { analyticsHead, faviconHead } from './head'
Expand Down

0 comments on commit c4d734c

Please sign in to comment.