Skip to content

Commit

Permalink
build(packaging): ci build
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinse12 authored and github-actions[bot] committed Aug 31, 2024
1 parent f102695 commit 8e324c2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions dist/cli/commands/subplebbit/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Create extends base_command_js_1.BaseCommand {
if (flags.privateKeyPath)
createOptions.signer = { privateKey: (await fs_1.default.promises.readFile(flags.privateKeyPath)).toString(), type: "ed25519" };
const createdSub = await plebbit.createSubplebbit(createOptions);
if (!("started" in createdSub))
throw Error("plebbit-js failed to create a local sub");
await createdSub.start();
await plebbit.destroy();
this.log(createdSub.address);
Expand Down
9 changes: 6 additions & 3 deletions dist/cli/commands/subplebbit/edit.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const lodash_1 = tslib_1.__importDefault(require("lodash"));
//@ts-ignore
const dataobject_parser_1 = tslib_1.__importDefault(require("dataobject-parser"));
const core_1 = require("@oclif/core");
const base_command_js_1 = require("../../base-command.js");
const util_js_1 = require("../../../util.js");
const remeda = tslib_1.__importStar(require("remeda"));
const lodash_1 = tslib_1.__importDefault(require("lodash"));
class Edit extends base_command_js_1.BaseCommand {
static description = "Edit a subplebbit properties. For a list of properties, visit https://github.com/plebbit/plebbit-js#subplebbiteditsubplebbiteditoptions";
static args = {
Expand Down Expand Up @@ -38,14 +39,16 @@ class Edit extends base_command_js_1.BaseCommand {
const { flags, args } = await this.parse(Edit);
const log = (await (0, util_js_1.getPlebbitLogger)())("plebbit-cli:commands:subplebbit:edit");
log(`flags: `, flags);
const editOptions = dataobject_parser_1.default.transpose(lodash_1.default.omit(flags, ["plebbitRpcApiUrl"]))["_data"];
const editOptions = dataobject_parser_1.default.transpose(remeda.omit(flags, ["plebbitRpcApiUrl"]))["_data"];
log("Edit options parsed:", editOptions);
const plebbit = await this._connectToPlebbitRpc(flags.plebbitRpcApiUrl.toString());
const localSubs = await plebbit.listSubplebbits();
if (!localSubs.includes(args.address))
this.error("Can't edit a remote subplebbit, make sure you're editing a local sub");
const sub = await plebbit.createSubplebbit({ address: args.address });
const mergedSubState = lodash_1.default.pick(sub.toJSONInternalRpc(), Object.keys(editOptions));
if (!("started" in sub))
throw Error("plebbit-js failed to create a local subplebbit");
const mergedSubState = remeda.pick(sub, remeda.keys.strict(editOptions));
lodash_1.default.merge(mergedSubState, editOptions);
log("Internal sub state after merge:", mergedSubState);
await sub.edit(mergedSubState);
Expand Down
5 changes: 3 additions & 2 deletions dist/cli/commands/subplebbit/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const core_1 = require("@oclif/core");
const base_command_js_1 = require("../../base-command.js");
const lodash_1 = tslib_1.__importDefault(require("lodash"));
const remeda = tslib_1.__importStar(require("remeda"));
class Get extends base_command_js_1.BaseCommand {
static description = "Fetch a local or remote subplebbit, and print its json in the terminal";
static examples = [
Expand All @@ -22,7 +22,8 @@ class Get extends base_command_js_1.BaseCommand {
const plebbit = await this._connectToPlebbitRpc(flags.plebbitRpcApiUrl.toString());
const sub = await plebbit.getSubplebbit(args.address);
await plebbit.destroy();
this.logJson({ posts: sub.toJSON().posts, ...lodash_1.default.omit(sub.toJSON(), "posts") }); // make sure posts is printed first, because most users won't look at it
const subJson = JSON.parse(JSON.stringify(sub));
this.logJson({ posts: subJson.posts, ...remeda.omit(subJson, ["posts"]) }); // make sure posts is printed first, because most users won't look at it
}
}
exports.default = Get;
2 changes: 2 additions & 0 deletions dist/cli/commands/subplebbit/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class List extends base_command_js_1.BaseCommand {
else {
const subsWithStarted = await Promise.all(subs.map(async (subAddress) => {
const subInstance = await plebbit.createSubplebbit({ address: subAddress });
if (!("started" in subInstance))
throw Error("plebbit-js failed to create a local subplebbit");
return { address: subInstance.address, started: subInstance.started };
}));
core_1.ux.table(subsWithStarted, { address: {}, started: {} }, {
Expand Down
2 changes: 1 addition & 1 deletion dist/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

0 comments on commit 8e324c2

Please sign in to comment.