Skip to content

Commit 87fddd2

Browse files
committed
feat: add option to render without fetching data
1 parent 7c84997 commit 87fddd2

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",
77
"build": "node dist/build.js",
8+
"render": "node dist/render.js",
89
"postinstall": "npx tsc"
910
},
1011
"repository": {

src/render.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Card } from './trello/api'
2+
import * as path from 'path'
3+
import { readFromFileCache } from './cache/cache-to-file'
4+
import { render } from './website/render'
5+
6+
const srcDir = path.join(__dirname, '..', 'src')
7+
const webDir = path.join(__dirname, '..', 'web')
8+
const cacheLocation = path.join(webDir, 'cards.json')
9+
const readCachedCards = readFromFileCache<Card[]>(cacheLocation)
10+
11+
readCachedCards()
12+
.then(cards =>
13+
render({
14+
cards,
15+
webDir,
16+
srcDir,
17+
}),
18+
)
19+
.then(() => {
20+
console.log('website generated successfully')
21+
})
22+
.catch(error => {
23+
console.error(error)
24+
process.exit(1)
25+
})

0 commit comments

Comments
 (0)