@neonwilderness/moveskins 1.2.0 → 1.3.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0 (02.05.2026)
4
+
5
+ - Add --toolbar CLI switch to additionally download 3 related modToolbar skins
6
+
3
7
  ## 1.2.0 (25.04.2026)
4
8
 
5
9
  - Implement recursive expansion of <% xxx.skin name="yyy" %> macros
package/dist/index.js CHANGED
@@ -1213,7 +1213,7 @@ var ft, pt = class {
1213
1213
  let y = [], b = Object.assign(Object.create(null), { _: [] }), x = {};
1214
1214
  for (let e = 0; e < r.length; e++) {
1215
1215
  let t = r[e], n = t.replace(/^-{3,}/, "---"), i, a, s, c, l, u;
1216
- if (t !== "--" && t.startsWith('-') && V(t)) S(t);
1216
+ if (t !== "--" && /^-/.test(t) && V(t)) S(t);
1217
1217
  else if (n.match(/^---+(=|$)/)) {
1218
1218
  S(t);
1219
1219
  continue;
@@ -1281,14 +1281,14 @@ var ft, pt = class {
1281
1281
  function w(e, t, n, r) {
1282
1282
  let a = [], c = r || n[e + 1], l = R(t, h.nargs);
1283
1283
  if (R(t, h.bools) && !/^(true|false)$/.test(c)) a.push(!0);
1284
- else if (re(c) || re(r) && c.startsWith('-') && !g.test(c) && !V(c)) {
1284
+ else if (re(c) || re(r) && /^-/.test(c) && !g.test(c) && !V(c)) {
1285
1285
  if (s[t] !== void 0) {
1286
1286
  let e = s[t];
1287
1287
  a = Array.isArray(e) ? e : [e];
1288
1288
  }
1289
1289
  } else {
1290
1290
  re(r) || a.push(D(t, r, !0));
1291
- for (let r = e + 1; r < n.length && !(!o["greedy-arrays"] && a.length > 0 || l && typeof l == "number" && a.length >= l || (c = n[r], c.startsWith('-') && !g.test(c) && !V(c))); r++) e = r, a.push(D(t, c, i));
1291
+ for (let r = e + 1; r < n.length && !(!o["greedy-arrays"] && a.length > 0 || l && typeof l == "number" && a.length >= l || (c = n[r], /^-/.test(c) && !g.test(c) && !V(c))); r++) e = r, a.push(D(t, c, i));
1292
1292
  }
1293
1293
  return typeof l == "number" && (l && a.length < l || isNaN(l) && a.length === 0) && (v = Error(m("Not enough arguments following: %s", t))), T(t, a), e;
1294
1294
  }
@@ -1780,7 +1780,7 @@ function qt(e) {
1780
1780
  };
1781
1781
  return t.forEach((e, r) => {
1782
1782
  let a = !1;
1783
- e = e.replace(/\s/g, ""), /\.+[\]>]/.test(e) && r === t.length - 1 && (a = !0), e.startsWith('[') ? i.optional.push({
1783
+ e = e.replace(/\s/g, ""), /\.+[\]>]/.test(e) && r === t.length - 1 && (a = !0), /^\[/.test(e) ? i.optional.push({
1784
1784
  cmd: e.replace(n, "").split("|"),
1785
1785
  variadic: a
1786
1786
  }) : i.demanded.push({
@@ -2312,7 +2312,7 @@ function mn(e, t) {
2312
2312
  g = g.filter((t) => !e.parsed.newAliases[t] && E.every((e) => (h.alias[e] || []).indexOf(t) === -1));
2313
2313
  let D = n("Options:");
2314
2314
  c[D] || (c[D] = []), x(g, h.alias, c, D);
2315
- let O = (e) => vn(e).startsWith('--'), k = Object.keys(c).filter((e) => c[e].length > 0).map((e) => ({
2315
+ let O = (e) => /^--/.test(vn(e)), k = Object.keys(c).filter((e) => c[e].length > 0).map((e) => ({
2316
2316
  groupName: e,
2317
2317
  normalizedKeys: c[e].filter(S).map((e) => {
2318
2318
  if (E.includes(e)) return e;
@@ -2583,7 +2583,7 @@ var yn = "###-begin-{{app_name}}-completions-###\n#\n# yargs command completion
2583
2583
  }), r = n ? t[n] : void 0, a = t[e] ?? r ?? "";
2584
2584
  i = `${e.replace(/:/g, "\\:")}:${a.replace("__yargsString__:", "").replace(/(\r\n|\n|\r)/gm, " ")}`;
2585
2585
  }
2586
- let a = !((e) => e.startsWith('--'))(n) && ((e) => /^[^0-9]$/.test(e))(e) ? "-" : "--";
2586
+ let a = !((e) => /^--/.test(e))(n) && ((e) => /^[^0-9]$/.test(e))(e) ? "-" : "--";
2587
2587
  t.push(a + i), r && t.push(a + "no-" + i);
2588
2588
  }
2589
2589
  customCompletion(e, t, n, r) {
@@ -10263,7 +10263,7 @@ var Ya, Xa, Za, Qa, $a, eo = L((() => {
10263
10263
  element: function(e, t, r) {
10264
10264
  var a = r.adapter, s = t.name, c = t.value;
10265
10265
  if (/\s/.test(c)) return n.default.falseFunc;
10266
- var l = RegExp(`(?:^|\\s)${i(c)}(?:$|\\s)`, o(t, r) ? "i" : "");
10266
+ var l = RegExp(`(?:^|\\s)${i(c)}(?:\$|\\s)`, o(t, r) ? "i" : "");
10267
10267
  return function(t) {
10268
10268
  var n = a.getAttributeValue(t, s);
10269
10269
  return n != null && n.length >= c.length && l.test(n) && e(t);
@@ -17147,7 +17147,7 @@ var Ya, Xa, Za, Qa, $a, eo = L((() => {
17147
17147
  this.iconv = t;
17148
17148
  }
17149
17149
  n.prototype.encoder = i, n.prototype.decoder = a, n.prototype.bomAware = !0;
17150
- var r = /[^A-Za-z0-9'(),-./:? \n\r\t]+/g;
17150
+ var r = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g;
17151
17151
  function i(e, t) {
17152
17152
  this.iconv = t.iconv;
17153
17153
  }
@@ -17159,7 +17159,7 @@ var Ya, Xa, Za, Qa, $a, eo = L((() => {
17159
17159
  function a(e, t) {
17160
17160
  this.iconv = t.iconv, this.inBase64 = !1, this.base64Accum = "";
17161
17161
  }
17162
- for (var o = /[A-Za-z0-9/+]/, s = [], c = 0; c < 256; c++) s[c] = o.test(String.fromCharCode(c));
17162
+ for (var o = /[A-Za-z0-9\/+]/, s = [], c = 0; c < 256; c++) s[c] = o.test(String.fromCharCode(c));
17163
17163
  var l = 43, u = 45, d = 38;
17164
17164
  a.prototype.write = function(e) {
17165
17165
  for (var n = "", r = 0, i = this.inBase64, a = this.base64Accum, o = 0; o < e.length; o++) if (!i) e[o] == l && (n += this.iconv.decode(e.slice(r, o), "ascii"), r = o + 1, i = !0);
@@ -25183,7 +25183,7 @@ Content-Type: ${s.type || "application/octet-stream"}\r\n\r\n`);
25183
25183
  a.protocol === "https:" && (i ||= H("node:tls"), m("upgrading to TLS"), l = i.connect({
25184
25184
  socket: c,
25185
25185
  servername: o,
25186
- ...e.tls
25186
+ ...e.tls || {}
25187
25187
  }), await new Promise((e, t) => {
25188
25188
  l.once("secureConnect", e), l.once("error", t);
25189
25189
  })), t(null, l);
@@ -33522,7 +33522,7 @@ Content-Type: ${s.type || "application/octet-stream"}\r\n\r\n`);
33522
33522
  function t(e) {
33523
33523
  let t = e.split(/\n/), n = [], r = 0;
33524
33524
  function i(e) {
33525
- return e.startsWith('diff --git ');
33525
+ return /^diff --git /.test(e);
33526
33526
  }
33527
33527
  function a(e) {
33528
33528
  return i(e) || /^Index:\s/.test(e) || /^diff(?: -r \w+)+\s/.test(e);
@@ -33562,7 +33562,7 @@ Content-Type: ${s.type || "application/octet-stream"}\r\n\r\n`);
33562
33562
  let m = /^old mode (\d+)/.exec(n);
33563
33563
  m && (e.oldMode = m[1]);
33564
33564
  let h = /^new mode (\d+)/.exec(n);
33565
- h && (e.newMode = h[1]), n.startsWith('Binary files ') && (e.isBinary = !0), r++;
33565
+ h && (e.newMode = h[1]), /^Binary files /.test(n) && (e.isBinary = !0), r++;
33566
33566
  }
33567
33567
  continue;
33568
33568
  } else if (a(n)) {
@@ -33576,7 +33576,7 @@ Content-Type: ${s.type || "application/octet-stream"}\r\n\r\n`);
33576
33576
  if (f(e), f(e), e.oldFileName === void 0 != (e.newFileName === void 0)) throw Error("Missing " + (e.oldFileName === void 0 ? "\"--- ...\"" : "\"+++ ...\"") + " file header for " + (e.oldFileName ?? e.newFileName));
33577
33577
  for (; r < t.length;) {
33578
33578
  let n = t[r];
33579
- if (a(n) || o(n) || n.startsWith('===================================================================')) break;
33579
+ if (a(n) || o(n) || /^===================================================================/.test(n)) break;
33580
33580
  s(n) ? e.hunks.push(p()) : r++;
33581
33581
  }
33582
33582
  }
@@ -42590,10 +42590,10 @@ Content-Type: ${s.type || "application/octet-stream"}\r\n\r\n`);
42590
42590
  s = t ? "" : s;
42591
42591
  let l = !1;
42592
42592
  c[c.length - 1] === "base64" && (c.pop(), l = !0);
42593
- let u = (c.shift() || "").toLowerCase(), d = c.map((e) => {
42593
+ let u = (c.shift() || "").toLowerCase(), d = [...c.map((e) => {
42594
42594
  let [t, n = ""] = e.split("=").map((e) => e.trim());
42595
42595
  return t === "charset" && (n = n.toLowerCase(), n === r) ? "" : `${t}${n ? `=${n}` : ""}`;
42596
- }).filter(Boolean);
42596
+ }).filter(Boolean)];
42597
42597
  return l && d.push("base64"), (d.length !== 0 || u && u !== n) && d.unshift(u), `data:${d.join(";")},${l ? o.trim() : o}${s ? `#${s}` : ""}`;
42598
42598
  };
42599
42599
  t.exports = (e, t) => {
@@ -43096,12 +43096,12 @@ Content-Type: ${s.type || "application/octet-stream"}\r\n\r\n`);
43096
43096
  Object.hasOwnProperty.call(t, a) && !o && (i || (n += ","), i = !1, r ? t[a] == null ? n += "null" : n += e(t[a]) : t[a] !== void 0 && (n += e(a) + ":" + e(t[a])));
43097
43097
  }
43098
43098
  return n += r ? "]" : "}", n;
43099
- } else if (typeof t == "string") return JSON.stringify(t.startsWith(':') ? ":" + t : t);
43099
+ } else if (typeof t == "string") return JSON.stringify(/^:/.test(t) ? ":" + t : t);
43100
43100
  else if (t === void 0) return "null";
43101
43101
  else return JSON.stringify(t);
43102
43102
  }, e.parse = function(e) {
43103
43103
  return JSON.parse(e, function(e, t) {
43104
- return typeof t == "string" ? t.startsWith(':base64:') ? Buffer.from(t.substring(8), "base64") : t.startsWith(':') ? t.substring(1) : t : t;
43104
+ return typeof t == "string" ? /^:base64:/.test(t) ? Buffer.from(t.substring(8), "base64") : /^:/.test(t) ? t.substring(1) : t : t;
43105
43105
  });
43106
43106
  };
43107
43107
  })), Dp = /* @__PURE__ */ R(((e, t) => {
@@ -45324,7 +45324,7 @@ Content-Type: ${s.type || "application/octet-stream"}\r\n\r\n`);
45324
45324
  types: () => _m,
45325
45325
  version: () => mm
45326
45326
  }), pm, mm, hm, gm, _m, vm, ym, bm, xm, Sm, Cm, wm, Tm, Em, Dm, Om = L((() => {
45327
- pm = "@neonwilderness/twoday", mm = "0.7.1", hm = "Module to help interact with the most relevant functions of the Twoday blogger platform", gm = "./src/index.js", _m = "./types/index.d.ts", vm = [
45327
+ pm = "@neonwilderness/twoday", mm = "0.8.0", hm = "Module to help interact with the most relevant functions of the Twoday blogger platform", gm = "./src/index.js", _m = "./types/index.d.ts", vm = [
45328
45328
  "src",
45329
45329
  "docs",
45330
45330
  "types",
@@ -57716,6 +57716,9 @@ var gh, _h = L((() => {
57716
57716
  this.#r(`Error while reading sidebar modules of "${e}"`, t, f);
57717
57717
  }
57718
57718
  }
57719
+ isValidFreeTextModule(e) {
57720
+ return [...Array.from({ length: 5 }, (e, t) => `modFreeText${(++t).toString().padStart(2, "0")}`), ...Array.from({ length: 3 }, (e, t) => `modMacroFreeText${(++t).toString().padStart(2, "0")}`)].includes(e);
57721
+ }
57719
57722
  async getFreeTextModule(e, t) {
57720
57723
  try {
57721
57724
  this.#e();
@@ -57728,6 +57731,20 @@ var gh, _h = L((() => {
57728
57731
  this.#r(`Error while reading freetext module "${t}" of "${e}"`, n, f);
57729
57732
  }
57730
57733
  }
57734
+ async updateFreeTextModule(e, t, n = {}) {
57735
+ try {
57736
+ if (this.#e(), !this.isValidFreeTextModule(t)) throw Error(`Cannot update "${t}" as it is no FreeText module!`);
57737
+ let r = `${this.getAliasDomain(e)}/modules/preferences?mod=${t}`, i = await this.delayed(this.got.get(r)), a = `${t.toLowerCase()}header`, o = `${t}Text`, s = {
57738
+ secretKey: this.#n(i.body),
57739
+ mod: t,
57740
+ preferencesform: 1,
57741
+ submit: "Sichern"
57742
+ };
57743
+ return s[a] = n.heading || " ", s[o] = n.content || "", await this.delayed(this.got.post(r, { form: s }));
57744
+ } catch (n) {
57745
+ this.#r(`Error while updating freetext module "${t}" of "${e}"`, n, f);
57746
+ }
57747
+ }
57731
57748
  async getModuleSkins(e, t) {
57732
57749
  try {
57733
57750
  this.#e();
@@ -57743,20 +57760,6 @@ var gh, _h = L((() => {
57743
57760
  this.#r(`Error while reading freetext module "${t}" of "${e}"`, n, f);
57744
57761
  }
57745
57762
  }
57746
- async updateFreeTextModule(e, t, n = {}) {
57747
- try {
57748
- if (this.#e(), !/FreeText\d{2}/.test(t)) throw Error(`Cannot update "${t}" as it is no FreeText module!`);
57749
- let r = `${this.getAliasDomain(e)}/modules/preferences?mod=${t}`, i = await this.delayed(this.got.get(r)), a = `${t.toLowerCase()}header`, o = `${t}Text`, s = {
57750
- secretKey: this.#n(i.body),
57751
- mod: t,
57752
- preferencesform: 1,
57753
- submit: "Sichern"
57754
- };
57755
- return s[a] = n.heading || " ", s[o] = n.content || "", await this.delayed(this.got.post(r, { form: s }));
57756
- } catch (n) {
57757
- this.#r(`Error while updating freetext module "${t}" of "${e}"`, n, f);
57758
- }
57759
- }
57760
57763
  };
57761
57764
  })))(), 1), bh = /* @__PURE__ */ R(((e) => {
57762
57765
  Object.defineProperty(e, "__esModule", { value: !0 }), e.splitWhen = e.flatten = void 0;
@@ -57876,7 +57879,7 @@ var gh, _h = L((() => {
57876
57879
  return t && t.strict === !1 && (r = a), r(e);
57877
57880
  };
57878
57881
  })), Eh = /* @__PURE__ */ R(((e, t) => {
57879
- var n = Th(), r = H("path").posix.dirname, i = H("os").platform() === "win32", a = "/", o = /\\/g, s = /[{[].*[}\]]$/, c = /(^|[^\\])([{[]|\([^)]+$)/, l = /\\([!*?|[\](){}])/g;
57882
+ var n = Th(), r = H("path").posix.dirname, i = H("os").platform() === "win32", a = "/", o = /\\/g, s = /[\{\[].*[\}\]]$/, c = /(^|[^\\])([\{\[]|\([^\)]+$)/, l = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
57880
57883
  t.exports = function(e, t) {
57881
57884
  Object.assign({ flipBackslashes: !0 }, t).flipBackslashes && i && e.indexOf(a) < 0 && (e = e.replace(o, a)), s.test(e) && (e += a), e += "a";
57882
57885
  do
@@ -61009,7 +61012,7 @@ var Ug = /* @__PURE__ */ B((/* @__PURE__ */ R(((e, t) => {
61009
61012
  [/\\\\\\(?=[$.|*+(){^])/g, () => o],
61010
61013
  [/\\\\/g, () => o],
61011
61014
  [/(\\)?\[([^\]/]*?)(\\*)($|\])/g, (e, t, n, r, i) => t === o ? `\\[${n}${x(r)}${i}` : i === "]" && r.length % 2 == 0 ? `[${b(n)}${r}]` : "[]"],
61012
- [/(?:[^*])$/, (e) => e.endsWith('/') ? `${e}$` : `${e}(?=$|\\/$)`]
61015
+ [/(?:[^*])$/, (e) => /\/$/.test(e) ? `${e}$` : `${e}(?=$|\\/$)`]
61013
61016
  ], C = /(^|\\\/)?\\\*$/, w = "regex", T = "checkRegex", E = "_", D = {
61014
61017
  [w](e, t) {
61015
61018
  return `${t ? `${t}[^/]+` : "[^/]*"}(?=$|\\/$)`;
@@ -61117,7 +61120,7 @@ var Ug = /* @__PURE__ */ B((/* @__PURE__ */ R(((e, t) => {
61117
61120
  return this._test(e, this._testCache, !0);
61118
61121
  }
61119
61122
  }, R = (e) => new L(e), z = (e) => F(e && F.convert(e), e, y), te = () => {
61120
- F.convert = (e) => e.startsWith('\\\\?\\') || /["<>|\u0000-\u001F]+/u.test(e) ? e : e.replace(/\\/g, "/");
61123
+ F.convert = (e) => /^\\\\\?\\/.test(e) || /["<>|\u0000-\u001F]+/u.test(e) ? e : e.replace(/\\/g, "/");
61121
61124
  let e = /^[a-z]:\//i;
61122
61125
  F.isNotRelative = (t) => e.test(t) || I(t);
61123
61126
  };
@@ -61335,19 +61338,63 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61335
61338
  }, M_ = (e, t) => {
61336
61339
  let n = A_(e, t);
61337
61340
  return v(n) ? x(n).filter((e) => e.endsWith(".skin")) : [];
61338
- }, N_ = (e, t) => e.split(t).filter((e) => e.trim().length).map((e) => e.toLowerCase()), P_ = async (e, t, n) => {
61341
+ }, N_ = (e, t) => e.split(t).filter((e) => e.trim().length).map((e) => e.toLowerCase()), P_ = (e) => e.charAt(0).toUpperCase() + e.slice(1), F_ = async (e, t, n, r) => {
61342
+ let i = n.match(/<%\s.*?\.skin name=".*?"\s%>/g);
61343
+ if (i) for (let n of i) {
61344
+ let i = n.match(/(\w+)\.skin name="(\w+)"/);
61345
+ if (!i) continue;
61346
+ let a = `${P_(i[1])}.${i[2]}`, o = await e.getActiveLayoutUrl(t), { skin: s } = await e.getSkin({
61347
+ name: a,
61348
+ url: `${o}/skins/edit?key=${a}`
61349
+ });
61350
+ r[a] = s, r = await F_(e, t, s, r);
61351
+ }
61352
+ return r;
61353
+ }, I_ = async (e, t, n) => {
61339
61354
  try {
61340
61355
  await e.login();
61341
61356
  for (let r of t) {
61342
61357
  console.log(Fi.green(`\nNow processing alias "${r}"...`));
61343
- let t = A_(r, n.backup), i = await e.getModifiedSkins(r);
61358
+ let t = A_(r, n.backup), i = await e.getModifiedSkins(r), a = {};
61344
61359
  i.length && !v(t) && y(t), console.log(Fi.yellow(`${r} has ${i.length} modified skin${i.length === 1 ? "" : "s"}`)), n.skin && console.log(Fi.yellow(`Filtering skins for ${n.skin}.`));
61345
- for (let r of i) {
61346
- if (n.skin && !n.skin.test(r.name)) continue;
61347
- console.log(Fi.gray(`Reading "${r.name}".`));
61348
- let { title: i, description: a, skin: o } = await e.getSkin(r);
61349
- k_.setData(r.name, i, a), S(A(t, `${r.name}.skin`), o);
61360
+ for (let t of i) {
61361
+ if (n.skin && !n.skin.test(t.name)) continue;
61362
+ console.log(Fi.gray(`Reading "${t.name}".`));
61363
+ let { title: i, description: o, skin: s } = await e.getSkin(t);
61364
+ k_.setData(t.name, i, o), a[t.name] = s, a = await F_(e, r, s, a);
61365
+ }
61366
+ if (n.modules) {
61367
+ console.log(Fi.yellow("Exporting sidebar freetext modules as requested."));
61368
+ let t = await e.getSidebarModules(r), n = [...t.sidebar01, ...t.sidebar02];
61369
+ for (let t of n) if (e.isValidFreeTextModule(t)) {
61370
+ console.log(Fi.gray(`Reading sidebar module "${t}".`));
61371
+ let { heading: n, content: i } = await e.getFreeTextModule(r, t);
61372
+ a[`Sidebar.${t}`] = `${n}\n${i}`;
61373
+ } else {
61374
+ let { skins: n } = await e.getModuleSkins(r, t);
61375
+ for (let t of n) {
61376
+ let { title: n, description: r, skin: i } = await e.getSkin(t);
61377
+ k_.setData(t.name, n, r), a[t.name] = i;
61378
+ }
61379
+ }
61350
61380
  }
61381
+ if (n.toolbar) {
61382
+ let t = await e.getActiveLayoutUrl(r);
61383
+ for (let n of [
61384
+ "Main",
61385
+ "DropDowns",
61386
+ "Closed"
61387
+ ]) {
61388
+ let r = `Site.modToolbar${n}`;
61389
+ console.log(Fi.gray(`Reading "${r}".`));
61390
+ let { title: i, description: o, skin: s } = await e.getSkin({
61391
+ name: r,
61392
+ url: `${t}/skins/edit?key=${r}`
61393
+ });
61394
+ k_.setData(r, i, o), a[r] = s;
61395
+ }
61396
+ }
61397
+ for (let [e, n] of Object.entries(a)) S(A(t, `${e}.skin`), n);
61351
61398
  }
61352
61399
  console.log(Fi.green("Download completed."));
61353
61400
  } catch (e) {
@@ -61355,7 +61402,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61355
61402
  } finally {
61356
61403
  k_.store();
61357
61404
  }
61358
- }, F_ = async (e, t, n) => {
61405
+ }, L_ = async (e, t, n) => {
61359
61406
  try {
61360
61407
  await e.login();
61361
61408
  for (let r of t) {
@@ -61365,13 +61412,28 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61365
61412
  let i = await e.getModifiedSkins(r), a = new Set(i.map((e) => e.name)), o = A_(r, n.backup);
61366
61413
  for (let i of t) {
61367
61414
  if (!i.endsWith(".skin") || n.skin && !n.skin.test(i)) continue;
61368
- let t = k_.getData(i);
61369
- t.content = b(A(o, i)).toString().replace(/\r\n/g, "\n"), console.log(Fi.blue(`Now updating skin ${t.name} (len=${t.content.length}).`)), await e.updateSkin(r, t.name, {
61370
- title: t.title,
61371
- description: t.description,
61372
- skin: t.content,
61373
- diff: n.debug
61374
- }), console.log(Fi.green(`Update request completed for skin: ${t.name}`)), a.has(t.name) && a.delete(t.name);
61415
+ let [t, s] = i.split(".");
61416
+ if (t === "Sidebar") {
61417
+ let t = b(A(o, i)).toString().replace(/\r\n/g, "\n"), n = t.indexOf("\n"), a = t.slice(0, n), c = t.slice(++n);
61418
+ console.log(Fi.blue(`Now updating sidebar module ${s} (len=${c.length}).`)), await e.updateFreeTextModule(r, s, {
61419
+ heading: a,
61420
+ content: c
61421
+ }), console.log(Fi.green(`Update request completed for module: ${s}`));
61422
+ } else {
61423
+ let { isValid: t, prototype: a } = e.isValidHoptype(i.slice(0, -5));
61424
+ if (!t) {
61425
+ console.log(Fi.red(`Skipping upload for invalid skin hoptype "${a}" (Skin file ${i}).`));
61426
+ continue;
61427
+ }
61428
+ let s = k_.getData(i);
61429
+ s.content = b(A(o, i)).toString().replace(/\r\n/g, "\n"), console.log(Fi.blue(`Now updating skin ${s.name} (len=${s.content.length}).`)), await e.updateSkin(r, s.name, {
61430
+ title: s.title,
61431
+ description: s.description,
61432
+ skin: s.content,
61433
+ diff: n.debug
61434
+ }), console.log(Fi.green(`Update request completed for skin: ${s.name}`));
61435
+ }
61436
+ a.has(skin.name) && a.delete(skin.name);
61375
61437
  }
61376
61438
  a.size > 0 && (console.log(Fi.blue(`\nFollowing skins exist on "${r}" and were not touched by this upload:`)), a.forEach((e) => console.log(`--> ${Fi.blue(e)}`)));
61377
61439
  }
@@ -61379,12 +61441,12 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61379
61441
  } catch (e) {
61380
61442
  console.log(Fi.red(`Error while uploading skins: ${e}`));
61381
61443
  }
61382
- }, I_ = {
61444
+ }, R_ = {
61383
61445
  different: "cyan",
61384
61446
  identical: "grey",
61385
61447
  new: "green",
61386
61448
  untouched: "grey"
61387
- }, L_ = (e, t) => e.name < t.name ? -1 : +(e.name > t.name), R_ = async (e, t) => {
61449
+ }, z_ = (e, t) => e.name < t.name ? -1 : +(e.name > t.name), B_ = async (e, t) => {
61388
61450
  let n = { aliases: [] };
61389
61451
  try {
61390
61452
  typeof t == "string" && (t = [t]), await e.login();
@@ -61397,7 +61459,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61397
61459
  let o = A_(i, !1), s = M_(i, !1).map((e) => {
61398
61460
  let t = k_.getData(e);
61399
61461
  return t.skin = b(A(o, e)).toString().replace(/\r\n/g, "\n"), t;
61400
- }).sort(L_), c = await e.getModifiedSkins(a), l = [];
61462
+ }).sort(z_), c = await e.getModifiedSkins(a), l = [];
61401
61463
  for (let t of c) l.push(e.getSkin(t));
61402
61464
  let u = (await Promise.all(l)).map((e) => {
61403
61465
  let { name: t, title: n, description: r, skin: i } = e;
@@ -61407,7 +61469,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61407
61469
  description: r,
61408
61470
  skin: i
61409
61471
  };
61410
- }).sort(L_), d = 0, f = 0;
61472
+ }).sort(z_), d = 0, f = 0;
61411
61473
  for (; d < s.length && f < u.length;) {
61412
61474
  let n = d < s.length ? s[d].name : "￿", r = f < u.length ? u[f].name : "￿", i = {
61413
61475
  open: !1,
@@ -61417,7 +61479,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61417
61479
  console.log(Fi.white(`Processing skin ${Fi.italic(n)}`));
61418
61480
  let t = e.diffSkin(n, u[f], s[d]);
61419
61481
  i.class = t.skinChanged ? "different" : "identical", i.open = t.skinChanged, i.text = `${t.skinName} is ${i.class}.`, i.results = t.results, d++, f++;
61420
- } else n < r ? (i.text = `Local skin ${n} missing on remote. Will be created upon update!`, i.class = "new", d++) : (i.text = `Remote skin ${r} without local counterpart. Will remain untouched upon update!`, i.class = "untouched", f++), console.log(Fi[I_[i.class]](i.text));
61482
+ } else n < r ? (i.text = `Local skin ${n} missing on remote. Will be created upon update!`, i.class = "new", d++) : (i.text = `Remote skin ${r} without local counterpart. Will remain untouched upon update!`, i.class = "untouched", f++), console.log(Fi[R_[i.class]](i.text));
61421
61483
  t.skins.push(i);
61422
61484
  }
61423
61485
  n.aliases.push(t);
@@ -61428,7 +61490,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61428
61490
  } catch (e) {
61429
61491
  console.log(Fi.red(`Error while comparing skins: ${e}`));
61430
61492
  }
61431
- }, z_ = /* @__PURE__ */ R(((e, t) => {
61493
+ }, V_ = /* @__PURE__ */ R(((e, t) => {
61432
61494
  var n = H("fs"), r = H("path");
61433
61495
  function i(e) {
61434
61496
  console.log(`[dotenv][DEBUG] ${e}`);
@@ -61457,7 +61519,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61457
61519
  }
61458
61520
  }
61459
61521
  t.exports.config = u, t.exports.parse = l;
61460
- })), B_ = /* @__PURE__ */ R(((e, t) => {
61522
+ })), H_ = /* @__PURE__ */ R(((e, t) => {
61461
61523
  var n = H("util");
61462
61524
  function r(e, t, n, r, i) {
61463
61525
  let a = `The following variables were defined in ${n} but are not present in the environment:\n ${r.join(", ")}
@@ -61469,8 +61531,8 @@ Make sure to add them to ${t} or directly to the environment.`, o = e ? "" : "If
61469
61531
  ].filter(Boolean).join("\n\n"), Error.captureStackTrace(this, this.constructor);
61470
61532
  }
61471
61533
  n.inherits(r, Error), t.exports = r;
61472
- })), V_ = (/* @__PURE__ */ R(((e, t) => {
61473
- var n = z_(), r = H("fs"), i = B_();
61534
+ })), U_ = (/* @__PURE__ */ R(((e, t) => {
61535
+ var n = V_(), r = H("fs"), i = H_();
61474
61536
  function a(e, t) {
61475
61537
  return e.filter((e) => t.indexOf(e) < 0);
61476
61538
  }
@@ -61493,7 +61555,7 @@ Make sure to add them to ${t} or directly to the environment.`, o = e ? "" : "If
61493
61555
  parse: n.parse,
61494
61556
  MissingEnvVarsError: i
61495
61557
  }, t.exports.MissingEnvVarsError = i;
61496
- })))(), H_ = ei(process.argv.slice(2)).options({
61558
+ })))(), W_ = ei(process.argv.slice(2)).options({
61497
61559
  from: {
61498
61560
  alias: "f",
61499
61561
  description: "Platform where to download the skins from: \"dev\" or \"prod\"",
@@ -61514,6 +61576,17 @@ Make sure to add them to ${t} or directly to the environment.`, o = e ? "" : "If
61514
61576
  description: "Skin selection string (regex) to filter the skins to upload",
61515
61577
  type: "string"
61516
61578
  },
61579
+ modules: {
61580
+ alias: "m",
61581
+ description: "Download sidebar module skins/freetext as well",
61582
+ default: !1,
61583
+ type: "boolean"
61584
+ },
61585
+ toolbar: {
61586
+ description: "Download modToolbar skins, too",
61587
+ default: !1,
61588
+ type: "boolean"
61589
+ },
61517
61590
  backup: {
61518
61591
  alias: "b",
61519
61592
  description: "Backup skins to the local /backup folder to preserve their former status",
@@ -61535,20 +61608,22 @@ Make sure to add them to ${t} or directly to the environment.`, o = e ? "" : "If
61535
61608
  type: "boolean"
61536
61609
  }
61537
61610
  }).argv;
61538
- (0, V_.config)(), !H_.from && !H_.to && (console.log("Desired action must be specified with --from=dev|prod or --to=dev|prod"), process.exit(1)), H_.from && H_.to && (console.log("You cannot specify --from=dev|prod AND --to=dev|prod in one run"), process.exit(1)), H_.compare && !H_.to && (console.log("You must specify a target platform with --to=dev|prod when comparing skins"), process.exit(1)), H_.alias || (console.log("You must specify the desired alias(es) with --alias=name1[,name2,...] OR --alias=*"), process.exit(1));
61539
- var U_ = (H_.from || H_.to).toLowerCase(), W_ = new yh.Twoday(U_, { delay: 100 }), G_ = H_.alias === "*" ? [
61611
+ (0, U_.config)(), !W_.from && !W_.to && (console.log("Desired action must be specified with --from=dev|prod or --to=dev|prod"), process.exit(1)), W_.from && W_.to && (console.log("You cannot specify --from=dev|prod AND --to=dev|prod in one run"), process.exit(1)), W_.compare && !W_.to && (console.log("You must specify a target platform with --to=dev|prod when comparing skins"), process.exit(1)), W_.alias || (console.log("You must specify the desired alias(es) with --alias=name1[,name2,...] OR --alias=*"), process.exit(1));
61612
+ var G_ = (W_.from || W_.to).toLowerCase(), K_ = new yh.Twoday(G_, { delay: 100 }), q_ = W_.alias === "*" ? [
61540
61613
  "www",
61541
61614
  "info",
61542
61615
  "help",
61543
61616
  "top"
61544
- ] : N_(H_.alias, ",");
61545
- if (H_.compare) G_.length === 1 && G_[0].includes(":") && console.log(`Start comparing local skin files of alias${G_.length > 1 ? "es" : ""} ${Fi.yellow(G_.join(", "))} to ${Fi.green(W_.fullDomain)}...`), R_(W_, G_);
61617
+ ] : N_(W_.alias, ",");
61618
+ if (W_.compare) q_.length === 1 && q_[0].includes(":") && console.log(`Start comparing local skin files of alias${q_.length > 1 ? "es" : ""} ${Fi.yellow(q_.join(", "))} to ${Fi.green(K_.fullDomain)}...`), B_(K_, q_);
61546
61619
  else {
61547
- let e = H_.from ? "down" : "up", t = H_.from ? "from" : "to", n = H_.from ? P_ : F_;
61548
- e === "down" && H_.clean && j_(G_, H_.backup), console.log(`Start ${e}loading modified skins of alias${G_.length > 1 ? "es" : ""} ${Fi.yellow(G_.join(", "))} ${t} remote ${Fi.green(W_.fullDomain)}...`), n(W_, G_, {
61549
- backup: H_.backup,
61550
- debug: H_.debug,
61551
- skin: H_.skin ? new RegExp(H_.skin) : null
61620
+ let e = W_.from ? "down" : "up", t = W_.from ? "from" : "to", n = W_.from ? I_ : L_;
61621
+ e === "down" && W_.clean && (j_(q_, W_.backup), console.log(Fi.yellow(`Cleaning target download folder/s for "${q_}".`))), console.log(`Start ${e}loading modified skins of alias${q_.length > 1 ? "es" : ""} ${Fi.yellow(q_.join(", "))} ${t} remote ${Fi.green(K_.fullDomain)}...`), n(K_, q_, {
61622
+ backup: W_.backup,
61623
+ debug: W_.debug,
61624
+ modules: W_.modules,
61625
+ skin: W_.skin ? new RegExp(W_.skin) : null,
61626
+ toolbar: W_.toolbar
61552
61627
  });
61553
61628
  }
61554
61629
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neonwilderness/moveskins",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Download/Upload/Compare modified skins for selected aliases on Twoday",
5
5
  "keywords": [
6
6
  "antville",
@@ -38,6 +38,7 @@
38
38
  "compare:blogs": "node ./src/index --compare --alias=foundation:info --to=prod && npm run report",
39
39
  "download": "node ./src/index --alias=www --from=prod --modules",
40
40
  "download2": "node ./src/index --alias=info,help --from=prod",
41
+ "download:toolbar": "node ./src/index --alias=www --from=prod --toolbar --skin=modToolbar",
41
42
  "download:clean": "node ./src/index --alias=www --from=prod --clean --modules",
42
43
  "download:core": "node ./src/index --alias=* --from=prod --modules",
43
44
  "download:core:clean": "node ./src/index --alias=* --from=prod --clean --modules",
@@ -61,7 +62,7 @@
61
62
  "devDependencies": {
62
63
  "@vitest/ui": "4.1.5",
63
64
  "slash": "^5.1.0",
64
- "vite-plus": "^0.1.19"
65
+ "vite-plus": "^0.1.20"
65
66
  },
66
67
  "engines": {
67
68
  "node": ">=20"
@@ -222,5 +222,13 @@
222
222
  "Site.adminnavigation": {
223
223
  "title": "Navigationsleiste für Site Administratoren",
224
224
  "description": "Dieses Skin beinhaltet die zusätzlichen Navigationselemente für Site Administratoren. (z.B. »Einstellungen bearbeiten«, »Skins bearbeiten«, ...)"
225
+ },
226
+ "Site.modToolbarMain": {
227
+ "title": "Toolbar HTML-Code",
228
+ "description": "HTML-Code der toolbar Zeile, jedoch ohne die Dropdowns."
229
+ },
230
+ "Site.modToolbarClosed": {
231
+ "title": "Closed Toolbar",
232
+ "description": "Geschlossene Version der Toolbar."
225
233
  }
226
234
  }
package/src/_download.js CHANGED
@@ -69,7 +69,7 @@ const downloadModifiedSkins = async (td, aliases, options) => {
69
69
  const sidebar = await td.getSidebarModules(alias);
70
70
  const moduleNames = [...sidebar.sidebar01, ...sidebar.sidebar02];
71
71
  for (let module of moduleNames) {
72
- if (/FreeText\d{2}/.test(module)) {
72
+ if (td.isValidFreeTextModule(module)) {
73
73
  console.log(chalk.gray(`Reading sidebar module "${module}".`));
74
74
  const { heading, content } = await td.getFreeTextModule(alias, module);
75
75
  skinContainer[`Sidebar.${module}`] = `${heading}\n${content}`;
@@ -84,6 +84,20 @@ const downloadModifiedSkins = async (td, aliases, options) => {
84
84
  }
85
85
  }
86
86
 
87
+ if (options.toolbar) {
88
+ const layoutUrl = await td.getActiveLayoutUrl(alias);
89
+ for (const s of ["Main", "DropDowns", "Closed"]) {
90
+ const name = `Site.modToolbar${s}`;
91
+ console.log(chalk.gray(`Reading "${name}".`));
92
+ const { title, description, skin } = await td.getSkin({
93
+ name,
94
+ url: `${layoutUrl}/skins/edit?key=${name}`,
95
+ });
96
+ skinRegister.setData(name, title, description);
97
+ skinContainer[name] = skin;
98
+ }
99
+ }
100
+
87
101
  for (const [name, content] of Object.entries(skinContainer)) {
88
102
  writeFileSync(resolve(aliasSkinDir, `${name}.skin`), content);
89
103
  }
package/src/index.js CHANGED
@@ -39,6 +39,11 @@ const argv = yargs(process.argv.slice(2)).options({
39
39
  default: false,
40
40
  type: "boolean",
41
41
  },
42
+ toolbar: {
43
+ description: "Download modToolbar skins, too",
44
+ default: false,
45
+ type: "boolean",
46
+ },
42
47
  backup: {
43
48
  alias: "b",
44
49
  description: "Backup skins to the local /backup folder to preserve their former status",
@@ -120,5 +125,6 @@ if (argv.compare) {
120
125
  debug: argv.debug,
121
126
  modules: argv.modules,
122
127
  skin: argv.skin ? new RegExp(argv.skin) : null,
128
+ toolbar: argv.toolbar,
123
129
  });
124
130
  }