@@ -7,13 +7,13 @@ import { md5 } from "./md5"
77import { IProjectConfig } from "./project-config-interface"
88import {
99 helperPath ,
10- markdownPath ,
10+ markdownLayoutPath ,
1111 markdownTempPath ,
1212 notFoundPath ,
1313 tempJsEntryPath
1414} from "./structor-config"
1515
16- const MARKDOWN_TEMPLATE_NAME = "MarkdownTemplate"
16+ const MARKDOWN_LAYOUT_NAME = "MarkdownTemplate"
1717const MARKDOWN_WRAPPER = "MarkdownWrapper"
1818
1919interface IEntryText {
@@ -135,8 +135,17 @@ export async function createEntry(info: IProjectInfo, projectRootPath: string, e
135135
136136 // Set markdownImporter
137137 if ( info . hasMarkdownFile ) {
138- const markdownRelativePath = path . relative ( tempJsEntryPath . dir , path . join ( markdownPath . dir , markdownPath . name ) )
139- entryText . markdownImporter += `import ${ MARKDOWN_TEMPLATE_NAME } from "${ markdownRelativePath } "\n`
138+ const markdownRelativePath = path . relative ( tempJsEntryPath . dir , path . join ( markdownLayoutPath . dir , markdownLayoutPath . name ) )
139+
140+ if ( info . stores . length === 0 ) {
141+ entryText . markdownImporter = `import ${ MARKDOWN_LAYOUT_NAME } from "${ markdownRelativePath } "\n`
142+ } else {
143+ const markdownLayoutPure = `${ MARKDOWN_LAYOUT_NAME } Pure`
144+ entryText . markdownImporter = `
145+ import ${ markdownLayoutPure } from "${ markdownRelativePath } "
146+ const ${ MARKDOWN_LAYOUT_NAME } = Connect()(${ markdownLayoutPure } )
147+ `
148+ }
140149 }
141150
142151 // Set routes
@@ -228,9 +237,9 @@ export async function createEntry(info: IProjectInfo, projectRootPath: string, e
228237 entryText . pageImporter += `
229238 import ${ tempComponentName } from "${ markdownTsAbsolutePathWithoutExt } "
230239 const ${ componentName } = () => (
231- <${ MARKDOWN_TEMPLATE_NAME } >
240+ <${ MARKDOWN_LAYOUT_NAME } >
232241 ${ wrapperStr }
233- </${ MARKDOWN_TEMPLATE_NAME } >
242+ </${ MARKDOWN_LAYOUT_NAME } >
234243 )
235244 `
236245 } else {
@@ -246,9 +255,9 @@ export async function createEntry(info: IProjectInfo, projectRootPath: string, e
246255 importCode = `
247256 import("${ markdownTsAbsolutePathWithoutExt } ").then(code => {
248257 return () => (
249- <${ MARKDOWN_TEMPLATE_NAME } >
258+ <${ MARKDOWN_LAYOUT_NAME } >
250259 ${ wrapperStr }
251- </${ MARKDOWN_TEMPLATE_NAME } >
260+ </${ MARKDOWN_LAYOUT_NAME } >
252261 )
253262 })
254263 `
0 commit comments