Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
1#!/usr/bin/env node
2import { execSync } from "node:child_process";
3import { format } from "node:util";
4
5function exec(cmd) {
6 execSync(cmd, { stdio: "inherit" });
7}
8
9function hasChanges() {
10 const output = execSync("git status --porcelain").toString().trim();
11 return output.length > 0;
12}
13
14if (hasChanges()) {
15 console.error(
16 "Uncommitted changes detected. Please commit or stash them before running this script."
17 );
18 process.exit(1);
19}
20
21const now = new Date();
22const pad = (n) => String(n).padStart(2, "0");
23const branchName = format(
24 "update-dependencies-%d-%s-%s-%s-%s",
25 now.getFullYear(),
26 pad(now.getMonth() + 1),
27 pad(now.getDate()),
28 pad(now.getHours()),
29 pad(now.getMinutes())
30);
31const commitMessage = "chore: update dependencies across all packages";
32
33exec(`git checkout -b ${branchName}`);
34exec("pnpm update --interactive --recursive --latest");
35
36if (!hasChanges()) {
37 console.log("No changes in dependencies. Exiting.");
38 process.exit(0);
39}
40
41exec("node ./script/clean.mjs");
42exec("pnpm install");
43exec("git add .");
44exec(`git commit -m "${commitMessage}"`);
45exec(`git push -u origin ${branchName}`);
46console.log(`Dependencies updated and pushed to branch ${branchName}.`);