inngest-cli 1.13.7 → 1.14.0

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 (2) hide show
  1. package/package.json +4 -1
  2. package/postinstall.js +25 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inngest-cli",
3
- "version": "1.13.7",
3
+ "version": "1.14.0",
4
4
  "description": "The leading workflow orchestration platform. Run stateful step functions and AI workflows on serverless, servers, or the edge.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
@@ -38,5 +38,8 @@
38
38
  "@types/request": "^2.48.8",
39
39
  "@types/tar": "^6.1.1",
40
40
  "typescript": "^4.7.4"
41
+ },
42
+ "prettier": {
43
+ "singleQuote": false
41
44
  }
42
45
  }
package/postinstall.js CHANGED
@@ -35,16 +35,23 @@ const platformMap = {
35
35
  darwin: { platform: "darwin", extension: KnownExtension.Tar },
36
36
  win32: { platform: "windows", extension: KnownExtension.Zip },
37
37
  };
38
- function getBinaryUrl() {
38
+ function getBinaryUrl(source) {
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
40
  const debug = rootDebug.extend("getBinaryUrl");
41
41
  const { arch, platform } = getArchPlatform();
42
- debug({ arch, platform });
42
+ debug({ arch, platform, source });
43
43
  let version = package_json_1.default.version.trim();
44
44
  debug("package.json version:", version);
45
- const targetUrl = new url_1.URL(`https://cli.inngest.com/artifact/v${version}/inngest_${version}_${platform.platform}_${arch}${platform.extension}`);
46
- debug("targetUrl:", targetUrl.href);
47
- return targetUrl;
45
+ if (source === "cdn") {
46
+ const url = new url_1.URL(`https://cli.inngest.com/artifact/v${version}/inngest_${version}_${platform.platform}_${arch}${platform.extension}`);
47
+ debug("targetUrl:", url.href);
48
+ return url;
49
+ }
50
+ else {
51
+ const url = new url_1.URL(`https://github.com/inngest/inngest/releases/download/v${version}/inngest_${version}_${platform.platform}_${arch}${platform.extension}`);
52
+ debug("targetUrl:", url.href);
53
+ return url;
54
+ }
48
55
  });
49
56
  }
50
57
  function getArchPlatform() {
@@ -126,10 +133,19 @@ function pipeBinaryToInstallLocation(res, originalUrl) {
126
133
  process.exit(0);
127
134
  }
128
135
  try {
129
- const binaryUrl = yield getBinaryUrl();
130
- const req = yield downloadBinary(binaryUrl);
131
- yield pipeBinaryToInstallLocation(req, binaryUrl);
132
- rootDebug("postinstall complete");
136
+ try {
137
+ const binaryUrl = yield getBinaryUrl("cdn");
138
+ const req = yield downloadBinary(binaryUrl);
139
+ yield pipeBinaryToInstallLocation(req, binaryUrl);
140
+ rootDebug("postinstall complete (via cdn)");
141
+ }
142
+ catch (err) {
143
+ rootDebug("failed to download from cdn; falling back to github");
144
+ const binaryUrl = yield getBinaryUrl("github");
145
+ const req = yield downloadBinary(binaryUrl);
146
+ yield pipeBinaryToInstallLocation(req, binaryUrl);
147
+ rootDebug("postinstall complete (via github)");
148
+ }
133
149
  }
134
150
  catch (err) {
135
151
  console.error(err);