@neonwilderness/moveskins 1.2.0 → 1.4.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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.0 (07.05.2026)
4
+
5
+ - Add --layout CLI param string to address different Twoday layouts for up-/downloads
6
+
7
+ ## 1.3.0 (02.05.2026)
8
+
9
+ - Add --toolbar CLI switch to additionally download 3 related modToolbar skins
10
+
3
11
  ## 1.2.0 (25.04.2026)
4
12
 
5
13
  - 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,66 @@ 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
- console.log(Fi.green(`\nNow processing alias "${r}"...`));
61343
- let t = A_(r, n.backup), i = await e.getModifiedSkins(r);
61357
+ if (console.log(Fi.green(`\nNow processing alias "${r}"...`)), n.layout) {
61358
+ let t = await e.useLayout(r, n.layout);
61359
+ console.log(Fi.green(`Switching to layout "${t.activeLayoutName} of alias "${r}".`));
61360
+ }
61361
+ let t = A_(r, n.backup), i = await e.getModifiedSkins(r), a = {};
61344
61362
  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);
61363
+ for (let t of i) {
61364
+ if (n.skin && !n.skin.test(t.name)) continue;
61365
+ console.log(Fi.gray(`Reading "${t.name}".`));
61366
+ let { title: i, description: o, skin: s } = await e.getSkin(t);
61367
+ k_.setData(t.name, i, o), a[t.name] = s, a = await F_(e, r, s, a);
61368
+ }
61369
+ if (n.modules) {
61370
+ console.log(Fi.yellow("Exporting sidebar freetext modules as requested."));
61371
+ let t = await e.getSidebarModules(r), n = [...t.sidebar01, ...t.sidebar02];
61372
+ for (let t of n) if (e.isValidFreeTextModule(t)) {
61373
+ console.log(Fi.gray(`Reading sidebar module "${t}".`));
61374
+ let { heading: n, content: i } = await e.getFreeTextModule(r, t);
61375
+ a[`Sidebar.${t}`] = `${n}\n${i}`;
61376
+ } else {
61377
+ let { skins: n } = await e.getModuleSkins(r, t);
61378
+ for (let t of n) {
61379
+ let { title: n, description: r, skin: i } = await e.getSkin(t);
61380
+ k_.setData(t.name, n, r), a[t.name] = i;
61381
+ }
61382
+ }
61383
+ }
61384
+ if (n.toolbar) {
61385
+ let t = await e.getActiveLayoutUrl(r);
61386
+ for (let n of [
61387
+ "Main",
61388
+ "DropDowns",
61389
+ "Closed"
61390
+ ]) {
61391
+ let r = `Site.modToolbar${n}`;
61392
+ console.log(Fi.gray(`Reading "${r}".`));
61393
+ let { title: i, description: o, skin: s } = await e.getSkin({
61394
+ name: r,
61395
+ url: `${t}/skins/edit?key=${r}`
61396
+ });
61397
+ k_.setData(r, i, o), a[r] = s;
61398
+ }
61350
61399
  }
61400
+ for (let [e, n] of Object.entries(a)) S(A(t, `${e}.skin`), n);
61351
61401
  }
61352
61402
  console.log(Fi.green("Download completed."));
61353
61403
  } catch (e) {
@@ -61355,23 +61405,41 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61355
61405
  } finally {
61356
61406
  k_.store();
61357
61407
  }
61358
- }, F_ = async (e, t, n) => {
61408
+ }, L_ = async (e, t, n) => {
61359
61409
  try {
61360
61410
  await e.login();
61361
61411
  for (let r of t) {
61362
- console.log(Fi.green(`\nNow processing alias "${r}"...`));
61412
+ if (console.log(Fi.green(`\nNow processing alias "${r}"...`)), n.layout) {
61413
+ let t = await e.useLayout(r, n.layout);
61414
+ console.log(Fi.green(`Switching to layout "${t.activeLayoutName} of alias "${r}".`));
61415
+ }
61363
61416
  let t = M_(r, n.backup);
61364
61417
  console.log(Fi.yellow(`${r} has ${t.length} local skins. `) + Fi.red(`${t.length === 0 ? "Got nothing to do!" : ""}`)), n.skin && console.log(Fi.yellow(`Filtering skins for ${n.skin}.`));
61365
61418
  let i = await e.getModifiedSkins(r), a = new Set(i.map((e) => e.name)), o = A_(r, n.backup);
61366
61419
  for (let i of t) {
61367
61420
  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);
61421
+ let [t, s] = i.split(".");
61422
+ if (t === "Sidebar") {
61423
+ 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);
61424
+ console.log(Fi.blue(`Now updating sidebar module ${s} (len=${c.length}).`)), await e.updateFreeTextModule(r, s, {
61425
+ heading: a,
61426
+ content: c
61427
+ }), console.log(Fi.green(`Update request completed for module: ${s}`));
61428
+ } else {
61429
+ let { isValid: t, prototype: a } = e.isValidHoptype(i.slice(0, -5));
61430
+ if (!t) {
61431
+ console.log(Fi.red(`Skipping upload for invalid skin hoptype "${a}" (Skin file ${i}).`));
61432
+ continue;
61433
+ }
61434
+ let s = k_.getData(i);
61435
+ 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, {
61436
+ title: s.title,
61437
+ description: s.description,
61438
+ skin: s.content,
61439
+ diff: n.debug
61440
+ }), console.log(Fi.green(`Update request completed for skin: ${s.name}`));
61441
+ }
61442
+ a.has(skin.name) && a.delete(skin.name);
61375
61443
  }
61376
61444
  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
61445
  }
@@ -61379,12 +61447,12 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61379
61447
  } catch (e) {
61380
61448
  console.log(Fi.red(`Error while uploading skins: ${e}`));
61381
61449
  }
61382
- }, I_ = {
61450
+ }, R_ = {
61383
61451
  different: "cyan",
61384
61452
  identical: "grey",
61385
61453
  new: "green",
61386
61454
  untouched: "grey"
61387
- }, L_ = (e, t) => e.name < t.name ? -1 : +(e.name > t.name), R_ = async (e, t) => {
61455
+ }, z_ = (e, t) => e.name < t.name ? -1 : +(e.name > t.name), B_ = async (e, t) => {
61388
61456
  let n = { aliases: [] };
61389
61457
  try {
61390
61458
  typeof t == "string" && (t = [t]), await e.login();
@@ -61397,7 +61465,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61397
61465
  let o = A_(i, !1), s = M_(i, !1).map((e) => {
61398
61466
  let t = k_.getData(e);
61399
61467
  return t.skin = b(A(o, e)).toString().replace(/\r\n/g, "\n"), t;
61400
- }).sort(L_), c = await e.getModifiedSkins(a), l = [];
61468
+ }).sort(z_), c = await e.getModifiedSkins(a), l = [];
61401
61469
  for (let t of c) l.push(e.getSkin(t));
61402
61470
  let u = (await Promise.all(l)).map((e) => {
61403
61471
  let { name: t, title: n, description: r, skin: i } = e;
@@ -61407,7 +61475,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61407
61475
  description: r,
61408
61476
  skin: i
61409
61477
  };
61410
- }).sort(L_), d = 0, f = 0;
61478
+ }).sort(z_), d = 0, f = 0;
61411
61479
  for (; d < s.length && f < u.length;) {
61412
61480
  let n = d < s.length ? s[d].name : "￿", r = f < u.length ? u[f].name : "￿", i = {
61413
61481
  open: !1,
@@ -61417,7 +61485,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61417
61485
  console.log(Fi.white(`Processing skin ${Fi.italic(n)}`));
61418
61486
  let t = e.diffSkin(n, u[f], s[d]);
61419
61487
  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));
61488
+ } 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
61489
  t.skins.push(i);
61422
61490
  }
61423
61491
  n.aliases.push(t);
@@ -61428,7 +61496,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61428
61496
  } catch (e) {
61429
61497
  console.log(Fi.red(`Error while comparing skins: ${e}`));
61430
61498
  }
61431
- }, z_ = /* @__PURE__ */ R(((e, t) => {
61499
+ }, V_ = /* @__PURE__ */ R(((e, t) => {
61432
61500
  var n = H("fs"), r = H("path");
61433
61501
  function i(e) {
61434
61502
  console.log(`[dotenv][DEBUG] ${e}`);
@@ -61457,7 +61525,7 @@ var E_ = A(process.cwd(), "skins"), D_ = A(process.cwd(), "backup"), O_ = A(E_,
61457
61525
  }
61458
61526
  }
61459
61527
  t.exports.config = u, t.exports.parse = l;
61460
- })), B_ = /* @__PURE__ */ R(((e, t) => {
61528
+ })), H_ = /* @__PURE__ */ R(((e, t) => {
61461
61529
  var n = H("util");
61462
61530
  function r(e, t, n, r, i) {
61463
61531
  let a = `The following variables were defined in ${n} but are not present in the environment:\n ${r.join(", ")}
@@ -61469,8 +61537,8 @@ Make sure to add them to ${t} or directly to the environment.`, o = e ? "" : "If
61469
61537
  ].filter(Boolean).join("\n\n"), Error.captureStackTrace(this, this.constructor);
61470
61538
  }
61471
61539
  n.inherits(r, Error), t.exports = r;
61472
- })), V_ = (/* @__PURE__ */ R(((e, t) => {
61473
- var n = z_(), r = H("fs"), i = B_();
61540
+ })), U_ = (/* @__PURE__ */ R(((e, t) => {
61541
+ var n = V_(), r = H("fs"), i = H_();
61474
61542
  function a(e, t) {
61475
61543
  return e.filter((e) => t.indexOf(e) < 0);
61476
61544
  }
@@ -61493,7 +61561,7 @@ Make sure to add them to ${t} or directly to the environment.`, o = e ? "" : "If
61493
61561
  parse: n.parse,
61494
61562
  MissingEnvVarsError: i
61495
61563
  }, t.exports.MissingEnvVarsError = i;
61496
- })))(), H_ = ei(process.argv.slice(2)).options({
61564
+ })))(), W_ = ei(process.argv.slice(2)).options({
61497
61565
  from: {
61498
61566
  alias: "f",
61499
61567
  description: "Platform where to download the skins from: \"dev\" or \"prod\"",
@@ -61514,6 +61582,23 @@ Make sure to add them to ${t} or directly to the environment.`, o = e ? "" : "If
61514
61582
  description: "Skin selection string (regex) to filter the skins to upload",
61515
61583
  type: "string"
61516
61584
  },
61585
+ layout: {
61586
+ alias: "l",
61587
+ description: "Uses this layout name for all subsequent actions",
61588
+ default: "",
61589
+ type: "string"
61590
+ },
61591
+ modules: {
61592
+ alias: "m",
61593
+ description: "Download sidebar module skins/freetext as well",
61594
+ default: !1,
61595
+ type: "boolean"
61596
+ },
61597
+ toolbar: {
61598
+ description: "Download modToolbar skins, too",
61599
+ default: !1,
61600
+ type: "boolean"
61601
+ },
61517
61602
  backup: {
61518
61603
  alias: "b",
61519
61604
  description: "Backup skins to the local /backup folder to preserve their former status",
@@ -61535,20 +61620,23 @@ Make sure to add them to ${t} or directly to the environment.`, o = e ? "" : "If
61535
61620
  type: "boolean"
61536
61621
  }
61537
61622
  }).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 === "*" ? [
61623
+ (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));
61624
+ var G_ = (W_.from || W_.to).toLowerCase(), K_ = new yh.Twoday(G_, { delay: 100 }), q_ = W_.alias === "*" ? [
61540
61625
  "www",
61541
61626
  "info",
61542
61627
  "help",
61543
61628
  "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_);
61629
+ ] : N_(W_.alias, ",");
61630
+ 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
61631
  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
61632
+ let e = W_.from ? "down" : "up", t = W_.from ? "from" : "to", n = W_.from ? I_ : L_;
61633
+ 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_, {
61634
+ backup: W_.backup,
61635
+ debug: W_.debug,
61636
+ layout: W_.layout,
61637
+ modules: W_.modules,
61638
+ skin: W_.skin ? new RegExp(W_.skin) : null,
61639
+ toolbar: W_.toolbar
61552
61640
  });
61553
61641
  }
61554
61642
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neonwilderness/moveskins",
3
- "version": "1.2.0",
3
+ "version": "1.4.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
@@ -42,6 +42,12 @@ const downloadModifiedSkins = async (td, aliases, options) => {
42
42
 
43
43
  for (let alias of aliases) {
44
44
  console.log(chalk.green(`\nNow processing alias "${alias}"...`));
45
+
46
+ if (options.layout) {
47
+ const layout = await td.useLayout(alias, options.layout);
48
+ console.log(chalk.green(`Switching to layout "${layout.activeLayoutName} of alias "${alias}".`));
49
+ }
50
+
45
51
  const aliasSkinDir = aliasSkinFolder(alias, options.backup);
46
52
  const modifiedSkins = await td.getModifiedSkins(alias);
47
53
  let skinContainer = {};
@@ -69,7 +75,7 @@ const downloadModifiedSkins = async (td, aliases, options) => {
69
75
  const sidebar = await td.getSidebarModules(alias);
70
76
  const moduleNames = [...sidebar.sidebar01, ...sidebar.sidebar02];
71
77
  for (let module of moduleNames) {
72
- if (/FreeText\d{2}/.test(module)) {
78
+ if (td.isValidFreeTextModule(module)) {
73
79
  console.log(chalk.gray(`Reading sidebar module "${module}".`));
74
80
  const { heading, content } = await td.getFreeTextModule(alias, module);
75
81
  skinContainer[`Sidebar.${module}`] = `${heading}\n${content}`;
@@ -84,6 +90,20 @@ const downloadModifiedSkins = async (td, aliases, options) => {
84
90
  }
85
91
  }
86
92
 
93
+ if (options.toolbar) {
94
+ const layoutUrl = await td.getActiveLayoutUrl(alias);
95
+ for (const s of ["Main", "DropDowns", "Closed"]) {
96
+ const name = `Site.modToolbar${s}`;
97
+ console.log(chalk.gray(`Reading "${name}".`));
98
+ const { title, description, skin } = await td.getSkin({
99
+ name,
100
+ url: `${layoutUrl}/skins/edit?key=${name}`,
101
+ });
102
+ skinRegister.setData(name, title, description);
103
+ skinContainer[name] = skin;
104
+ }
105
+ }
106
+
87
107
  for (const [name, content] of Object.entries(skinContainer)) {
88
108
  writeFileSync(resolve(aliasSkinDir, `${name}.skin`), content);
89
109
  }
package/src/_upload.js CHANGED
@@ -20,6 +20,12 @@ const uploadModifiedSkins = async (td, aliases, options) => {
20
20
 
21
21
  for (let alias of aliases) {
22
22
  console.log(chalk.green(`\nNow processing alias "${alias}"...`));
23
+
24
+ if (options.layout) {
25
+ const layout = await td.useLayout(alias, options.layout);
26
+ console.log(chalk.green(`Switching to layout "${layout.activeLayoutName} of alias "${alias}".`));
27
+ }
28
+
23
29
  const localSkinFiles = getLocalSkins(alias, options.backup);
24
30
  console.log(
25
31
  chalk.yellow(`${alias} has ${localSkinFiles.length} local skins. `) +
package/src/index.js CHANGED
@@ -33,12 +33,23 @@ const argv = yargs(process.argv.slice(2)).options({
33
33
  description: "Skin selection string (regex) to filter the skins to upload",
34
34
  type: "string",
35
35
  },
36
+ layout: {
37
+ alias: "l",
38
+ description: "Uses this layout name for all subsequent actions",
39
+ default: '',
40
+ type: "string",
41
+ },
36
42
  modules: {
37
43
  alias: "m",
38
44
  description: "Download sidebar module skins/freetext as well",
39
45
  default: false,
40
46
  type: "boolean",
41
47
  },
48
+ toolbar: {
49
+ description: "Download modToolbar skins, too",
50
+ default: false,
51
+ type: "boolean",
52
+ },
42
53
  backup: {
43
54
  alias: "b",
44
55
  description: "Backup skins to the local /backup folder to preserve their former status",
@@ -118,7 +129,9 @@ if (argv.compare) {
118
129
  execTask(td, aliases, {
119
130
  backup: argv.backup,
120
131
  debug: argv.debug,
132
+ layout: argv.layout,
121
133
  modules: argv.modules,
122
134
  skin: argv.skin ? new RegExp(argv.skin) : null,
135
+ toolbar: argv.toolbar,
123
136
  });
124
137
  }