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 30, 2024
1 parent b530be2 commit d758c6d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dist/cli/commands/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Daemon extends core_1.Command {
return; // already started, no need to intervene
const isIpfsApiPortTaken = await tcp_port_used_1.default.check(ipfsApiPort, flags.ipfsApiUrl.hostname);
if (isIpfsApiPortTaken) {
log(`Ipfs API already running on port (${ipfsApiPort}) by another program. Plebbit-cli will use the running ipfs daemon instead of starting a new one`);
log.trace(`Ipfs API already running on port (${ipfsApiPort}) by another program. Plebbit-cli will use the running ipfs daemon instead of starting a new one`);
return;
}
ipfsProcess = await (0, startIpfs_js_1.startIpfsNode)(ipfsApiEndpoint, ipfsGatewayEndpoint, mergedPlebbitOptions.dataPath);
Expand Down
2 changes: 1 addition & 1 deletion dist/cli/commands/subplebbit/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Create extends base_command_js_1.BaseCommand {
const log = (await (0, util_js_1.getPlebbitLogger)())("plebbit-cli:commands:subplebbit:create");
log(`flags: `, flags);
const plebbit = await this._connectToPlebbitRpc(flags.plebbitRpcUrl.toString());
const createOptions = dataobject_parser_1.default.transpose(lodash_1.default.omit(flags, ["plebbitRpcApiUrl", "privateKeyPath"]))["_data"];
const createOptions = dataobject_parser_1.default.transpose(lodash_1.default.omit(flags, ["plebbitRpcUrl", "privateKeyPath"]))["_data"];
if (flags.privateKeyPath)
createOptions.signer = { privateKey: (await fs_1.default.promises.readFile(flags.privateKeyPath)).toString(), type: "ed25519" };
const createdSub = await plebbit.createSubplebbit(createOptions);
Expand Down
2 changes: 1 addition & 1 deletion dist/cli/commands/subplebbit/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ 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(remeda.omit(flags, ["plebbitRpcApiUrl"]))["_data"];
const editOptions = dataobject_parser_1.default.transpose(remeda.omit(flags, ["plebbitRpcUrl"]))["_data"];
log("Edit options parsed:", editOptions);
const plebbit = await this._connectToPlebbitRpc(flags.plebbitRpcUrl.toString());
const localSubs = plebbit.subplebbits;
Expand Down
32 changes: 20 additions & 12 deletions dist/ipfs/startIpfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,26 @@ function _spawnAsync(log, ...args) {
return new Promise((resolve, reject) => {
//@ts-ignore
const spawedProcess = (0, child_process_1.spawn)(...args);
let errorMessage = "";
spawedProcess.on("exit", (exitCode, signal) => {
if (exitCode === 0)
resolve(null);
else
reject(Error(`spawnAsync process '${spawedProcess.pid}' exited with code '${exitCode}' signal '${signal}'`));
else {
const error = new Error(errorMessage);
Object.assign(error, { exitCode, pid: spawedProcess.pid, signal });
reject(error);
}
});
spawedProcess.stderr.on("data", (data) => {
log.trace(data.toString());
errorMessage += data.toString();
});
spawedProcess.stderr.on("data", (data) => log.trace(data.toString()));
spawedProcess.stdin.on("data", (data) => log.trace(data.toString()));
spawedProcess.stdout.on("data", (data) => log.trace(data.toString()));
spawedProcess.on("error", (data) => log.error(data.toString()));
spawedProcess.on("error", (data) => {
errorMessage += data.toString();
log.error(data.toString());
});
});
}
async function startIpfsNode(apiUrl, gatewayUrl, dataPath) {
Expand All @@ -42,12 +52,16 @@ async function startIpfsNode(apiUrl, gatewayUrl, dataPath) {
try {
await _spawnAsync(log, ipfsExePath, ["init"], { env, hideWindows: true });
}
catch (e) { }
catch (e) {
const error = e;
if (!error?.message?.includes("ipfs configuration file already exists!"))
throw new Error("Failed to call ipfs init" + error);
}
await _spawnAsync(log, ipfsExePath, ["config", "profile", "apply", `server`], {
env,
hideWindows: true
});
log("Called ipfs config profile apply successfully");
log("Called 'ipfs config profile apply server' successfully");
const ipfsConfigPath = path_1.default.join(ipfsDataPath, "config");
const ipfsConfig = JSON.parse((await fsPromises.readFile(ipfsConfigPath)).toString());
const mergedIpfsConfig = {
Expand All @@ -67,12 +81,6 @@ async function startIpfsNode(apiUrl, gatewayUrl, dataPath) {
AutoTLS: {
...ipfsConfig["AutoTLS"],
Enabled: true
},
Datastore: {
GCPeriod: "1h",
StorageGCWatermark: 90,
StorageMax: "10GB",
...ipfsConfig["Datastore"]
}
};
await fsPromises.writeFile(ipfsConfigPath, JSON.stringify(mergedIpfsConfig, null, 4));
Expand Down
2 changes: 1 addition & 1 deletion dist/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

0 comments on commit d758c6d

Please sign in to comment.