@tremho/mist-lift 1.1.4-pre-release.1 → 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,42 +1,42 @@
1
- import * as fs from 'fs'
2
- import * as path from 'path'
3
- import * as ac from 'ansi-colors'
4
- import { resolvePaths } from '../lib/pathResolve'
5
- import { getProjectName } from '../lib/LiftVersion'
6
-
7
- /// Info command
8
- export function doInfo (
9
- ): void {
10
- const projectName = getProjectName()
11
- const projectPaths = resolvePaths()
12
-
13
- const publishedFile = path.join(projectPaths.basePath, '.published')
14
- let publishedInfo = { url: '', time: 0 }
15
- try {
16
- if (fs.existsSync(publishedFile)) {
17
- publishedInfo = JSON.parse(fs.readFileSync(publishedFile).toString())
18
- }
19
- } catch (e) {
20
- }
21
- const deployedFile = path.join(projectPaths.basePath, '.deployed')
22
- let deployedInfo: any = {}
23
- try {
24
- if (fs.existsSync(deployedFile)) {
25
- deployedInfo = JSON.parse(fs.readFileSync(deployedFile).toString())
26
- }
27
- } catch (e) {
28
- }
29
- if (publishedInfo.url === '') {
30
- console.log(ac.bold.magenta(`${projectName} is not yet published`))
31
- } else {
32
- const publishedUrl = publishedInfo.url
33
- const when = new Date(publishedInfo.time)
34
- console.log(ac.green.bold(`${projectName} Last published to ${publishedUrl} at ${when.toString()}`))
35
- for (const depName of Object.getOwnPropertyNames(deployedInfo)) {
36
- const depTime = deployedInfo[depName] ?? 0
37
- if (depTime > 0 && depTime < publishedInfo.time) {
38
- console.log(' ' + ac.blue.bold(depName))
39
- }
40
- }
41
- }
42
- }
1
+ import * as fs from 'fs'
2
+ import * as path from 'path'
3
+ import * as ac from 'ansi-colors'
4
+ import { resolvePaths } from '../lib/pathResolve'
5
+ import { getProjectName } from '../lib/LiftVersion'
6
+
7
+ /// Info command
8
+ export function doInfo (
9
+ ): void {
10
+ const projectName = getProjectName()
11
+ const projectPaths = resolvePaths()
12
+
13
+ const publishedFile = path.join(projectPaths.basePath, '.published')
14
+ let publishedInfo = { url: '', time: 0 }
15
+ try {
16
+ if (fs.existsSync(publishedFile)) {
17
+ publishedInfo = JSON.parse(fs.readFileSync(publishedFile).toString())
18
+ }
19
+ } catch (e) {
20
+ }
21
+ const deployedFile = path.join(projectPaths.basePath, '.deployed')
22
+ let deployedInfo: any = {}
23
+ try {
24
+ if (fs.existsSync(deployedFile)) {
25
+ deployedInfo = JSON.parse(fs.readFileSync(deployedFile).toString())
26
+ }
27
+ } catch (e) {
28
+ }
29
+ if (publishedInfo.url === '') {
30
+ console.log(ac.bold.magenta(`${projectName} is not yet published`))
31
+ } else {
32
+ const publishedUrl = publishedInfo.url
33
+ const when = new Date(publishedInfo.time)
34
+ console.log(ac.green.bold(`${projectName} Last published to ${publishedUrl} at ${when.toString()}`))
35
+ for (const depName of Object.getOwnPropertyNames(deployedInfo)) {
36
+ const depTime = deployedInfo[depName] ?? 0
37
+ if (depTime > 0 && depTime < publishedInfo.time) {
38
+ console.log(' ' + ac.blue.bold(depName))
39
+ }
40
+ }
41
+ }
42
+ }
@@ -1,61 +1,61 @@
1
- /** Handles the init command to set up a new project space
2
- *
3
- * necessary inputs:
4
- * - path to project folder
5
- *
6
- * create folder if not exist
7
- * populate with directory structure
8
- * build
9
- * functions
10
- * tsccoinfig
11
- * package.json
12
- *
13
- * npm i
14
- * npm run build
15
- */
16
-
17
- import * as path from 'path'
18
- import * as fs from 'fs'
19
- import { helpInit } from './help'
20
- import { interrogateUserForPackageJsonSettings } from './actions/initQuestions'
21
- import { addPackageScripts, installPackage, installDevPackage } from './actions/setupPackageJson'
22
-
23
- export async function doInit (
24
- folder?: string,
25
- defaults?: boolean
26
- ): Promise<void> {
27
- if (folder === undefined || folder === '') {
28
- helpInit()
29
- return
30
- }
31
- const cwd = process.cwd()
32
- const refPath = path.isAbsolute(folder) ? path.normalize(folder) : path.normalize(path.join(cwd, folder))
33
- console.log(refPath)
34
- if (!fs.existsSync(refPath)) {
35
- fs.mkdirSync(refPath, { recursive: true })
36
- }
37
-
38
- const funcDir = path.join(refPath, 'functions')
39
- if (!fs.existsSync(funcDir)) {
40
- fs.mkdirSync(funcDir)
41
- }
42
-
43
- // make webroot with docs folder and placeholder yaml
44
- const webrootDocs = path.join(refPath, 'webroot', 'docs')
45
- if (!fs.existsSync(webrootDocs)) {
46
- fs.mkdirSync(webrootDocs, { recursive: true })
47
- const yaml = path.join(webrootDocs, 'apidoc.yaml')
48
- fs.writeFileSync(yaml, '')
49
- const swaggerSrcDir = path.join(__dirname, '..', '..', 'templateData')
50
- fs.copyFileSync(path.join(swaggerSrcDir, 'swagger-ui.css'), path.join(webrootDocs, 'swagger-ui.css'))
51
- fs.copyFileSync(path.join(swaggerSrcDir, 'swagger-ui-bundle.js'), path.join(webrootDocs, 'swagger-ui-bundle.js'))
52
- fs.copyFileSync(path.join(swaggerSrcDir, 'swagger-ui-standalone-preset.js'), path.join(webrootDocs, 'swagger-ui-standalone-preset.js'))
53
- }
54
-
55
- await interrogateUserForPackageJsonSettings(refPath, defaults)
56
- await addPackageScripts(refPath)
57
- await installDevPackage(refPath, '@types/node')
58
- await installDevPackage(refPath, 'typescript')
59
- await installDevPackage(refPath, 'tap')
60
- await installPackage(refPath, '@tremho/inverse-y')
61
- }
1
+ /** Handles the init command to set up a new project space
2
+ *
3
+ * necessary inputs:
4
+ * - path to project folder
5
+ *
6
+ * create folder if not exist
7
+ * populate with directory structure
8
+ * build
9
+ * functions
10
+ * tsccoinfig
11
+ * package.json
12
+ *
13
+ * npm i
14
+ * npm run build
15
+ */
16
+
17
+ import * as path from 'path'
18
+ import * as fs from 'fs'
19
+ import { helpInit } from './help'
20
+ import { interrogateUserForPackageJsonSettings } from './actions/initQuestions'
21
+ import { addPackageScripts, installPackage, installDevPackage } from './actions/setupPackageJson'
22
+
23
+ export async function doInit (
24
+ folder?: string,
25
+ defaults?: boolean
26
+ ): Promise<void> {
27
+ if (folder === undefined || folder === '') {
28
+ helpInit()
29
+ return
30
+ }
31
+ const cwd = process.cwd()
32
+ const refPath = path.isAbsolute(folder) ? path.normalize(folder) : path.normalize(path.join(cwd, folder))
33
+ console.log(refPath)
34
+ if (!fs.existsSync(refPath)) {
35
+ fs.mkdirSync(refPath, { recursive: true })
36
+ }
37
+
38
+ const funcDir = path.join(refPath, 'functions')
39
+ if (!fs.existsSync(funcDir)) {
40
+ fs.mkdirSync(funcDir)
41
+ }
42
+
43
+ // make webroot with docs folder and placeholder yaml
44
+ const webrootDocs = path.join(refPath, 'webroot', 'docs')
45
+ if (!fs.existsSync(webrootDocs)) {
46
+ fs.mkdirSync(webrootDocs, { recursive: true })
47
+ const yaml = path.join(webrootDocs, 'apidoc.yaml')
48
+ fs.writeFileSync(yaml, '')
49
+ const swaggerSrcDir = path.join(__dirname, '..', '..', 'templateData')
50
+ fs.copyFileSync(path.join(swaggerSrcDir, 'swagger-ui.css'), path.join(webrootDocs, 'swagger-ui.css'))
51
+ fs.copyFileSync(path.join(swaggerSrcDir, 'swagger-ui-bundle.js'), path.join(webrootDocs, 'swagger-ui-bundle.js'))
52
+ fs.copyFileSync(path.join(swaggerSrcDir, 'swagger-ui-standalone-preset.js'), path.join(webrootDocs, 'swagger-ui-standalone-preset.js'))
53
+ }
54
+
55
+ await interrogateUserForPackageJsonSettings(refPath, defaults)
56
+ await addPackageScripts(refPath)
57
+ await installDevPackage(refPath, '@types/node')
58
+ await installDevPackage(refPath, 'typescript')
59
+ await installDevPackage(refPath, 'tap')
60
+ await installPackage(refPath, '@tremho/inverse-y')
61
+ }