1 | const fs = require('fs-extra')
|
2 | const { join } = require('path')
|
3 | const { getPageTplList } = require('./pageTpl')
|
4 | exports.isPageNameExists = function(pageName) {
|
5 | const cwd = process.cwd()
|
6 | return (
|
7 | fs.pathExistsSync(join(cwd, `page/${pageName}.html`)) ||
|
8 | fs.pathExistsSync(join(cwd, `src/${pageName}`))
|
9 | )
|
10 | }
|
11 |
|
12 |
|
13 |
|
14 | exports.isPageTplExists = function(pageTpl, position) {
|
15 | if (position === 'local') {
|
16 | return fs.pathExistsSync(
|
17 | join(process.cwd(), `template/${pageTpl}/index.html`)
|
18 | )
|
19 | } else {
|
20 | const list = getPageTplList()
|
21 | return list.includes(pageTpl)
|
22 | }
|
23 | }
|