@tremho/mist-lift 1.1.1 → 1.1.3-pre-release.1
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/LICENSE +21 -21
- package/README.md +65 -65
- package/build/commands/actions/initQuestions.js +35 -33
- package/build/commands/actions/initQuestions.js.map +1 -1
- package/build/commands/build.js +1 -1
- package/build/commands/build.js.map +1 -1
- package/build/commands/create.js +1 -1
- package/build/commands/create.js.map +1 -1
- package/build/commands/deploy.js +1 -1
- package/build/commands/deploy.js.map +1 -1
- package/build/commands/info.js +1 -1
- package/build/commands/info.js.map +1 -1
- package/build/commands/init.js +2 -2
- package/build/commands/init.js.map +1 -1
- package/build/commands/package.js +2 -2
- package/build/commands/package.js.map +1 -1
- package/build/commands/publish.js +2 -2
- package/build/commands/publish.js.map +1 -1
- package/build/expressRoutes/functionBinder.js.map +1 -1
- package/build/integration-tests/quickstart-scenario.test.js +76 -0
- package/build/integration-tests/quickstart-scenario.test.js.map +1 -0
- package/build/lib/utils.js +1 -1
- package/build/lib/utils.js.map +1 -1
- package/build/lift.js +1 -1
- package/build/lift.js.map +1 -1
- package/package.json +79 -72
- package/src/commands/actions/initQuestions.ts +133 -131
- package/src/commands/actions/setupPackageJson.ts +32 -32
- package/src/commands/build.ts +170 -170
- package/src/commands/builtin/ApiDocMaker.ts +102 -102
- package/src/commands/builtin/BuiltInHandler.ts +47 -47
- package/src/commands/builtin/DeployBuiltInZip.ts +25 -25
- package/src/commands/builtin/StageWebrootZip.ts +36 -36
- package/src/commands/create.ts +52 -52
- package/src/commands/deploy.ts +161 -161
- package/src/commands/doctor.ts +106 -106
- package/src/commands/help.ts +178 -178
- package/src/commands/info.ts +42 -43
- package/src/commands/init.ts +61 -60
- package/src/commands/package.ts +234 -234
- package/src/commands/publish.ts +330 -330
- package/src/commands/settings.ts +73 -73
- package/src/commands/start.ts +43 -43
- package/src/commands/test.ts +37 -37
- package/src/commands/user.ts +20 -20
- package/src/expressRoutes/all.ts +99 -99
- package/src/expressRoutes/api.ts +22 -22
- package/src/expressRoutes/functionBinder.ts +155 -156
- package/src/integration-tests/quickstart-scenario.test.ts +74 -0
- package/src/lib/CaseUtils.ts +63 -63
- package/src/lib/DirectoryUtils.ts +34 -34
- package/src/lib/LiftConfig.ts +74 -74
- package/src/lib/LiftVersion.ts +87 -87
- package/src/lib/Tests/fileCompare.test.ts +35 -35
- package/src/lib/askQuestion.ts +17 -17
- package/src/lib/executeCommand.ts +45 -45
- package/src/lib/fileCompare.ts +55 -55
- package/src/lib/openAPI/ApiBuildCollector.ts +47 -47
- package/src/lib/openAPI/WebrootFileSupport.ts +19 -19
- package/src/lib/openAPI/openApiConstruction.ts +196 -196
- package/src/lib/pathResolve.ts +26 -26
- package/src/lib/utils.ts +43 -43
- package/src/lift.ts +87 -87
- package/templateData/function-definition-template +20 -20
- package/templateData/function-local-ts +16 -16
- package/templateData/function-main-ts +16 -16
- package/templateData/function-runmain-mjs +6 -6
- package/templateData/function-test-template +11 -11
- package/templateData/swagger-ui-bundle.js +2 -2
- package/templateData/swagger-ui-standalone-preset.js +2 -2
- package/templateData/swagger-ui.css +2 -2
- package/tsconfig.json +28 -28
- /package/build/commands/builtin/{prebuilt-zips → prebult-zips}/API.zip +0 -0
- /package/build/commands/builtin/{prebuilt-zips → prebult-zips}/FileServe.zip +0 -0
- /package/build/commands/builtin/{prebuilt-zips → prebult-zips}/Webroot.zip +0 -0
package/src/lift.ts
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/* eslint @typescript-eslint/no-floating-promises: "off" */
|
|
4
|
-
|
|
5
|
-
import * as ac from 'ansi-colors'
|
|
6
|
-
import * as process from 'process'
|
|
7
|
-
|
|
8
|
-
import { getLiftVersion } from './lib/LiftVersion'
|
|
9
|
-
|
|
10
|
-
import { doHelp } from './commands/help'
|
|
11
|
-
import { doInit } from './commands/init'
|
|
12
|
-
import { doCreate } from './commands/create'
|
|
13
|
-
import { doBuildAsync } from './commands/build'
|
|
14
|
-
import { doTestAsync } from './commands/test'
|
|
15
|
-
import { doPackageAsync } from './commands/package'
|
|
16
|
-
import { doDeployAsync } from './commands/deploy'
|
|
17
|
-
import { doPublishAsync } from './commands/publish'
|
|
18
|
-
import { doDoctor } from './commands/doctor'
|
|
19
|
-
import { startLocalServer } from './commands/start'
|
|
20
|
-
import { doSettings } from './commands/settings'
|
|
21
|
-
import { doInfo} from './commands/info'
|
|
22
|
-
|
|
23
|
-
const command = process.argv[2] ?? 'help'
|
|
24
|
-
const args = process.argv.slice(3)
|
|
25
|
-
|
|
26
|
-
async function processCommand (): Promise<void> {
|
|
27
|
-
switch (command) {
|
|
28
|
-
case 'version':
|
|
29
|
-
case '--version':
|
|
30
|
-
case '-v':
|
|
31
|
-
console.log(`Lift v${getLiftVersion().toString()}`)
|
|
32
|
-
return
|
|
33
|
-
case 'help':
|
|
34
|
-
return doHelp(args[0] ?? '')
|
|
35
|
-
case 'doctor':
|
|
36
|
-
await doDoctor()
|
|
37
|
-
return
|
|
38
|
-
case 'init':
|
|
39
|
-
return await doInit(args[0] ?? '')
|
|
40
|
-
case 'create':
|
|
41
|
-
return doCreate(args[0] ?? '')
|
|
42
|
-
case 'build': {
|
|
43
|
-
const ret = await doBuildAsync(args)
|
|
44
|
-
if (ret !== 0) process.exit(-1)
|
|
45
|
-
}
|
|
46
|
-
return
|
|
47
|
-
case 'test': {
|
|
48
|
-
const ret = await doTestAsync(args)
|
|
49
|
-
if (ret !== 0) process.exit(ret)
|
|
50
|
-
}
|
|
51
|
-
return
|
|
52
|
-
case 'start':
|
|
53
|
-
return startLocalServer()
|
|
54
|
-
|
|
55
|
-
case 'package': {
|
|
56
|
-
const ret = await doPackageAsync(args)
|
|
57
|
-
if (ret !== 0) process.exit(ret)
|
|
58
|
-
}
|
|
59
|
-
return
|
|
60
|
-
case 'deploy': {
|
|
61
|
-
const ret = await doDeployAsync(args)
|
|
62
|
-
if (ret !== 0) process.exit(ret)
|
|
63
|
-
}
|
|
64
|
-
return
|
|
65
|
-
case 'publish': {
|
|
66
|
-
const ret = await doPublishAsync()
|
|
67
|
-
if (ret !== 0) process.exit(ret)
|
|
68
|
-
}
|
|
69
|
-
return
|
|
70
|
-
case 'settings':
|
|
71
|
-
await doSettings()
|
|
72
|
-
return
|
|
73
|
-
case 'info':
|
|
74
|
-
await doInfo()
|
|
75
|
-
return
|
|
76
|
-
}
|
|
77
|
-
return doUnknown(command)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function doUnknown (command: string): void {
|
|
81
|
-
console.log(ac.red.bold(`Unrecognized command ${command ?? ''}`))
|
|
82
|
-
console.log(ac.grey.dim('try'))
|
|
83
|
-
console.log(ac.blue.dim('help, init, create, build, test, start, package, deploy, publish, settings'))
|
|
84
|
-
console.log('')
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
processCommand()
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/* eslint @typescript-eslint/no-floating-promises: "off" */
|
|
4
|
+
|
|
5
|
+
import * as ac from 'ansi-colors'
|
|
6
|
+
import * as process from 'process'
|
|
7
|
+
|
|
8
|
+
import { getLiftVersion } from './lib/LiftVersion'
|
|
9
|
+
|
|
10
|
+
import { doHelp } from './commands/help'
|
|
11
|
+
import { doInit } from './commands/init'
|
|
12
|
+
import { doCreate } from './commands/create'
|
|
13
|
+
import { doBuildAsync } from './commands/build'
|
|
14
|
+
import { doTestAsync } from './commands/test'
|
|
15
|
+
import { doPackageAsync } from './commands/package'
|
|
16
|
+
import { doDeployAsync } from './commands/deploy'
|
|
17
|
+
import { doPublishAsync } from './commands/publish'
|
|
18
|
+
import { doDoctor } from './commands/doctor'
|
|
19
|
+
import { startLocalServer } from './commands/start'
|
|
20
|
+
import { doSettings } from './commands/settings'
|
|
21
|
+
import { doInfo } from './commands/info'
|
|
22
|
+
|
|
23
|
+
const command = process.argv[2] ?? 'help'
|
|
24
|
+
const args = process.argv.slice(3)
|
|
25
|
+
|
|
26
|
+
async function processCommand (): Promise<void> {
|
|
27
|
+
switch (command) {
|
|
28
|
+
case 'version':
|
|
29
|
+
case '--version':
|
|
30
|
+
case '-v':
|
|
31
|
+
console.log(`Lift v${getLiftVersion().toString()}`)
|
|
32
|
+
return
|
|
33
|
+
case 'help':
|
|
34
|
+
return doHelp(args[0] ?? '')
|
|
35
|
+
case 'doctor':
|
|
36
|
+
await doDoctor()
|
|
37
|
+
return
|
|
38
|
+
case 'init':
|
|
39
|
+
return await doInit(args[0] ?? '')
|
|
40
|
+
case 'create':
|
|
41
|
+
return doCreate(args[0] ?? '')
|
|
42
|
+
case 'build': {
|
|
43
|
+
const ret = await doBuildAsync(args)
|
|
44
|
+
if (ret !== 0) process.exit(-1)
|
|
45
|
+
}
|
|
46
|
+
return
|
|
47
|
+
case 'test': {
|
|
48
|
+
const ret = await doTestAsync(args)
|
|
49
|
+
if (ret !== 0) process.exit(ret)
|
|
50
|
+
}
|
|
51
|
+
return
|
|
52
|
+
case 'start':
|
|
53
|
+
return await startLocalServer()
|
|
54
|
+
|
|
55
|
+
case 'package': {
|
|
56
|
+
const ret = await doPackageAsync(args)
|
|
57
|
+
if (ret !== 0) process.exit(ret)
|
|
58
|
+
}
|
|
59
|
+
return
|
|
60
|
+
case 'deploy': {
|
|
61
|
+
const ret = await doDeployAsync(args)
|
|
62
|
+
if (ret !== 0) process.exit(ret)
|
|
63
|
+
}
|
|
64
|
+
return
|
|
65
|
+
case 'publish': {
|
|
66
|
+
const ret = await doPublishAsync()
|
|
67
|
+
if (ret !== 0) process.exit(ret)
|
|
68
|
+
}
|
|
69
|
+
return
|
|
70
|
+
case 'settings':
|
|
71
|
+
await doSettings()
|
|
72
|
+
return
|
|
73
|
+
case 'info':
|
|
74
|
+
await doInfo()
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
return doUnknown(command)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function doUnknown (command: string): void {
|
|
81
|
+
console.log(ac.red.bold(`Unrecognized command ${command ?? ''}`))
|
|
82
|
+
console.log(ac.grey.dim('try'))
|
|
83
|
+
console.log(ac.blue.dim('help, init, create, build, test, start, package, deploy, publish, settings'))
|
|
84
|
+
console.log('')
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
processCommand()
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "$$FUNCTION_NAME$$",
|
|
3
|
-
"description": "",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"pathMap": "$$PATHMAP$$",
|
|
6
|
-
"allowedMethods": "GET",
|
|
7
|
-
"schemas": {
|
|
8
|
-
},
|
|
9
|
-
"parameters": [
|
|
10
|
-
],
|
|
11
|
-
"returns": {
|
|
12
|
-
"200": {
|
|
13
|
-
"type": "empty",
|
|
14
|
-
"description": "successful response."
|
|
15
|
-
},
|
|
16
|
-
"500": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"description": "Error details"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "$$FUNCTION_NAME$$",
|
|
3
|
+
"description": "",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"pathMap": "$$PATHMAP$$",
|
|
6
|
+
"allowedMethods": "GET",
|
|
7
|
+
"schemas": {
|
|
8
|
+
},
|
|
9
|
+
"parameters": [
|
|
10
|
+
],
|
|
11
|
+
"returns": {
|
|
12
|
+
"200": {
|
|
13
|
+
"type": "empty",
|
|
14
|
+
"description": "successful response."
|
|
15
|
+
},
|
|
16
|
+
"500": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Error details"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
21
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import {start} from "./main"
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
|
|
5
|
-
async function run() {
|
|
6
|
-
const name = process.argv[2]
|
|
7
|
-
let request = {}
|
|
8
|
-
if(name) {
|
|
9
|
-
const path = `functions/HelloWorld/${name}`;
|
|
10
|
-
console.log("Local run with request " + path)
|
|
11
|
-
request = JSON.parse(fs.readFileSync(path).toString())
|
|
12
|
-
} else {
|
|
13
|
-
console.log("Local run with default request");
|
|
14
|
-
}
|
|
15
|
-
console.log(await start(request, null, (ret:any) => { return ret; }));
|
|
16
|
-
}
|
|
1
|
+
|
|
2
|
+
import {start} from "./main"
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
|
|
5
|
+
async function run() {
|
|
6
|
+
const name = process.argv[2]
|
|
7
|
+
let request = {}
|
|
8
|
+
if(name) {
|
|
9
|
+
const path = `functions/HelloWorld/${name}`;
|
|
10
|
+
console.log("Local run with request " + path)
|
|
11
|
+
request = JSON.parse(fs.readFileSync(path).toString())
|
|
12
|
+
} else {
|
|
13
|
+
console.log("Local run with default request");
|
|
14
|
+
}
|
|
15
|
+
console.log(await start(request, null, (ret:any) => { return ret; }));
|
|
16
|
+
}
|
|
17
17
|
run();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {LambdaApi, Success, NotFound, NotImplemented, ServerError} from "@tremho/inverse-y"
|
|
2
|
-
import fs from "fs"
|
|
3
|
-
import path from 'path'
|
|
4
|
-
import {Log} from "@tremho/inverse-y"
|
|
5
|
-
|
|
6
|
-
const def = JSON.parse(fs.readFileSync(path.join(__dirname, "definition.json")).toString());
|
|
7
|
-
|
|
8
|
-
const service = new LambdaApi<any>(def,
|
|
9
|
-
async (event:any) => {
|
|
10
|
-
Log.Info("Entering Main");
|
|
11
|
-
return Success("Hello, World!")
|
|
12
|
-
}
|
|
13
|
-
)
|
|
14
|
-
export function start(e:any, c:any, cb:any) {
|
|
15
|
-
return service.entryPoint(e, c, cb)
|
|
16
|
-
}
|
|
1
|
+
import {LambdaApi, Success, NotFound, NotImplemented, ServerError} from "@tremho/inverse-y"
|
|
2
|
+
import fs from "fs"
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import {Log} from "@tremho/inverse-y"
|
|
5
|
+
|
|
6
|
+
const def = JSON.parse(fs.readFileSync(path.join(__dirname, "definition.json")).toString());
|
|
7
|
+
|
|
8
|
+
const service = new LambdaApi<any>(def,
|
|
9
|
+
async (event:any) => {
|
|
10
|
+
Log.Info("Entering Main");
|
|
11
|
+
return Success("Hello, World!")
|
|
12
|
+
}
|
|
13
|
+
)
|
|
14
|
+
export function start(e:any, c:any, cb:any) {
|
|
15
|
+
return service.entryPoint(e, c, cb)
|
|
16
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { start } from "./src/main.js"
|
|
3
|
-
|
|
4
|
-
export const handler = async(event) => {
|
|
5
|
-
|
|
6
|
-
return await start(event);
|
|
1
|
+
|
|
2
|
+
import { start } from "./src/main.js"
|
|
3
|
+
|
|
4
|
+
export const handler = async(event) => {
|
|
5
|
+
|
|
6
|
+
return await start(event);
|
|
7
7
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import Tap from "tap"
|
|
3
|
-
function test(t:any) {
|
|
4
|
-
t.ok(true, 'Sanity test passes')
|
|
5
|
-
|
|
6
|
-
t.end()
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
Tap.test('First function Test', t => {
|
|
10
|
-
test(t)
|
|
11
|
-
})
|
|
1
|
+
|
|
2
|
+
import Tap from "tap"
|
|
3
|
+
function test(t:any) {
|
|
4
|
+
t.ok(true, 'Sanity test passes')
|
|
5
|
+
|
|
6
|
+
t.end()
|
|
7
|
+
|
|
8
|
+
}
|
|
9
|
+
Tap.test('First function Test', t => {
|
|
10
|
+
test(t)
|
|
11
|
+
})
|