File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,8 @@ async function renderFiles() {
37
37
const currPath = path . resolve ( currDir , file )
38
38
const prevPath = path . resolve ( prevDir , file )
39
39
40
- let curr
41
- if ( existsSync ( currPath ) ) curr = await importJSON ( currPath )
42
- let prev
43
- if ( existsSync ( prevPath ) ) prev = await importJSON ( prevPath )
44
-
40
+ const curr = await importJSON ( currPath )
41
+ const prev = await importJSON ( prevPath )
45
42
const fileName = curr ?. file || prev ?. file
46
43
47
44
if ( ! curr ) {
@@ -79,7 +76,9 @@ async function processExports() {
79
76
const curr = await importJSON ( path . resolve ( currDir , '_exports.json' ) )
80
77
const prev = await importJSON ( path . resolve ( prevDir , '_exports.json' ) )
81
78
output += '\n### Exports\n\n'
82
- output += renderExports ( curr , prev )
79
+ if ( prev ) {
80
+ output += renderExports ( curr , prev )
81
+ }
83
82
output += `\n\n<details>\n<summary>Show full exports</summary>\n\n${ renderExports (
84
83
curr
85
84
) } \n\n</details>\n\n`
@@ -123,6 +122,7 @@ function renderExports(exports, prev) {
123
122
* @param {string } path
124
123
*/
125
124
async function importJSON ( path ) {
125
+ if ( ! existsSync ( path ) ) return undefined
126
126
return ( await import ( path , { assert : { type : 'json' } } ) ) . default
127
127
}
128
128
You can’t perform that action at this time.
0 commit comments