@contrail/cli 1.0.66 → 1.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apps/create-app/create.js +2 -2
- package/package.json +1 -1
- package/src/apps/create-app/create.ts +2 -2
- package/templates/typescript/actions/handler.ts +1 -1
- package/templates/typescript/actions/mock-server.ts +24 -0
- package/templates/typescript/actions/utils/logger.ts +3 -3
- package/templates/typescript/package.json +6 -0
- package/templates/typescript/tsconfig.json +6 -10
|
@@ -17,7 +17,7 @@ function parseArgumentsIntoOptions(rawArgs) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
async function promptForMissingOptions(options) {
|
|
20
|
-
const defaultTemplate = '
|
|
20
|
+
const defaultTemplate = 'TypeScript';
|
|
21
21
|
const questions = [];
|
|
22
22
|
if (!options.appName) {
|
|
23
23
|
questions.push({
|
|
@@ -32,7 +32,7 @@ async function promptForMissingOptions(options) {
|
|
|
32
32
|
type: 'list',
|
|
33
33
|
name: 'template',
|
|
34
34
|
message: 'Which project template would you like to use?',
|
|
35
|
-
choices: ['
|
|
35
|
+
choices: ['TypeScript', 'JavaScript'],
|
|
36
36
|
default: defaultTemplate,
|
|
37
37
|
});
|
|
38
38
|
}
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ function parseArgumentsIntoOptions(rawArgs) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
async function promptForMissingOptions(options) {
|
|
24
|
-
const defaultTemplate = '
|
|
24
|
+
const defaultTemplate = 'TypeScript';
|
|
25
25
|
|
|
26
26
|
const questions = [];
|
|
27
27
|
if (!options.appName) {
|
|
@@ -38,7 +38,7 @@ async function promptForMissingOptions(options) {
|
|
|
38
38
|
type: 'list',
|
|
39
39
|
name: 'template',
|
|
40
40
|
message: 'Which project template would you like to use?',
|
|
41
|
-
choices: ['
|
|
41
|
+
choices: ['TypeScript', 'JavaScript'],
|
|
42
42
|
default: defaultTemplate,
|
|
43
43
|
});
|
|
44
44
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { execute } from './handler';
|
|
2
|
+
const express = require('express');
|
|
3
|
+
const bodyParser = require('body-parser');
|
|
4
|
+
const app = express();
|
|
5
|
+
const port = 5050;
|
|
6
|
+
|
|
7
|
+
// parse application/x-www-form-urlencoded
|
|
8
|
+
app.use(bodyParser.urlencoded({ extended: false }));
|
|
9
|
+
// parse application/json
|
|
10
|
+
app.use(bodyParser.json());
|
|
11
|
+
|
|
12
|
+
app.get('/health_check', (req, res) => {
|
|
13
|
+
res.send('Hello World!');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// DO NOT CHANGE THIS IMPLEMENTATION
|
|
17
|
+
app.post('/', async (req, res) => {
|
|
18
|
+
const result = await execute(req.body);
|
|
19
|
+
res.send(result);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
app.listen(port, () => {
|
|
23
|
+
console.log(`Mock server listening on port ${port}`);
|
|
24
|
+
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export class Logger {
|
|
2
2
|
allEntries = [];
|
|
3
3
|
public log(...args){
|
|
4
|
-
console.log(args);
|
|
4
|
+
console.log(...args);
|
|
5
5
|
this.allEntries.push(args);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
public getEntries(){
|
|
9
|
-
return this.allEntries;
|
|
9
|
+
return this.allEntries.join('\n');
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
public clearEntries(){
|
|
13
13
|
this.allEntries = [];
|
|
14
14
|
}
|
|
15
|
-
}
|
|
15
|
+
}
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc",
|
|
18
|
+
"start": "nodemon --watch 'actions/**/*.ts' --exec ts-node actions/mock-server.ts",
|
|
19
|
+
"debug": "nodemon -r ts-node/register --inspect=127.0.0.1:60002 --watch 'actions/**/*.ts' --exec node actions/mock-server.ts",
|
|
18
20
|
"lint": "eslint . --fix",
|
|
19
21
|
"test": "jest",
|
|
20
22
|
"test-watch": "jest --watch",
|
|
@@ -39,8 +41,12 @@
|
|
|
39
41
|
"chalk": "^4.0.0"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
44
|
+
"body-parser": "^1.20.2",
|
|
45
|
+
"express": "^4.18.2",
|
|
46
|
+
"nodemon": "^1.19.4",
|
|
42
47
|
"jest": "^29.2.2",
|
|
43
48
|
"ts-jest": "^29.0.3",
|
|
49
|
+
"ts-node": "^7.0.1",
|
|
44
50
|
"typescript": "^4.7.4"
|
|
45
51
|
}
|
|
46
52
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
3
|
+
"target": "ES2020",
|
|
4
4
|
"module": "commonjs",
|
|
5
5
|
"declaration": true,
|
|
6
6
|
"esModuleInterop": true,
|
|
@@ -17,15 +17,11 @@
|
|
|
17
17
|
"ES2015",
|
|
18
18
|
"ES2016",
|
|
19
19
|
"ES2017",
|
|
20
|
+
"ES2020",
|
|
20
21
|
"dom",
|
|
21
22
|
"esnext.asynciterable"
|
|
22
|
-
]
|
|
23
|
+
]
|
|
23
24
|
},
|
|
24
|
-
"include": [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"exclude": [
|
|
28
|
-
"node_modules",
|
|
29
|
-
"**/__tests__/*"
|
|
30
|
-
]
|
|
31
|
-
}
|
|
25
|
+
"include": ["actions"],
|
|
26
|
+
"exclude": ["node_modules", "**/__tests__/*"]
|
|
27
|
+
}
|