@tremho/mist-lift 1.1.1-pre-release.2 → 1.1.2

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 (38) hide show
  1. package/README.md +3 -2
  2. package/build/commands/actions/initQuestions.js +35 -33
  3. package/build/commands/actions/initQuestions.js.map +1 -1
  4. package/build/commands/build.js +36 -38
  5. package/build/commands/build.js.map +1 -1
  6. package/build/commands/create.js +1 -1
  7. package/build/commands/create.js.map +1 -1
  8. package/build/commands/deploy.js +1 -1
  9. package/build/commands/deploy.js.map +1 -1
  10. package/build/commands/info.js +1 -1
  11. package/build/commands/info.js.map +1 -1
  12. package/build/commands/init.js +2 -2
  13. package/build/commands/init.js.map +1 -1
  14. package/build/commands/package.js +14 -8
  15. package/build/commands/package.js.map +1 -1
  16. package/build/commands/publish.js +2 -2
  17. package/build/commands/publish.js.map +1 -1
  18. package/build/expressRoutes/functionBinder.js.map +1 -1
  19. package/build/integration-tests/quickstart-scenario.test.js +76 -0
  20. package/build/integration-tests/quickstart-scenario.test.js.map +1 -0
  21. package/build/lib/utils.js +1 -1
  22. package/build/lib/utils.js.map +1 -1
  23. package/build/lift.js +1 -1
  24. package/build/lift.js.map +1 -1
  25. package/package.json +6 -3
  26. package/src/commands/actions/initQuestions.ts +52 -50
  27. package/src/commands/build.ts +12 -12
  28. package/src/commands/create.ts +3 -3
  29. package/src/commands/deploy.ts +3 -3
  30. package/src/commands/help.ts +1 -1
  31. package/src/commands/info.ts +30 -31
  32. package/src/commands/init.ts +3 -2
  33. package/src/commands/package.ts +15 -10
  34. package/src/commands/publish.ts +4 -4
  35. package/src/expressRoutes/functionBinder.ts +6 -7
  36. package/src/integration-tests/quickstart-scenario.test.ts +74 -0
  37. package/src/lib/utils.ts +1 -1
  38. package/src/lift.ts +2 -2
@@ -0,0 +1,74 @@
1
+
2
+ /* eslint @typescript-eslint/no-floating-promises: "off" */
3
+
4
+ import Tap from 'tap'
5
+
6
+ import fs from 'fs'
7
+ import path from 'path'
8
+
9
+ import { doInit } from '../commands/init'
10
+ import { doCreate } from '../commands/create'
11
+ import { doBuildAsync } from '../commands/build'
12
+ import { doDeployAsync } from '../commands/deploy'
13
+ import { doPublishAsync } from '../commands/publish'
14
+
15
+ import axios from 'axios'
16
+
17
+ async function test (t: any): Promise<void> {
18
+ const testMessage = `test on ${Date.now()}`
19
+ // start clean
20
+ fs.rmSync('./QSTest', { recursive: true })
21
+ // init
22
+ await doInit('QSTest', true)
23
+
24
+ // verify project got made
25
+ t.ok(fs.existsSync('./QSTest'), 'created test project')
26
+ // verify we have a functions dir
27
+ t.ok(fs.existsSync(path.join('./QSTest', 'functions')), 'functions exists')
28
+ // verify we have a node_modules dir
29
+ t.ok(fs.existsSync(path.join('./QSTest', 'node_modules')), 'node_modules exists')
30
+ // verify we have a webroot dir
31
+ t.ok(fs.existsSync(path.join('./QSTest', 'webroot')), 'webroot exists')
32
+ // verify we have a package.json
33
+ t.ok(fs.existsSync(path.join('./QSTest', 'package.json')), 'package.json exists')
34
+ // verify we have webroot/docs
35
+ t.ok(fs.existsSync(path.join('./QSTest', 'webroot', 'docs', 'apidoc.yaml')), 'yaml exists')
36
+ t.ok(fs.existsSync(path.join('./QSTest', 'webroot', 'docs', 'swagger-ui-bundle.js')), 'js exists')
37
+ t.ok(fs.existsSync(path.join('./QSTest', 'webroot', 'docs', 'swagger-ui-standalone-preset.js')), 'js exists')
38
+ t.ok(fs.existsSync(path.join('./QSTest', 'webroot', 'docs', 'swagger-ui.css')), 'css exists')
39
+
40
+ // create
41
+ process.chdir('./QSTest')
42
+ await doCreate('IntegrationTest')
43
+ t.ok(fs.existsSync(path.join('functions', 'IntegrationTest')), 'function exists')
44
+ t.ok(fs.existsSync(path.join('functions', 'IntegrationTest', 'src', 'definition.json')), 'definition.json exists')
45
+ t.ok(fs.existsSync(path.join('functions', 'IntegrationTest', 'src', 'local.ts')), 'local.ts exists')
46
+ const maints = path.join('functions', 'IntegrationTest', 'src', 'main.ts')
47
+ t.ok(fs.existsSync(maints), 'main.ts exists')
48
+ const content = fs.readFileSync(maints).toString().replace('Hello, World!', testMessage)
49
+ fs.writeFileSync(maints, content)
50
+
51
+ // build
52
+ await doBuildAsync(['--clean'])
53
+
54
+ await doDeployAsync([])
55
+
56
+ await doPublishAsync()
57
+
58
+ const publishedJson = fs.readFileSync('.published').toString()
59
+ const publishedInfo = JSON.parse(publishedJson)
60
+ const apiUrl: string = publishedInfo.url
61
+ t.ok(apiUrl.length > 0, 'url exists')
62
+ const testUrl = apiUrl + '/integrationtest'
63
+
64
+ const resp: any = await axios.get(testUrl)
65
+ t.ok(resp.status === 200, 'status is 200')
66
+ const data: string = resp.data.toString()
67
+ t.ok(data === testMessage, 'saw expected data')
68
+
69
+ t.end()
70
+ }
71
+
72
+ Tap.test('Integration Quickstart', async t => {
73
+ await test(t)
74
+ })
package/src/lib/utils.ts CHANGED
@@ -18,7 +18,7 @@ export async function FolderToZip (
18
18
  folderPath: string,
19
19
  zipPath: string
20
20
  ): Promise<Uint8Array> {
21
- return new Promise(resolve => {
21
+ return await new Promise(resolve => {
22
22
  zipDir(folderPath, { saveTo: zipPath }, function (err: any, buffer: Uint8Array) {
23
23
  if (err !== '' && err !== undefined && err !== null) throw err
24
24
  // `buffer` is the buffer of the zipped file
package/src/lift.ts CHANGED
@@ -18,7 +18,7 @@ import { doPublishAsync } from './commands/publish'
18
18
  import { doDoctor } from './commands/doctor'
19
19
  import { startLocalServer } from './commands/start'
20
20
  import { doSettings } from './commands/settings'
21
- import { doInfo} from './commands/info'
21
+ import { doInfo } from './commands/info'
22
22
 
23
23
  const command = process.argv[2] ?? 'help'
24
24
  const args = process.argv.slice(3)
@@ -50,7 +50,7 @@ async function processCommand (): Promise<void> {
50
50
  }
51
51
  return
52
52
  case 'start':
53
- return startLocalServer()
53
+ return await startLocalServer()
54
54
 
55
55
  case 'package': {
56
56
  const ret = await doPackageAsync(args)