@iannisz/node-cms
Advanced tools
Comparing version 0.0.1 to 0.0.2
import * as fs from 'fs' | ||
import * as chalk from 'chalk' | ||
import { Table } from 'node-json-database' | ||
type HTMLString = string | ||
type Path = string | ||
type PageCompiler = (pageContent: any, pages: any) => { html: string, path: string } | ||
type PageCompiler = (pageContent: any, pages: any) => { html: HTMLString, path: Path } | ||
export const compile = (pages: any, compilePage: any, root: string) => { | ||
export const compile = (pagesTable: Table, pageTypesTable: Table, compilePage: any, root: string) => { | ||
// Store start time | ||
@@ -16,7 +14,9 @@ | ||
for (let pageType in pages) { | ||
for (let i = 0; i < pages[pageType].pages.length; i++) { | ||
const pageCompiler = compilePage[pageType] as PageCompiler | ||
const page = pageCompiler(pages[pageType].pages[i], pages) | ||
for (let pageType of pageTypesTable.rows) { | ||
const pages = pagesTable.where(row => row.pageType == pageType.name).rows | ||
for (let i = 0; i < pages.length; i++) { | ||
const pageCompiler = compilePage[pageType.name] as PageCompiler | ||
const page = pageCompiler(pages[i], pages) | ||
// Create directory, if needed | ||
@@ -41,3 +41,3 @@ | ||
const getDirectory = (path: Path) => { | ||
const getDirectory = (path: string) => { | ||
let currentChar = path.charAt(path.length - 1) | ||
@@ -44,0 +44,0 @@ |
{ | ||
"name": "@iannisz/node-cms", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
@@ -16,4 +16,5 @@ "main": "index.js", | ||
"chalk": "^4.0.0", | ||
"ncp": "^2.0.0" | ||
"ncp": "^2.0.0", | ||
"node-json-database": "0.0.9" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3212
5
+ Addednode-json-database@0.0.9
+ Added@types/node@14.18.63(transitive)
+ Addednode-json-database@0.0.9(transitive)