@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.
- package/dist/config/commitlint/index.cjs +1 -0
- package/dist/config/config.type.cjs +1 -0
- package/dist/config/config.util.cjs +1 -0
- package/dist/config/config.util.js +35 -26
- package/dist/config/env/env.constant.cjs +1 -0
- package/dist/config/env/env.util.cjs +1 -0
- package/dist/config/env/index.cjs +1 -0
- package/dist/config/eslint/index.cjs +1 -0
- package/dist/config/eslint/index.js +12 -4
- package/dist/config/graphql-codegen/graphql-codegen.util.cjs +1 -0
- package/dist/config/graphql-codegen/graphql-codegen.util.js +33 -28
- package/dist/config/graphql-codegen/index.cjs +1 -0
- package/dist/config/index.cjs +1 -0
- package/dist/config/lint-staged/index.cjs +1 -0
- package/dist/config/vitest/index.cjs +1 -0
- package/dist/config/vitest/vitest.e2e.cjs +1 -0
- package/dist/config/vitest/vitest.e2e.js +16 -9
- package/dist/config/vitest/vitest.unit.cjs +1 -0
- package/dist/config/vitest/vitest.unit.js +18 -11
- package/dist/constant/common.cjs +1 -0
- package/dist/constant/common.js +1 -1
- package/dist/constant/index.cjs +1 -0
- package/dist/constant/response-status.cjs +1 -0
- package/dist/node/apollo-server/apollo-server.util.cjs +1 -0
- package/dist/node/apollo-server/apollo-server.util.js +48 -21
- package/dist/node/apollo-server/index.cjs +1 -0
- package/dist/node/cli/index.cjs +6 -0
- package/dist/node/cli/index.js +140 -90
- package/dist/node/command/command.type.cjs +1 -0
- package/dist/node/command/command.util.cjs +2 -0
- package/dist/node/command/command.util.js +148 -117
- package/dist/node/command/index.cjs +1 -0
- package/dist/node/express/express.util.cjs +1 -0
- package/dist/node/express/express.util.js +70 -37
- package/dist/node/express/index.cjs +1 -0
- package/dist/node/fs/fs.util.cjs +1 -0
- package/dist/node/fs/fs.util.js +55 -40
- package/dist/node/fs/index.cjs +1 -0
- package/dist/node/log/index.cjs +1 -0
- package/dist/node/log/log.type.cjs +1 -0
- package/dist/node/log/log.util.cjs +1 -0
- package/dist/node/log/log.util.js +31 -30
- package/dist/node/mongo/index.cjs +1 -0
- package/dist/node/mongo/mongo.constant.cjs +1 -0
- package/dist/node/mongo/mongo.type.cjs +1 -0
- package/dist/node/mongo/mongo.util.cjs +5 -0
- package/dist/node/mongo/mongo.util.js +433 -365
- package/dist/node/package/index.cjs +1 -0
- package/dist/node/package/package.type.cjs +1 -0
- package/dist/node/package/package.util.cjs +1 -0
- package/dist/node/package/package.util.js +224 -195
- package/dist/node/path/index.cjs +1 -0
- package/dist/node/path/path.constant.cjs +1 -0
- package/dist/node/path/path.constant.js +205 -183
- package/dist/node/path/path.util.cjs +1 -0
- package/dist/node/storage/index.cjs +1 -0
- package/dist/node/storage/storage.util.cjs +1 -0
- package/dist/node/storage/storage.util.js +70 -40
- package/dist/node/upload/index.cjs +1 -0
- package/dist/node/upload/upload.type.cjs +1 -0
- package/dist/node/upload/upload.util.cjs +1 -0
- package/dist/node/upload/upload.util.js +119 -91
- package/dist/node/ws/index.cjs +1 -0
- package/dist/node/ws/ts.util.cjs +1 -0
- 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
- package/dist/react/apollo-client/apollo-client.component.cjs +1 -0
- package/dist/react/apollo-client/apollo-client.constant.cjs +1 -0
- package/dist/react/apollo-client/apollo-client.context.cjs +1 -0
- package/dist/react/apollo-client/apollo-client.util.cjs +1 -0
- package/dist/react/apollo-client/apollo-client.util.js +74 -64
- package/dist/react/apollo-client/index.cjs +1 -0
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +1 -0
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs +1 -0
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +1 -0
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js +18 -11
- package/dist/react/apollo-client-nextjs/index.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.component.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.component.js +6 -6
- package/dist/react/apollo-error/apollo-error.context.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.hook.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.module.scss.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.provider.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.util.cjs +1 -0
- package/dist/react/apollo-error/apollo-error.util.js +1 -1
- package/dist/react/apollo-error/index.cjs +1 -0
- package/dist/react/i18next/i18next.hook.cjs +1 -0
- package/dist/react/i18next/i18next.util.cjs +1 -0
- package/dist/react/i18next/index.cjs +1 -0
- package/dist/react/loading/index.cjs +1 -0
- package/dist/react/loading/loading.component.cjs +6 -0
- package/dist/react/loading/loading.component.js +36 -19
- package/dist/react/loading/loading.context.cjs +1 -0
- package/dist/react/loading/loading.hook.cjs +1 -0
- package/dist/react/loading/loading.module.scss.cjs +1 -0
- package/dist/react/loading/loading.provider.cjs +1 -0
- package/dist/react/log/index.cjs +1 -0
- package/dist/react/log/log.util.cjs +1 -0
- package/dist/react/log/log.util.js +4 -4
- package/dist/react/next-intl/index.cjs +1 -0
- package/dist/react/next-intl/next-intl.constant.cjs +1 -0
- package/dist/react/next-intl/next-intl.context.cjs +1 -0
- package/dist/react/next-intl/next-intl.hoc.cjs +1 -0
- package/dist/react/next-intl/next-intl.hoc.js +23 -14
- package/dist/react/next-intl/next-intl.hook.cjs +1 -0
- package/dist/react/next-intl/next-intl.provider.cjs +1 -0
- package/dist/react/next-intl/next-intl.provider.js +7 -7
- package/dist/react/storage/index.cjs +1 -0
- package/dist/react/storage/storage.hook.cjs +1 -0
- package/dist/react/storage/storage.hook.js +57 -41
- package/dist/react/storage/storage.util.cjs +1 -0
- package/dist/react/storage/storage.util.js +50 -25
- package/dist/react/toast/index.cjs +1 -0
- package/dist/react/userback/index.cjs +1 -0
- package/dist/react/userback/userback.component.cjs +1 -0
- package/dist/react/userback/userback.component.js +42 -18
- package/dist/style.css +1 -1
- package/dist/typescript/common.type.cjs +1 -0
- package/dist/typescript/index.cjs +1 -0
- package/dist/util/common/common.util.cjs +1 -0
- package/dist/util/common/common.util.js +37 -29
- package/dist/util/common/index.cjs +1 -0
- package/dist/util/index.cjs +1 -0
- package/dist/util/object/index.cjs +1 -0
- package/dist/util/object/object.util.cjs +1 -0
- package/dist/util/object/object.util.js +55 -49
- package/dist/util/serializer/index.cjs +1 -0
- package/dist/util/serializer/serializer.util.cjs +1 -0
- package/dist/util/string/index.cjs +1 -0
- package/dist/util/string/string.util.cjs +1 -0
- package/dist/util/string/string.util.js +46 -36
- package/dist/util/validate/index.cjs +1 -0
- package/dist/util/validate/validate.util.cjs +1 -0
- package/package.json +69 -35
package/dist/node/cli/index.js
CHANGED
|
@@ -1,110 +1,160 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { hideBin as
|
|
4
|
-
import
|
|
5
|
-
import { clearAllErrorLists as
|
|
6
|
-
import { getPackage as
|
|
7
|
-
import { removeSync as
|
|
8
|
-
import { resolve as
|
|
9
|
-
import { CYBERSKILL_CLI as
|
|
10
|
-
import { log as
|
|
11
|
-
import { E_IssueType as
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
25
|
-
|
|
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
|
|
28
|
-
if (!
|
|
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
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
68
|
-
`).includes(
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
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
|
-
}),
|
|
149
|
+
}), (n) => e(null, null, function* () {
|
|
100
150
|
if (!n.name) {
|
|
101
|
-
|
|
151
|
+
a.error("Migration name is required.");
|
|
102
152
|
return;
|
|
103
153
|
}
|
|
104
|
-
|
|
105
|
-
}).command("mongo:migrate:up", "Apply all MongoDB migrations",
|
|
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
|
-
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import { storage as
|
|
5
|
-
import { getPackage as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { catchError as
|
|
9
|
-
import { getEnv as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
70
|
+
function W(r) {
|
|
47
71
|
const t = [], e = [];
|
|
48
|
-
let
|
|
49
|
-
const
|
|
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((
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
56
|
-
|
|
57
|
-
file:
|
|
58
|
-
position: `${
|
|
59
|
-
type:
|
|
60
|
-
message:
|
|
61
|
-
rule:
|
|
62
|
-
}) :
|
|
63
|
-
file:
|
|
64
|
-
position: `${
|
|
65
|
-
type:
|
|
66
|
-
message:
|
|
67
|
-
}) :
|
|
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:
|
|
70
|
-
message:
|
|
71
|
-
rule:
|
|
72
|
-
}) : e.push(
|
|
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 &&
|
|
99
|
+
}), t.length && A(t), j.DEBUG && e.length && (h.warn("Unmatched lines:"), e.forEach((n) => h.info(` ${n}`)));
|
|
75
100
|
}
|
|
76
|
-
function
|
|
101
|
+
function U(r) {
|
|
77
102
|
try {
|
|
78
103
|
const t = JSON.parse(r), e = [];
|
|
79
|
-
t.forEach(({ filePath:
|
|
80
|
-
|
|
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:
|
|
83
|
-
file:
|
|
84
|
-
position: `${
|
|
85
|
-
rule:
|
|
86
|
-
message:
|
|
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 &&
|
|
90
|
-
} catch {
|
|
91
|
-
|
|
114
|
+
}), e.length && A(e);
|
|
115
|
+
} catch (t) {
|
|
116
|
+
W(r);
|
|
92
117
|
}
|
|
93
118
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
}
|
|
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
|
|
139
|
+
function er(r) {
|
|
113
140
|
return { raw: !0, cmd: r };
|
|
114
141
|
}
|
|
115
|
-
function
|
|
116
|
-
return t
|
|
142
|
+
function T(r, t) {
|
|
143
|
+
return t != null && t.isCurrentProject ? `${k} ${D} ${M} ${r}` : `${k} ${O} ${r}`;
|
|
117
144
|
}
|
|
118
|
-
function
|
|
119
|
-
return typeof r == "function" ?
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
Object.
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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;
|