@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.
Files changed (75) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +65 -65
  3. package/build/commands/actions/initQuestions.js +35 -33
  4. package/build/commands/actions/initQuestions.js.map +1 -1
  5. package/build/commands/build.js +1 -1
  6. package/build/commands/build.js.map +1 -1
  7. package/build/commands/create.js +1 -1
  8. package/build/commands/create.js.map +1 -1
  9. package/build/commands/deploy.js +1 -1
  10. package/build/commands/deploy.js.map +1 -1
  11. package/build/commands/info.js +1 -1
  12. package/build/commands/info.js.map +1 -1
  13. package/build/commands/init.js +2 -2
  14. package/build/commands/init.js.map +1 -1
  15. package/build/commands/package.js +2 -2
  16. package/build/commands/package.js.map +1 -1
  17. package/build/commands/publish.js +2 -2
  18. package/build/commands/publish.js.map +1 -1
  19. package/build/expressRoutes/functionBinder.js.map +1 -1
  20. package/build/integration-tests/quickstart-scenario.test.js +76 -0
  21. package/build/integration-tests/quickstart-scenario.test.js.map +1 -0
  22. package/build/lib/utils.js +1 -1
  23. package/build/lib/utils.js.map +1 -1
  24. package/build/lift.js +1 -1
  25. package/build/lift.js.map +1 -1
  26. package/package.json +79 -72
  27. package/src/commands/actions/initQuestions.ts +133 -131
  28. package/src/commands/actions/setupPackageJson.ts +32 -32
  29. package/src/commands/build.ts +170 -170
  30. package/src/commands/builtin/ApiDocMaker.ts +102 -102
  31. package/src/commands/builtin/BuiltInHandler.ts +47 -47
  32. package/src/commands/builtin/DeployBuiltInZip.ts +25 -25
  33. package/src/commands/builtin/StageWebrootZip.ts +36 -36
  34. package/src/commands/create.ts +52 -52
  35. package/src/commands/deploy.ts +161 -161
  36. package/src/commands/doctor.ts +106 -106
  37. package/src/commands/help.ts +178 -178
  38. package/src/commands/info.ts +42 -43
  39. package/src/commands/init.ts +61 -60
  40. package/src/commands/package.ts +234 -234
  41. package/src/commands/publish.ts +330 -330
  42. package/src/commands/settings.ts +73 -73
  43. package/src/commands/start.ts +43 -43
  44. package/src/commands/test.ts +37 -37
  45. package/src/commands/user.ts +20 -20
  46. package/src/expressRoutes/all.ts +99 -99
  47. package/src/expressRoutes/api.ts +22 -22
  48. package/src/expressRoutes/functionBinder.ts +155 -156
  49. package/src/integration-tests/quickstart-scenario.test.ts +74 -0
  50. package/src/lib/CaseUtils.ts +63 -63
  51. package/src/lib/DirectoryUtils.ts +34 -34
  52. package/src/lib/LiftConfig.ts +74 -74
  53. package/src/lib/LiftVersion.ts +87 -87
  54. package/src/lib/Tests/fileCompare.test.ts +35 -35
  55. package/src/lib/askQuestion.ts +17 -17
  56. package/src/lib/executeCommand.ts +45 -45
  57. package/src/lib/fileCompare.ts +55 -55
  58. package/src/lib/openAPI/ApiBuildCollector.ts +47 -47
  59. package/src/lib/openAPI/WebrootFileSupport.ts +19 -19
  60. package/src/lib/openAPI/openApiConstruction.ts +196 -196
  61. package/src/lib/pathResolve.ts +26 -26
  62. package/src/lib/utils.ts +43 -43
  63. package/src/lift.ts +87 -87
  64. package/templateData/function-definition-template +20 -20
  65. package/templateData/function-local-ts +16 -16
  66. package/templateData/function-main-ts +16 -16
  67. package/templateData/function-runmain-mjs +6 -6
  68. package/templateData/function-test-template +11 -11
  69. package/templateData/swagger-ui-bundle.js +2 -2
  70. package/templateData/swagger-ui-standalone-preset.js +2 -2
  71. package/templateData/swagger-ui.css +2 -2
  72. package/tsconfig.json +28 -28
  73. /package/build/commands/builtin/{prebuilt-zips → prebult-zips}/API.zip +0 -0
  74. /package/build/commands/builtin/{prebuilt-zips → prebult-zips}/FileServe.zip +0 -0
  75. /package/build/commands/builtin/{prebuilt-zips → prebult-zips}/Webroot.zip +0 -0
@@ -1,43 +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 { helpInfo } from './help'
6
- import {getProjectName} from "../lib/LiftVersion";
7
-
8
- /// Info command
9
- export function doInfo (
10
- ): void {
11
- const projectName = getProjectName()
12
- const projectPaths = resolvePaths()
13
-
14
- const publishedFile = path.join(projectPaths.basePath, '.published')
15
- let publishedInfo = {url:'', time:0}
16
- try {
17
- if (fs.existsSync(publishedFile)) {
18
- publishedInfo = JSON.parse(fs.readFileSync(publishedFile).toString())
19
- }
20
- } catch (e) {
21
- }
22
- const deployedFile = path.join(projectPaths.basePath, '.deployed')
23
- let deployedInfo:any = {}
24
- try {
25
- if (fs.existsSync(deployedFile)) {
26
- deployedInfo = JSON.parse(fs.readFileSync(deployedFile).toString())
27
- }
28
- } catch (e) {
29
- }
30
- if(publishedInfo.url === '') {
31
- console.log(ac.bold.magenta(`${projectName} is not yet published`))
32
- } else {
33
- const publishedUrl = publishedInfo.url
34
- const when = new Date(publishedInfo.time)
35
- console.log(ac.green.bold(`${projectName} Last published to ${publishedUrl} at ${when}`))
36
- for (const depName of Object.getOwnPropertyNames(deployedInfo)) {
37
- const depTime = deployedInfo[depName] ?? 0
38
- if(depTime > 0 && depTime < publishedInfo.time) {
39
- console.log(' '+ac.blue.bold(depName))
40
- }
41
- }
42
- }
43
- }
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,60 +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
- ): Promise<void> {
26
- if (folder === undefined || folder === '') {
27
- helpInit()
28
- return
29
- }
30
- const cwd = process.cwd()
31
- const refPath = path.isAbsolute(folder) ? path.normalize(folder) : path.normalize(path.join(cwd, folder))
32
- console.log(refPath)
33
- if (!fs.existsSync(refPath)) {
34
- fs.mkdirSync(refPath, { recursive: true })
35
- }
36
-
37
- const funcDir = path.join(refPath, 'functions')
38
- if (!fs.existsSync(funcDir)) {
39
- fs.mkdirSync(funcDir)
40
- }
41
-
42
- // make webroot with docs folder and placeholder yaml
43
- const webrootDocs = path.join(refPath, 'webroot', 'docs')
44
- if (!fs.existsSync(webrootDocs)) {
45
- fs.mkdirSync(webrootDocs, { recursive: true })
46
- const yaml = path.join(webrootDocs, 'apidoc.yaml')
47
- fs.writeFileSync(yaml, '')
48
- const swaggerSrcDir = path.join(__dirname, '..', '..', 'templateData')
49
- fs.copyFileSync(path.join(swaggerSrcDir, 'swagger-ui.css'), path.join(webrootDocs, 'swagger-ui.css'))
50
- fs.copyFileSync(path.join(swaggerSrcDir, 'swagger-ui-bundle.js'), path.join(webrootDocs, 'swagger-ui-bundle.js'))
51
- fs.copyFileSync(path.join(swaggerSrcDir, 'swagger-ui-standalone-preset.js'), path.join(webrootDocs, 'swagger-ui-standalone-preset.js'))
52
- }
53
-
54
- await interrogateUserForPackageJsonSettings(refPath)
55
- await addPackageScripts(refPath)
56
- await installDevPackage(refPath, '@types/node')
57
- await installDevPackage(refPath, 'typescript')
58
- await installDevPackage(refPath, 'tap')
59
- await installPackage(refPath, '@tremho/inverse-y')
60
- }
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
+ }