Skip to content

Commit fed9285

Browse files
committed
feat(@cubejs-backend/server): Introduce external commands for CLI (demo)
1 parent 06b5f01 commit fed9285

File tree

7 files changed

+696
-135
lines changed

7 files changed

+696
-135
lines changed

packages/cubejs-server/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

packages/cubejs-server/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"main": "index.js",
1616
"files": [
17+
"dist",
1718
"index.js",
1819
"index.d.ts",
1920
"WebSocketServer.js",
@@ -23,6 +24,9 @@
2324
"cubejs-dev-server": "./bin/dev-server.js"
2425
},
2526
"scripts": {
27+
"tsc": "tsc",
28+
"watch": "tsc -w",
29+
"build": "tsc",
2630
"test": "npm run unit",
2731
"lint": "eslint *.js __mocks__/*.js",
2832
"lint:fix": "eslint --fix *.js __mocks__/*.js",
@@ -31,6 +35,7 @@
3135
},
3236
"dependencies": {
3337
"@cubejs-backend/server-core": "^0.21.1",
38+
"@oclif/command": "^1.8.0",
3439
"body-parser": "^1.19.0",
3540
"codesandbox-import-utils": "^2.1.12",
3641
"cors": "^2.8.4",
@@ -45,7 +50,8 @@
4550
"eslint-plugin-node": "^5.2.1",
4651
"jest": "^24.9.0",
4752
"mocha": "^8.0.1",
48-
"should": "^13.2.3"
53+
"should": "^13.2.3",
54+
"typescript": "^4.0.3"
4955
},
5056
"license": "Apache-2.0"
5157
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {Command, flags} from '@oclif/command';
2+
3+
export default class DevServer extends Command {
4+
static description = 'Run server in Development mode';
5+
6+
static flags = {}
7+
8+
static args = [];
9+
10+
async run() {
11+
this.parse(DevServer);
12+
13+
console.log('Demo, source code will be in next PR');
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {Command, flags} from '@oclif/command';
2+
3+
export default class Server extends Command {
4+
static description = 'Run server in Production mode';
5+
6+
static flags = {}
7+
8+
static args = [];
9+
10+
async run() {
11+
this.parse(Server);
12+
13+
console.log('Demo, source code will be in next PR');
14+
}
15+
}

packages/cubejs-server/src/index.ts

Whitespace-only changes.

packages/cubejs-server/tsconfig.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["es2017"],
4+
"target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
5+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
6+
"declaration": true,
7+
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
8+
"sourceMap": true, /* Generates corresponding '.map' file. */
9+
"outDir": "./dist", /* Redirect output structure to the directory. */
10+
"strict": true, /* Enable all strict type-checking options. */
11+
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
12+
"strictNullChecks": true, /* Enable strict null checks. */
13+
"strictFunctionTypes": true, /* Enable strict checking of function types. */
14+
"strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
15+
"strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
16+
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
17+
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
18+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
19+
"allowSyntheticDefaultImports": true,
20+
"skipLibCheck": true, /* Skip type checking of declaration files. */
21+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
22+
}
23+
}

0 commit comments

Comments
 (0)