Skip to content

Commit

Permalink
Release 0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mo4islona authored Sep 19, 2022
2 parents 345bedb + 47fd493 commit 7ed906c
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 33 deletions.
7 changes: 7 additions & 0 deletions bin/pkg-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

rm -rf package
npx pkg -t ${TARGET_NODE:-node18}-macos-x64,${TARGET_NODE:-node18}-linux-x64,${TARGET_NODE:-node18}-win-x64 \
--compress GZip \
-o package/sqd \
package.json
6 changes: 6 additions & 0 deletions bin/pkg-compress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

cd package
mv sqd-macos sqd && tar -czf subsquid-cli-${npm_package_version}-macos-x64.tar.gz sqd && rm sqd
mv sqd-linux sqd && tar -czf subsquid-cli-${npm_package_version}-linux-x64.tar.gz sqd && rm sqd
mv sqd-win.exe sqd.exe
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@subsquid/cli",
"description": "squid cli tool",
"version": "0.7.0",
"version": "0.7.1",
"license": "GPL-3.0-or-later",
"repository": "[email protected]:subsquid/squid.git",
"publishConfig": {
Expand Down Expand Up @@ -36,7 +36,9 @@
"dev": "./bin/dev",
"lint": "eslint --fix src/**/*",
"test:unit": "NODE_ENV=test jest --bail --testRegex=.unit.spec.ts$",
"tsc": "tsc --noEmit"
"tsc": "tsc --noEmit",
"pkg:build": "./bin/pkg-build.sh",
"pkg:compress": "./bin/pkg-compress.sh"
},
"jest": {
"moduleFileExtensions": [
Expand Down Expand Up @@ -81,6 +83,7 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"jest": "^29.0.2",
"pkg": "^5.8.0",
"prettier": "^2.6.2",
"ts-jest": "^28.0.8",
"typescript": "~4.5.5"
Expand Down
52 changes: 35 additions & 17 deletions src/api/squids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,43 @@ export async function streamSquidLogs(
onLog: (log: string) => unknown,
query: { container?: string[]; level?: string[] } = {},
) {
const stream = await versionLogsFollow(squidName, versionName, query);

await new Promise((resolve, reject) => {
streamLines(stream, (line) => {
if (line.length === 0) return;

try {
const entries: LogEntry[] = JSON.parse(line);

pretty(entries).forEach((l) => {
onLog(l);
});
} catch (e) {
reject(e);
}
while (true) {
const retry = await new Promise(async (resolve) => {
const stream = await versionLogsFollow(squidName, versionName, query).catch((e) => {
/**
* 524 status means timeout
*/
if (e.status === 524) {
resolve(true);
return;
}

resolve(false);
});

if (!stream) return;

streamLines(stream, (line) => {
if (line.length === 0) return;

try {
const entries: LogEntry[] = JSON.parse(line);

pretty(entries).forEach((l) => {
onLog(l);
});
} catch (e) {
resolve(false);
}
});

stream.on('error', async (e) => {
resolve(false);
});
});

stream.on('error', reject);
});
if (!retry) return;
}
}

export async function releaseSquid(
Expand Down
7 changes: 6 additions & 1 deletion src/commands/squid/kill.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Command } from '@oclif/core';
import { CliUx, Command } from '@oclif/core';

import { destroyApp, destroyDeployment } from '../../rest-client/routes/destroy';
import { parseNameAndVersion } from '../../utils';
Expand All @@ -17,12 +17,17 @@ export default class Kill extends Command {
const { flags, args } = await this.parse(Kill);
const params: string = args.nameAndVersion;
let message;

if (params.includes('@')) {
const { squidName, versionName } = parseNameAndVersion(params, this);
CliUx.ux.action.start('◷ Deleting version');
message = await destroyDeployment(squidName, versionName);
} else {
CliUx.ux.action.start('◷ Deleting squid');
message = await destroyApp(params);
}
CliUx.ux.action.stop();

this.log(message);
}
}
Loading

0 comments on commit 7ed906c

Please sign in to comment.