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