Skip to content

Commit

Permalink
fix(runner): base options
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Jun 17, 2023
1 parent dd706aa commit 6016d60
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/pdfeasy/src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const resolveRunnerOptions = (
): RunOptions => {
return {
type: options.type || isBrowser ? 'client' : 'server',
clientEmit: options.clientEmit || isBrowser ? 'blob' : 'none',
clientEmit: options.clientEmit || 'blob',
serverPath: options.serverPath || '/',
colorSchema: options.colorSchema || 'RGB',
cwd: options?.cwd || !isBrowser ? process.cwd() : '/',
Expand Down
7 changes: 3 additions & 4 deletions packages/pdfeasy/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,8 @@ export class PDFEasy {
if (this.runOptions?.type === 'server') {
this.pdfkit?.pipe(
createWriteStream(
path.resolve(
(options?.cwd || process.cwd()) + this.runOptions.serverPath
) + `/${this.options?.exports?.name || 'New PDF'}.pdf`
path.resolve(this.runOptions.cwd + this.runOptions.serverPath) +
`/${this.options?.exports?.name || 'New PDF'}.pdf`
)
)

Expand Down Expand Up @@ -366,7 +365,7 @@ export class PDFEasy {
})

stream.on('finish', (): void => {
switch (options?.clientEmit || 'blob') {
switch (this.runOptions?.clientEmit) {
case 'blob':
res(stream.toBlobURL('application/pdf') as string)
break
Expand Down
1 change: 1 addition & 0 deletions packages/pdfeasy/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from 'vite'

export default defineConfig({
test: {
testTimeout: 10000,
environment: 'happy-dom',
coverage: {
include: ['src'],
Expand Down

0 comments on commit 6016d60

Please sign in to comment.