Skip to content

Commit

Permalink
fix(export): revert to __app in exporter
Browse files Browse the repository at this point in the history
feat(api): added api (wip)
  • Loading branch information
jakobrosenberg committed Apr 6, 2020
1 parent d03e8b5 commit dad565f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 1 addition & 5 deletions lib/services/exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ module.exports.exporter = async function exporter(params) {
const routesPath = getAbsolutePath(params.routifyDir, 'urlIndex.js')
const basepaths = params.basepath
const urls = require(routesPath)
const entrypoint = fs.existsSync(`${distDir}/__dynamic.html`)
? `${distDir}/__dynamic.html`
: fs.existsSync(`${distDir}/__app.html`)
? `${distDir}/__app.html`
: `${distDir}/__bundled.html`
const entrypoint = `${distDir}/__app.html`

log(`Exporting to: ${relative(process.cwd(), distDir)}`)
await saveUrls(urls, basepaths, distDir, entrypoint)
Expand Down
1 change: 1 addition & 0 deletions runtime/buildRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function buildClientTree(file, parent = false, prevFiles = []) {
"assignLayout",
"assignIndexables",
"setPrototype",
"assignAPI"
]

// eslint-disable-next-line import/namespace
Expand Down
7 changes: 4 additions & 3 deletions runtime/plugins/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ export function setPrototype({ file }) {
}

export function assignAPI({ file }) {
const { nextSibling, prevSibling, parent, path, _prettyName, meta, indexables } = file
file.api = {
get name() { return file._prettyName },
get path() { return file.path },
get parent() { return file.parent.api },
get parent() { return parent && parent.api },
get children() { return file.indexables.map(({ api }) => api) },
get next() { return file.nextSibling.api },
get prev() { return file.prev.api },
get next() { return nextSibling && nextSibling.api },
get prev() { return prevSibling && prevSibling.api },
get meta() { return file.meta }
}
}
Expand Down

0 comments on commit dad565f

Please sign in to comment.