@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
@@ -1,133 +1,133 @@
1
- /** Handles the input the user must supply upon init
2
- */
3
-
4
- import * as path from 'path'
5
- import * as fs from 'fs'
6
- import { executeCommand } from '../../lib/executeCommand'
7
- import { ask } from '../../lib/askQuestion'
8
-
9
- export async function interrogateUserForPackageJsonSettings (
10
- projectPath: string,
11
- defaults?: boolean
12
- ): Promise<void> {
13
- // get existing package.json or {}
14
- // name of project - module name, display name, short name
15
- // description
16
- // set version
17
- // gitAuthor ?? Author
18
- // create a repository under gitAuthor?
19
- // copyright
20
- // spdx licence
21
-
22
- const gitAuthor = await findGitAuthor()
23
- const pkgJson = existingPackageJson(projectPath)
24
- let name = pkgJson.name ?? nameFromProjectPath(projectPath)
25
- let version = pkgJson.version ?? '1.0.0-prerelease.1'
26
- let description = pkgJson.description ?? ''
27
- let author = pkgJson.author ?? gitAuthor
28
- let copyright = pkgJson.copyright ?? defaultCopyright(author)
29
- let spdx = pkgJson.license ?? 'MIT'
30
-
31
- if (defaults !== true) {
32
- let ok = false
33
- while (!ok) {
34
- name = ask('Module name of this project',
35
- 'module name',
36
- name
37
- )
38
- ok = name !== undefined && name.indexOf(' ') === -1
39
- }
40
- ok = false
41
- while (!ok) {
42
- version = ask('Project version. Use prerelease suffix for development versions. Use Semantic Versioning (https://semver.org).',
43
- 'version',
44
- version ?? '0.1.0-prerelease.1'
45
- )
46
- ok = version !== undefined && version.indexOf('.') !== -1
47
- }
48
- ok = false
49
- while (!ok) {
50
- description = ask('Give a brief description of what this project does / what it is for',
51
- 'description',
52
- description ?? ''
53
- )
54
- ok = description !== ''
55
- }
56
- ok = false
57
- while (!ok) {
58
- author = ask('Identify yourself as the author of this project',
59
- 'name',
60
- author
61
- )
62
- ok = author !== ''
63
- }
64
- ok = false
65
- while (!ok) {
66
- copyright = ask('Specify a displayable copyright notice',
67
- 'Copyright',
68
- copyright
69
- )
70
- ok = copyright !== ''
71
- }
72
- ok = false
73
- while (!ok) {
74
- spdx = ask('Specify the appropriate SPDX license identifier for this project. See https://spdx.org/licenses/ for more info.',
75
- 'spdx identifier',
76
- spdx
77
- )
78
- ok = spdx !== ''
79
- }
80
- }
81
- pkgJson.name = name
82
- pkgJson.version = version
83
- pkgJson.description = description
84
- pkgJson.author = author
85
- pkgJson.copyright = copyright
86
- pkgJson.license = spdx
87
-
88
- const pkgPath = path.join(projectPath, 'package.json')
89
- fs.writeFileSync(pkgPath,
90
- JSON.stringify(pkgJson, null, 2))
91
- }
92
-
93
- async function findGitAuthor (
94
- ): Promise<string> {
95
- return await executeCommand('git', ['config', '--get', 'user.name']).then((rt: any) => {
96
- const rrt: { retcode: number | undefined, stdStr: string | undefined, errStr: string | undefined } = rt
97
- let name: string | undefined = ''
98
- if (rrt?.retcode !== 0) {
99
- console.error(`Error ${rrt?.retcode ?? ''}`, rrt?.errStr)
100
- } else {
101
- name = rrt?.stdStr?.trim().toLowerCase()
102
- }
103
- return name ?? ''
104
- })
105
- }
106
-
107
- function defaultCopyright (
108
- name: string
109
- ): string {
110
- return `(C) ${new Date(Date.now()).getFullYear()} ${name}. All rights reserved.`
111
- }
112
-
113
- function nameFromProjectPath (
114
- refPath: string
115
- ): string {
116
- const n = refPath.lastIndexOf(path.sep) + 1
117
- return refPath.substring(n)
118
- }
119
-
120
- function existingPackageJson (
121
- refPath: string
122
- ): any {
123
- let packageJson: any = {}
124
- const pkgPath = path.join(refPath, 'package.json')
125
- if (fs.existsSync((pkgPath))) {
126
- try {
127
- packageJson = JSON.parse(fs.readFileSync(pkgPath).toString())
128
- } catch (e: any) {
129
- // error in existing package.json. Please fix or remove and try again.
130
- }
131
- }
132
- return packageJson
133
- }
1
+ /** Handles the input the user must supply upon init
2
+ */
3
+
4
+ import * as path from 'path'
5
+ import * as fs from 'fs'
6
+ import { executeCommand } from '../../lib/executeCommand'
7
+ import { ask } from '../../lib/askQuestion'
8
+
9
+ export async function interrogateUserForPackageJsonSettings (
10
+ projectPath: string,
11
+ defaults?: boolean
12
+ ): Promise<void> {
13
+ // get existing package.json or {}
14
+ // name of project - module name, display name, short name
15
+ // description
16
+ // set version
17
+ // gitAuthor ?? Author
18
+ // create a repository under gitAuthor?
19
+ // copyright
20
+ // spdx licence
21
+
22
+ const gitAuthor = await findGitAuthor()
23
+ const pkgJson = existingPackageJson(projectPath)
24
+ let name = pkgJson.name ?? nameFromProjectPath(projectPath)
25
+ let version = pkgJson.version ?? '1.0.0-prerelease.1'
26
+ let description = pkgJson.description ?? ''
27
+ let author = pkgJson.author ?? gitAuthor
28
+ let copyright = pkgJson.copyright ?? defaultCopyright(author)
29
+ let spdx = pkgJson.license ?? 'MIT'
30
+
31
+ if (defaults !== true) {
32
+ let ok = false
33
+ while (!ok) {
34
+ name = ask('Module name of this project',
35
+ 'module name',
36
+ name
37
+ )
38
+ ok = name !== undefined && name.indexOf(' ') === -1
39
+ }
40
+ ok = false
41
+ while (!ok) {
42
+ version = ask('Project version. Use prerelease suffix for development versions. Use Semantic Versioning (https://semver.org).',
43
+ 'version',
44
+ version ?? '0.1.0-prerelease.1'
45
+ )
46
+ ok = version !== undefined && version.indexOf('.') !== -1
47
+ }
48
+ ok = false
49
+ while (!ok) {
50
+ description = ask('Give a brief description of what this project does / what it is for',
51
+ 'description',
52
+ description ?? ''
53
+ )
54
+ ok = description !== ''
55
+ }
56
+ ok = false
57
+ while (!ok) {
58
+ author = ask('Identify yourself as the author of this project',
59
+ 'name',
60
+ author
61
+ )
62
+ ok = author !== ''
63
+ }
64
+ ok = false
65
+ while (!ok) {
66
+ copyright = ask('Specify a displayable copyright notice',
67
+ 'Copyright',
68
+ copyright
69
+ )
70
+ ok = copyright !== ''
71
+ }
72
+ ok = false
73
+ while (!ok) {
74
+ spdx = ask('Specify the appropriate SPDX license identifier for this project. See https://spdx.org/licenses/ for more info.',
75
+ 'spdx identifier',
76
+ spdx
77
+ )
78
+ ok = spdx !== ''
79
+ }
80
+ }
81
+ pkgJson.name = name
82
+ pkgJson.version = version
83
+ pkgJson.description = description
84
+ pkgJson.author = author
85
+ pkgJson.copyright = copyright
86
+ pkgJson.license = spdx
87
+
88
+ const pkgPath = path.join(projectPath, 'package.json')
89
+ fs.writeFileSync(pkgPath,
90
+ JSON.stringify(pkgJson, null, 2))
91
+ }
92
+
93
+ async function findGitAuthor (
94
+ ): Promise<string> {
95
+ return await executeCommand('git', ['config', '--get', 'user.name']).then((rt: any) => {
96
+ const rrt: { retcode: number | undefined, stdStr: string | undefined, errStr: string | undefined } = rt
97
+ let name: string | undefined = ''
98
+ if (rrt?.retcode !== 0) {
99
+ console.error(`Error ${rrt?.retcode ?? ''}`, rrt?.errStr)
100
+ } else {
101
+ name = rrt?.stdStr?.trim().toLowerCase()
102
+ }
103
+ return name ?? ''
104
+ })
105
+ }
106
+
107
+ function defaultCopyright (
108
+ name: string
109
+ ): string {
110
+ return `(C) ${new Date(Date.now()).getFullYear()} ${name}. All rights reserved.`
111
+ }
112
+
113
+ function nameFromProjectPath (
114
+ refPath: string
115
+ ): string {
116
+ const n = refPath.lastIndexOf(path.sep) + 1
117
+ return refPath.substring(n)
118
+ }
119
+
120
+ function existingPackageJson (
121
+ refPath: string
122
+ ): any {
123
+ let packageJson: any = {}
124
+ const pkgPath = path.join(refPath, 'package.json')
125
+ if (fs.existsSync((pkgPath))) {
126
+ try {
127
+ packageJson = JSON.parse(fs.readFileSync(pkgPath).toString())
128
+ } catch (e: any) {
129
+ // error in existing package.json. Please fix or remove and try again.
130
+ }
131
+ }
132
+ return packageJson
133
+ }
@@ -1,32 +1,32 @@
1
- /** Adds necessary scripts to package.json */
2
-
3
- import * as path from 'path'
4
- import * as fs from 'fs'
5
- import { executeCommand } from '../../lib/executeCommand'
6
-
7
- /**
8
- * Adds necessary scripts to package.json
9
- */
10
- export function addPackageScripts (
11
- projectPath: string
12
- ): void {
13
- const pkgPath = path.join(projectPath, 'package.json')
14
- let pkgJson: any = {}
15
- try { pkgJson = JSON.parse(fs.readFileSync(pkgPath).toString()) } catch {}
16
- const script = pkgJson.script ?? {}
17
- script.test = 'lift test'
18
- pkgJson.script = script
19
- }
20
- export async function installPackage (
21
- projectPath: string,
22
- packageName: string
23
- ): Promise<void> {
24
- await executeCommand('npm', ['i', packageName], projectPath, true)
25
- }
26
-
27
- export async function installDevPackage (
28
- projectPath: string,
29
- packageName: string
30
- ): Promise<void> {
31
- await executeCommand('npm', ['i', '--save-dev', packageName], projectPath, true)
32
- }
1
+ /** Adds necessary scripts to package.json */
2
+
3
+ import * as path from 'path'
4
+ import * as fs from 'fs'
5
+ import { executeCommand } from '../../lib/executeCommand'
6
+
7
+ /**
8
+ * Adds necessary scripts to package.json
9
+ */
10
+ export function addPackageScripts (
11
+ projectPath: string
12
+ ): void {
13
+ const pkgPath = path.join(projectPath, 'package.json')
14
+ let pkgJson: any = {}
15
+ try { pkgJson = JSON.parse(fs.readFileSync(pkgPath).toString()) } catch {}
16
+ const script = pkgJson.script ?? {}
17
+ script.test = 'lift test'
18
+ pkgJson.script = script
19
+ }
20
+ export async function installPackage (
21
+ projectPath: string,
22
+ packageName: string
23
+ ): Promise<void> {
24
+ await executeCommand('npm', ['i', packageName], projectPath, true)
25
+ }
26
+
27
+ export async function installDevPackage (
28
+ projectPath: string,
29
+ packageName: string
30
+ ): Promise<void> {
31
+ await executeCommand('npm', ['i', '--save-dev', packageName], projectPath, true)
32
+ }