Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 8525a82

Browse files
committed
Cleanup on the cli.
1 parent ed8e3cb commit 8525a82

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/cli/cli.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export class Cli {
1212
/**
1313
* Default config options.
1414
*
15-
* @type {any}
15+
* @type {object}
1616
*/
17-
defaultOptions: any;
17+
defaultOptions: object;
1818

1919
/**
2020
* Create new CLI instance.
@@ -26,13 +26,13 @@ export class Cli {
2626
/**
2727
* Initialize server with a configuration file.
2828
*
29-
* @param {Object} yargs
29+
* @param {object} yargs
3030
* @return {void}
3131
*/
32-
init(yargs) {
32+
init(yargs): void {
3333
this.setupConfig().then((options) => {
3434
options = Object.assign({}, this.defaultOptions, options);
35-
35+
3636
if (options.addClient) {
3737
let client = {
3838
appId: this.createAppId(),
@@ -44,7 +44,7 @@ export class Cli {
4444
console.log('key: ' + colors.magenta(client.key));
4545
}
4646

47-
if(options.corsAllow){
47+
if (options.corsAllow) {
4848
options.apiOriginAllow.allowCors = true;
4949
options.apiOriginAllow.allowOrigin = options.allowOrigin;
5050
options.apiOriginAllow.allowMethods = options.allowMethods;
@@ -64,7 +64,7 @@ export class Cli {
6464
/**
6565
* Setup configuration with questions.
6666
*
67-
* @return {Promise}
67+
* @return {Promise<any>}
6868
*/
6969
setupConfig() {
7070
return inquirer.prompt([
@@ -111,27 +111,27 @@ export class Cli {
111111
}, {
112112
name: 'corsAllow',
113113
default: false,
114-
message: 'Do you want to setup cross domain access to API? Useful for AJAX request to API on same domain different port.',
114+
message: 'Do you want to setup cross domain access to the API?',
115115
type: 'confirm'
116-
},{
116+
}, {
117117
name: 'allowOrigin',
118118
default: 'http://localhost:80',
119-
message: 'Enter the domain you want CORS access to:',
120-
when: function(options){
119+
message: 'Specify the URI that may access the API:',
120+
when: function(options) {
121121
return options.corsAllow == true;
122122
}
123-
},{
123+
}, {
124124
name: 'allowMethods',
125125
default: 'GET, POST',
126-
message: 'Enter the CORS HTTP methods you want to allow:',
127-
when: function(options){
126+
message: 'Enter the HTTP methods that are allowed for CORS:',
127+
when: function(options) {
128128
return options.corsAllow == true;
129129
}
130-
},{
130+
}, {
131131
name: 'allowHeaders',
132132
default: 'Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id',
133-
message: 'Enter the CORS headers you want to allow:',
134-
when: function(options){
133+
message: 'Enter the HTTP headers that are allowed for CORS:',
134+
when: function(options) {
135135
return options.corsAllow == true;
136136
}
137137
}
@@ -141,7 +141,7 @@ export class Cli {
141141
/**
142142
* Save configuration file.
143143
*
144-
* @param {Object} options
144+
* @param {object} options
145145
* @return {Promise<any>}
146146
*/
147147
saveConfig(options): Promise<any> {
@@ -166,7 +166,7 @@ export class Cli {
166166
/**
167167
* Start the Laravel Echo server.
168168
*
169-
* @param {Object} yargs
169+
* @param {object} yargs
170170
* @return {void}
171171
*/
172172
start(yargs): void {
@@ -218,7 +218,7 @@ export class Cli {
218218
/**
219219
* Add a registered referrer.
220220
*
221-
* @param {Object} yargs
221+
* @param {object} yargs
222222
* @return {void}
223223
*/
224224
clientAdd(yargs): void {
@@ -260,7 +260,7 @@ export class Cli {
260260
/**
261261
* Remove a registered referrer.
262262
*
263-
* @param {Object} yargs
263+
* @param {object} yargs
264264
* @return {void}
265265
*/
266266
clientRemove(yargs): void {

0 commit comments

Comments
 (0)