@cyberskill/shared 1.203.0 → 1.204.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/dist/config.util-Ci2CZDut.cjs +1 -0
- package/dist/config.util-DKBwEBKR.js +61 -0
- package/dist/log.type-CMvG6Box.cjs +1 -0
- package/dist/{src/node/log/log.type.js → log.type-DTOvZHyz.js} +1 -1
- package/dist/path.constant-CWtb99gS.cjs +2 -0
- package/dist/{path.constant-DJq0jtD0.js → path.constant-CvSr0Rrx.js} +186 -185
- package/dist/src/config/config.util.cjs +1 -1
- package/dist/src/config/config.util.js +7 -58
- package/dist/src/config/index.cjs +1 -1
- package/dist/src/config/index.js +2 -3
- package/dist/src/config/vitest/vitest.unit.cjs +1 -1
- package/dist/src/config/vitest/vitest.unit.js +1 -1
- package/dist/src/node/cli/cli.util.cjs +1 -1
- package/dist/src/node/cli/cli.util.js +15 -15
- package/dist/src/node/command/command.util.cjs +1 -1
- package/dist/src/node/command/command.util.js +2 -2
- package/dist/src/node/command/index.cjs +1 -1
- package/dist/src/node/command/index.js +6 -7
- package/dist/src/node/log/index.cjs +1 -1
- package/dist/src/node/log/index.js +5 -5
- package/dist/src/node/mongo/index.cjs +1 -1
- package/dist/src/node/mongo/index.js +24 -15
- package/dist/src/node/mongo/mongo.util.cjs +1 -1
- package/dist/src/node/mongo/mongo.util.js +1 -1
- package/dist/src/node/package/index.cjs +1 -1
- package/dist/src/node/package/index.js +5 -6
- package/dist/src/node/package/package.util.cjs +1 -1
- package/dist/src/node/package/package.util.js +5 -6
- package/dist/src/node/path/index.cjs +1 -1
- package/dist/src/node/path/index.js +1 -1
- package/dist/src/node/path/path.constant.cjs +1 -1
- package/dist/src/node/path/path.constant.js +43 -45
- package/dist/src/node/upload/index.cjs +1 -1
- package/dist/src/node/upload/index.js +3 -4
- package/dist/src/node/upload/upload.util.cjs +1 -1
- package/dist/src/node/upload/upload.util.js +6 -157
- package/dist/upload.util-CE3MjBdh.cjs +1 -0
- package/dist/upload.util-D4aUdmPo.js +160 -0
- package/package.json +6 -6
- package/dist/path.constant-CPGOAxEp.cjs +0 -2
- package/dist/src/config/config.type.cjs +0 -1
- package/dist/src/config/config.type.js +0 -4
- package/dist/src/config/env/env.type.cjs +0 -1
- package/dist/src/config/env/env.type.js +0 -1
- package/dist/src/config/graphql-codegen/graphql-codegen.type.cjs +0 -1
- package/dist/src/config/graphql-codegen/graphql-codegen.type.js +0 -1
- package/dist/src/node/apollo-server/apollo-server.type.cjs +0 -1
- package/dist/src/node/apollo-server/apollo-server.type.js +0 -1
- package/dist/src/node/command/command.type.cjs +0 -1
- package/dist/src/node/command/command.type.js +0 -4
- package/dist/src/node/express/express.type.cjs +0 -1
- package/dist/src/node/express/express.type.js +0 -4
- package/dist/src/node/fs/fs.type.cjs +0 -1
- package/dist/src/node/fs/fs.type.js +0 -1
- package/dist/src/node/log/log.type.cjs +0 -1
- package/dist/src/node/mongo/mongo.type.cjs +0 -1
- package/dist/src/node/mongo/mongo.type.js +0 -16
- package/dist/src/node/package/package.type.cjs +0 -1
- package/dist/src/node/package/package.type.js +0 -4
- package/dist/src/node/upload/upload.type.cjs +0 -1
- package/dist/src/node/upload/upload.type.js +0 -4
- package/dist/src/node/ws/ws.type.cjs +0 -1
- package/dist/src/node/ws/ws.type.js +0 -1
- package/dist/src/react/apollo-client/apollo-client.type.cjs +0 -1
- package/dist/src/react/apollo-client/apollo-client.type.js +0 -1
- package/dist/src/react/apollo-error/apollo-error.type.cjs +0 -1
- package/dist/src/react/apollo-error/apollo-error.type.js +0 -1
- package/dist/src/react/loading/loading.type.cjs +0 -1
- package/dist/src/react/loading/loading.type.js +0 -1
- package/dist/src/react/log/log.type.cjs +0 -1
- package/dist/src/react/log/log.type.js +0 -1
- package/dist/src/react/next-intl/next-intl.type.cjs +0 -1
- package/dist/src/react/next-intl/next-intl.type.js +0 -1
- package/dist/src/react/userback/userback.type.cjs +0 -1
- package/dist/src/react/userback/userback.type.js +0 -1
- package/dist/src/util/common/common.type.cjs +0 -1
- package/dist/src/util/common/common.type.js +0 -1
- package/dist/src/util/serializer/serializer.type.cjs +0 -1
- package/dist/src/util/serializer/serializer.type.js +0 -1
- package/dist/src/util/string/string.type.cjs +0 -1
- package/dist/src/util/string/string.type.js +0 -1
|
@@ -1,63 +1,62 @@
|
|
|
1
1
|
var ue = Object.defineProperty;
|
|
2
2
|
var Q = Object.getOwnPropertySymbols;
|
|
3
|
-
var
|
|
4
|
-
var Z = (e,
|
|
5
|
-
for (var
|
|
6
|
-
|
|
3
|
+
var Ne = Object.prototype.hasOwnProperty, Ce = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var Z = (e, s, t) => s in e ? ue(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t, q = (e, s) => {
|
|
5
|
+
for (var t in s || (s = {}))
|
|
6
|
+
Ne.call(s, t) && Z(e, t, s[t]);
|
|
7
7
|
if (Q)
|
|
8
|
-
for (var
|
|
9
|
-
|
|
8
|
+
for (var t of Q(s))
|
|
9
|
+
Ce.call(s, t) && Z(e, t, s[t]);
|
|
10
10
|
return e;
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var N = (e, s, t) => new Promise((n, a) => {
|
|
13
|
+
var c = (r) => {
|
|
14
14
|
try {
|
|
15
|
-
o(
|
|
16
|
-
} catch (
|
|
17
|
-
a(
|
|
15
|
+
o(t.next(r));
|
|
16
|
+
} catch (C) {
|
|
17
|
+
a(C);
|
|
18
18
|
}
|
|
19
19
|
}, p = (r) => {
|
|
20
20
|
try {
|
|
21
|
-
o(
|
|
22
|
-
} catch (
|
|
23
|
-
a(
|
|
21
|
+
o(t.throw(r));
|
|
22
|
+
} catch (C) {
|
|
23
|
+
a(C);
|
|
24
24
|
}
|
|
25
|
-
}, o = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(
|
|
26
|
-
o((
|
|
25
|
+
}, o = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(c, p);
|
|
26
|
+
o((t = t.apply(e, s)).next());
|
|
27
27
|
});
|
|
28
28
|
import Ie from "fs-extra";
|
|
29
29
|
import { getEnv as b } from "./src/config/env/env.util.js";
|
|
30
|
-
import {
|
|
31
|
-
import { exec as _e } from "node:child_process";
|
|
30
|
+
import { exec as fe } from "node:child_process";
|
|
32
31
|
import ee from "node:process";
|
|
33
|
-
import * as
|
|
34
|
-
import {
|
|
35
|
-
import { log as
|
|
32
|
+
import * as _e from "node:util";
|
|
33
|
+
import { E as T } from "./log.type-DTOvZHyz.js";
|
|
34
|
+
import { log as _, catchError as d } from "./src/node/log/log.util.js";
|
|
36
35
|
import de from "node-fetch";
|
|
37
36
|
import { pathExistsSync as V, readJsonSync as R, writeFileSync as De } from "./src/node/fs/fs.util.js";
|
|
38
|
-
import {
|
|
39
|
-
import { join as j, resolveWorkingPath as u } from "./src/node/path/path.util.js";
|
|
37
|
+
import { join as U, resolveWorkingPath as u } from "./src/node/path/path.util.js";
|
|
40
38
|
import { storage as K } from "./src/node/storage/storage.util.js";
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
var l = /* @__PURE__ */ ((e) => (e.CLI = "CLI", e.STRING = "STRING", e.FUNCTION = "FUNCTION", e))(l || {}), i = /* @__PURE__ */ ((e) => (e.DEPENDENCY = "dependencies", e.DEV_DEPENDENCY = "devDependencies", e.PEER_DEPENDENCY = "peerDependencies", e.BUNDLE_DEPENDENCY = "bundleDependencies", e.OPTIONAL_DEPENDENCY = "optionalDependencies", e))(i || {});
|
|
40
|
+
const Te = b();
|
|
41
|
+
function ye(e) {
|
|
42
|
+
return N(this, null, function* () {
|
|
44
43
|
try {
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
throw new Error(`Failed to fetch latest version: ${
|
|
48
|
-
const { version:
|
|
44
|
+
const s = yield de(`https://registry.npmjs.org/${e}/latest`);
|
|
45
|
+
if (!s.ok)
|
|
46
|
+
throw new Error(`Failed to fetch latest version: ${s.status} ${s.statusText}`);
|
|
47
|
+
const { version: t } = yield s.json();
|
|
49
48
|
return {
|
|
50
49
|
success: !0,
|
|
51
|
-
result:
|
|
50
|
+
result: t
|
|
52
51
|
};
|
|
53
|
-
} catch (
|
|
54
|
-
return d(
|
|
52
|
+
} catch (s) {
|
|
53
|
+
return d(s);
|
|
55
54
|
}
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
function H(e) {
|
|
59
|
-
return
|
|
60
|
-
var
|
|
58
|
+
return N(this, null, function* () {
|
|
59
|
+
var s, t;
|
|
61
60
|
try {
|
|
62
61
|
if (!e) {
|
|
63
62
|
if (V(E.PACKAGE_JSON)) {
|
|
@@ -104,30 +103,30 @@ function H(e) {
|
|
|
104
103
|
isCurrentProject: !1,
|
|
105
104
|
isInstalled: !1,
|
|
106
105
|
isUpToDate: !1,
|
|
107
|
-
isDependency: e.type ===
|
|
108
|
-
isDevDependency: e.type ===
|
|
106
|
+
isDependency: e.type === i.DEPENDENCY,
|
|
107
|
+
isDevDependency: e.type === i.DEV_DEPENDENCY,
|
|
109
108
|
installedPath: "",
|
|
110
109
|
file: {}
|
|
111
110
|
}
|
|
112
111
|
};
|
|
113
|
-
const n = R(E.PACKAGE_JSON), { name: a, version:
|
|
112
|
+
const n = R(E.PACKAGE_JSON), { name: a, version: c = "", dependencies: p = {}, devDependencies: o = {} } = n;
|
|
114
113
|
if (e.name === a)
|
|
115
114
|
return {
|
|
116
115
|
success: !0,
|
|
117
116
|
result: {
|
|
118
117
|
name: a,
|
|
119
|
-
currentVersion:
|
|
120
|
-
latestVersion:
|
|
118
|
+
currentVersion: c,
|
|
119
|
+
latestVersion: c,
|
|
121
120
|
isCurrentProject: !0,
|
|
122
121
|
isInstalled: !0,
|
|
123
122
|
isUpToDate: !0,
|
|
124
|
-
isDependency: e.type ===
|
|
125
|
-
isDevDependency: e.type ===
|
|
123
|
+
isDependency: e.type === i.DEPENDENCY,
|
|
124
|
+
isDevDependency: e.type === i.DEV_DEPENDENCY,
|
|
126
125
|
installedPath: E.PACKAGE_JSON,
|
|
127
126
|
file: n
|
|
128
127
|
}
|
|
129
128
|
};
|
|
130
|
-
const r = e.name in p,
|
|
129
|
+
const r = e.name in p, C = e.name in o, D = yield ye(e.name);
|
|
131
130
|
if (!D.success)
|
|
132
131
|
return {
|
|
133
132
|
success: !0,
|
|
@@ -139,12 +138,12 @@ function H(e) {
|
|
|
139
138
|
isInstalled: !1,
|
|
140
139
|
isUpToDate: !1,
|
|
141
140
|
isDependency: r,
|
|
142
|
-
isDevDependency:
|
|
141
|
+
isDevDependency: C,
|
|
143
142
|
installedPath: "",
|
|
144
143
|
file: {}
|
|
145
144
|
}
|
|
146
145
|
};
|
|
147
|
-
if (!r && !
|
|
146
|
+
if (!r && !C)
|
|
148
147
|
return {
|
|
149
148
|
success: !0,
|
|
150
149
|
result: {
|
|
@@ -154,13 +153,13 @@ function H(e) {
|
|
|
154
153
|
isCurrentProject: !1,
|
|
155
154
|
isInstalled: !1,
|
|
156
155
|
isUpToDate: !1,
|
|
157
|
-
isDependency: e.type ===
|
|
158
|
-
isDevDependency: e.type ===
|
|
156
|
+
isDependency: e.type === i.DEPENDENCY,
|
|
157
|
+
isDevDependency: e.type === i.DEV_DEPENDENCY,
|
|
159
158
|
installedPath: "",
|
|
160
159
|
file: {}
|
|
161
160
|
}
|
|
162
161
|
};
|
|
163
|
-
const
|
|
162
|
+
const y = (t = (s = p[e.name]) != null ? s : o[e.name]) != null ? t : "", g = U(Te.CWD, W, e.name, X);
|
|
164
163
|
if (!V(g))
|
|
165
164
|
return {
|
|
166
165
|
success: !0,
|
|
@@ -172,23 +171,23 @@ function H(e) {
|
|
|
172
171
|
isInstalled: !1,
|
|
173
172
|
isUpToDate: !1,
|
|
174
173
|
isDependency: r,
|
|
175
|
-
isDevDependency:
|
|
174
|
+
isDevDependency: C,
|
|
176
175
|
installedPath: "",
|
|
177
176
|
file: {}
|
|
178
177
|
}
|
|
179
178
|
};
|
|
180
179
|
const P = R(g), { version: A = "" } = P;
|
|
181
|
-
return
|
|
180
|
+
return y !== A ? {
|
|
182
181
|
success: !0,
|
|
183
182
|
result: {
|
|
184
183
|
name: e.name,
|
|
185
|
-
currentVersion: A ||
|
|
184
|
+
currentVersion: A || y,
|
|
186
185
|
latestVersion: D.result,
|
|
187
186
|
isCurrentProject: !1,
|
|
188
187
|
isInstalled: !0,
|
|
189
188
|
isUpToDate: !1,
|
|
190
189
|
isDependency: r,
|
|
191
|
-
isDevDependency:
|
|
190
|
+
isDevDependency: C,
|
|
192
191
|
installedPath: g,
|
|
193
192
|
file: P
|
|
194
193
|
}
|
|
@@ -196,13 +195,13 @@ function H(e) {
|
|
|
196
195
|
success: !0,
|
|
197
196
|
result: {
|
|
198
197
|
name: e.name,
|
|
199
|
-
currentVersion:
|
|
198
|
+
currentVersion: y,
|
|
200
199
|
latestVersion: D.result,
|
|
201
200
|
isCurrentProject: !1,
|
|
202
201
|
isInstalled: !0,
|
|
203
|
-
isUpToDate:
|
|
202
|
+
isUpToDate: y === D.result,
|
|
204
203
|
isDependency: r,
|
|
205
|
-
isDevDependency:
|
|
204
|
+
isDevDependency: C,
|
|
206
205
|
installedPath: g,
|
|
207
206
|
file: P
|
|
208
207
|
}
|
|
@@ -212,29 +211,29 @@ function H(e) {
|
|
|
212
211
|
}
|
|
213
212
|
});
|
|
214
213
|
}
|
|
215
|
-
function
|
|
216
|
-
return
|
|
217
|
-
var
|
|
214
|
+
function se(e) {
|
|
215
|
+
return N(this, null, function* () {
|
|
216
|
+
var s, t;
|
|
218
217
|
try {
|
|
219
|
-
const n = R(E.PACKAGE_JSON), a = (
|
|
220
|
-
e.isDependency ? a[e.name] = e.latestVersion : e.isDevDependency && (
|
|
218
|
+
const n = R(E.PACKAGE_JSON), a = (s = n.dependencies) != null ? s : {}, c = (t = n.devDependencies) != null ? t : {};
|
|
219
|
+
e.isDependency ? a[e.name] = e.latestVersion : e.isDevDependency && (c[e.name] = e.latestVersion), De(E.PACKAGE_JSON, JSON.stringify(n, null, 4)), _.info(`Updated "${e.name}" to version ${e.latestVersion}`);
|
|
221
220
|
} catch (n) {
|
|
222
221
|
d(n);
|
|
223
222
|
}
|
|
224
223
|
});
|
|
225
224
|
}
|
|
226
225
|
function ge() {
|
|
227
|
-
return
|
|
226
|
+
return N(this, null, function* () {
|
|
228
227
|
try {
|
|
229
228
|
const e = [
|
|
230
229
|
{ command: () => w.pnpmInstallStandard(), message: "Installing dependencies (standard)" },
|
|
231
230
|
{ command: () => w.pnpmInstallLegacy(), message: "Retrying with legacy peer dependencies" },
|
|
232
231
|
{ command: () => w.pnpmInstallForce(), message: "Retrying with force install" }
|
|
233
232
|
];
|
|
234
|
-
for (const { command:
|
|
233
|
+
for (const { command: s, message: t } of e)
|
|
235
234
|
try {
|
|
236
|
-
const n = yield
|
|
237
|
-
yield le(`${
|
|
235
|
+
const n = yield s();
|
|
236
|
+
yield le(`${t} using: ${n}`, n);
|
|
238
237
|
return;
|
|
239
238
|
} catch (n) {
|
|
240
239
|
d(n);
|
|
@@ -244,50 +243,50 @@ function ge() {
|
|
|
244
243
|
}
|
|
245
244
|
});
|
|
246
245
|
}
|
|
247
|
-
function Oe(e,
|
|
248
|
-
return
|
|
249
|
-
var
|
|
246
|
+
function Oe(e, s) {
|
|
247
|
+
return N(this, null, function* () {
|
|
248
|
+
var t;
|
|
250
249
|
try {
|
|
251
250
|
if (!V(E.PACKAGE_JSON)) {
|
|
252
|
-
|
|
251
|
+
_.error("package.json not found. Aborting setup.");
|
|
253
252
|
return;
|
|
254
253
|
}
|
|
255
|
-
const a = (yield Promise.all(e.map(H))).filter((r) => r.success && !!r.result && !r.result.isCurrentProject).map((r) => r.result),
|
|
256
|
-
|
|
257
|
-
for (const r of (
|
|
254
|
+
const a = (yield Promise.all(e.map(H))).filter((r) => r.success && !!r.result && !r.result.isCurrentProject).map((r) => r.result), c = a.filter((r) => !r.isInstalled), p = a.filter((r) => !r.isUpToDate), o = [];
|
|
255
|
+
s != null && s.install && c.length > 0 && o.push(...c.map(se)), s != null && s.update && p.length > 0 && o.push(...p.map(se)), o.length > 0 && (yield Promise.all(o), yield ge(), yield le("Running ESLint with auto-fix", yield w.eslintFix()));
|
|
256
|
+
for (const r of (t = s == null ? void 0 : s.callbacks) != null ? t : [])
|
|
258
257
|
yield r();
|
|
259
258
|
} catch (n) {
|
|
260
259
|
d(n);
|
|
261
260
|
}
|
|
262
261
|
});
|
|
263
262
|
}
|
|
264
|
-
const ie = b(), Ge =
|
|
263
|
+
const ie = b(), Ge = _e.promisify(fe);
|
|
265
264
|
function B() {
|
|
266
|
-
return
|
|
265
|
+
return N(this, null, function* () {
|
|
267
266
|
const e = yield H();
|
|
268
267
|
return e.success ? e.result.name : Date.now().toString();
|
|
269
268
|
});
|
|
270
269
|
}
|
|
271
270
|
function ce(e) {
|
|
272
|
-
return
|
|
271
|
+
return N(this, null, function* () {
|
|
273
272
|
if (e.length === 0)
|
|
274
273
|
return;
|
|
275
|
-
const
|
|
274
|
+
const s = yield B();
|
|
276
275
|
try {
|
|
277
|
-
yield K.set(
|
|
278
|
-
const
|
|
279
|
-
|
|
276
|
+
yield K.set(s, e), setTimeout(() => N(null, null, function* () {
|
|
277
|
+
const t = yield K.getLogLink(s);
|
|
278
|
+
t && _.info(`📂 Open the error list manually: ${t}`);
|
|
280
279
|
}), 0);
|
|
281
|
-
} catch (
|
|
282
|
-
d(
|
|
280
|
+
} catch (t) {
|
|
281
|
+
d(t);
|
|
283
282
|
}
|
|
284
283
|
});
|
|
285
284
|
}
|
|
286
|
-
function
|
|
287
|
-
return
|
|
285
|
+
function Es() {
|
|
286
|
+
return N(this, null, function* () {
|
|
288
287
|
try {
|
|
289
|
-
const e = yield B(),
|
|
290
|
-
return
|
|
288
|
+
const e = yield B(), s = yield K.get(e);
|
|
289
|
+
return s != null ? s : [];
|
|
291
290
|
} catch (e) {
|
|
292
291
|
return d(e, {
|
|
293
292
|
returnValue: []
|
|
@@ -295,8 +294,8 @@ function pt() {
|
|
|
295
294
|
}
|
|
296
295
|
});
|
|
297
296
|
}
|
|
298
|
-
function
|
|
299
|
-
return
|
|
297
|
+
function ms() {
|
|
298
|
+
return N(this, null, function* () {
|
|
300
299
|
try {
|
|
301
300
|
const e = yield B();
|
|
302
301
|
yield K.remove(e);
|
|
@@ -306,109 +305,109 @@ function ut() {
|
|
|
306
305
|
});
|
|
307
306
|
}
|
|
308
307
|
function Pe(e) {
|
|
309
|
-
const
|
|
308
|
+
const s = [], t = [];
|
|
310
309
|
let n = "";
|
|
311
|
-
const a = /^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,
|
|
310
|
+
const a = /^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/, c = /^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/, p = /^✖\s+(.*?)\s+\[(.*?)\]$/;
|
|
312
311
|
e.split(`
|
|
313
312
|
`).forEach((o) => {
|
|
314
|
-
var r,
|
|
313
|
+
var r, C, D, y, g, P, A, $, M, h, z;
|
|
315
314
|
if (o.startsWith("/"))
|
|
316
315
|
n = o.trim();
|
|
317
316
|
else {
|
|
318
|
-
const I = a.exec(o) || [],
|
|
319
|
-
I.length && n ?
|
|
317
|
+
const I = a.exec(o) || [], f = c.exec(o) || [], O = p.exec(o) || [];
|
|
318
|
+
I.length && n ? s.push({
|
|
320
319
|
file: n,
|
|
321
320
|
position: `${I[1]}:${I[2]}`,
|
|
322
|
-
type: I[3] ===
|
|
323
|
-
message: (
|
|
324
|
-
rule: (
|
|
325
|
-
}) :
|
|
326
|
-
file: (g =
|
|
327
|
-
position: `${
|
|
328
|
-
type:
|
|
329
|
-
message: (A = (P =
|
|
330
|
-
}) : O.length ?
|
|
321
|
+
type: I[3] === T.Error ? T.Error : T.Warning,
|
|
322
|
+
message: (C = (r = I == null ? void 0 : I[4]) == null ? void 0 : r.trim()) != null ? C : "",
|
|
323
|
+
rule: (y = (D = I == null ? void 0 : I[5]) == null ? void 0 : D.trim()) != null ? y : ""
|
|
324
|
+
}) : f.length ? s.push({
|
|
325
|
+
file: (g = f == null ? void 0 : f[1]) != null ? g : "",
|
|
326
|
+
position: `${f[2]}:${f[3]}`,
|
|
327
|
+
type: f[4] === T.Error ? T.Error : T.Warning,
|
|
328
|
+
message: (A = (P = f == null ? void 0 : f[5]) == null ? void 0 : P.trim()) != null ? A : ""
|
|
329
|
+
}) : O.length ? s.push({
|
|
331
330
|
file: "commitlint",
|
|
332
|
-
type:
|
|
331
|
+
type: T.Error,
|
|
333
332
|
message: (M = ($ = O == null ? void 0 : O[1]) == null ? void 0 : $.trim()) != null ? M : "",
|
|
334
333
|
rule: (z = (h = O == null ? void 0 : O[2]) == null ? void 0 : h.trim()) != null ? z : ""
|
|
335
|
-
}) :
|
|
334
|
+
}) : t.push(o.trim());
|
|
336
335
|
}
|
|
337
|
-
}),
|
|
336
|
+
}), s.length && ce(s), ie.DEBUG && t.length && (_.warn("Unmatched lines:"), t.forEach((o) => _.info(` ${o}`)));
|
|
338
337
|
}
|
|
339
338
|
function Se(e) {
|
|
340
339
|
try {
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
a.forEach(({ severity:
|
|
344
|
-
|
|
345
|
-
type:
|
|
340
|
+
const s = JSON.parse(e), t = [];
|
|
341
|
+
s.forEach(({ filePath: n, messages: a }) => {
|
|
342
|
+
a.forEach(({ severity: c, line: p, column: o, ruleId: r, message: C }) => {
|
|
343
|
+
t.push({
|
|
344
|
+
type: c === 2 ? T.Error : T.Warning,
|
|
346
345
|
file: n,
|
|
347
346
|
position: `${p}:${o}`,
|
|
348
347
|
rule: r,
|
|
349
|
-
message:
|
|
348
|
+
message: C
|
|
350
349
|
});
|
|
351
350
|
});
|
|
352
|
-
}),
|
|
353
|
-
} catch (
|
|
351
|
+
}), t.length && ce(t);
|
|
352
|
+
} catch (s) {
|
|
354
353
|
Pe(e);
|
|
355
354
|
}
|
|
356
355
|
}
|
|
357
|
-
function Le(
|
|
358
|
-
return
|
|
356
|
+
function Le(t) {
|
|
357
|
+
return N(this, arguments, function* (e, s = Se) {
|
|
359
358
|
const n = new AbortController();
|
|
360
359
|
ee.on("SIGINT", () => {
|
|
361
|
-
|
|
360
|
+
_.warn("Process interrupted. Terminating..."), n.abort(), ee.exit();
|
|
362
361
|
});
|
|
363
362
|
try {
|
|
364
363
|
if (typeof e == "string") {
|
|
365
|
-
const { stdout: a, stderr:
|
|
364
|
+
const { stdout: a, stderr: c } = yield Ge(e, {
|
|
366
365
|
maxBuffer: 104857600,
|
|
367
366
|
signal: n.signal
|
|
368
367
|
});
|
|
369
|
-
[a,
|
|
368
|
+
[a, c].forEach((p) => p && s(p));
|
|
370
369
|
}
|
|
371
370
|
} catch (a) {
|
|
372
|
-
const { stdout:
|
|
373
|
-
[
|
|
371
|
+
const { stdout: c, stderr: p, message: o } = a;
|
|
372
|
+
[c, p].forEach((r) => r && s(r)), !p && !c && _.error(`Command failed: ${o}`);
|
|
374
373
|
}
|
|
375
374
|
});
|
|
376
375
|
}
|
|
377
|
-
function
|
|
376
|
+
function j(e) {
|
|
378
377
|
return { raw: !0, cmd: e };
|
|
379
378
|
}
|
|
380
|
-
function
|
|
381
|
-
return
|
|
379
|
+
function te(e, s) {
|
|
380
|
+
return s != null && s.isCurrentProject ? `${x} ${G} ${Fe} ${e}` : `${x} ${je} ${e}`;
|
|
382
381
|
}
|
|
383
|
-
function
|
|
384
|
-
return typeof e == "function" ?
|
|
382
|
+
function F(e, s) {
|
|
383
|
+
return typeof e == "function" ? te(e(s), s) : typeof e == "object" && (e == null ? void 0 : e.raw) === !0 ? e.cmd : typeof e == "string" ? te(e, s) : e;
|
|
385
384
|
}
|
|
386
|
-
function
|
|
387
|
-
return
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
const
|
|
385
|
+
function ps(e) {
|
|
386
|
+
return N(this, null, function* () {
|
|
387
|
+
const s = yield H({ name: k });
|
|
388
|
+
if (s.success) {
|
|
389
|
+
const t = { isCurrentProject: s.result.isCurrentProject }, n = typeof e == "function" ? e(t) : e;
|
|
391
390
|
return Object.fromEntries(
|
|
392
|
-
Object.entries(n).map(([a,
|
|
391
|
+
Object.entries(n).map(([a, c]) => [a, F(c, t)])
|
|
393
392
|
);
|
|
394
393
|
}
|
|
395
394
|
});
|
|
396
395
|
}
|
|
397
|
-
function le(e,
|
|
398
|
-
return
|
|
396
|
+
function le(e, s) {
|
|
397
|
+
return N(this, null, function* () {
|
|
399
398
|
try {
|
|
400
|
-
|
|
401
|
-
} catch (
|
|
402
|
-
d(
|
|
399
|
+
_.start(`${e}`), ie.DEBUG && _.info(`→ ${s}`), yield Le(s), _.success(`${e} done.`);
|
|
400
|
+
} catch (t) {
|
|
401
|
+
d(t);
|
|
403
402
|
}
|
|
404
403
|
});
|
|
405
404
|
}
|
|
406
|
-
const Ae = b(),
|
|
407
|
-
const
|
|
408
|
-
return
|
|
409
|
-
})(),
|
|
405
|
+
const Ae = b(), J = Ae.CWD, k = "@cyberskill/shared", W = "node_modules", $e = "dist", he = "public", X = "package.json", Me = "package-lock.json", Ve = "tsconfig.json", Re = ".gitignore", we = ".simple-git-hooks.json", Ke = "pnpm-lock.yaml", Ye = ".git/hooks/", ve = ".git/COMMIT_EDITMSG", Ue = ".migrate-mongo.config.js", S = (() => {
|
|
406
|
+
const s = Ie.readJsonSync(u(X)).name === k ? J : U(J, W, k);
|
|
407
|
+
return U(s, $e);
|
|
408
|
+
})(), je = "cyberskill", Fe = "src/node/cli/index.ts", ne = "eslint", re = "eslint", ae = "vitest", oe = "vitest", Je = "@commitlint/cli", ke = "@commitlint/config-conventional", Ee = "commitlint", xe = "lint-staged", me = "lint-staged", be = "typescript", He = "tsc", G = "tsx", pe = "git", L = "pnpm", x = "pnpm exec", Be = "simple-git-hooks", We = "simple-git-hooks", Xe = "@eslint/config-inspector", ze = "eslint-config-inspector", Qe = "node-modules-inspector", Ze = "node-modules-inspector", Y = "migrate-mongo", v = "./node_modules/migrate-mongo/bin/migrate-mongo", E = {
|
|
410
409
|
CYBERSKILL_DIRECTORY: S,
|
|
411
|
-
WORKING_DIRECTORY:
|
|
410
|
+
WORKING_DIRECTORY: J,
|
|
412
411
|
PUBLIC_DIRECTORY: u(he),
|
|
413
412
|
TS_CONFIG: u(Ve),
|
|
414
413
|
GIT_IGNORE: u(Re),
|
|
@@ -419,29 +418,29 @@ const Ae = b(), k = Ae.CWD, F = "@cyberskill/shared", W = "node_modules", $e = "
|
|
|
419
418
|
PACKAGE_LOCK_JSON: u(Me),
|
|
420
419
|
PNPM_LOCK_YAML: u(Ke),
|
|
421
420
|
NODE_MODULES: u(W),
|
|
422
|
-
MIGRATE_MONGO_CONFIG: u(
|
|
421
|
+
MIGRATE_MONGO_CONFIG: u(Ue),
|
|
423
422
|
LINT_STAGED_CONFIG: u(`${S}/src/config/lint-staged/index.js`),
|
|
424
423
|
COMMITLINT_CONFIG: u(`${S}/src/config/commitlint/index.js`),
|
|
425
424
|
VITEST_UNIT_CONFIG: u(`${S}/src/config/vitest/vitest.unit.js`),
|
|
426
425
|
VITEST_UNIT_SETUP_CONFIG: u(`${S}/src/config/vitest/vitest.unit.setup.js`),
|
|
427
426
|
VITEST_E2E_CONFIG: u(`${S}/src/config/vitest/vitest.e2e.js`)
|
|
428
427
|
};
|
|
429
|
-
function
|
|
428
|
+
function us({ isCurrentProject: e }) {
|
|
430
429
|
return q({
|
|
431
430
|
"pre-commit": me,
|
|
432
431
|
"commit-msg": Ee
|
|
433
|
-
}, e && { "pre-push":
|
|
432
|
+
}, e && { "pre-push": j(`${pe} pull`) });
|
|
434
433
|
}
|
|
435
|
-
function m({ type: e, packages:
|
|
436
|
-
const n =
|
|
437
|
-
return () =>
|
|
434
|
+
function m({ type: e, packages: s, command: t }) {
|
|
435
|
+
const n = s == null ? void 0 : s.reduce((a, c) => (a.some((p) => p.name === c.name) || a.push(c), a), []);
|
|
436
|
+
return () => N(null, null, function* () {
|
|
438
437
|
switch (e) {
|
|
439
438
|
case l.CLI:
|
|
440
439
|
return n != null && n.length && (yield Oe(n, {
|
|
441
440
|
install: !0
|
|
442
|
-
})),
|
|
441
|
+
})), F(j(`${x} ${t}`));
|
|
443
442
|
case l.STRING:
|
|
444
|
-
return
|
|
443
|
+
return F(j(t));
|
|
445
444
|
default:
|
|
446
445
|
throw new Error("Unsupported command type");
|
|
447
446
|
}
|
|
@@ -453,7 +452,7 @@ const w = {
|
|
|
453
452
|
packages: [
|
|
454
453
|
{
|
|
455
454
|
name: Be,
|
|
456
|
-
type:
|
|
455
|
+
type: i.DEV_DEPENDENCY
|
|
457
456
|
}
|
|
458
457
|
],
|
|
459
458
|
command: We
|
|
@@ -463,7 +462,7 @@ const w = {
|
|
|
463
462
|
packages: [
|
|
464
463
|
{
|
|
465
464
|
name: Xe,
|
|
466
|
-
type:
|
|
465
|
+
type: i.DEV_DEPENDENCY
|
|
467
466
|
}
|
|
468
467
|
],
|
|
469
468
|
command: ze
|
|
@@ -473,7 +472,7 @@ const w = {
|
|
|
473
472
|
packages: [
|
|
474
473
|
{
|
|
475
474
|
name: Qe,
|
|
476
|
-
type:
|
|
475
|
+
type: i.DEV_DEPENDENCY
|
|
477
476
|
}
|
|
478
477
|
],
|
|
479
478
|
command: Ze
|
|
@@ -483,7 +482,7 @@ const w = {
|
|
|
483
482
|
packages: [
|
|
484
483
|
{
|
|
485
484
|
name: ne,
|
|
486
|
-
type:
|
|
485
|
+
type: i.DEV_DEPENDENCY
|
|
487
486
|
}
|
|
488
487
|
],
|
|
489
488
|
command: `${re} ${E.WORKING_DIRECTORY} --no-cache`
|
|
@@ -493,7 +492,7 @@ const w = {
|
|
|
493
492
|
packages: [
|
|
494
493
|
{
|
|
495
494
|
name: ne,
|
|
496
|
-
type:
|
|
495
|
+
type: i.DEV_DEPENDENCY
|
|
497
496
|
}
|
|
498
497
|
],
|
|
499
498
|
command: `${re} ${E.WORKING_DIRECTORY} --fix --no-cache`
|
|
@@ -503,7 +502,7 @@ const w = {
|
|
|
503
502
|
packages: [
|
|
504
503
|
{
|
|
505
504
|
name: be,
|
|
506
|
-
type:
|
|
505
|
+
type: i.DEV_DEPENDENCY
|
|
507
506
|
}
|
|
508
507
|
],
|
|
509
508
|
command: `${He} -p ${E.TS_CONFIG} --noEmit`
|
|
@@ -513,7 +512,7 @@ const w = {
|
|
|
513
512
|
packages: [
|
|
514
513
|
{
|
|
515
514
|
name: ae,
|
|
516
|
-
type:
|
|
515
|
+
type: i.DEV_DEPENDENCY
|
|
517
516
|
}
|
|
518
517
|
],
|
|
519
518
|
command: `${oe} --config ${E.VITEST_UNIT_CONFIG}`
|
|
@@ -523,7 +522,7 @@ const w = {
|
|
|
523
522
|
packages: [
|
|
524
523
|
{
|
|
525
524
|
name: ae,
|
|
526
|
-
type:
|
|
525
|
+
type: i.DEV_DEPENDENCY
|
|
527
526
|
}
|
|
528
527
|
],
|
|
529
528
|
command: `${oe} --config ${E.VITEST_E2E_CONFIG}`
|
|
@@ -533,11 +532,11 @@ const w = {
|
|
|
533
532
|
packages: [
|
|
534
533
|
{
|
|
535
534
|
name: G,
|
|
536
|
-
type:
|
|
535
|
+
type: i.DEPENDENCY
|
|
537
536
|
},
|
|
538
537
|
{
|
|
539
538
|
name: Y,
|
|
540
|
-
type:
|
|
539
|
+
type: i.DEPENDENCY
|
|
541
540
|
}
|
|
542
541
|
],
|
|
543
542
|
command: `${G} ${v} create ${e} -f ${E.MIGRATE_MONGO_CONFIG}`
|
|
@@ -547,11 +546,11 @@ const w = {
|
|
|
547
546
|
packages: [
|
|
548
547
|
{
|
|
549
548
|
name: G,
|
|
550
|
-
type:
|
|
549
|
+
type: i.DEPENDENCY
|
|
551
550
|
},
|
|
552
551
|
{
|
|
553
552
|
name: Y,
|
|
554
|
-
type:
|
|
553
|
+
type: i.DEPENDENCY
|
|
555
554
|
}
|
|
556
555
|
],
|
|
557
556
|
command: `${G} ${v} up -f ${E.MIGRATE_MONGO_CONFIG}`
|
|
@@ -561,11 +560,11 @@ const w = {
|
|
|
561
560
|
packages: [
|
|
562
561
|
{
|
|
563
562
|
name: G,
|
|
564
|
-
type:
|
|
563
|
+
type: i.DEPENDENCY
|
|
565
564
|
},
|
|
566
565
|
{
|
|
567
566
|
name: Y,
|
|
568
|
-
type:
|
|
567
|
+
type: i.DEPENDENCY
|
|
569
568
|
}
|
|
570
569
|
],
|
|
571
570
|
command: `${G} ${v} down -f ${E.MIGRATE_MONGO_CONFIG}`
|
|
@@ -574,12 +573,12 @@ const w = {
|
|
|
574
573
|
type: l.CLI,
|
|
575
574
|
packages: [
|
|
576
575
|
{
|
|
577
|
-
name:
|
|
578
|
-
type:
|
|
576
|
+
name: Je,
|
|
577
|
+
type: i.DEV_DEPENDENCY
|
|
579
578
|
},
|
|
580
579
|
{
|
|
581
|
-
name:
|
|
582
|
-
type:
|
|
580
|
+
name: ke,
|
|
581
|
+
type: i.DEV_DEPENDENCY
|
|
583
582
|
}
|
|
584
583
|
],
|
|
585
584
|
command: `${Ee} --edit ${E.GIT_COMMIT_MSG} --config ${E.COMMITLINT_CONFIG}`
|
|
@@ -589,7 +588,7 @@ const w = {
|
|
|
589
588
|
packages: [
|
|
590
589
|
{
|
|
591
590
|
name: xe,
|
|
592
|
-
type:
|
|
591
|
+
type: i.DEV_DEPENDENCY
|
|
593
592
|
}
|
|
594
593
|
],
|
|
595
594
|
command: `${me} --config ${E.LINT_STAGED_CONFIG}`
|
|
@@ -624,46 +623,48 @@ const w = {
|
|
|
624
623
|
})
|
|
625
624
|
};
|
|
626
625
|
export {
|
|
627
|
-
|
|
626
|
+
F as $,
|
|
628
627
|
Y as A,
|
|
629
628
|
$e as B,
|
|
630
|
-
|
|
629
|
+
k as C,
|
|
631
630
|
v as D,
|
|
632
631
|
ne as E,
|
|
633
632
|
E as F,
|
|
634
633
|
Re as G,
|
|
635
|
-
|
|
634
|
+
us as H,
|
|
636
635
|
w as I,
|
|
637
|
-
|
|
638
|
-
|
|
636
|
+
i as J,
|
|
637
|
+
ye as K,
|
|
639
638
|
xe as L,
|
|
640
|
-
|
|
639
|
+
Ue as M,
|
|
641
640
|
W as N,
|
|
642
|
-
|
|
641
|
+
H as O,
|
|
643
642
|
he as P,
|
|
644
|
-
|
|
645
|
-
|
|
643
|
+
se as Q,
|
|
644
|
+
ge as R,
|
|
646
645
|
we as S,
|
|
647
646
|
Ve as T,
|
|
648
|
-
|
|
647
|
+
Oe as U,
|
|
649
648
|
ae as V,
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
649
|
+
J as W,
|
|
650
|
+
l as X,
|
|
651
|
+
Es as Y,
|
|
652
|
+
ms as Z,
|
|
653
|
+
j as _,
|
|
655
654
|
X as a,
|
|
655
|
+
ps as a0,
|
|
656
|
+
le as a1,
|
|
656
657
|
Me as b,
|
|
657
658
|
Ke as c,
|
|
658
659
|
Ye as d,
|
|
659
660
|
ve as e,
|
|
660
661
|
S as f,
|
|
661
|
-
|
|
662
|
-
|
|
662
|
+
je as g,
|
|
663
|
+
Fe as h,
|
|
663
664
|
re as i,
|
|
664
665
|
oe as j,
|
|
665
|
-
|
|
666
|
-
|
|
666
|
+
Je as k,
|
|
667
|
+
ke as l,
|
|
667
668
|
Ee as m,
|
|
668
669
|
me as n,
|
|
669
670
|
be as o,
|