@tremho/mist-lift 2.2.1 → 2.2.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 (35) hide show
  1. package/README.md +5 -0
  2. package/build/commands/builtin/ApiDocMaker.js +23 -6
  3. package/build/commands/builtin/ApiDocMaker.js.map +1 -1
  4. package/build/commands/builtin/BuiltInHandler.js +3 -1
  5. package/build/commands/builtin/BuiltInHandler.js.map +1 -1
  6. package/build/commands/builtin/DeployBuiltInZip.js +6 -38
  7. package/build/commands/builtin/DeployBuiltInZip.js.map +1 -1
  8. package/build/commands/builtin/StageWebrootZip.js +16 -2
  9. package/build/commands/builtin/StageWebrootZip.js.map +1 -1
  10. package/build/commands/deploy.js +9 -0
  11. package/build/commands/deploy.js.map +1 -1
  12. package/build/commands/doctor.js +21 -1
  13. package/build/commands/doctor.js.map +1 -1
  14. package/build/commands/publish.js +32 -14
  15. package/build/commands/publish.js.map +1 -1
  16. package/build/commands/test.js +30 -0
  17. package/build/commands/test.js.map +1 -1
  18. package/build/commands/update.js +1 -1
  19. package/build/commands/update.js.map +1 -1
  20. package/build/lib/IdSrc.js +21 -1
  21. package/build/lib/IdSrc.js.map +1 -1
  22. package/build/lift.js +1 -2
  23. package/build/lift.js.map +1 -1
  24. package/package.json +1 -1
  25. package/src/commands/builtin/ApiDocMaker.ts +20 -3
  26. package/src/commands/builtin/BuiltInHandler.ts +3 -1
  27. package/src/commands/builtin/DeployBuiltInZip.ts +5 -15
  28. package/src/commands/builtin/StageWebrootZip.ts +16 -2
  29. package/src/commands/deploy.ts +10 -0
  30. package/src/commands/doctor.ts +19 -0
  31. package/src/commands/publish.ts +35 -15
  32. package/src/commands/test.ts +9 -0
  33. package/src/commands/update.ts +1 -1
  34. package/src/lib/IdSrc.ts +19 -1
  35. package/src/lift.ts +1 -1
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -12,10 +35,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
35
  exports.doTestAsync = void 0;
13
36
  const executeCommand_1 = require("../lib/executeCommand");
14
37
  const build_1 = require("./build");
38
+ const doctor_1 = require("./doctor");
39
+ const ac = __importStar(require("ansi-colors"));
15
40
  function doTestAsync(args) {
16
41
  return __awaiter(this, void 0, void 0, function* () {
17
42
  if ((yield (0, build_1.doBuildAsync)(args)) !== 0)
18
43
  return 1; // don't test if build fails
44
+ if (!(yield (0, doctor_1.isTapInstalled)())) {
45
+ // don't continue if tap unavaiable
46
+ console.log(ac.yellow.dim.bold.italic('\nTap is necessary for the lift test command.\nInstall with ') + ac.black.bold('npm i -g tap\n'));
47
+ return 1;
48
+ }
19
49
  if (args.length === 0)
20
50
  args = ['*'];
21
51
  let ret = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAsD;AACtD,mCAAsC;AAEtC,SAAsB,WAAW,CAAE,IAAc;;QAC/C,IAAI,CAAA,MAAM,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAK,CAAC;YAAE,OAAO,CAAC,CAAA,CAAC,4BAA4B;QACzE,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,GAAG,GAAG,CAAC,CAAA;QACX,KAAK,MAAM,QAAQ,IAAI,IAAI,EAAE,CAAC;YAC5B,MAAM,MAAM,GAAG,MAAM,IAAA,+BAAc,EAAC,KAAK,EAAE;gBACnC,mBAAmB,QAAQ,YAAY;gBACvC;;;;;;;;;;;mBAWG;gBACH,iBAAiB;gBACjB,SAAS;gBACT,UAAU;gBACV,wBAAwB;gBACxB,6BAA6B;aAEpC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAA;YAEZ,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;gBACzB,GAAG,GAAG,MAAM,CAAC,OAAO,CAAA;gBACpB,MAAK;YACP,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;CAAA;AAjCD,kCAiCC"}
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAsD;AACtD,mCAAsC;AACtC,qCAAyC;AACzC,gDAAiC;AAEjC,SAAsB,WAAW,CAAE,IAAc;;QAC/C,IAAI,CAAA,MAAM,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAK,CAAC;YAAE,OAAO,CAAC,CAAA,CAAC,4BAA4B;QAEzE,IAAI,CAAC,CAAA,MAAM,IAAA,uBAAc,GAAE,CAAA,EAAE,CAAC;YAC5B,mCAAmC;YACnC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,8DAA8D,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAA;YACxI,OAAO,CAAC,CAAA;QACV,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,GAAG,GAAG,CAAC,CAAA;QACX,KAAK,MAAM,QAAQ,IAAI,IAAI,EAAE,CAAC;YAC5B,MAAM,MAAM,GAAG,MAAM,IAAA,+BAAc,EAAC,KAAK,EAAE;gBACnC,mBAAmB,QAAQ,YAAY;gBACvC;;;;;;;;;;;mBAWG;gBACH,iBAAiB;gBACjB,SAAS;gBACT,UAAU;gBACV,wBAAwB;gBACxB,6BAA6B;aAEpC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAA;YAEZ,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;gBACzB,GAAG,GAAG,MAAM,CAAC,OAAO,CAAA;gBACpB,MAAK;YACP,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;CAAA;AAxCD,kCAwCC"}
@@ -51,7 +51,7 @@ function doUpdateAsync(stageName) {
51
51
  console.log(ac.green.bold(`Updating Webroot files to ${stageName}`));
52
52
  try {
53
53
  // console.warn(">>> esbuilder")
54
- yield (0, ESBuild_1.esbuilder)();
54
+ yield (0, ESBuild_1.esbuilder)(null, true);
55
55
  // console.warn(">>> DeployRootFileserves")
56
56
  yield (0, BuiltInHandler_1.DeployRootFileserves)();
57
57
  // console.warn(">>> DeployWebrootBuiltIn")
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAiC;AACjC,oD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EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC,CAAA;YACxE,OAAO,CAAC,CAAC,CAAA;QACX,CAAC;QAED,IAAI,SAAS,KAAK,SAAS;YAAE,SAAS,GAAG,KAAK,CAAA;QAC9C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,6BAA6B,SAAS,EAAE,CAAC,CAAC,CAAA;QAEpE,IAAI,CAAC;YACH,gCAAgC;YAChC,MAAM,IAAA,mBAAS,EAAC,IAAI,EAAE,IAAI,CAAC,CAAA;YAC3B,2CAA2C;YAC3C,MAAM,IAAA,qCAAoB,GAAE,CAAA;YAC5B,2CAA2C;YAC3C,MAAM,IAAA,qCAAoB,GAAE,CAAA;YAC5B,OAAO,CAAC,CAAA;QACV,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC,CAAA;YAC3E,OAAO,CAAC,CAAC,CAAA;QACX,CAAC;IACH,CAAC;CAAA;AA3BD,sCA2BC"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.decoratedName = exports.getIdSrc = exports.getIdDelimiter = void 0;
4
7
  const LiftVersion_1 = require("../lib/LiftVersion");
8
+ const sha1_1 = __importDefault(require("sha1"));
5
9
  function getIdDelimiter() {
6
10
  return '_-_';
7
11
  }
@@ -17,7 +21,23 @@ function getIdSrc() {
17
21
  }
18
22
  exports.getIdSrc = getIdSrc;
19
23
  function decoratedName(name) {
20
- return name + getIdDelimiter() + getIdSrc();
24
+ if (name.includes(getIdDelimiter())) {
25
+ // console.warn('name '+name+' appears to be decorated already')
26
+ return name;
27
+ }
28
+ while (name.includes('/'))
29
+ name = name.replace('/', '');
30
+ const hash8 = (0, sha1_1.default)(name.toLowerCase()).toString().substring(0, 8);
31
+ const fullName = name + getIdDelimiter() + getIdSrc();
32
+ let dname;
33
+ if (name.startsWith('fileserve_')) {
34
+ dname = ('fileServe_' + hash8 + getIdDelimiter() + getIdSrc()).substring(0, 64);
35
+ }
36
+ else {
37
+ dname = fullName.substring(0, 50) + '_' + hash8;
38
+ }
39
+ // console.warn('decorated to '+dname+' from '+name)
40
+ return dname;
21
41
  }
22
42
  exports.decoratedName = decoratedName;
23
43
  //# sourceMappingURL=IdSrc.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IdSrc.js","sourceRoot":"","sources":["../../src/lib/IdSrc.ts"],"names":[],"mappings":";;;AACA,oDAAsE;AAEtE,SAAgB,cAAc;IAC5B,OAAO,KAAK,CAAA;AACd,CAAC;AAFD,wCAEC;AACD,SAAgB,QAAQ;;IACtB,IAAI,KAAK,GAAG,EAAE,GAAG,CAAC,MAAA,IAAA,4BAAc,GAAE,mCAAI,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,MAAA,MAAA,IAAA,+BAAiB,GAAE,0CAAE,QAAQ,EAAE,mCAAI,EAAE,CAAC,CAAA;IAC3F,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC3D,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAE3D,OAAO,KAAK,CAAA;AACd,CAAC;AAND,4BAMC;AACD,SAAgB,aAAa,CAAE,IAAY;IACzC,OAAO,IAAI,GAAG,cAAc,EAAE,GAAG,QAAQ,EAAE,CAAA;AAC7C,CAAC;AAFD,sCAEC"}
1
+ {"version":3,"file":"IdSrc.js","sourceR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AG,CAAC,YAAY,GAAG,KAAK,GAAG,cAAc,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACjF,CAAC;SAAM,CAAC;QACN,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,KAAK,CAAA;IACjD,CAAC;IACD,oDAAoD;IACpD,OAAO,KAAK,CAAA;AACd,CAAC;AAnBD,sCAmBC"}
package/build/lift.js CHANGED
@@ -104,8 +104,7 @@ function processCommand() {
104
104
  case 'publish':
105
105
  {
106
106
  const ret = yield (0, publish_1.doPublishAsync)();
107
- if (ret !== 0)
108
- process.exit(ret);
107
+ process.exit(ret);
109
108
  }
110
109
  return;
111
110
  case 'update':
package/build/lift.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"lift.js","sourceRoot":"","sources":["../src/lift.ts"],"names":[],"mappings":";;AAEA,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,gDAAiC;AACjC,iDAAkC;AAElC,mDAAkD;AAElD,0CAAwC;AACxC,0CAAwC;AACxC,8CAA4C;AAC5C,4CAA+C;AAC/C,0CAA6C;AAC7C,gDAAmD;AACnD,8CAAiD;AACjD,gDAAmD;AACnD,8CAAiD;AACjD,8CAA4C;AAC5C,4CAAmD;AACnD,kDAAgD;AAChD,0CAAwC;AAExC,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAI,MAAM,CAAA;AACzC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAElC,SAAe,cAAc;;;QAC3B,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,SAAS,CAAC;YACf,KAAK,WAAW,CAAC;YACjB,KAAK,IAAI;gBACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAA,4BAAc,GAAE,CAAC,Q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AC,GAAG,CAAC,IAAI,CAAC,wBAAwB,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,EAAE,CAAC,CAAC,CAAA;IACjE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;IAC/B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,4EAA4E,CAAC,CAAC,CAAA;IACtG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AACjB,CAAC;AAED,cAAc,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tremho/mist-lift",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "lift command line utility for MistLift development",
5
5
  "main": "build/lift.js",
6
6
  "bin": {
@@ -3,6 +3,8 @@ import { buildOpenApi } from '../../lib/openAPI/openApiConstruction'
3
3
  import { GetWebrootServePaths } from '../../lib/openAPI/WebrootFileSupport'
4
4
 
5
5
  import path from 'path'
6
+ // import * as ac from 'ansi-colors'
7
+ import { decoratedName } from '../../lib/IdSrc'
6
8
 
7
9
  export async function MakePublicApiDoc
8
10
  (
@@ -16,33 +18,48 @@ export async function MakeBuiltinApiDoc
16
18
  yamlFile: string
17
19
 
18
20
  ): Promise<Uint8Array> {
21
+ // console.log(ac.gray.dim('>>> gatherFunctionDefinitions '))
19
22
  const defs = gatherFunctionDefinitions()
23
+ // console.log(ac.gray.dim('>> after gatherfunctions'), defs)
24
+ // console.log(ac.gray.dim('>>> addBuiltInDefinitions '))
20
25
  addBuiltInDefinitions(defs)
26
+ // console.log(ac.gray.dim('>> after addBuiltIns'), defs)
27
+ // console.log(ac.gray.dim('>>> buildOpenApi '))
21
28
  return await buildOpenApi(defs, false, yamlFile) //, true)
22
29
  }
23
30
 
24
31
  export function addBuiltInDefinitions (defs: any[]): void {
25
32
  // console.warn("NOT ADDING ANY BUILTIN API INTEGRATIONS")
26
33
  // console.log("ADDING apiDef");
34
+ // console.log(ac.gray.dim('>>>> pushing apiDef '), apiDef)
27
35
  defs.push(apiDef)
36
+ // console.log(ac.gray.dim('>>>> pushing webrootDef '), webrootDef)
28
37
  defs.push(webrootDef)
29
38
 
39
+ // console.log(ac.gray.dim('>>>> Adding webroot literals '))
30
40
  // console.warn("Adding webroot literals");
31
41
  // do just /docs and see how that goes
42
+ /*
32
43
  const fsdef = Object.assign({}, fileServeDef) // copy
33
- fsdef.name = 'fileserve_docs'
44
+ fsdef.name = decoratedName('fileserve_docs')
34
45
  fsdef.pathMap = '/docs/{path}'
35
46
  defs.push(fsdef)
47
+ */
36
48
  const roots = GetWebrootServePaths()
37
49
  // console.log("roots", roots)
50
+ // console.log(ac.gray.dim('>>>> roots here: '), roots)
38
51
  for (const root of roots) {
52
+ // console.log(ac.gray.dim('>> top of loop with root '+root))
39
53
  if (root !== '') {
40
54
  const rootPath = root.replace(path.sep, '/')
41
55
  let rootName = rootPath
42
- while (rootName.includes('/')) rootName = rootPath.replace('/', '').toLowerCase().trim()
56
+ // console.log(ac.gray.dim('>> rootName = '+rootName))
57
+ while (rootName.includes('/')) rootName = rootName.replace('/', '').toLowerCase().trim()
58
+ // console.log(ac.gray.dim('>> past stupid error = '+rootName))
43
59
  const fileserve = Object.assign({}, fileServeDef) // copy
44
- fileserve.name = 'fileserve_' + rootName
60
+ fileserve.name = decoratedName('fileserve_' + rootName)
45
61
  fileserve.pathMap = `${rootPath}/{path}`
62
+ // console.log('pathmap = '+fileserve.pathMap)
46
63
  defs.push(fileserve)
47
64
  }
48
65
  }
@@ -2,6 +2,7 @@ import { StageWebrootZip } from './StageWebrootZip'
2
2
  import { DeployBuiltInZip } from './DeployBuiltInZip'
3
3
  import { GetWebrootServePaths } from '../../lib/openAPI/WebrootFileSupport'
4
4
  import * as ac from 'ansi-colors'
5
+ import { decoratedName } from '../../lib/IdSrc'
5
6
 
6
7
  import fs from 'fs'
7
8
  import path from 'path'
@@ -28,7 +29,8 @@ export async function DeployRootFileserves
28
29
  const all: Array<Promise<any>> = []
29
30
  for (let root of roots) {
30
31
  root = root.trim()
31
- let name = 'fileserve_' + root
32
+ let name = decoratedName('fileserve_' + root)
33
+ // console.log(ac.gray.dim('>> '+root+' > '+name))
32
34
  while (name.includes('/')) {
33
35
  name = name.replace('/', '')
34
36
  }
@@ -1,25 +1,15 @@
1
1
 
2
- import * as path from 'path'
2
+ // import * as path from 'path'
3
3
  import { deployPackage } from '../deploy'
4
+ // import sha1 from 'sha1'
5
+ // import * as ac from 'ansi-colors'
4
6
 
5
7
  export async function DeployBuiltInZip
6
8
  (
7
9
  name: string,
8
10
  zipPath: string
9
11
  ): Promise<void> {
10
- // console.log(">> Deploying "+name)
12
+ // console.log(ac.gray.dim('>> DeployBuiltInZip '))
11
13
  await deployPackage(name, zipPath)
12
- }
13
-
14
- export async function DeployFileserve
15
- (
16
- root: string
17
- ): Promise<void> {
18
- // rootName is without slash
19
- if (root !== '') {
20
- const rootName = root.replace('/', '')
21
- const name = 'fileserve_' + rootName
22
- const zipPath = path.join(__dirname, 'prebuilt-zips', 'FileServe.zip')
23
- await DeployBuiltInZip(name, zipPath)
24
- }
14
+ // console.log(ac.gray.dim('>> returning from DeployBuiltInZip '))
25
15
  }
@@ -7,6 +7,7 @@ import { recurseDirectory } from '../../lib/DirectoryUtils'
7
7
  import { FolderToZip, UnzipToFolder } from '../../lib/utils'
8
8
  // import { executeCommand } from '../../lib/executeCommand'
9
9
  import { rmSync } from 'fs'
10
+ // import * as ac from 'ansi-colors'
10
11
 
11
12
  export async function StageWebrootZip
12
13
  (
@@ -41,14 +42,27 @@ export async function StageWebrootZip
41
42
  // console.log(">>>> making zipFilesPath "+zipFilesPath)
42
43
  await fs.mkdirSync(zipFilesPath)
43
44
 
45
+ // todo: read the redirects.json file
46
+ let redirected: string[] = []
47
+ try {
48
+ const redir = JSON.parse(fs.readFileSync(path.join(webroot, 'redirects.json')).toString())
49
+ redirected = Object.getOwnPropertyNames(redir)
50
+ // console.log(ac.grey.dim('>> redirected files '), redirected)
51
+ } catch (e: any) {
52
+ // console.log(ac.grey.dim('>> exception reading redirects.json'), e)
53
+ }
54
+
44
55
  // console.log(">>>> enumerating "+webroot)
45
56
  await recurseDirectory(webroot, (filepath, stats) => {
46
57
  const relPath = filepath.substring(webroot.length)
47
58
  if (stats.isDirectory()) {
48
59
  fs.mkdirSync(zipFilesPath + relPath, { recursive: true })
49
60
  } else {
50
- // console.log(">>>> copying "+filepath+" to "+zipFilesPath+relPath)
51
- fs.copyFileSync(filepath, zipFilesPath + relPath)
61
+ // console.log(ac.grey.dim('>> considering ' + relPath))
62
+ if (!redirected.includes(relPath.substring(1))) {
63
+ // console.log(ac.grey.dim('>> copying...'))
64
+ fs.copyFileSync(filepath, zipFilesPath + relPath) // copy only if not in redirected list
65
+ }
52
66
  }
53
67
  return false
54
68
  })
@@ -68,12 +68,16 @@ export async function doDeployAsync (
68
68
  })
69
69
  }
70
70
 
71
+ // console.log(ac.gray.dim('>> beginning loop in doDeployAsync '))
72
+
71
73
  for (const funcName of funcsToDeploy) {
72
74
  const zipFile = path.join(projectPaths.basePath, 'MistLift_Zips', funcName + '.zip')
73
75
  if (fs.existsSync(zipFile)) {
74
76
  const zipTime = fs.statSync(zipFile).mtime
75
77
  if (zipTime.getTime() > (deploymentRecord[funcName] ?? 0)) {
78
+ // console.log(ac.gray.dim('>> calling deployPackage '))
76
79
  await deployPackage(funcName)
80
+ // console.log(ac.gray.dim('>> recording result '))
77
81
  deploymentRecord[funcName] = Date.now()
78
82
  }
79
83
  } else {
@@ -84,6 +88,7 @@ export async function doDeployAsync (
84
88
 
85
89
  try { fs.writeFileSync(deploymentRecordPath, JSON.stringify(deploymentRecord)) } catch {}
86
90
 
91
+ // console.log(ac.gray.dim('>> returning from doDeployAsync '))
87
92
  return 0
88
93
  }
89
94
 
@@ -132,10 +137,13 @@ export async function deployPackage (
132
137
  const principal = parts[4]
133
138
  await AddPermissions(client, dFuncName, principal)
134
139
  let deployMsg: string = `Successfully deployed ${funcName}`
140
+ // console.log(ac.gray.dim('>> deploy trace 1'))
135
141
  if (memorySize > 0 || timeout > 0) {
142
+ // console.log(ac.gray.dim('>> deploy trace 1a'))
136
143
  deployMsg += ac.grey.italic(' with ')
137
144
  const useAnd = memorySize > 9 && timeout > 0
138
145
  if (memorySize > 0) {
146
+ // console.log(ac.gray.dim('>> deploy trace 1b'))
139
147
  deployMsg += ac.grey(`memorySize ${memorySize}mb`)
140
148
  if (useAnd) deployMsg += ac.grey.italic(' and ')
141
149
  }
@@ -143,11 +151,13 @@ export async function deployPackage (
143
151
  deployMsg += ac.grey(`timeout ${timeout} seconds`)
144
152
  }
145
153
  }
154
+ // console.log(ac.gray.dim('>> deploy trace 2'))
146
155
 
147
156
  console.log(ac.green.bold(deployMsg))
148
157
  } catch (e: any) {
149
158
  console.error(ac.red.bold.italic('Error deploying ' + funcName), e)
150
159
  }
160
+ // console.log(ac.gray.dim('>> deploy trace 3'))
151
161
  }
152
162
  async function CreateCloudFunction (
153
163
  funcName: string,
@@ -5,6 +5,8 @@ import { executeCommand } from '../lib/executeCommand'
5
5
  import { resolvePaths } from '../lib/pathResolve'
6
6
  import { areSettingsAvailable } from '../lib/LiftConfig'
7
7
 
8
+ const minTapVersion = '19.2.5'
9
+
8
10
  export async function doDoctor (): Promise<boolean> {
9
11
  console.log(ac.blue.bold('Lift doctor'))
10
12
 
@@ -26,6 +28,11 @@ export async function doDoctor (): Promise<boolean> {
26
28
  ok = ok && report('Npm', npmVersion, isWin ? '9.6.4' : '10.3.0')
27
29
  report('Git', gitVersion, '2.0.0')
28
30
  report('unzip', unzipVersion, '1.0.0')
31
+
32
+ if (!await isTapInstalled()) {
33
+ console.log(ac.yellow.dim.bold.italic('\nTap is necessary for the lift test command.\nInstall with ') + ac.black.bold('npm i -g tap\n'))
34
+ }
35
+
29
36
  if (!settingsAvail) {
30
37
  console.log('')
31
38
  console.log(ac.yellow.dim.bold('Cloud Settings are not set. ') + ac.blue('run ' + ac.bold('lift settings')))
@@ -81,6 +88,13 @@ async function fetchNpmVersion (
81
88
  return vstr
82
89
  }
83
90
 
91
+ async function fetchTapVersion (): Promise<string> {
92
+ const result = await executeCommand('tap', ['-v'])
93
+ if (result.retcode !== 0) return 'Tap not found'
94
+ const vstr = versionTrim(result.stdStr)
95
+ return vstr
96
+ }
97
+
84
98
  async function fetchGitVersion (
85
99
 
86
100
  ): Promise<string> {
@@ -116,3 +130,8 @@ function report (
116
130
  }
117
131
  return ok
118
132
  }
133
+
134
+ export async function isTapInstalled (): Promise<boolean> {
135
+ const v = await fetchTapVersion()
136
+ return report('tap', v, minTapVersion)
137
+ }
@@ -27,7 +27,7 @@ import { delay } from '../lib/utils'
27
27
  import { addBuiltInDefinitions, MakeBuiltinApiDoc } from './builtin/ApiDocMaker'
28
28
  import { DeployApiBuiltin, DeployRootFileserves, DeployWebrootBuiltIn } from './builtin/BuiltInHandler'
29
29
  import { esbuilder } from '../lib/ESBuild'
30
- import { decoratedName, getIdDelimiter } from '../lib/IdSrc'
30
+ import { getIdSrc, getIdDelimiter } from '../lib/IdSrc'
31
31
 
32
32
  let projectPaths: any
33
33
 
@@ -53,19 +53,24 @@ async function publishApi (
53
53
  if (stageName === undefined) stageName = 'Dev'
54
54
  console.log(ac.green.bold(`Publishing Api to ${stageName}`))
55
55
 
56
- // console.log('esbuild...')
57
- await esbuilder()
58
- // console.log('done')
56
+ // console.log(ac.gray.dim('>> esbuilder '))
57
+ await esbuilder(null, true)
59
58
  // do the built-in deploys
59
+ // console.log(ac.gray.dim('>> webroot '))
60
60
  await DeployWebrootBuiltIn()
61
+ // console.log(ac.gray.dim('>> fileserves '))
61
62
  await DeployRootFileserves()
63
+ // console.log(ac.gray.dim('>> api built in '))
62
64
  await DeployApiBuiltin()
65
+ // console.log(ac.gray.dim('>> past api built in '))
63
66
 
64
67
  // make a private api
65
68
  // const fs = require('fs')
66
69
  // const os = require('os')
67
70
  // const path = require('path')
68
71
 
72
+ // console.log(ac.gray.dim('>> create staging folder '))
73
+
69
74
  let tmpDir
70
75
  let apiBytes
71
76
  const appPrefix = 'MistLift'
@@ -75,7 +80,9 @@ async function publishApi (
75
80
  mkdirSync(tmpDir, { recursive: true })
76
81
 
77
82
  const yamlFile = path.join(tmpDir, 'papi.yaml')
83
+ // console.log(ac.gray.dim('>> Make builtin ApiDoc '))
78
84
  await MakeBuiltinApiDoc(yamlFile)
85
+ // console.log(ac.gray.dim('>> Past making builtin ApiDoc '))
79
86
  // console.log("reading "+yamlFile)
80
87
  apiBytes = fs.readFileSync(yamlFile)
81
88
  } catch (e: any) {
@@ -90,9 +97,11 @@ async function publishApi (
90
97
  console.error(`An error has occurred while removing the temp folder at ${tmpDir ?? ''}. Please remove it manually. Error: ${(e.message as string)}`)
91
98
  }
92
99
  }
100
+ // console.log(ac.gray.dim('>> past that part, onto API Gateway '))
93
101
 
94
102
  const client = new APIGatewayClient(getAWSCredentials())
95
103
 
104
+ // console.log(ac.gray.dim('>> remove Existing versions '))
96
105
  await RemoveExistingVersions(client)
97
106
 
98
107
  const command: any = new ImportRestApiCommand({
@@ -123,15 +132,17 @@ async function publishApi (
123
132
 
124
133
  console.log(ac.grey('Continuing with binding...'))
125
134
  const prereq = await PrequisiteValues(apiId ?? '')
135
+ // console.log(ac.gray.dim('>> making intRequests'))
126
136
  const intRequests = prereq.MakeRequests()
137
+ // console.log(ac.magenta.dim('>> putting integration'), intRequests)
127
138
  await PutIntegrations(intRequests)
128
139
  await DeployApi(apiId ?? '', stageName)
129
140
  const region = getSettings()?.awsPreferredRegion ?? ''
130
141
  const publishUrl = `https://${apiId ?? ''}.execute-api.${region}.amazonaws.com/${stageName}`
131
142
  console.log(ac.green.bold(`\n Successfully deployed to ${publishUrl}`))
132
143
  recordLatestPublish(publishUrl)
133
- // process.exit(0) // this was a dumb idea
134
144
  }
145
+
135
146
  function findApiName (): string {
136
147
  const infoFile = path.join(projectPaths.functionPath, 'apiService.info.json')
137
148
  const pkgFile = projectPaths.packagePath
@@ -198,7 +209,7 @@ class PrereqInfo {
198
209
  if (api?.path === pathMap) {
199
210
  // console.log("resourceMethods", api.resourceMethods)
200
211
  const methodList: string[] = Object.getOwnPropertyNames(api.resourceMethods)
201
- // ClogTrace("methodList", methodList)
212
+ // console.log("methodList", methodList)
202
213
  for (const meth of allowedMethods.toUpperCase().split(',')) { // NOTE: we no longer try to support multiples, but this still works as is.
203
214
  // console.log("meth", meth)
204
215
  if (methodList.includes(meth)) {
@@ -212,9 +223,11 @@ class PrereqInfo {
212
223
  }
213
224
 
214
225
  public findARN (name: string): string {
215
- // console.warn(`>>> finding name ${name} in functions ${JSON.stringify(this.functions)}`)
226
+ let lastus = name.lastIndexOf(getIdDelimiter())
227
+ if (lastus !== -1) name = name.substring(0, lastus)
228
+ // console.warn(`>>> finding name ${name} in ${this.functions.length} functions`)
216
229
  for (const f of this.functions ?? []) {
217
- const lastus = f.name.lastIndexOf(getIdDelimiter())
230
+ lastus = f.name.lastIndexOf(getIdDelimiter())
218
231
  const fname = f.name.substring(0, lastus)
219
232
  // console.warn('comparing name, fname, lc ', {lastus, fname, name})
220
233
  if (fname.toLowerCase() === name.toLowerCase()) {
@@ -222,21 +235,26 @@ class PrereqInfo {
222
235
  return f.arn
223
236
  }
224
237
  }
225
- console.log("$$$ Couldn't find " + name + ' in ', this.functions)
238
+ console.error(ac.red.bold("$$ Couldn't find " + name + ' in integration list'))
239
+ process.exit(1)
226
240
  return ''
227
241
  }
228
242
 
229
243
  public MakeRequests (): PutIntegrationRequest[] {
230
244
  const region = getSettings()?.awsPreferredRegion ?? ''
231
245
  const out: PutIntegrationRequest[] = []
246
+
232
247
  for (const d of this.defs) {
233
248
  const def = (d)
249
+ // console.log(ac.magenta.dim('>> finding api and arn for '), {pathMap:def.pathMap, name: def.name})
234
250
  const api = this.findApi(def.pathMap, def.method)
235
251
  const arn = this.findARN(def.name) ?? ''
236
252
  if (arn === '') {
237
- console.log(`>>> No ARN for ${(def.name as string)} ${(def.pathMap as string)}, ${(api.id as string)}`)
253
+ console.log(ac.red.dim(`>>> No ARN for ${(def.name as string)} ${(def.pathMap as string)}, ${(api.id as string)}`))
254
+ process.exit(1)
238
255
  }
239
- if (api !== undefined) {
256
+ // console.log(ac.magenta.dim.italic('>> api for '+arn), api)
257
+ if (api !== null && api !== undefined && arn !== '') {
240
258
  out.push({
241
259
  restApiId: this.requestApiId,
242
260
  resourceId: api.id, // api.parentId
@@ -268,11 +286,13 @@ async function GetFunctionInfo (info: PrereqInfo): Promise<PrereqInfo> {
268
286
  const listCommand: any = new ListFunctionsCommand({})
269
287
  const response: any = await client.send(listCommand)
270
288
 
271
- const sfx = decoratedName('')
289
+ const sfx = getIdSrc()
272
290
 
273
291
  for (const func of response.Functions ?? []) {
274
292
  const fName: string = func?.FunctionName ?? ''
275
- if (fName.endsWith(sfx)) {
293
+ // console.log(ac.gray.dim('>> checking if '+fName+' has our suffix '+sfx))
294
+ if (fName.includes(sfx)) {
295
+ // console.log(ac.gray.dim('>>> Yes'))
276
296
  info.functions.push({
277
297
  name: func.FunctionName ?? '',
278
298
  arn: func.FunctionArn ?? ''
@@ -321,8 +341,8 @@ async function DeployApi (restApiId: string, stageName: string): Promise<void> {
321
341
  })
322
342
  await client.send(command)
323
343
  } catch (e: any) {
324
- console.error(ac.red.bold(`Error with deployApi: ${e.message as string}`))
325
- throw e
344
+ console.error(ac.red.bold(`Fatal Error with deployApi: ${e.message as string}`))
345
+ process.exit(-1)
326
346
  }
327
347
  }
328
348
 
@@ -1,8 +1,17 @@
1
1
  import { executeCommand } from '../lib/executeCommand'
2
2
  import { doBuildAsync } from './build'
3
+ import { isTapInstalled } from './doctor'
4
+ import * as ac from 'ansi-colors'
3
5
 
4
6
  export async function doTestAsync (args: string[]): Promise<number> {
5
7
  if (await doBuildAsync(args) !== 0) return 1 // don't test if build fails
8
+
9
+ if (!await isTapInstalled()) {
10
+ // don't continue if tap unavaiable
11
+ console.log(ac.yellow.dim.bold.italic('\nTap is necessary for the lift test command.\nInstall with ') + ac.black.bold('npm i -g tap\n'))
12
+ return 1
13
+ }
14
+
6
15
  if (args.length === 0) args = ['*']
7
16
  let ret = 0
8
17
  for (const funcName of args) {
@@ -21,7 +21,7 @@ export async function doUpdateAsync (
21
21
 
22
22
  try {
23
23
  // console.warn(">>> esbuilder")
24
- await esbuilder()
24
+ await esbuilder(null, true)
25
25
  // console.warn(">>> DeployRootFileserves")
26
26
  await DeployRootFileserves()
27
27
  // console.warn(">>> DeployWebrootBuiltIn")
package/src/lib/IdSrc.ts CHANGED
@@ -1,5 +1,6 @@
1
1
 
2
2
  import { getProjectName, getProjectVersion } from '../lib/LiftVersion'
3
+ import sha1 from 'sha1'
3
4
 
4
5
  export function getIdDelimiter (): string {
5
6
  return '_-_'
@@ -12,5 +13,22 @@ export function getIdSrc (): string {
12
13
  return idsrc
13
14
  }
14
15
  export function decoratedName (name: string): string {
15
- return name + getIdDelimiter() + getIdSrc()
16
+ if (name.includes(getIdDelimiter())) {
17
+ // console.warn('name '+name+' appears to be decorated already')
18
+ return name
19
+ }
20
+
21
+ while (name.includes('/')) name = name.replace('/', '')
22
+
23
+ const hash8 = sha1(name.toLowerCase()).toString().substring(0, 8)
24
+
25
+ const fullName = name + getIdDelimiter() + getIdSrc()
26
+ let dname
27
+ if (name.startsWith('fileserve_')) {
28
+ dname = ('fileServe_' + hash8 + getIdDelimiter() + getIdSrc()).substring(0, 64)
29
+ } else {
30
+ dname = fullName.substring(0, 50) + '_' + hash8
31
+ }
32
+ // console.warn('decorated to '+dname+' from '+name)
33
+ return dname
16
34
  }
package/src/lift.ts CHANGED
@@ -65,7 +65,7 @@ async function processCommand (): Promise<void> {
65
65
  return
66
66
  case 'publish': {
67
67
  const ret = await doPublishAsync()
68
- if (ret !== 0) process.exit(ret)
68
+ process.exit(ret)
69
69
  }
70
70
  return
71
71
  case 'update': {