-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cubejs-cli): Run dev-server/server commands from @cubejs-backend…
…/core
- Loading branch information
Showing
5 changed files
with
76 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { CommanderStatic } from 'commander'; | ||
import { displayError, requireFromPackage, requiredPackageExists } from '../utils'; | ||
|
||
async function devServerCommand() { | ||
await requiredPackageExists('@cubejs-backend/server'); | ||
|
||
const OriginalCommandPackage = await requireFromPackage('@cubejs-backend/server/dist/command/dev-server'); | ||
// eslint-disable-next-line new-cap | ||
const Command = new OriginalCommandPackage.default([]); | ||
return Command.run(); | ||
} | ||
|
||
export function configureDevServerCommand(program: CommanderStatic) { | ||
program | ||
.command('dev-server') | ||
.description('Run server in Development mode') | ||
.action( | ||
() => devServerCommand() | ||
.catch((e) => displayError(e.stack || e)) | ||
) | ||
.on('--help', () => { | ||
console.log(''); | ||
console.log('Examples:'); | ||
console.log(''); | ||
console.log(' $ cubejs dev-server'); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { CommanderStatic } from 'commander'; | ||
import { displayError, requiredPackageExists, requireFromPackage } from '../utils'; | ||
|
||
async function serverCommand() { | ||
await requiredPackageExists('@cubejs-backend/server'); | ||
|
||
const OriginalCommandPackage = await requireFromPackage('@cubejs-backend/server/dist/command/server'); | ||
// eslint-disable-next-line new-cap | ||
const Command = new OriginalCommandPackage.default([]); | ||
return Command.run(); | ||
} | ||
|
||
export function configureServerCommand(program: CommanderStatic) { | ||
program | ||
.command('server') | ||
.description('Run server in Production mode') | ||
.action( | ||
() => serverCommand() | ||
.catch((e) => displayError(e.stack || e)) | ||
) | ||
.on('--help', () => { | ||
console.log(''); | ||
console.log('Examples:'); | ||
console.log(''); | ||
console.log(' $ cubejs server'); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters