@cyberskill/shared 1.210.0 → 1.211.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.
Files changed (133) hide show
  1. package/dist/config/commitlint/index.cjs +1 -0
  2. package/dist/config/config.type.cjs +1 -0
  3. package/dist/config/config.util.cjs +1 -0
  4. package/dist/config/config.util.js +35 -26
  5. package/dist/config/env/env.constant.cjs +1 -0
  6. package/dist/config/env/env.util.cjs +1 -0
  7. package/dist/config/env/index.cjs +1 -0
  8. package/dist/config/eslint/index.cjs +1 -0
  9. package/dist/config/eslint/index.js +12 -4
  10. package/dist/config/graphql-codegen/graphql-codegen.util.cjs +1 -0
  11. package/dist/config/graphql-codegen/graphql-codegen.util.js +33 -28
  12. package/dist/config/graphql-codegen/index.cjs +1 -0
  13. package/dist/config/index.cjs +1 -0
  14. package/dist/config/lint-staged/index.cjs +1 -0
  15. package/dist/config/vitest/index.cjs +1 -0
  16. package/dist/config/vitest/vitest.e2e.cjs +1 -0
  17. package/dist/config/vitest/vitest.e2e.js +16 -9
  18. package/dist/config/vitest/vitest.unit.cjs +1 -0
  19. package/dist/config/vitest/vitest.unit.js +18 -11
  20. package/dist/constant/common.cjs +1 -0
  21. package/dist/constant/common.js +1 -1
  22. package/dist/constant/index.cjs +1 -0
  23. package/dist/constant/response-status.cjs +1 -0
  24. package/dist/node/apollo-server/apollo-server.util.cjs +1 -0
  25. package/dist/node/apollo-server/apollo-server.util.js +48 -21
  26. package/dist/node/apollo-server/index.cjs +1 -0
  27. package/dist/node/cli/index.cjs +6 -0
  28. package/dist/node/cli/index.js +140 -90
  29. package/dist/node/command/command.type.cjs +1 -0
  30. package/dist/node/command/command.util.cjs +2 -0
  31. package/dist/node/command/command.util.js +148 -117
  32. package/dist/node/command/index.cjs +1 -0
  33. package/dist/node/express/express.util.cjs +1 -0
  34. package/dist/node/express/express.util.js +70 -37
  35. package/dist/node/express/index.cjs +1 -0
  36. package/dist/node/fs/fs.util.cjs +1 -0
  37. package/dist/node/fs/fs.util.js +55 -40
  38. package/dist/node/fs/index.cjs +1 -0
  39. package/dist/node/log/index.cjs +1 -0
  40. package/dist/node/log/log.type.cjs +1 -0
  41. package/dist/node/log/log.util.cjs +1 -0
  42. package/dist/node/log/log.util.js +31 -30
  43. package/dist/node/mongo/index.cjs +1 -0
  44. package/dist/node/mongo/mongo.constant.cjs +1 -0
  45. package/dist/node/mongo/mongo.type.cjs +1 -0
  46. package/dist/node/mongo/mongo.util.cjs +5 -0
  47. package/dist/node/mongo/mongo.util.js +433 -365
  48. package/dist/node/package/index.cjs +1 -0
  49. package/dist/node/package/package.type.cjs +1 -0
  50. package/dist/node/package/package.util.cjs +1 -0
  51. package/dist/node/package/package.util.js +224 -195
  52. package/dist/node/path/index.cjs +1 -0
  53. package/dist/node/path/path.constant.cjs +1 -0
  54. package/dist/node/path/path.constant.js +205 -183
  55. package/dist/node/path/path.util.cjs +1 -0
  56. package/dist/node/storage/index.cjs +1 -0
  57. package/dist/node/storage/storage.util.cjs +1 -0
  58. package/dist/node/storage/storage.util.js +70 -40
  59. package/dist/node/upload/index.cjs +1 -0
  60. package/dist/node/upload/upload.type.cjs +1 -0
  61. package/dist/node/upload/upload.util.cjs +1 -0
  62. package/dist/node/upload/upload.util.js +119 -91
  63. package/dist/node/ws/index.cjs +1 -0
  64. package/dist/node/ws/ts.util.cjs +1 -0
  65. package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.13_@vitest_browser@3.2.4_jiti@2.4.2_j_cac3da623d5688a51c0b1a2270e144db/node_modules/vitest/dist/config.cjs +1 -0
  66. package/dist/react/apollo-client/apollo-client.component.cjs +1 -0
  67. package/dist/react/apollo-client/apollo-client.constant.cjs +1 -0
  68. package/dist/react/apollo-client/apollo-client.context.cjs +1 -0
  69. package/dist/react/apollo-client/apollo-client.util.cjs +1 -0
  70. package/dist/react/apollo-client/apollo-client.util.js +74 -64
  71. package/dist/react/apollo-client/index.cjs +1 -0
  72. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +1 -0
  73. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs +1 -0
  74. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +1 -0
  75. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js +18 -11
  76. package/dist/react/apollo-client-nextjs/index.cjs +1 -0
  77. package/dist/react/apollo-error/apollo-error.component.cjs +1 -0
  78. package/dist/react/apollo-error/apollo-error.component.js +6 -6
  79. package/dist/react/apollo-error/apollo-error.context.cjs +1 -0
  80. package/dist/react/apollo-error/apollo-error.hook.cjs +1 -0
  81. package/dist/react/apollo-error/apollo-error.module.scss.cjs +1 -0
  82. package/dist/react/apollo-error/apollo-error.provider.cjs +1 -0
  83. package/dist/react/apollo-error/apollo-error.util.cjs +1 -0
  84. package/dist/react/apollo-error/apollo-error.util.js +1 -1
  85. package/dist/react/apollo-error/index.cjs +1 -0
  86. package/dist/react/i18next/i18next.hook.cjs +1 -0
  87. package/dist/react/i18next/i18next.util.cjs +1 -0
  88. package/dist/react/i18next/index.cjs +1 -0
  89. package/dist/react/loading/index.cjs +1 -0
  90. package/dist/react/loading/loading.component.cjs +6 -0
  91. package/dist/react/loading/loading.component.js +36 -19
  92. package/dist/react/loading/loading.context.cjs +1 -0
  93. package/dist/react/loading/loading.hook.cjs +1 -0
  94. package/dist/react/loading/loading.module.scss.cjs +1 -0
  95. package/dist/react/loading/loading.provider.cjs +1 -0
  96. package/dist/react/log/index.cjs +1 -0
  97. package/dist/react/log/log.util.cjs +1 -0
  98. package/dist/react/log/log.util.js +4 -4
  99. package/dist/react/next-intl/index.cjs +1 -0
  100. package/dist/react/next-intl/next-intl.constant.cjs +1 -0
  101. package/dist/react/next-intl/next-intl.context.cjs +1 -0
  102. package/dist/react/next-intl/next-intl.hoc.cjs +1 -0
  103. package/dist/react/next-intl/next-intl.hoc.js +23 -14
  104. package/dist/react/next-intl/next-intl.hook.cjs +1 -0
  105. package/dist/react/next-intl/next-intl.provider.cjs +1 -0
  106. package/dist/react/next-intl/next-intl.provider.js +7 -7
  107. package/dist/react/storage/index.cjs +1 -0
  108. package/dist/react/storage/storage.hook.cjs +1 -0
  109. package/dist/react/storage/storage.hook.js +57 -41
  110. package/dist/react/storage/storage.util.cjs +1 -0
  111. package/dist/react/storage/storage.util.js +50 -25
  112. package/dist/react/toast/index.cjs +1 -0
  113. package/dist/react/userback/index.cjs +1 -0
  114. package/dist/react/userback/userback.component.cjs +1 -0
  115. package/dist/react/userback/userback.component.js +42 -18
  116. package/dist/style.css +1 -1
  117. package/dist/typescript/common.type.cjs +1 -0
  118. package/dist/typescript/index.cjs +1 -0
  119. package/dist/util/common/common.util.cjs +1 -0
  120. package/dist/util/common/common.util.js +37 -29
  121. package/dist/util/common/index.cjs +1 -0
  122. package/dist/util/index.cjs +1 -0
  123. package/dist/util/object/index.cjs +1 -0
  124. package/dist/util/object/object.util.cjs +1 -0
  125. package/dist/util/object/object.util.js +55 -49
  126. package/dist/util/serializer/index.cjs +1 -0
  127. package/dist/util/serializer/serializer.util.cjs +1 -0
  128. package/dist/util/string/index.cjs +1 -0
  129. package/dist/util/string/string.util.cjs +1 -0
  130. package/dist/util/string/string.util.js +46 -36
  131. package/dist/util/validate/index.cjs +1 -0
  132. package/dist/util/validate/validate.util.cjs +1 -0
  133. package/package.json +69 -35
@@ -1,110 +1,160 @@
1
1
  #!/usr/bin/env node
2
- import g from "node:process";
3
- import { hideBin as C } from "yargs/helpers";
4
- import L from "yargs/yargs";
5
- import { clearAllErrorLists as s, runCommand as t, getStoredErrorLists as M, resolveCommands as _ } from "../command/command.util.js";
6
- import { getPackage as O, installDependencies as w } from "../package/package.util.js";
7
- import { removeSync as y, readFileSync as E, pathExistsSync as h, writeFileSync as l, appendFileSync as R } from "../fs/fs.util.js";
8
- import { resolve as G } from "../path/path.util.js";
9
- import { CYBERSKILL_CLI as N, command as i, CYBERSKILL_PACKAGE_NAME as p, PATH as e, SIMPLE_GIT_HOOK_JSON as u, createGitHooksConfig as T } from "../path/path.constant.js";
10
- import { log as r, catchError as P } from "../log/log.util.js";
11
- import { E_IssueType as d } from "../log/log.type.js";
12
- function D() {
2
+ import p from "node:process";
3
+ import { hideBin as N } from "yargs/helpers";
4
+ import P from "yargs/yargs";
5
+ import { clearAllErrorLists as u, runCommand as i, getStoredErrorLists as T, resolveCommands as w } from "../command/command.util.js";
6
+ import { getPackage as D, installDependencies as I } from "../package/package.util.js";
7
+ import { removeSync as C, readFileSync as _, pathExistsSync as L, writeFileSync as y, appendFileSync as B } from "../fs/fs.util.js";
8
+ import { resolve as x } from "../path/path.util.js";
9
+ import { CYBERSKILL_CLI as A, command as t, CYBERSKILL_PACKAGE_NAME as h, PATH as l, SIMPLE_GIT_HOOK_JSON as E, createGitHooksConfig as F } from "../path/path.constant.js";
10
+ import { log as a, catchError as H } from "../log/log.util.js";
11
+ import { E_IssueType as S } from "../log/log.type.js";
12
+ var e = (n, o, r) => new Promise((c, f) => {
13
+ var R = (s) => {
14
+ try {
15
+ m(r.next(s));
16
+ } catch (g) {
17
+ f(g);
18
+ }
19
+ }, G = (s) => {
20
+ try {
21
+ m(r.throw(s));
22
+ } catch (g) {
23
+ f(g);
24
+ }
25
+ }, m = (s) => s.done ? c(s.value) : Promise.resolve(s.value).then(R, G);
26
+ m((r = r.apply(n, o)).next());
27
+ });
28
+ function U() {
13
29
  try {
14
30
  return JSON.parse(
15
- E(G(__dirname, "../../../package.json"), "utf-8")
31
+ _(x(__dirname, "../../../package.json"), "utf-8")
16
32
  ).version;
17
- } catch {
33
+ } catch (n) {
18
34
  return "1.0.0";
19
35
  }
20
36
  }
21
- async function S() {
22
- h(e.TS_CONFIG) ? await t("Performing TypeScript validation", await i.typescriptCheck()) : r.warn("No TypeScript configuration found. Skipping type check.");
37
+ function M() {
38
+ return e(this, null, function* () {
39
+ L(l.TS_CONFIG) ? yield i("Performing TypeScript validation", yield t.typescriptCheck()) : a.warn("No TypeScript configuration found. Skipping type check.");
40
+ });
23
41
  }
24
- async function k(n = !1) {
25
- n ? await t("Running ESLint with auto-fix", await i.eslintFix()) : await t("Running ESLint check", await i.eslintCheck());
42
+ function O(n = !1) {
43
+ return e(this, null, function* () {
44
+ n ? yield i("Running ESLint with auto-fix", yield t.eslintFix()) : yield i("Running ESLint check", yield t.eslintCheck());
45
+ });
26
46
  }
27
- function f(n, a) {
28
- if (!a.length)
29
- return;
30
- const o = n === "Errors" ? "red" : "yellow";
31
- r.printBoxedLog(n === "Errors" ? "✖ Errors" : "⚠ Warnings", a, o);
32
- }
33
- async function c() {
34
- setTimeout(async () => {
35
- const n = await M(), a = n.filter((m) => m.type === d.Error), o = n.filter((m) => m.type === d.Warning);
36
- !a.length && !o.length ? r.printBoxedLog("✔ NO ISSUES FOUND", [], "green") : (f("Warnings", o), f("Errors", a), a.length > 0 && g.exit(1));
37
- }, 0);
38
- }
39
- async function v() {
40
- await s();
41
- const n = await O({ name: p });
42
- if (!n.success) {
43
- r.error("Failed to retrieve package information. Aborting lint-staged.");
47
+ function k(n, o) {
48
+ if (!o.length)
44
49
  return;
45
- }
46
- n.result.isCurrentProject && await t(`Building package: ${p}`, await i.build()), await t("Executing lint-staged", await i.lintStaged()), c();
47
- }
48
- async function B() {
49
- await t("Inspecting ESLint configuration", await i.eslintInspect());
50
- }
51
- async function x() {
52
- await s(), await Promise.all([S(), k()]), c();
53
- }
54
- async function A() {
55
- await s(), await Promise.all([S(), k(!0)]), c();
56
- }
57
- async function F() {
58
- await s(), await t("Validating commit message", await i.commitLint()), c();
59
- }
60
- async function I() {
61
- await t("Configuring Git hooks", await i.configureGitHook()), y(e.GIT_HOOK);
62
- const n = await _(T);
63
- l(e.SIMPLE_GIT_HOOKS_JSON, JSON.stringify(n, null, 4));
64
- const a = `
65
- ${u}
50
+ const r = n === "Errors" ? "red" : "yellow";
51
+ a.printBoxedLog(n === "Errors" ? "✖ Errors" : " Warnings", o, r);
52
+ }
53
+ function d() {
54
+ return e(this, null, function* () {
55
+ setTimeout(() => e(null, null, function* () {
56
+ const n = yield T(), o = n.filter((c) => c.type === S.Error), r = n.filter((c) => c.type === S.Warning);
57
+ !o.length && !r.length ? a.printBoxedLog("✔ NO ISSUES FOUND", [], "green") : (k("Warnings", r), k("Errors", o), o.length > 0 && p.exit(1));
58
+ }), 0);
59
+ });
60
+ }
61
+ function K() {
62
+ return e(this, null, function* () {
63
+ yield u();
64
+ const n = yield D({ name: h });
65
+ if (!n.success) {
66
+ a.error("Failed to retrieve package information. Aborting lint-staged.");
67
+ return;
68
+ }
69
+ n.result.isCurrentProject && (yield i(`Building package: ${h}`, yield t.build())), yield i("Executing lint-staged", yield t.lintStaged()), d();
70
+ });
71
+ }
72
+ function b() {
73
+ return e(this, null, function* () {
74
+ yield i("Inspecting ESLint configuration", yield t.eslintInspect());
75
+ });
76
+ }
77
+ function j() {
78
+ return e(this, null, function* () {
79
+ yield u(), yield Promise.all([M(), O()]), d();
80
+ });
81
+ }
82
+ function J() {
83
+ return e(this, null, function* () {
84
+ yield u(), yield Promise.all([M(), O(!0)]), d();
85
+ });
86
+ }
87
+ function V() {
88
+ return e(this, null, function* () {
89
+ yield u(), yield i("Validating commit message", yield t.commitLint()), d();
90
+ });
91
+ }
92
+ function v() {
93
+ return e(this, null, function* () {
94
+ yield i("Configuring Git hooks", yield t.configureGitHook()), C(l.GIT_HOOK);
95
+ const n = yield w(F);
96
+ y(l.SIMPLE_GIT_HOOKS_JSON, JSON.stringify(n, null, 4));
97
+ const o = `
98
+ ${E}
66
99
  `;
67
- h(e.GIT_IGNORE) ? E(e.GIT_IGNORE, "utf-8").split(`
68
- `).includes(u) || R(e.GIT_IGNORE, a) : l(e.GIT_IGNORE, a), await t("Setting up simple-git-hooks", await i.simpleGitHooks());
69
- }
70
- async function H() {
71
- await w(), await I();
72
- }
73
- async function U() {
74
- y(e.NODE_MODULES, e.PNPM_LOCK_YAML), await t("Pruning pnpm store", await i.pnpmPruneStore()), await t("Clearing pnpm cache", await i.pnpmCleanCache()), await w(), await I();
75
- }
76
- async function K() {
77
- await t("Inspecting project dependencies", await i.nodeModulesInspect());
78
- }
79
- async function b() {
80
- await t("Running unit tests", await i.testUnit());
81
- }
82
- async function j() {
83
- await t("Running end-to-end tests", await i.testE2e());
84
- }
85
- async function J(n) {
86
- await t("Creating MongoDB migration", await i.mongoMigrateCreate(n));
87
- }
88
- async function V() {
89
- await t("Running MongoDB migrations", await i.mongoMigrateUp());
90
- }
91
- async function W() {
92
- await t("Rolling back MongoDB migration", await i.mongoMigrateDown());
93
- }
94
- (async () => {
100
+ L(l.GIT_IGNORE) ? _(l.GIT_IGNORE, "utf-8").split(`
101
+ `).includes(E) || B(l.GIT_IGNORE, o) : y(l.GIT_IGNORE, o), yield i("Setting up simple-git-hooks", yield t.simpleGitHooks());
102
+ });
103
+ }
104
+ function W() {
105
+ return e(this, null, function* () {
106
+ yield I(), yield v();
107
+ });
108
+ }
109
+ function Y() {
110
+ return e(this, null, function* () {
111
+ C(l.NODE_MODULES, l.PNPM_LOCK_YAML), yield i("Pruning pnpm store", yield t.pnpmPruneStore()), yield i("Clearing pnpm cache", yield t.pnpmCleanCache()), yield I(), yield v();
112
+ });
113
+ }
114
+ function $() {
115
+ return e(this, null, function* () {
116
+ yield i("Inspecting project dependencies", yield t.nodeModulesInspect());
117
+ });
118
+ }
119
+ function z() {
120
+ return e(this, null, function* () {
121
+ yield i("Running unit tests", yield t.testUnit());
122
+ });
123
+ }
124
+ function q() {
125
+ return e(this, null, function* () {
126
+ yield i("Running end-to-end tests", yield t.testE2e());
127
+ });
128
+ }
129
+ function Q(n) {
130
+ return e(this, null, function* () {
131
+ yield i("Creating MongoDB migration", yield t.mongoMigrateCreate(n));
132
+ });
133
+ }
134
+ function X() {
135
+ return e(this, null, function* () {
136
+ yield i("Running MongoDB migrations", yield t.mongoMigrateUp());
137
+ });
138
+ }
139
+ function Z() {
140
+ return e(this, null, function* () {
141
+ yield i("Rolling back MongoDB migration", yield t.mongoMigrateDown());
142
+ });
143
+ }
144
+ e(null, null, function* () {
95
145
  try {
96
- await L(C(g.argv)).scriptName(N).usage("$0 <command> [options]").command("lint", "Check code for linting issues", x).command("lint:fix", "Fix linting issues automatically", A).command("lint:inspect", "View active ESLint configuration", B).command("lint-staged", "Run lint checks on staged files", v).command("commitlint", "Validate commit message format", F).command("ready", "Initialize project and dependencies", H).command("reset", "Reset the project and reinstall dependencies", U).command("inspect", "Analyze installed project dependencies", K).command("test:unit", "Run unit test suite", b).command("test:e2e", "Run end-to-end test suite", j).command("mongo:migrate:create <name>", "Create a MongoDB migration", (n) => n.positional("name", {
146
+ yield P(N(p.argv)).scriptName(A).usage("$0 <command> [options]").command("lint", "Check code for linting issues", j).command("lint:fix", "Fix linting issues automatically", J).command("lint:inspect", "View active ESLint configuration", b).command("lint-staged", "Run lint checks on staged files", K).command("commitlint", "Validate commit message format", V).command("ready", "Initialize project and dependencies", W).command("reset", "Reset the project and reinstall dependencies", Y).command("inspect", "Analyze installed project dependencies", $).command("test:unit", "Run unit test suite", z).command("test:e2e", "Run end-to-end test suite", q).command("mongo:migrate:create <name>", "Create a MongoDB migration", (n) => n.positional("name", {
97
147
  describe: "Migration name",
98
148
  type: "string"
99
- }), async (n) => {
149
+ }), (n) => e(null, null, function* () {
100
150
  if (!n.name) {
101
- r.error("Migration name is required.");
151
+ a.error("Migration name is required.");
102
152
  return;
103
153
  }
104
- await J(n.name);
105
- }).command("mongo:migrate:up", "Apply all MongoDB migrations", V).command("mongo:migrate:down", "Rollback last MongoDB migration", W).demandCommand(1, "Please specify a valid command.").strict().help().alias("h", "help").alias("v", "version").version(D()).epilog(`💡 Tip: Use "--help" with any command to see options
154
+ yield Q(n.name);
155
+ })).command("mongo:migrate:up", "Apply all MongoDB migrations", X).command("mongo:migrate:down", "Rollback last MongoDB migration", Z).demandCommand(1, "Please specify a valid command.").strict().help().alias("h", "help").alias("v", "version").version(U()).epilog(`💡 Tip: Use "--help" with any command to see options
106
156
  `).parse();
107
157
  } catch (n) {
108
- P(n), g.exit(1);
158
+ H(n), p.exit(1);
109
159
  }
110
- })();
160
+ });
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.E_CommandType=(e=>(e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e))(exports.E_CommandType||{});
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("node:child_process"),b=require("node:process"),q=require("node:util"),y=require("../storage/storage.util.cjs"),j=require("../package/package.util.cjs"),p=require("../path/path.constant.cjs"),a=require("../log/log.type.cjs"),u=require("../log/log.util.cjs"),M=require("../../config/env/env.util.cjs");function A(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const D=A(q);var h=(e,r,t)=>new Promise((o,i)=>{var l=s=>{try{n(t.next(s))}catch(f){i(f)}},c=s=>{try{n(t.throw(s))}catch(f){i(f)}},n=s=>s.done?o(s.value):Promise.resolve(s.value).then(l,c);n((t=t.apply(e,r)).next())});const k=M.getEnv(),B=D.promisify(N.exec);function E(){return h(this,null,function*(){const e=yield j.getPackage();return e.success?e.result.name:Date.now().toString()})}function O(e){return h(this,null,function*(){if(e.length===0)return;const r=yield E();try{yield y.storage.set(r,e),setTimeout(()=>h(null,null,function*(){const t=yield y.storage.getLogLink(r);t&&u.log.info(`📂 Open the error list manually: ${t}`)}),0)}catch(t){u.catchError(t)}})}function R(){return h(this,null,function*(){try{const e=yield E(),r=yield y.storage.get(e);return r!=null?r:[]}catch(e){return u.catchError(e,{returnValue:[]})}})}function G(){return h(this,null,function*(){try{const e=yield E();yield y.storage.remove(e)}catch(e){u.catchError(e)}})}function K(e){const r=[],t=[];let o="";const i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,l=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split(`
2
+ `).forEach(n=>{var s,f,_,v,C,$,L,P,I,T,S;if(n.startsWith("/"))o=n.trim();else{const g=i.exec(n)||[],d=l.exec(n)||[],m=c.exec(n)||[];g.length&&o?r.push({file:o,position:`${g[1]}:${g[2]}`,type:g[3]===a.E_IssueType.Error?a.E_IssueType.Error:a.E_IssueType.Warning,message:(f=(s=g==null?void 0:g[4])==null?void 0:s.trim())!=null?f:"",rule:(v=(_=g==null?void 0:g[5])==null?void 0:_.trim())!=null?v:""}):d.length?r.push({file:(C=d==null?void 0:d[1])!=null?C:"",position:`${d[2]}:${d[3]}`,type:d[4]===a.E_IssueType.Error?a.E_IssueType.Error:a.E_IssueType.Warning,message:(L=($=d==null?void 0:d[5])==null?void 0:$.trim())!=null?L:""}):m.length?r.push({file:"commitlint",type:a.E_IssueType.Error,message:(I=(P=m==null?void 0:m[1])==null?void 0:P.trim())!=null?I:"",rule:(S=(T=m==null?void 0:m[2])==null?void 0:T.trim())!=null?S:""}):t.push(n.trim())}}),r.length&&O(r),k.DEBUG&&t.length&&(u.log.warn("Unmatched lines:"),t.forEach(n=>u.log.info(` ${n}`)))}function W(e){try{const r=JSON.parse(e),t=[];r.forEach(({filePath:o,messages:i})=>{i.forEach(({severity:l,line:c,column:n,ruleId:s,message:f})=>{t.push({type:l===2?a.E_IssueType.Error:a.E_IssueType.Warning,file:o,position:`${c}:${n}`,rule:s,message:f})})}),t.length&&O(t)}catch(r){K(e)}}function U(e){return h(this,arguments,function*(r,t=W){const o=new AbortController;b.on("SIGINT",()=>{u.log.warn("Process interrupted. Terminating..."),o.abort(),b.exit()});try{if(typeof r=="string"){const{stdout:i,stderr:l}=yield B(r,{maxBuffer:104857600,signal:o.signal});[i,l].forEach(c=>c&&t(c))}}catch(i){const{stdout:l,stderr:c,message:n}=i;[l,c].forEach(s=>s&&t(s)),!c&&!l&&u.log.error(`Command failed: ${n}`)}})}function X(e){return{raw:!0,cmd:e}}function w(e,r){return r!=null&&r.isCurrentProject?`${p.PNPM_EXEC_CLI} ${p.TSX_CLI} ${p.CYBERSKILL_CLI_PATH} ${e}`:`${p.PNPM_EXEC_CLI} ${p.CYBERSKILL_CLI} ${e}`}function x(e,r){return typeof e=="function"?w(e(r),r):typeof e=="object"&&(e==null?void 0:e.raw)===!0?e.cmd:typeof e=="string"?w(e,r):e}function Y(e){return h(this,null,function*(){const r=yield j.getPackage({name:p.CYBERSKILL_PACKAGE_NAME});if(r.success){const t={isCurrentProject:r.result.isCurrentProject},o=typeof e=="function"?e(t):e;return Object.fromEntries(Object.entries(o).map(([i,l])=>[i,x(l,t)]))}})}function z(e,r){return h(this,null,function*(){try{u.log.start(`${e}`),k.DEBUG&&u.log.info(`→ ${r}`),yield U(r),u.log.success(`${e} done.`)}catch(t){u.catchError(t)}})}exports.clearAllErrorLists=G;exports.formatCommand=x;exports.getStoredErrorLists=R;exports.rawCommand=X;exports.resolveCommands=Y;exports.runCommand=z;
@@ -1,144 +1,175 @@
1
- import { exec as d } from "node:child_process";
2
- import E from "node:process";
3
- import * as P from "node:util";
4
- import { storage as l } from "../storage/storage.util.js";
5
- import { getPackage as C } from "../package/package.util.js";
6
- import { E_IssueType as a } from "../log/log.type.js";
7
- import { CYBERSKILL_PACKAGE_NAME as x, PNPM_EXEC_CLI as y, TSX_CLI as S, CYBERSKILL_CLI_PATH as I, CYBERSKILL_CLI as T } from "../path/path.constant.js";
8
- import { catchError as g, log as u } from "../log/log.util.js";
9
- import { getEnv as _ } from "../../config/env/env.util.js";
10
- const w = _(), k = P.promisify(d);
11
- async function h() {
12
- const r = await C();
13
- return r.success ? r.result.name : Date.now().toString();
1
+ import { exec as B } from "node:child_process";
2
+ import I from "node:process";
3
+ import * as R from "node:util";
4
+ import { storage as p } from "../storage/storage.util.js";
5
+ import { getPackage as N } from "../package/package.util.js";
6
+ import { CYBERSKILL_PACKAGE_NAME as b, PNPM_EXEC_CLI as k, TSX_CLI as D, CYBERSKILL_CLI_PATH as M, CYBERSKILL_CLI as O } from "../path/path.constant.js";
7
+ import { E_IssueType as c } from "../log/log.type.js";
8
+ import { catchError as y, log as h } from "../log/log.util.js";
9
+ import { getEnv as G } from "../../config/env/env.util.js";
10
+ var g = (r, t, e) => new Promise((i, s) => {
11
+ var l = (o) => {
12
+ try {
13
+ n(e.next(o));
14
+ } catch (a) {
15
+ s(a);
16
+ }
17
+ }, u = (o) => {
18
+ try {
19
+ n(e.throw(o));
20
+ } catch (a) {
21
+ s(a);
22
+ }
23
+ }, n = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(l, u);
24
+ n((e = e.apply(r, t)).next());
25
+ });
26
+ const j = G(), K = R.promisify(B);
27
+ function E() {
28
+ return g(this, null, function* () {
29
+ const r = yield N();
30
+ return r.success ? r.result.name : Date.now().toString();
31
+ });
14
32
  }
15
- async function L(r) {
16
- if (r.length === 0)
17
- return;
18
- const t = await h();
19
- try {
20
- await l.set(t, r), setTimeout(async () => {
21
- const e = await l.getLogLink(t);
22
- e && u.info(`📂 Open the error list manually: ${e}`);
23
- }, 0);
24
- } catch (e) {
25
- g(e);
26
- }
33
+ function A(r) {
34
+ return g(this, null, function* () {
35
+ if (r.length === 0)
36
+ return;
37
+ const t = yield E();
38
+ try {
39
+ yield p.set(t, r), setTimeout(() => g(null, null, function* () {
40
+ const e = yield p.getLogLink(t);
41
+ e && h.info(`📂 Open the error list manually: ${e}`);
42
+ }), 0);
43
+ } catch (e) {
44
+ y(e);
45
+ }
46
+ });
27
47
  }
28
- async function W() {
29
- try {
30
- const r = await h();
31
- return await l.get(r) ?? [];
32
- } catch (r) {
33
- return g(r, {
34
- returnValue: []
35
- });
36
- }
48
+ function rr() {
49
+ return g(this, null, function* () {
50
+ try {
51
+ const r = yield E(), t = yield p.get(r);
52
+ return t != null ? t : [];
53
+ } catch (r) {
54
+ return y(r, {
55
+ returnValue: []
56
+ });
57
+ }
58
+ });
37
59
  }
38
- async function U() {
39
- try {
40
- const r = await h();
41
- await l.remove(r);
42
- } catch (r) {
43
- g(r);
44
- }
60
+ function tr() {
61
+ return g(this, null, function* () {
62
+ try {
63
+ const r = yield E();
64
+ yield p.remove(r);
65
+ } catch (r) {
66
+ y(r);
67
+ }
68
+ });
45
69
  }
46
- function N(r) {
70
+ function W(r) {
47
71
  const t = [], e = [];
48
- let s = "";
49
- const i = /^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/, n = /^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/, m = /^✖\s+(.*?)\s+\[(.*?)\]$/;
72
+ let i = "";
73
+ const s = /^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/, l = /^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/, u = /^✖\s+(.*?)\s+\[(.*?)\]$/;
50
74
  r.split(`
51
- `).forEach((o) => {
52
- if (o.startsWith("/"))
53
- s = o.trim();
75
+ `).forEach((n) => {
76
+ var o, a, v, _, $, C, L, P, S, w, x;
77
+ if (n.startsWith("/"))
78
+ i = n.trim();
54
79
  else {
55
- const c = i.exec(o) || [], f = n.exec(o) || [], p = m.exec(o) || [];
56
- c.length && s ? t.push({
57
- file: s,
58
- position: `${c[1]}:${c[2]}`,
59
- type: c[3] === a.Error ? a.Error : a.Warning,
60
- message: c?.[4]?.trim() ?? "",
61
- rule: c?.[5]?.trim() ?? ""
62
- }) : f.length ? t.push({
63
- file: f?.[1] ?? "",
64
- position: `${f[2]}:${f[3]}`,
65
- type: f[4] === a.Error ? a.Error : a.Warning,
66
- message: f?.[5]?.trim() ?? ""
67
- }) : p.length ? t.push({
80
+ const f = s.exec(n) || [], m = l.exec(n) || [], d = u.exec(n) || [];
81
+ f.length && i ? t.push({
82
+ file: i,
83
+ position: `${f[1]}:${f[2]}`,
84
+ type: f[3] === c.Error ? c.Error : c.Warning,
85
+ message: (a = (o = f == null ? void 0 : f[4]) == null ? void 0 : o.trim()) != null ? a : "",
86
+ rule: (_ = (v = f == null ? void 0 : f[5]) == null ? void 0 : v.trim()) != null ? _ : ""
87
+ }) : m.length ? t.push({
88
+ file: ($ = m == null ? void 0 : m[1]) != null ? $ : "",
89
+ position: `${m[2]}:${m[3]}`,
90
+ type: m[4] === c.Error ? c.Error : c.Warning,
91
+ message: (L = (C = m == null ? void 0 : m[5]) == null ? void 0 : C.trim()) != null ? L : ""
92
+ }) : d.length ? t.push({
68
93
  file: "commitlint",
69
- type: a.Error,
70
- message: p?.[1]?.trim() ?? "",
71
- rule: p?.[2]?.trim() ?? ""
72
- }) : e.push(o.trim());
94
+ type: c.Error,
95
+ message: (S = (P = d == null ? void 0 : d[1]) == null ? void 0 : P.trim()) != null ? S : "",
96
+ rule: (x = (w = d == null ? void 0 : d[2]) == null ? void 0 : w.trim()) != null ? x : ""
97
+ }) : e.push(n.trim());
73
98
  }
74
- }), t.length && L(t), w.DEBUG && e.length && (u.warn("Unmatched lines:"), e.forEach((o) => u.info(` ${o}`)));
99
+ }), t.length && A(t), j.DEBUG && e.length && (h.warn("Unmatched lines:"), e.forEach((n) => h.info(` ${n}`)));
75
100
  }
76
- function j(r) {
101
+ function U(r) {
77
102
  try {
78
103
  const t = JSON.parse(r), e = [];
79
- t.forEach(({ filePath: s, messages: i }) => {
80
- i.forEach(({ severity: n, line: m, column: o, ruleId: c, message: f }) => {
104
+ t.forEach(({ filePath: i, messages: s }) => {
105
+ s.forEach(({ severity: l, line: u, column: n, ruleId: o, message: a }) => {
81
106
  e.push({
82
- type: n === 2 ? a.Error : a.Warning,
83
- file: s,
84
- position: `${m}:${o}`,
85
- rule: c,
86
- message: f
107
+ type: l === 2 ? c.Error : c.Warning,
108
+ file: i,
109
+ position: `${u}:${n}`,
110
+ rule: o,
111
+ message: a
87
112
  });
88
113
  });
89
- }), e.length && L(e);
90
- } catch {
91
- N(r);
114
+ }), e.length && A(e);
115
+ } catch (t) {
116
+ W(r);
92
117
  }
93
118
  }
94
- async function A(r, t = j) {
95
- const e = new AbortController();
96
- E.on("SIGINT", () => {
97
- u.warn("Process interrupted. Terminating..."), e.abort(), E.exit();
98
- });
99
- try {
100
- if (typeof r == "string") {
101
- const { stdout: s, stderr: i } = await k(r, {
102
- maxBuffer: 104857600,
103
- signal: e.signal
104
- });
105
- [s, i].forEach((n) => n && t(n));
119
+ function Y(r) {
120
+ return g(this, arguments, function* (t, e = U) {
121
+ const i = new AbortController();
122
+ I.on("SIGINT", () => {
123
+ h.warn("Process interrupted. Terminating..."), i.abort(), I.exit();
124
+ });
125
+ try {
126
+ if (typeof t == "string") {
127
+ const { stdout: s, stderr: l } = yield K(t, {
128
+ maxBuffer: 104857600,
129
+ signal: i.signal
130
+ });
131
+ [s, l].forEach((u) => u && e(u));
132
+ }
133
+ } catch (s) {
134
+ const { stdout: l, stderr: u, message: n } = s;
135
+ [l, u].forEach((o) => o && e(o)), !u && !l && h.error(`Command failed: ${n}`);
106
136
  }
107
- } catch (s) {
108
- const { stdout: i, stderr: n, message: m } = s;
109
- [i, n].forEach((o) => o && t(o)), !n && !i && u.error(`Command failed: ${m}`);
110
- }
137
+ });
111
138
  }
112
- function Y(r) {
139
+ function er(r) {
113
140
  return { raw: !0, cmd: r };
114
141
  }
115
- function $(r, t) {
116
- return t?.isCurrentProject ? `${y} ${S} ${I} ${r}` : `${y} ${T} ${r}`;
142
+ function T(r, t) {
143
+ return t != null && t.isCurrentProject ? `${k} ${D} ${M} ${r}` : `${k} ${O} ${r}`;
117
144
  }
118
- function B(r, t) {
119
- return typeof r == "function" ? $(r(t), t) : typeof r == "object" && r?.raw === !0 ? r.cmd : typeof r == "string" ? $(r, t) : r;
145
+ function X(r, t) {
146
+ return typeof r == "function" ? T(r(t), t) : typeof r == "object" && (r == null ? void 0 : r.raw) === !0 ? r.cmd : typeof r == "string" ? T(r, t) : r;
120
147
  }
121
- async function X(r) {
122
- const t = await C({ name: x });
123
- if (t.success) {
124
- const e = { isCurrentProject: t.result.isCurrentProject }, s = typeof r == "function" ? r(e) : r;
125
- return Object.fromEntries(
126
- Object.entries(s).map(([i, n]) => [i, B(n, e)])
127
- );
128
- }
148
+ function nr(r) {
149
+ return g(this, null, function* () {
150
+ const t = yield N({ name: b });
151
+ if (t.success) {
152
+ const e = { isCurrentProject: t.result.isCurrentProject }, i = typeof r == "function" ? r(e) : r;
153
+ return Object.fromEntries(
154
+ Object.entries(i).map(([s, l]) => [s, X(l, e)])
155
+ );
156
+ }
157
+ });
129
158
  }
130
- async function F(r, t) {
131
- try {
132
- u.start(`${r}`), w.DEBUG && u.info(`→ ${t}`), await A(t), u.success(`${r} done.`);
133
- } catch (e) {
134
- g(e);
135
- }
159
+ function or(r, t) {
160
+ return g(this, null, function* () {
161
+ try {
162
+ h.start(`${r}`), j.DEBUG && h.info(`→ ${t}`), yield Y(t), h.success(`${r} done.`);
163
+ } catch (e) {
164
+ y(e);
165
+ }
166
+ });
136
167
  }
137
168
  export {
138
- U as clearAllErrorLists,
139
- B as formatCommand,
140
- W as getStoredErrorLists,
141
- Y as rawCommand,
142
- X as resolveCommands,
143
- F as runCommand
169
+ tr as clearAllErrorLists,
170
+ X as formatCommand,
171
+ rr as getStoredErrorLists,
172
+ er as rawCommand,
173
+ nr as resolveCommands,
174
+ or as runCommand
144
175
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./command.type.cjs"),r=require("./command.util.cjs");Object.defineProperty(exports,"E_CommandType",{enumerable:!0,get:()=>e.E_CommandType});exports.clearAllErrorLists=r.clearAllErrorLists;exports.formatCommand=r.formatCommand;exports.getStoredErrorLists=r.getStoredErrorLists;exports.rawCommand=r.rawCommand;exports.resolveCommands=r.resolveCommands;exports.runCommand=r.runCommand;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("@nestjs/core"),P=require("compression"),h=require("cookie-parser"),m=require("cors"),c=require("express"),q=require("express-session"),x=require("express-useragent"),b=require("graphql-upload/graphqlUploadExpress.mjs");var g=Object.defineProperty,l=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,p=(e,r,t)=>r in e?g(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,S=(e,r)=>{for(var t in r||(r={}))d.call(r,t)&&p(e,t,r[t]);if(l)for(var t of l(r))v.call(r,t)&&p(e,t,r[t]);return e},E=(e,r)=>{var t={};for(var s in e)d.call(e,s)&&r.indexOf(s)<0&&(t[s]=e[s]);if(e!=null&&l)for(var s of l(e))r.indexOf(s)<0&&v.call(e,s)&&(t[s]=e[s]);return t},C=(e,r,t)=>new Promise((s,a)=>{var i=n=>{try{o(t.next(n))}catch(f){a(f)}},u=n=>{try{o(t.throw(n))}catch(f){a(f)}},o=n=>n.done?s(n.value):Promise.resolve(n.value).then(i,u);o((t=t.apply(e,r)).next())});function y(e){var r=e,{isDev:t,whiteList:s}=r,a=E(r,["isDev","whiteList"]);return S({origin:(i,u)=>{t||!i||s!=null&&s.includes(i!=null?i:"")?u(null,!0):u(new Error("Not allowed by CORS"),!1)},credentials:!0},a)}function N(e){return m(y(e))}function j(e){return q(e)}function _(e){e.set("trust proxy",1),e.use(h()),e.use(c.urlencoded({extended:!0})),e.use(P()),e.use(x.express())}function O(e,r){r&&(Array.isArray(r)?r:[r]).forEach(s=>{e.use(c.static(s))})}function A(e){const r=c();return _(r),O(r,e==null?void 0:e.static),r.use(b()),r}function I(e){return C(this,null,function*(){const r=yield w.NestFactory.create(e.module);return _(r.getHttpAdapter().getInstance()),O(r.getHttpAdapter().getInstance(),e.static),e.filters&&r.useGlobalFilters(...e.filters),e.pipes&&r.useGlobalPipes(...e.pipes),r})}exports.express=c;exports.createCors=N;exports.createCorsOptions=y;exports.createExpress=A;exports.createNest=I;exports.createSession=j;