Skip to content

Commit b4c57ab

Browse files
fix: small fixes
1 parent a2b2eb8 commit b4c57ab

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

.changeset/rude-pens-brake.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'create-presta': patch
3+
'presta': patch
4+
---
5+
6+
Small fixes

packages/create-presta/lib/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import path from 'path'
22
import fs from 'fs-extra'
33
import merge from 'deepmerge'
44
import sort from 'sort-package-json'
5-
// import type { Body } from 'package-json-types'
65

76
export type Service = 'presta' | 'netlify' | 'vercel'
87
export type Language = 'ts' | 'js'

packages/create-presta/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"@types/fs-extra": "^9.0.12",
3838
"@types/node": "^18.6.3",
3939
"@types/prompts": "^2.0.14",
40-
"package-json-types": "^1.0.2",
4140
"typescript": "^4.7.4"
4241
}
4342
}

packages/presta/lib/core.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,16 @@ export function sortManifestFunctions(functions: Manifest['functions']) {
272272

273273
export function findAndParseConfigFile(userProvidedConfigFilepath?: string): Partial<PrestaConfig> {
274274
if (userProvidedConfigFilepath) {
275-
return requireFresh(path.resolve(userProvidedConfigFilepath))?.default
275+
return requireFresh(path.resolve(userProvidedConfigFilepath))
276276
} else {
277277
try {
278-
return requireFresh(path.resolve(defaultJSConfigFilepath))?.default
278+
return requireFresh(path.resolve(defaultJSConfigFilepath))
279279
} catch (e) {
280280
if (fs.existsSync(defaultJSConfigFilepath)) {
281281
throw e
282282
} else {
283283
try {
284-
return requireFresh(path.resolve(defaultTSConfigFilepath))?.default
284+
return requireFresh(path.resolve(defaultTSConfigFilepath))
285285
} catch (e) {
286286
if (fs.existsSync(defaultTSConfigFilepath)) {
287287
throw e
@@ -648,10 +648,14 @@ export class Presta {
648648
const html = response.body
649649
const outfile = path.join(this.staticOutputDir, filename)
650650

651-
fs.outputFileSync(outfile, html, 'utf-8')
652-
builtFiles.push(outfile)
651+
if (!html) {
652+
this.logger.warn(`Nothing to build for ${url}, response.body is undefined`)
653+
} else {
654+
fs.outputFileSync(outfile, html, 'utf-8')
655+
builtFiles.push(outfile)
653656

654-
this.logger.info(`● ${url}`, { duration: time() })
657+
this.logger.info(`● ${url}`, { duration: time() })
658+
}
655659
}
656660

657661
// diff previous built files with new files and remove stale

0 commit comments

Comments
 (0)