File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @staart/site" ,
3- "version" : " 0.9.61 " ,
3+ "version" : " 0.9.62 " ,
44 "module" : " dist/module.js" ,
55 "main" : " dist/index.js" ,
66 "bin" : " ./dist/index.js" ,
Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ import gitUrlParse from "git-url-parse";
66import { cached } from "./cache" ;
77const explorer = cosmiconfig ( "staart" ) ;
88
9- export const getConfig = async ( ) => {
9+ let customConfig : StaartSiteConfig | undefined = undefined ;
10+ export const getConfig = async ( userConfig ?: StaartSiteConfig ) => {
11+ if ( userConfig ) customConfig = userConfig ;
1012 const config = await cached < StaartSiteConfig > ( "config" , _getConfig ) ;
11- if ( config ) return config ;
13+ if ( config ) return { ... config , ... customConfig } as StaartSiteConfig ;
1214 throw new Error ( "Config not found" ) ;
1315} ;
1416
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { removeHeading } from "./parse";
1818import { getConfig } from "./config" ;
1919import { SitemapStream , streamToPromise } from "sitemap" ;
2020import color from "color" ;
21+ import { StaartSiteConfig } from "./interfaces" ;
2122
2223export const getTemplate = async ( ) => {
2324 const result = await cached < string > ( "template" , async ( ) => {
@@ -111,9 +112,9 @@ export const getCss = async () => {
111112 ) ;
112113} ;
113114
114- export const generate = async ( ) => {
115+ export const generate = async ( customConfig ?: StaartSiteConfig ) => {
115116 ensureDir ( await getDistPath ( ) ) ;
116- const config = await getConfig ( ) ;
117+ const config = await getConfig ( customConfig ) ;
117118 if ( ! config . noHome ) await generatePage ( "index.html" , await getHomeContent ( ) ) ;
118119 if ( ! config . noSitemap ) await generateSitemap ( ) ;
119120 const files = ( await listContentFiles ( ) ) . filter (
Original file line number Diff line number Diff line change 1- import { generate } from "./generator" ;
2-
3- export default generate ;
1+ export { generate } from "./generator" ;
You can’t perform that action at this time.
0 commit comments