@cyberskill/shared 1.209.0 → 1.210.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 (236) hide show
  1. package/dist/config/config.type.js +4 -0
  2. package/dist/config/config.util.js +49 -0
  3. package/dist/config/env/env.util.js +29 -0
  4. package/dist/config/index.js +6 -0
  5. package/dist/{src/config → config}/vitest/vitest.e2e.js +1 -1
  6. package/dist/config/vitest/vitest.unit.js +19 -0
  7. package/dist/{src/node → node}/apollo-server/apollo-server.util.js +5 -7
  8. package/dist/{src/node → node}/cli/index.js +31 -29
  9. package/dist/node/command/command.type.js +4 -0
  10. package/dist/node/command/command.util.js +144 -0
  11. package/dist/node/command/index.js +11 -0
  12. package/dist/{src/node → node}/express/express.util.js +10 -12
  13. package/dist/node/log/index.js +8 -0
  14. package/dist/node/log/log.type.js +4 -0
  15. package/dist/node/mongo/index.js +17 -0
  16. package/dist/node/mongo/mongo.type.js +16 -0
  17. package/dist/{src/node → node}/mongo/mongo.util.js +1 -1
  18. package/dist/node/package/index.js +10 -0
  19. package/dist/node/package/package.type.js +4 -0
  20. package/dist/node/package/package.util.js +225 -0
  21. package/dist/node/path/index.js +52 -0
  22. package/dist/node/path/path.constant.js +273 -0
  23. package/dist/node/upload/index.js +7 -0
  24. package/dist/node/upload/upload.type.js +4 -0
  25. package/dist/{src/node → node}/upload/upload.util.js +34 -35
  26. package/dist/{config-CwzVfkkX.js → 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.js} +1 -1
  27. package/dist/{src/react → react}/apollo-client/apollo-client.component.js +9 -12
  28. package/dist/{src/react → react}/apollo-client/apollo-client.context.js +2 -2
  29. package/dist/{src/react → react}/apollo-client/apollo-client.util.js +3 -3
  30. package/dist/{src/react → react}/apollo-error/apollo-error.component.js +3 -10
  31. package/dist/react/apollo-error/apollo-error.module.scss.js +11 -0
  32. package/dist/{src/react → react}/apollo-error/apollo-error.provider.js +2 -2
  33. package/dist/react/loading/loading.component.js +34 -0
  34. package/dist/react/loading/loading.module.scss.js +15 -0
  35. package/dist/react/loading/loading.provider.js +17 -0
  36. package/dist/react/next-intl/next-intl.provider.js +23 -0
  37. package/dist/typescript/index.js +4 -0
  38. package/dist/{src/util → util}/common/common.util.js +1 -1
  39. package/package.json +68 -68
  40. package/dist/index-BG1UznTl.js +0 -628
  41. package/dist/magic-string.es-BQ9KnLz-.js +0 -659
  42. package/dist/src/config/config.util.js +0 -50
  43. package/dist/src/config/env/env.util.js +0 -29
  44. package/dist/src/config/index.js +0 -5
  45. package/dist/src/config/vitest/vitest.unit.js +0 -19
  46. package/dist/src/config/vitest/vitest.unit.setup.js +0 -30990
  47. package/dist/src/node/command/command.util.js +0 -16
  48. package/dist/src/node/command/index.js +0 -10
  49. package/dist/src/node/log/index.js +0 -8
  50. package/dist/src/node/mongo/index.js +0 -26
  51. package/dist/src/node/package/index.js +0 -9
  52. package/dist/src/node/package/package.util.js +0 -13
  53. package/dist/src/node/path/index.js +0 -52
  54. package/dist/src/node/path/path.constant.js +0 -49
  55. package/dist/src/node/upload/index.js +0 -6
  56. package/dist/src/react/apollo-client/apollo-client.hook.js +0 -11
  57. package/dist/src/react/loading/loading.component.js +0 -40
  58. package/dist/src/react/loading/loading.provider.js +0 -17
  59. package/dist/src/react/next-intl/next-intl.provider.js +0 -24
  60. package/dist/src/typescript/style.d.js +0 -1
  61. /package/dist/{src/config → config}/commitlint/index.d.ts +0 -0
  62. /package/dist/{src/config → config}/commitlint/index.js +0 -0
  63. /package/dist/{src/config → config}/config.type.d.ts +0 -0
  64. /package/dist/{src/config → config}/config.util.d.ts +0 -0
  65. /package/dist/{src/config → config}/env/env.constant.d.ts +0 -0
  66. /package/dist/{src/config → config}/env/env.constant.js +0 -0
  67. /package/dist/{src/config → config}/env/env.type.d.ts +0 -0
  68. /package/dist/{src/config → config}/env/env.util.d.ts +0 -0
  69. /package/dist/{src/config → config}/env/index.d.ts +0 -0
  70. /package/dist/{src/config → config}/env/index.js +0 -0
  71. /package/dist/{src/config → config}/eslint/index.d.ts +0 -0
  72. /package/dist/{src/config → config}/eslint/index.js +0 -0
  73. /package/dist/{src/config → config}/graphql-codegen/graphql-codegen.type.d.ts +0 -0
  74. /package/dist/{src/config → config}/graphql-codegen/graphql-codegen.util.d.ts +0 -0
  75. /package/dist/{src/config → config}/graphql-codegen/graphql-codegen.util.js +0 -0
  76. /package/dist/{src/config → config}/graphql-codegen/index.d.ts +0 -0
  77. /package/dist/{src/config → config}/graphql-codegen/index.js +0 -0
  78. /package/dist/{src/config → config}/index.d.ts +0 -0
  79. /package/dist/{src/config → config}/lint-staged/index.d.ts +0 -0
  80. /package/dist/{src/config → config}/lint-staged/index.js +0 -0
  81. /package/dist/{src/config → config}/vitest/index.d.ts +0 -0
  82. /package/dist/{src/config → config}/vitest/index.js +0 -0
  83. /package/dist/{src/config → config}/vitest/vitest.e2e.d.ts +0 -0
  84. /package/dist/{src/config → config}/vitest/vitest.unit.d.ts +0 -0
  85. /package/dist/{src/constant → constant}/common.d.ts +0 -0
  86. /package/dist/{src/constant → constant}/common.js +0 -0
  87. /package/dist/{src/constant → constant}/index.d.ts +0 -0
  88. /package/dist/{src/constant → constant}/index.js +0 -0
  89. /package/dist/{src/constant → constant}/response-status.d.ts +0 -0
  90. /package/dist/{src/constant → constant}/response-status.js +0 -0
  91. /package/dist/{src/node → node}/apollo-server/apollo-server.type.d.ts +0 -0
  92. /package/dist/{src/node → node}/apollo-server/apollo-server.util.d.ts +0 -0
  93. /package/dist/{src/node → node}/apollo-server/index.d.ts +0 -0
  94. /package/dist/{src/node → node}/apollo-server/index.js +0 -0
  95. /package/dist/{src/node → node}/cli/index.d.ts +0 -0
  96. /package/dist/{src/node → node}/command/command.type.d.ts +0 -0
  97. /package/dist/{src/node → node}/command/command.util.d.ts +0 -0
  98. /package/dist/{src/node → node}/command/index.d.ts +0 -0
  99. /package/dist/{src/node → node}/express/express.type.d.ts +0 -0
  100. /package/dist/{src/node → node}/express/express.util.d.ts +0 -0
  101. /package/dist/{src/node → node}/express/index.d.ts +0 -0
  102. /package/dist/{src/node → node}/express/index.js +0 -0
  103. /package/dist/{src/node → node}/fs/fs.type.d.ts +0 -0
  104. /package/dist/{src/node → node}/fs/fs.util.d.ts +0 -0
  105. /package/dist/{src/node → node}/fs/fs.util.js +0 -0
  106. /package/dist/{src/node → node}/fs/index.d.ts +0 -0
  107. /package/dist/{src/node → node}/fs/index.js +0 -0
  108. /package/dist/{src/node → node}/log/index.d.ts +0 -0
  109. /package/dist/{src/node → node}/log/log.type.d.ts +0 -0
  110. /package/dist/{src/node → node}/log/log.util.d.ts +0 -0
  111. /package/dist/{src/node → node}/log/log.util.js +0 -0
  112. /package/dist/{src/node → node}/mongo/index.d.ts +0 -0
  113. /package/dist/{src/node → node}/mongo/mongo.constant.d.ts +0 -0
  114. /package/dist/{src/node → node}/mongo/mongo.constant.js +0 -0
  115. /package/dist/{src/node → node}/mongo/mongo.type.d.ts +0 -0
  116. /package/dist/{src/node → node}/mongo/mongo.util.d.ts +0 -0
  117. /package/dist/{src/node → node}/package/index.d.ts +0 -0
  118. /package/dist/{src/node → node}/package/package.type.d.ts +0 -0
  119. /package/dist/{src/node → node}/package/package.util.d.ts +0 -0
  120. /package/dist/{src/node → node}/path/index.d.ts +0 -0
  121. /package/dist/{src/node → node}/path/path.constant.d.ts +0 -0
  122. /package/dist/{src/node → node}/path/path.util.d.ts +0 -0
  123. /package/dist/{src/node → node}/path/path.util.js +0 -0
  124. /package/dist/{src/node → node}/storage/index.d.ts +0 -0
  125. /package/dist/{src/node → node}/storage/index.js +0 -0
  126. /package/dist/{src/node → node}/storage/storage.util.d.ts +0 -0
  127. /package/dist/{src/node → node}/storage/storage.util.js +0 -0
  128. /package/dist/{src/node → node}/upload/index.d.ts +0 -0
  129. /package/dist/{src/node → node}/upload/upload.type.d.ts +0 -0
  130. /package/dist/{src/node → node}/upload/upload.util.d.ts +0 -0
  131. /package/dist/{src/node → node}/ws/index.d.ts +0 -0
  132. /package/dist/{src/node → node}/ws/index.js +0 -0
  133. /package/dist/{src/node → node}/ws/ts.util.d.ts +0 -0
  134. /package/dist/{src/node → node}/ws/ts.util.js +0 -0
  135. /package/dist/{src/node → node}/ws/ws.type.d.ts +0 -0
  136. /package/dist/{src/react → react}/apollo-client/apollo-client.component.d.ts +0 -0
  137. /package/dist/{src/react → react}/apollo-client/apollo-client.constant.d.ts +0 -0
  138. /package/dist/{src/react → react}/apollo-client/apollo-client.constant.js +0 -0
  139. /package/dist/{src/react → react}/apollo-client/apollo-client.context.d.ts +0 -0
  140. /package/dist/{src/react → react}/apollo-client/apollo-client.hook.d.ts +0 -0
  141. /package/dist/{src/react → react}/apollo-client/apollo-client.type.d.ts +0 -0
  142. /package/dist/{src/react → react}/apollo-client/apollo-client.util.d.ts +0 -0
  143. /package/dist/{src/react → react}/apollo-client/index.d.ts +0 -0
  144. /package/dist/{src/react → react}/apollo-client/index.js +0 -0
  145. /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.component.d.ts +0 -0
  146. /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.component.js +0 -0
  147. /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts +0 -0
  148. /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.rsc.js +0 -0
  149. /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.util.d.ts +0 -0
  150. /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.util.js +0 -0
  151. /package/dist/{src/react → react}/apollo-client-nextjs/index.d.ts +0 -0
  152. /package/dist/{src/react → react}/apollo-client-nextjs/index.js +0 -0
  153. /package/dist/{src/react → react}/apollo-error/apollo-error.component.d.ts +0 -0
  154. /package/dist/{src/react → react}/apollo-error/apollo-error.context.d.ts +0 -0
  155. /package/dist/{src/react → react}/apollo-error/apollo-error.context.js +0 -0
  156. /package/dist/{src/react → react}/apollo-error/apollo-error.hook.d.ts +0 -0
  157. /package/dist/{src/react → react}/apollo-error/apollo-error.hook.js +0 -0
  158. /package/dist/{src/react → react}/apollo-error/apollo-error.provider.d.ts +0 -0
  159. /package/dist/{src/react → react}/apollo-error/apollo-error.type.d.ts +0 -0
  160. /package/dist/{src/react → react}/apollo-error/apollo-error.util.d.ts +0 -0
  161. /package/dist/{src/react → react}/apollo-error/apollo-error.util.js +0 -0
  162. /package/dist/{src/react → react}/apollo-error/index.d.ts +0 -0
  163. /package/dist/{src/react → react}/apollo-error/index.js +0 -0
  164. /package/dist/{src/react → react}/i18next/i18next.hook.d.ts +0 -0
  165. /package/dist/{src/react → react}/i18next/i18next.hook.js +0 -0
  166. /package/dist/{src/react → react}/i18next/i18next.util.d.ts +0 -0
  167. /package/dist/{src/react → react}/i18next/i18next.util.js +0 -0
  168. /package/dist/{src/react → react}/i18next/index.d.ts +0 -0
  169. /package/dist/{src/react → react}/i18next/index.js +0 -0
  170. /package/dist/{src/react → react}/loading/index.d.ts +0 -0
  171. /package/dist/{src/react → react}/loading/index.js +0 -0
  172. /package/dist/{src/react → react}/loading/loading.component.d.ts +0 -0
  173. /package/dist/{src/react → react}/loading/loading.context.d.ts +0 -0
  174. /package/dist/{src/react → react}/loading/loading.context.js +0 -0
  175. /package/dist/{src/react → react}/loading/loading.hook.d.ts +0 -0
  176. /package/dist/{src/react → react}/loading/loading.hook.js +0 -0
  177. /package/dist/{src/react → react}/loading/loading.provider.d.ts +0 -0
  178. /package/dist/{src/react → react}/loading/loading.type.d.ts +0 -0
  179. /package/dist/{src/react → react}/log/index.d.ts +0 -0
  180. /package/dist/{src/react → react}/log/index.js +0 -0
  181. /package/dist/{src/react → react}/log/log.type.d.ts +0 -0
  182. /package/dist/{src/react → react}/log/log.util.d.ts +0 -0
  183. /package/dist/{src/react → react}/log/log.util.js +0 -0
  184. /package/dist/{src/react → react}/next-intl/index.d.ts +0 -0
  185. /package/dist/{src/react → react}/next-intl/index.js +0 -0
  186. /package/dist/{src/react → react}/next-intl/next-intl.constant.d.ts +0 -0
  187. /package/dist/{src/react → react}/next-intl/next-intl.constant.js +0 -0
  188. /package/dist/{src/react → react}/next-intl/next-intl.context.d.ts +0 -0
  189. /package/dist/{src/react → react}/next-intl/next-intl.context.js +0 -0
  190. /package/dist/{src/react → react}/next-intl/next-intl.hoc.d.ts +0 -0
  191. /package/dist/{src/react → react}/next-intl/next-intl.hoc.js +0 -0
  192. /package/dist/{src/react → react}/next-intl/next-intl.hook.d.ts +0 -0
  193. /package/dist/{src/react → react}/next-intl/next-intl.hook.js +0 -0
  194. /package/dist/{src/react → react}/next-intl/next-intl.provider.d.ts +0 -0
  195. /package/dist/{src/react → react}/next-intl/next-intl.type.d.ts +0 -0
  196. /package/dist/{src/react → react}/storage/index.d.ts +0 -0
  197. /package/dist/{src/react → react}/storage/index.js +0 -0
  198. /package/dist/{src/react → react}/storage/storage.hook.d.ts +0 -0
  199. /package/dist/{src/react → react}/storage/storage.hook.js +0 -0
  200. /package/dist/{src/react → react}/storage/storage.util.d.ts +0 -0
  201. /package/dist/{src/react → react}/storage/storage.util.js +0 -0
  202. /package/dist/{src/react → react}/toast/index.d.ts +0 -0
  203. /package/dist/{src/react → react}/toast/index.js +0 -0
  204. /package/dist/{src/react → react}/userback/index.d.ts +0 -0
  205. /package/dist/{src/react → react}/userback/index.js +0 -0
  206. /package/dist/{src/react → react}/userback/userback.component.d.ts +0 -0
  207. /package/dist/{src/react → react}/userback/userback.component.js +0 -0
  208. /package/dist/{src/react → react}/userback/userback.type.d.ts +0 -0
  209. /package/dist/{src/typescript → typescript}/common.type.d.ts +0 -0
  210. /package/dist/{src/typescript/index.js → typescript/common.type.js} +0 -0
  211. /package/dist/{src/typescript → typescript}/index.d.ts +0 -0
  212. /package/dist/{src/typescript → typescript}/react.type.d.ts +0 -0
  213. /package/dist/{src/util → util}/common/common.type.d.ts +0 -0
  214. /package/dist/{src/util → util}/common/common.util.d.ts +0 -0
  215. /package/dist/{src/util → util}/common/index.d.ts +0 -0
  216. /package/dist/{src/util → util}/common/index.js +0 -0
  217. /package/dist/{src/util → util}/index.d.ts +0 -0
  218. /package/dist/{src/util → util}/index.js +0 -0
  219. /package/dist/{src/util → util}/object/index.d.ts +0 -0
  220. /package/dist/{src/util → util}/object/index.js +0 -0
  221. /package/dist/{src/util → util}/object/object.util.d.ts +0 -0
  222. /package/dist/{src/util → util}/object/object.util.js +0 -0
  223. /package/dist/{src/util → util}/serializer/index.d.ts +0 -0
  224. /package/dist/{src/util → util}/serializer/index.js +0 -0
  225. /package/dist/{src/util → util}/serializer/serializer.type.d.ts +0 -0
  226. /package/dist/{src/util → util}/serializer/serializer.util.d.ts +0 -0
  227. /package/dist/{src/util → util}/serializer/serializer.util.js +0 -0
  228. /package/dist/{src/util → util}/string/index.d.ts +0 -0
  229. /package/dist/{src/util → util}/string/index.js +0 -0
  230. /package/dist/{src/util → util}/string/string.type.d.ts +0 -0
  231. /package/dist/{src/util → util}/string/string.util.d.ts +0 -0
  232. /package/dist/{src/util → util}/string/string.util.js +0 -0
  233. /package/dist/{src/util → util}/validate/index.d.ts +0 -0
  234. /package/dist/{src/util → util}/validate/index.js +0 -0
  235. /package/dist/{src/util → util}/validate/validate.util.d.ts +0 -0
  236. /package/dist/{src/util → util}/validate/validate.util.js +0 -0
@@ -1,628 +0,0 @@
1
- import ne from "fs-extra";
2
- import { join as h, resolveWorkingPath as p } from "./src/node/path/path.util.js";
3
- import { exec as re } from "node:child_process";
4
- import k from "node:process";
5
- import * as ae from "node:util";
6
- import { E_IssueType as f } from "./src/node/log/index.js";
7
- import { storage as G } from "./src/node/storage/storage.util.js";
8
- import oe from "node-fetch";
9
- import { pathExistsSync as T, readJsonSync as y, writeFileSync as ie } from "./src/node/fs/fs.util.js";
10
- import { log as C, catchError as I } from "./src/node/log/log.util.js";
11
- import { getEnv as w } from "./src/config/env/env.util.js";
12
- var o = /* @__PURE__ */ ((e) => (e.CLI = "CLI", e.STRING = "STRING", e.FUNCTION = "FUNCTION", e))(o || {}), a = /* @__PURE__ */ ((e) => (e.DEPENDENCY = "dependencies", e.DEV_DEPENDENCY = "devDependencies", e.PEER_DEPENDENCY = "peerDependencies", e.BUNDLE_DEPENDENCY = "bundleDependencies", e.OPTIONAL_DEPENDENCY = "optionalDependencies", e))(a || {});
13
- const ce = w();
14
- async function le(e) {
15
- try {
16
- const t = await oe(`https://registry.npmjs.org/${e}/latest`);
17
- if (!t.ok)
18
- throw new Error(`Failed to fetch latest version: ${t.status} ${t.statusText}`);
19
- const { version: s } = await t.json();
20
- return {
21
- success: !0,
22
- result: s
23
- };
24
- } catch (t) {
25
- return I(t);
26
- }
27
- }
28
- async function K(e) {
29
- try {
30
- if (!e) {
31
- if (T(i.PACKAGE_JSON)) {
32
- const F = y(i.PACKAGE_JSON), { name: se = "", version: J = "" } = F;
33
- return {
34
- success: !0,
35
- result: {
36
- name: se,
37
- currentVersion: J,
38
- latestVersion: J,
39
- isCurrentProject: !0,
40
- isInstalled: !0,
41
- isUpToDate: !0,
42
- isDependency: !1,
43
- isDevDependency: !1,
44
- installedPath: i.PACKAGE_JSON,
45
- file: F
46
- }
47
- };
48
- }
49
- return {
50
- success: !0,
51
- result: {
52
- name: "",
53
- currentVersion: "",
54
- latestVersion: "",
55
- isCurrentProject: !1,
56
- isInstalled: !1,
57
- isUpToDate: !1,
58
- isDependency: !1,
59
- isDevDependency: !1,
60
- installedPath: "",
61
- file: {}
62
- }
63
- };
64
- }
65
- if (!T(i.PACKAGE_JSON))
66
- return {
67
- success: !0,
68
- result: {
69
- name: e.name,
70
- currentVersion: "",
71
- latestVersion: "",
72
- isCurrentProject: !1,
73
- isInstalled: !1,
74
- isUpToDate: !1,
75
- isDependency: e.type === a.DEPENDENCY,
76
- isDevDependency: e.type === a.DEV_DEPENDENCY,
77
- installedPath: "",
78
- file: {}
79
- }
80
- };
81
- const t = y(i.PACKAGE_JSON), { name: s, version: r = "", dependencies: c = {}, devDependencies: l = {} } = t;
82
- if (e.name === s)
83
- return {
84
- success: !0,
85
- result: {
86
- name: s,
87
- currentVersion: r,
88
- latestVersion: r,
89
- isCurrentProject: !0,
90
- isInstalled: !0,
91
- isUpToDate: !0,
92
- isDependency: e.type === a.DEPENDENCY,
93
- isDevDependency: e.type === a.DEV_DEPENDENCY,
94
- installedPath: i.PACKAGE_JSON,
95
- file: t
96
- }
97
- };
98
- const m = e.name in c, n = e.name in l, u = await le(e.name);
99
- if (!u.success)
100
- return {
101
- success: !0,
102
- result: {
103
- name: e.name,
104
- currentVersion: "",
105
- latestVersion: "",
106
- isCurrentProject: !1,
107
- isInstalled: !1,
108
- isUpToDate: !1,
109
- isDependency: m,
110
- isDevDependency: n,
111
- installedPath: "",
112
- file: {}
113
- }
114
- };
115
- if (!m && !n)
116
- return {
117
- success: !0,
118
- result: {
119
- name: e.name,
120
- currentVersion: "",
121
- latestVersion: u.result,
122
- isCurrentProject: !1,
123
- isInstalled: !1,
124
- isUpToDate: !1,
125
- isDependency: e.type === a.DEPENDENCY,
126
- isDevDependency: e.type === a.DEV_DEPENDENCY,
127
- installedPath: "",
128
- file: {}
129
- }
130
- };
131
- const N = c[e.name] ?? l[e.name] ?? "", d = h(ce.CWD, v, e.name, U);
132
- if (!T(d))
133
- return {
134
- success: !0,
135
- result: {
136
- name: e.name,
137
- currentVersion: "",
138
- latestVersion: u.result,
139
- isCurrentProject: !1,
140
- isInstalled: !1,
141
- isUpToDate: !1,
142
- isDependency: m,
143
- isDevDependency: n,
144
- installedPath: "",
145
- file: {}
146
- }
147
- };
148
- const P = y(d), { version: j = "" } = P;
149
- return N !== j ? {
150
- success: !0,
151
- result: {
152
- name: e.name,
153
- currentVersion: j || N,
154
- latestVersion: u.result,
155
- isCurrentProject: !1,
156
- isInstalled: !0,
157
- isUpToDate: !1,
158
- isDependency: m,
159
- isDevDependency: n,
160
- installedPath: d,
161
- file: P
162
- }
163
- } : {
164
- success: !0,
165
- result: {
166
- name: e.name,
167
- currentVersion: N,
168
- latestVersion: u.result,
169
- isCurrentProject: !1,
170
- isInstalled: !0,
171
- isUpToDate: N === u.result,
172
- isDependency: m,
173
- isDevDependency: n,
174
- installedPath: d,
175
- file: P
176
- }
177
- };
178
- } catch (t) {
179
- return I(t);
180
- }
181
- }
182
- async function x(e) {
183
- try {
184
- const t = y(i.PACKAGE_JSON), s = t.dependencies ?? {}, r = t.devDependencies ?? {};
185
- e.isDependency ? s[e.name] = e.latestVersion : e.isDevDependency && (r[e.name] = e.latestVersion), ie(i.PACKAGE_JSON, JSON.stringify(t, null, 4)), C.info(`Updated "${e.name}" to version ${e.latestVersion}`);
186
- } catch (t) {
187
- I(t);
188
- }
189
- }
190
- async function Ee() {
191
- try {
192
- const e = [
193
- { command: () => O.pnpmInstallStandard(), message: "Installing dependencies (standard)" },
194
- { command: () => O.pnpmInstallLegacy(), message: "Retrying with legacy peer dependencies" },
195
- { command: () => O.pnpmInstallForce(), message: "Retrying with force install" }
196
- ];
197
- for (const { command: t, message: s } of e)
198
- try {
199
- const r = await t();
200
- await Q(`${s} using: ${r}`, r);
201
- return;
202
- } catch (r) {
203
- I(r);
204
- }
205
- } catch (e) {
206
- I(e);
207
- }
208
- }
209
- async function me(e, t) {
210
- try {
211
- if (!T(i.PACKAGE_JSON)) {
212
- C.error("package.json not found. Aborting setup.");
213
- return;
214
- }
215
- const r = (await Promise.all(e.map(K))).filter((n) => n.success && !!n.result && !n.result.isCurrentProject).map((n) => n.result), c = r.filter((n) => !n.isInstalled), l = r.filter((n) => !n.isUpToDate), m = [];
216
- t?.install && c.length > 0 && m.push(...c.map(x)), t?.update && l.length > 0 && m.push(...l.map(x)), m.length > 0 && (await Promise.all(m), await Ee(), await Q("Running ESLint with auto-fix", await O.eslintFix()));
217
- for (const n of t?.callbacks ?? [])
218
- await n();
219
- } catch (s) {
220
- I(s);
221
- }
222
- }
223
- const q = w(), pe = ae.promisify(re);
224
- async function Y() {
225
- const e = await K();
226
- return e.success ? e.result.name : Date.now().toString();
227
- }
228
- async function z(e) {
229
- if (e.length === 0)
230
- return;
231
- const t = await Y();
232
- try {
233
- await G.set(t, e), setTimeout(async () => {
234
- const s = await G.getLogLink(t);
235
- s && C.info(`📂 Open the error list manually: ${s}`);
236
- }, 0);
237
- } catch (s) {
238
- I(s);
239
- }
240
- }
241
- async function qe() {
242
- try {
243
- const e = await Y();
244
- return await G.get(e) ?? [];
245
- } catch (e) {
246
- return I(e, {
247
- returnValue: []
248
- });
249
- }
250
- }
251
- async function ze() {
252
- try {
253
- const e = await Y();
254
- await G.remove(e);
255
- } catch (e) {
256
- I(e);
257
- }
258
- }
259
- function ue(e) {
260
- const t = [], s = [];
261
- let r = "";
262
- const c = /^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/, l = /^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/, m = /^✖\s+(.*?)\s+\[(.*?)\]$/;
263
- e.split(`
264
- `).forEach((n) => {
265
- if (n.startsWith("/"))
266
- r = n.trim();
267
- else {
268
- const u = c.exec(n) || [], N = l.exec(n) || [], d = m.exec(n) || [];
269
- u.length && r ? t.push({
270
- file: r,
271
- position: `${u[1]}:${u[2]}`,
272
- type: u[3] === f.Error ? f.Error : f.Warning,
273
- message: u?.[4]?.trim() ?? "",
274
- rule: u?.[5]?.trim() ?? ""
275
- }) : N.length ? t.push({
276
- file: N?.[1] ?? "",
277
- position: `${N[2]}:${N[3]}`,
278
- type: N[4] === f.Error ? f.Error : f.Warning,
279
- message: N?.[5]?.trim() ?? ""
280
- }) : d.length ? t.push({
281
- file: "commitlint",
282
- type: f.Error,
283
- message: d?.[1]?.trim() ?? "",
284
- rule: d?.[2]?.trim() ?? ""
285
- }) : s.push(n.trim());
286
- }
287
- }), t.length && z(t), q.DEBUG && s.length && (C.warn("Unmatched lines:"), s.forEach((n) => C.info(` ${n}`)));
288
- }
289
- function Ne(e) {
290
- try {
291
- const t = JSON.parse(e), s = [];
292
- t.forEach(({ filePath: r, messages: c }) => {
293
- c.forEach(({ severity: l, line: m, column: n, ruleId: u, message: N }) => {
294
- s.push({
295
- type: l === 2 ? f.Error : f.Warning,
296
- file: r,
297
- position: `${m}:${n}`,
298
- rule: u,
299
- message: N
300
- });
301
- });
302
- }), s.length && z(s);
303
- } catch {
304
- ue(e);
305
- }
306
- }
307
- async function Ce(e, t = Ne) {
308
- const s = new AbortController();
309
- k.on("SIGINT", () => {
310
- C.warn("Process interrupted. Terminating..."), s.abort(), k.exit();
311
- });
312
- try {
313
- if (typeof e == "string") {
314
- const { stdout: r, stderr: c } = await pe(e, {
315
- maxBuffer: 104857600,
316
- signal: s.signal
317
- });
318
- [r, c].forEach((l) => l && t(l));
319
- }
320
- } catch (r) {
321
- const { stdout: c, stderr: l, message: m } = r;
322
- [c, l].forEach((n) => n && t(n)), !l && !c && C.error(`Command failed: ${m}`);
323
- }
324
- }
325
- function A(e) {
326
- return { raw: !0, cmd: e };
327
- }
328
- function b(e, t) {
329
- return t?.isCurrentProject ? `${R} ${_} ${Le} ${e}` : `${R} ${Se} ${e}`;
330
- }
331
- function $(e, t) {
332
- return typeof e == "function" ? b(e(t), t) : typeof e == "object" && e?.raw === !0 ? e.cmd : typeof e == "string" ? b(e, t) : e;
333
- }
334
- async function Qe(e) {
335
- const t = await K({ name: V });
336
- if (t.success) {
337
- const s = { isCurrentProject: t.result.isCurrentProject }, r = typeof e == "function" ? e(s) : e;
338
- return Object.fromEntries(
339
- Object.entries(r).map(([c, l]) => [c, $(l, s)])
340
- );
341
- }
342
- }
343
- async function Q(e, t) {
344
- try {
345
- C.start(`${e}`), q.DEBUG && C.info(`→ ${t}`), await Ce(t), C.success(`${e} done.`);
346
- } catch (s) {
347
- I(s);
348
- }
349
- }
350
- const Ie = w(), M = Ie.CWD, V = "@cyberskill/shared", v = "node_modules", fe = "dist", de = "public", U = "package.json", _e = "package-lock.json", De = "tsconfig.json", ge = ".gitignore", Te = ".simple-git-hooks.json", ye = "pnpm-lock.yaml", Oe = ".git/hooks/", Ge = ".git/COMMIT_EDITMSG", Pe = ".migrate-mongo.config.js", D = (() => {
351
- const t = ne.readJsonSync(p(U)).name === V ? M : h(M, v, V);
352
- return h(t, fe);
353
- })(), Se = "cyberskill", Le = "src/node/cli/index.ts", H = "eslint", B = "eslint", W = "vitest", X = "vitest", he = "@commitlint/cli", Ae = "@commitlint/config-conventional", Z = "commitlint", $e = "lint-staged", ee = "lint-staged", Me = "typescript", Ve = "tsc", _ = "tsx", te = "git", g = "pnpm", R = "pnpm exec", Re = "simple-git-hooks", we = "simple-git-hooks", Ke = "@eslint/config-inspector", Ye = "eslint-config-inspector", ve = "node-modules-inspector", Ue = "node-modules-inspector", S = "migrate-mongo", L = "./node_modules/migrate-mongo/bin/migrate-mongo", i = {
354
- CYBERSKILL_DIRECTORY: D,
355
- WORKING_DIRECTORY: M,
356
- PUBLIC_DIRECTORY: p(de),
357
- TS_CONFIG: p(De),
358
- GIT_IGNORE: p(ge),
359
- GIT_HOOK: p(Oe),
360
- GIT_COMMIT_MSG: p(Ge),
361
- SIMPLE_GIT_HOOKS_JSON: p(Te),
362
- PACKAGE_JSON: p(U),
363
- PACKAGE_LOCK_JSON: p(_e),
364
- PNPM_LOCK_YAML: p(ye),
365
- NODE_MODULES: p(v),
366
- MIGRATE_MONGO_CONFIG: p(Pe),
367
- LINT_STAGED_CONFIG: p(`${D}/src/config/lint-staged/index.js`),
368
- COMMITLINT_CONFIG: p(`${D}/src/config/commitlint/index.js`),
369
- VITEST_UNIT_CONFIG: p(`${D}/src/config/vitest/vitest.unit.js`),
370
- VITEST_UNIT_SETUP_CONFIG: p(`${D}/src/config/vitest/vitest.unit.setup.js`),
371
- VITEST_E2E_CONFIG: p(`${D}/src/config/vitest/vitest.e2e.js`)
372
- };
373
- function Ze({ isCurrentProject: e }) {
374
- return {
375
- "pre-commit": ee,
376
- "commit-msg": Z,
377
- ...e && { "pre-push": A(`${te} pull`) }
378
- };
379
- }
380
- function E({ type: e, packages: t, command: s }) {
381
- const r = t?.reduce((c, l) => (c.some((m) => m.name === l.name) || c.push(l), c), []);
382
- return async () => {
383
- switch (e) {
384
- case o.CLI:
385
- return r?.length && await me(r, {
386
- install: !0
387
- }), $(A(`${R} ${s}`));
388
- case o.STRING:
389
- return $(A(s));
390
- default:
391
- throw new Error("Unsupported command type");
392
- }
393
- };
394
- }
395
- const O = {
396
- simpleGitHooks: E({
397
- type: o.CLI,
398
- packages: [
399
- {
400
- name: Re,
401
- type: a.DEV_DEPENDENCY
402
- }
403
- ],
404
- command: we
405
- }),
406
- eslintInspect: E({
407
- type: o.CLI,
408
- packages: [
409
- {
410
- name: Ke,
411
- type: a.DEV_DEPENDENCY
412
- }
413
- ],
414
- command: Ye
415
- }),
416
- nodeModulesInspect: E({
417
- type: o.CLI,
418
- packages: [
419
- {
420
- name: ve,
421
- type: a.DEV_DEPENDENCY
422
- }
423
- ],
424
- command: Ue
425
- }),
426
- eslintCheck: E({
427
- type: o.CLI,
428
- packages: [
429
- {
430
- name: H,
431
- type: a.DEV_DEPENDENCY
432
- }
433
- ],
434
- command: `${B} ${i.WORKING_DIRECTORY} --no-cache`
435
- }),
436
- eslintFix: E({
437
- type: o.CLI,
438
- packages: [
439
- {
440
- name: H,
441
- type: a.DEV_DEPENDENCY
442
- }
443
- ],
444
- command: `${B} ${i.WORKING_DIRECTORY} --fix --no-cache`
445
- }),
446
- typescriptCheck: E({
447
- type: o.CLI,
448
- packages: [
449
- {
450
- name: Me,
451
- type: a.DEV_DEPENDENCY
452
- }
453
- ],
454
- command: `${Ve} -p ${i.TS_CONFIG} --noEmit`
455
- }),
456
- testUnit: E({
457
- type: o.CLI,
458
- packages: [
459
- {
460
- name: W,
461
- type: a.DEV_DEPENDENCY
462
- }
463
- ],
464
- command: `${X} --config ${i.VITEST_UNIT_CONFIG}`
465
- }),
466
- testE2e: E({
467
- type: o.CLI,
468
- packages: [
469
- {
470
- name: W,
471
- type: a.DEV_DEPENDENCY
472
- }
473
- ],
474
- command: `${X} --config ${i.VITEST_E2E_CONFIG}`
475
- }),
476
- mongoMigrateCreate: (e) => E({
477
- type: o.CLI,
478
- packages: [
479
- {
480
- name: _,
481
- type: a.DEPENDENCY
482
- },
483
- {
484
- name: S,
485
- type: a.DEPENDENCY
486
- }
487
- ],
488
- command: `${_} ${L} create ${e} -f ${i.MIGRATE_MONGO_CONFIG}`
489
- })(),
490
- mongoMigrateUp: E({
491
- type: o.CLI,
492
- packages: [
493
- {
494
- name: _,
495
- type: a.DEPENDENCY
496
- },
497
- {
498
- name: S,
499
- type: a.DEPENDENCY
500
- }
501
- ],
502
- command: `${_} ${L} up -f ${i.MIGRATE_MONGO_CONFIG}`
503
- }),
504
- mongoMigrateDown: E({
505
- type: o.CLI,
506
- packages: [
507
- {
508
- name: _,
509
- type: a.DEPENDENCY
510
- },
511
- {
512
- name: S,
513
- type: a.DEPENDENCY
514
- }
515
- ],
516
- command: `${_} ${L} down -f ${i.MIGRATE_MONGO_CONFIG}`
517
- }),
518
- commitLint: E({
519
- type: o.CLI,
520
- packages: [
521
- {
522
- name: he,
523
- type: a.DEV_DEPENDENCY
524
- },
525
- {
526
- name: Ae,
527
- type: a.DEV_DEPENDENCY
528
- }
529
- ],
530
- command: `${Z} --edit ${i.GIT_COMMIT_MSG} --config ${i.COMMITLINT_CONFIG}`
531
- }),
532
- lintStaged: E({
533
- type: o.CLI,
534
- packages: [
535
- {
536
- name: $e,
537
- type: a.DEV_DEPENDENCY
538
- }
539
- ],
540
- command: `${ee} --config ${i.LINT_STAGED_CONFIG}`
541
- }),
542
- configureGitHook: E({
543
- type: o.STRING,
544
- command: `${te} config core.hooksPath ${i.GIT_HOOK}`
545
- }),
546
- build: E({
547
- type: o.STRING,
548
- command: `${g} run --if-present build`
549
- }),
550
- pnpmInstallStandard: E({
551
- type: o.STRING,
552
- command: `${g} install --ignore-scripts`
553
- }),
554
- pnpmInstallLegacy: E({
555
- type: o.STRING,
556
- command: `${g} install --ignore-scripts --legacy-peer-deps`
557
- }),
558
- pnpmInstallForce: E({
559
- type: o.STRING,
560
- command: `${g} install --ignore-scripts --force`
561
- }),
562
- pnpmPruneStore: E({
563
- type: o.STRING,
564
- command: `${g} store prune`
565
- }),
566
- pnpmCleanCache: E({
567
- type: o.STRING,
568
- command: `${g} cache delete`
569
- })
570
- };
571
- export {
572
- Ue as $,
573
- he as A,
574
- fe as B,
575
- Se as C,
576
- Ae as D,
577
- a as E,
578
- Z as F,
579
- ge as G,
580
- ee as H,
581
- Me as I,
582
- Ve as J,
583
- _ as K,
584
- $e as L,
585
- Pe as M,
586
- v as N,
587
- te as O,
588
- i as P,
589
- g as Q,
590
- R,
591
- Te as S,
592
- De as T,
593
- Re as U,
594
- W as V,
595
- M as W,
596
- we as X,
597
- Ke as Y,
598
- Ye as Z,
599
- ve as _,
600
- O as a,
601
- S as a0,
602
- L as a1,
603
- V as b,
604
- ze as c,
605
- qe as d,
606
- Qe as e,
607
- Ze as f,
608
- K as g,
609
- le as h,
610
- Ee as i,
611
- A as j,
612
- $ as k,
613
- o as l,
614
- de as m,
615
- U as n,
616
- _e as o,
617
- ye as p,
618
- Oe as q,
619
- Q as r,
620
- me as s,
621
- Ge as t,
622
- x as u,
623
- D as v,
624
- Le as w,
625
- H as x,
626
- B as y,
627
- X as z
628
- };