@stacksjs/buddy 0.70.186 → 0.70.188

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -997,14 +997,14 @@ if [ -n "$FWD_B64" ] && [ -x /usr/local/bin/bun ]; then
997
997
  # while forwards.json sat untouched.
998
998
  /usr/local/bin/bun --bun -e '
999
999
  const fs=require("fs"); const f="/opt/mail/forwards.json";
1000
- const cur={}; try{cur=JSON.parse(fs.readFileSync(f,"utf8"))}catch{}
1000
+ let cur={}; try{cur=JSON.parse(fs.readFileSync(f,"utf8"))}catch{}
1001
1001
  const add=JSON.parse(fs.readFileSync("/tmp/.mailtenant-fwd.json","utf8"));
1002
1002
  const readme=fs.readFileSync("/tmp/.mailtenant-readme.txt","utf8");
1003
1003
  const merged={...cur}; delete merged._readme;
1004
1004
  for(const [k,v] of Object.entries(add)) merged[k]=v;
1005
1005
  const out={_readme:readme,...merged};
1006
1006
  const s=JSON.stringify(out,null,2)+"\\n";
1007
- const prev=""; try{prev=fs.readFileSync(f,"utf8")}catch{}
1007
+ let prev=""; try{prev=fs.readFileSync(f,"utf8")}catch{}
1008
1008
  if(s!==prev){ fs.writeFileSync(f,s); process.stdout.write("FWDCHANGED"); }
1009
1009
  ' > /tmp/.mailtenant-res 2>/tmp/.mailtenant-err || true
1010
1010
  # A merge that failed is worth one line, not silence: the rules decide where
@@ -22,6 +22,7 @@ async function loadUserModel() {
22
22
  if (User?.where)
23
23
  return User;
24
24
  log.error("Could not find a User model. Looked in app/Models, the framework defaults and @stacksjs/orm.");
25
+ await log.flush();
25
26
  process.exit(ExitCode.FatalError);
26
27
  }
27
28
  export function user(buddy) {
@@ -29,12 +30,14 @@ export function user(buddy) {
29
30
  const address = String(email || "").trim().toLowerCase();
30
31
  if (!address.includes("@")) {
31
32
  log.error(`\`${email}\` is not an email address.`);
33
+ await log.flush();
32
34
  process.exit(ExitCode.FatalError);
33
35
  }
34
36
  const password = options.password || generatePassword(), generated = !options.password, name = options.name || address.split("@")[0], User = await loadUserModel();
35
37
  let account = await User.where("email", address).first();
36
38
  if (account && !options.update) {
37
39
  log.error(`${address} already exists. Pass --update to reset its password and role.`);
40
+ await log.flush();
38
41
  process.exit(ExitCode.FatalError);
39
42
  }
40
43
  if (account) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/buddy",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.186",
5
+ "version": "0.70.188",
6
6
  "description": "Meet Buddy. The Stacks runtime.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [