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 Nov 4, 2024
1 parent 7cdff0c commit 70d9fb1
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dist/cli/base-command.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export declare abstract class BaseCommand extends Command {
static baseFlags: {
plebbitRpcApiUrl: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<URL, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
};
protected _connectToPlebbitRpc(plebbitRpcApiUrl: string): Promise<import("@plebbit/plebbit-js/dist/node/plebbit.js", { with: { "resolution-mode": "import" } }).Plebbit>;
protected _connectToPlebbitRpc(plebbitRpcApiUrl: string): Promise<import("@plebbit/plebbit-js/dist/node/plebbit/plebbit.js", { with: { "resolution-mode": "import" } }).Plebbit>;
}
2 changes: 1 addition & 1 deletion dist/cli/base-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BaseCommand extends core_1.Command {
async _connectToPlebbitRpc(plebbitRpcApiUrl) {
const Plebbit = await import("@plebbit/plebbit-js");
const plebbit = await Plebbit.default({ plebbitRpcClientsOptions: [plebbitRpcApiUrl] });
await plebbit.listSubplebbits(); // To make sure we're connected, will throw if there's no connection
await new Promise((resolve) => plebbit.once("subplebbitschange", resolve));
return plebbit;
}
}
Expand Down
3 changes: 2 additions & 1 deletion dist/cli/commands/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ class Daemon extends core_1.Command {
console.log("plebbit-cli daemon will monitor the plebbit RPC and ipfs API to make sure they're always up");
const Plebbit = await import("@plebbit/plebbit-js");
const plebbit = await Plebbit.default({ plebbitRpcClientsOptions: [plebbitRpcApiUrl] });
await new Promise((resolve) => plebbit.once("subplebbitschange", resolve));
plebbit.on("error", () => { });
console.log(`Subplebbits in data path: `, await plebbit.listSubplebbits());
console.log(`Subplebbits in data path: `, plebbit.subplebbits);
usingDifferentProcessRpc = true;
return;
}
Expand Down
2 changes: 0 additions & 2 deletions dist/cli/commands/subplebbit/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ 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
4 changes: 1 addition & 3 deletions dist/cli/commands/subplebbit/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ class Edit extends base_command_js_1.BaseCommand {
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();
const localSubs = plebbit.subplebbits;
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 });
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);
Expand Down
4 changes: 1 addition & 3 deletions dist/cli/commands/subplebbit/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ class List extends base_command_js_1.BaseCommand {
const log = (await (0, util_js_1.getPlebbitLogger)())("plebbit-cli:commands:subplebbit:list");
log(`flags: `, flags);
const plebbit = await this._connectToPlebbitRpc(flags.plebbitRpcApiUrl.toString());
const subs = await plebbit.listSubplebbits();
const subs = plebbit.subplebbits;
if (flags.quiet) {
this.log(subs.join(os_1.EOL));
}
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
3 changes: 2 additions & 1 deletion dist/cli/commands/subplebbit/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class Start extends base_command_js_1.BaseCommand {
log(`flags: `, flags);
const plebbit = await this._connectToPlebbitRpc(flags.plebbitRpcApiUrl.toString());
for (const address of addresses) {
await plebbit.plebbitRpcClient.startSubplebbit(address);
const sub = await plebbit.createSubplebbit({ address });
await sub.start();
this.log(address);
}
await plebbit.destroy();
Expand Down
3 changes: 2 additions & 1 deletion dist/cli/commands/subplebbit/stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class Stop extends base_command_js_1.BaseCommand {
this.error(`Failed to parse addresses correctly (${addresses})`);
const plebbit = await this._connectToPlebbitRpc(flags.plebbitRpcApiUrl.toString());
for (const address of addresses) {
await plebbit.plebbitRpcClient.stopSubplebbit(address);
const sub = await plebbit.createSubplebbit({ address });
await sub.stop(); // should stop the original subplebbit instance from running
this.log(address);
}
await plebbit.destroy();
Expand Down
2 changes: 1 addition & 1 deletion dist/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/webui/daemon-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ async function startDaemonServer(daemonPort, ipfsGatewayPort, ipfsApiEndpoint, p
const httpServer = webuiExpressApp.listen(daemonPort);
const rpcAuthKey = await _generateRpcAuthKeyIfNotExisting(plebbitDataPath);
const PlebbitWsServer = await import("@plebbit/plebbit-js/dist/node/rpc/src/index.js");
// Will add ability to edit later, but it's hard coded for now
const defaultHttpTrackers = ["https://peers.pleb.bot", "https://routing.lol"];
const rpcServer = await PlebbitWsServer.default.PlebbitWsServer({
server: httpServer,
plebbitOptions: {
ipfsHttpClientsOptions: [ipfsApiEndpoint],
dataPath: plebbitDataPath
dataPath: plebbitDataPath,
httpRoutersOptions: defaultHttpTrackers
},
authKey: rpcAuthKey
});
Expand Down Expand Up @@ -86,6 +89,6 @@ async function startDaemonServer(daemonPort, ipfsGatewayPort, ipfsApiEndpoint, p
process.exit();
};
["SIGINT", "SIGTERM", "SIGHUP", "beforeExit"].forEach((exitSignal) => process.on(exitSignal, handlRpcExit));
return { rpcAuthKey, listedSub: await rpcServer.plebbit.listSubplebbits(), webuis };
return { rpcAuthKey, listedSub: rpcServer.plebbit.subplebbits, webuis };
}
exports.startDaemonServer = startDaemonServer;

0 comments on commit 70d9fb1

Please sign in to comment.