@tremho/mist-lift 1.1.4 → 1.1.5

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.
Files changed (59) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +70 -66
  3. package/build/QSTest/functions/IntegrationTest/src/main.js +1 -1
  4. package/build/src/commands/builtin/ApiDocMaker.js +0 -1
  5. package/build/src/commands/builtin/ApiDocMaker.js.map +1 -1
  6. package/build/src/commands/doctor.js +12 -1
  7. package/build/src/commands/doctor.js.map +1 -1
  8. package/build/src/lib/LiftVersion.js +1 -1
  9. package/build/src/lib/LiftVersion.js.map +1 -1
  10. package/package.json +79 -79
  11. package/src/commands/actions/initQuestions.ts +133 -133
  12. package/src/commands/actions/setupPackageJson.ts +32 -32
  13. package/src/commands/build.ts +173 -173
  14. package/src/commands/builtin/ApiDocMaker.ts +105 -106
  15. package/src/commands/builtin/BuiltInHandler.ts +47 -47
  16. package/src/commands/builtin/DeployBuiltInZip.ts +25 -25
  17. package/src/commands/builtin/StageWebrootZip.ts +36 -36
  18. package/src/commands/create.ts +52 -52
  19. package/src/commands/deploy.ts +161 -161
  20. package/src/commands/doctor.ts +118 -107
  21. package/src/commands/help.ts +178 -178
  22. package/src/commands/info.ts +42 -42
  23. package/src/commands/init.ts +61 -61
  24. package/src/commands/package.ts +234 -234
  25. package/src/commands/publish.ts +330 -330
  26. package/src/commands/settings.ts +73 -73
  27. package/src/commands/start.ts +43 -43
  28. package/src/commands/test.ts +37 -37
  29. package/src/commands/user.ts +20 -20
  30. package/src/expressRoutes/all.ts +99 -99
  31. package/src/expressRoutes/api.ts +22 -22
  32. package/src/expressRoutes/functionBinder.ts +155 -155
  33. package/src/integration-tests/quickstart-scenario.test.ts +76 -76
  34. package/src/lib/CaseUtils.ts +63 -63
  35. package/src/lib/DirectoryUtils.ts +34 -34
  36. package/src/lib/LiftConfig.ts +74 -74
  37. package/src/lib/LiftVersion.ts +87 -87
  38. package/src/lib/Tests/fileCompare.test.ts +35 -35
  39. package/src/lib/askQuestion.ts +17 -17
  40. package/src/lib/executeCommand.ts +45 -45
  41. package/src/lib/fileCompare.ts +55 -55
  42. package/src/lib/openAPI/ApiBuildCollector.ts +47 -47
  43. package/src/lib/openAPI/WebrootFileSupport.ts +19 -19
  44. package/src/lib/openAPI/openApiConstruction.ts +196 -196
  45. package/src/lib/pathResolve.ts +26 -26
  46. package/src/lib/utils.ts +43 -43
  47. package/src/lift.ts +87 -87
  48. package/templateData/function-definition-template +20 -20
  49. package/templateData/function-local-ts +16 -16
  50. package/templateData/function-main-ts +16 -16
  51. package/templateData/function-runmain-mjs +6 -6
  52. package/templateData/function-test-template +11 -11
  53. package/templateData/swagger-ui-bundle.js +2 -2
  54. package/templateData/swagger-ui-standalone-preset.js +2 -2
  55. package/templateData/swagger-ui.css +2 -2
  56. package/tsconfig.json +28 -28
  57. package/build/commands/builtin/prebuilt-zips/API.zip +0 -0
  58. package/build/commands/builtin/prebuilt-zips/FileServe.zip +0 -0
  59. package/build/commands/builtin/prebuilt-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 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
+ #!/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
+ })