Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions lib/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,22 @@ export default argv => {
// create a list of plugin pages.
const pluginPages = new Map()

Object.keys(packageJson.dependencies)
.filter(depend => depend.startsWith('wiki-plugin'))
.forEach(plugin => {
const pagesPath = path.join(path.dirname(require.resolve(`${plugin}/package`)), 'pages')
fs.readdir(pagesPath, { withFileTypes: true }, (err, entries) => {
if (err) return
entries.forEach(entry => {
if (entry.isFile() && !pluginPages.has(entry.name)) {
pluginPages.set(entry.name, { pluginName: plugin, pluginPath: entry.parentPath })
}
})
const dependencyPlugins = Object.keys(packageJson.dependencies).filter(depend => depend.startsWith('wiki-plugin'))
const plugins = dependencyPlugins.length
? dependencyPlugins
: Object.keys(packageJson.devDependencies).filter(depend => depend.startsWith('wiki-plugin'))

plugins.forEach(plugin => {
const pagesPath = path.join(path.dirname(require.resolve(`${plugin}/package`)), 'pages')
fs.readdir(pagesPath, { withFileTypes: true }, (err, entries) => {
if (err) return
entries.forEach(entry => {
if (entry.isFile() && !pluginPages.has(entry.name)) {
pluginPages.set(entry.name, { pluginName: plugin, pluginPath: entry.parentPath })
}
})
})
})

// #### Private utility methods. ####
const load_parse = (loc, cb, annotations = {}) => {
Expand Down
19 changes: 14 additions & 5 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,17 @@ export default async argv => {
})
}

// in test (wiki-server) the plugins are listed as devDependencues, so we need to fallback to
// using devDEpendencies when there are no plugins in dependencies.
const dependencyPlugins = Object.keys(packageJson.dependencies).filter(depend => depend.startsWith('wiki-plugin'))
const plugins = dependencyPlugins.length
? dependencyPlugins
: Object.keys(packageJson.devDependencies).filter(depend => depend.startsWith('wiki-plugin'))

Promise.all(
Object.keys(packageJson.dependencies)
.filter(depend => depend.startsWith('wiki-plugin'))
.map(plugin => {
return getPackageFactory(plugin)
}),
plugins.map(plugin => {
return getPackageFactory(plugin)
}),
).then(() => res.end(JSON.stringify(factories)))
})

Expand Down Expand Up @@ -643,6 +648,10 @@ export default async argv => {
} catch (e) {
return res.e(e)
}
// Object.keys(packageJson.dependencies)
// .filter(depend => depend.startsWith('wiki-plugin'))
// .map(name => name.slice(12))
// .then(names => res.send(names))
})
//{
const sitemapLoc = path.join(argv.status, 'sitemap.json')
Expand Down
2 changes: 1 addition & 1 deletion lib/sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default argv => {
itself.emit('finished')
}
itself.isWorking = () => {
working
return working
}

itself.createSitemap = pagehandler => {
Expand Down
14 changes: 0 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"dependencies": {
"body-parser": "^2.2.1",
"client-sessions": "^0.8.0",
"coffeescript": "^2.5.0",
"cookie-parser": "^1.4.4",
"dompurify": "^3.3.0",
"errorhandler": "^1.5.1",
Expand All @@ -51,8 +50,8 @@
"scripts": {
"prettier:format": "prettier --write './**/*.js'",
"prettier:check": "prettier --check ./**/*.js",
"test": "cd test; node --test",
"watch": "cd test; node --test --watch",
"test": "node --test",
"watch": "node --test --watch",
"update-authors": "node scripts/update-authors.js"
},
"devDependencies": {
Expand Down