Skip to content

Commit

Permalink
build: update etl script
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard authored and rexxars committed Sep 14, 2022
1 parent d49a27d commit 9feb8f3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scripts/etl/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from 'path'
import {SanityDocument} from '@sanity/client'
import {APIPackageDocument, TransformResult} from '@sanity/tsdoc-to-portable-text'
import cac from 'cac'
import chalk from 'chalk'
Expand All @@ -19,10 +18,12 @@ function main() {
.command('[pattern]')
.option('--quiet', '[boolean] print only crucial logs')
.action(async (pattern, options) => {
const workspace = pattern
? config.workspace.filter((p) => p === pattern)
: // .filter((p) => p.includes(pattern))
config.workspace
const workspace = pattern ? config.workspace.filter((p) => p === pattern) : config.workspace

if (workspace.length === 0) {
console.error(`${chalk.red('error')} no matching packages "${pattern}"`)
process.exit(1)
}

const quiet = Boolean(options.quiet)

Expand Down Expand Up @@ -66,7 +67,7 @@ function main() {
await loadToSanity(docs)
} catch (error) {
if (error instanceof Error) {
console.log(`${chalk.red('error')} ${quiet ? error.message : error.stack}`)
console.error(`${chalk.red('error')} ${quiet ? error.message : error.stack}`)
}

process.exit(1)
Expand Down

0 comments on commit 9feb8f3

Please sign in to comment.