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
57 changes: 30 additions & 27 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@themost/cli",
"version": "2.6.0",
"version": "2.7.0",
"description": "CLI Tool for MOST Web Framework",
"homepage": "https://github.com/themost-framework/cli",
"repository": {
Expand Down
13 changes: 13 additions & 0 deletions util.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,19 @@ module.exports.getBuilder = function getBuilder(config) {
module.exports.getHttpApplication = function getHttpApplication(options) {
let HttpApplication;
let appModule;
if (options.application) {
// try to create application from custom module
let [customModule, className] = options.application.split('#');
if (className) {
const ApplicationClass = require(customModule)[className];
// create a new instance of application passing the output directory as the current path
return new ApplicationClass(path.resolve(process.cwd(), options.out));
}
if (typeof customModule !== 'function') {
throw new Error(`Invalid application module. The module ${options.application} does not export a function.`);
}
return customModule(path.resolve(process.cwd(), options.out));
}
try {
appModule = require.resolve('@themost/web',{
paths:[path.resolve(process.cwd(), 'node_modules')]
Expand Down