File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import * as path from 'path'
44import { setUpWebhooks } from './trello-netlify-bridge/setUpWebhooks'
55import { cacheToFile } from './cache/cache-to-file'
66import { render } from './website/render'
7+ import { promises as fs } from 'fs'
78
89config ( )
910
@@ -18,10 +19,19 @@ const cacheLocation = path.join(webDir, 'cards.json')
1819const cacheCards = cacheToFile < Card [ ] > ( cacheLocation )
1920const t = trelloApi ( { apiKey, apiToken } )
2021
21- t . lists
22- . cards ( {
23- list : websiteContentList ,
24- } )
22+ new Promise ( async resolve => {
23+ try {
24+ await fs . stat ( webDir )
25+ } catch {
26+ await fs . mkdir ( webDir )
27+ }
28+ resolve ( )
29+ } )
30+ . then ( ( ) =>
31+ t . lists . cards ( {
32+ list : websiteContentList ,
33+ } ) ,
34+ )
2535 . then ( cards =>
2636 Promise . all (
2737 cards . map ( card =>
Original file line number Diff line number Diff line change @@ -47,12 +47,6 @@ export const render = async ({
4747 webDir : string
4848 srcDir : string
4949} ) => {
50- try {
51- await fs . stat ( webDir )
52- } catch {
53- await fs . mkdir ( webDir )
54- }
55-
5650 const [ tpl , imageAttachmentTemplate ] = await Promise . all ( [
5751 fs . readFile ( path . join ( srcDir , 'index.html' ) , 'utf-8' ) ,
5852 fs . readFile ( path . join ( srcDir , 'image.html' ) , 'utf-8' ) ,
You can’t perform that action at this time.
0 commit comments