@cyberskill/shared 2.19.1 → 2.21.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/storybook/index.cjs +1 -0
- package/dist/config/storybook/index.d.ts +2 -0
- package/dist/config/storybook/index.js +6 -0
- package/dist/config/storybook/storybook.main.cjs +1 -0
- package/dist/config/storybook/storybook.main.d.ts +17 -0
- package/dist/config/storybook/storybook.main.js +18 -0
- package/dist/config/storybook/storybook.preview.cjs +1 -0
- package/dist/config/storybook/storybook.preview.d.ts +18 -0
- package/dist/config/storybook/storybook.preview.js +39 -0
- package/dist/config/vitest/vitest.e2e.cjs +1 -1
- package/dist/config/vitest/vitest.e2e.js +6 -6
- package/dist/config/vitest/vitest.unit.cjs +1 -1
- package/dist/config/vitest/vitest.unit.js +5 -5
- package/dist/node/cli/index.cjs +2 -2
- package/dist/node/cli/index.js +51 -41
- package/dist/node/express/express.util.cjs +1 -1
- package/dist/node/express/express.util.js +21 -21
- package/dist/node/mongo/mongo-controller.test.unit.d.ts +1 -0
- package/dist/node/mongo/mongo.test.unit.d.ts +1 -0
- package/dist/node/mongo/mongo.type.d.ts +2 -2
- package/dist/node/mongo/mongo.util.cjs +2 -2
- package/dist/node/mongo/mongo.util.d.ts +847 -147
- package/dist/node/mongo/mongo.util.js +70 -68
- package/dist/node/path/index.cjs +1 -1
- package/dist/node/path/index.js +27 -25
- package/dist/node/path/path.constant.cjs +1 -1
- package/dist/node/path/path.constant.d.ts +6 -0
- package/dist/node/path/path.constant.js +171 -143
- package/dist/node/path/path.test.unit.d.ts +1 -0
- package/dist/node/path/path.util.d.ts +2 -2
- package/dist/node/storage/index.cjs +1 -1
- package/dist/node/storage/index.d.ts +2 -0
- package/dist/node/storage/index.js +7 -2
- package/dist/node/storage/storage.constant.cjs +1 -0
- package/dist/node/storage/storage.constant.d.ts +4 -0
- package/dist/node/storage/storage.constant.js +7 -0
- package/dist/node/storage/storage.type.d.ts +14 -0
- package/dist/node/storage/storage.util.cjs +1 -1
- package/dist/node/storage/storage.util.d.ts +1 -1
- package/dist/node/storage/storage.util.js +160 -50
- package/dist/react/loading/loading.component.cjs +2 -2
- package/dist/react/loading/loading.component.js +32 -19
- package/dist/react/loading/loading.test.unit.d.ts +1 -0
- package/dist/react/loading/loading.type.d.ts +2 -1
- package/dist/util/common/common.test.unit.d.ts +1 -0
- package/dist/util/common/common.util.cjs +1 -1
- package/dist/util/common/common.util.js +14 -15
- package/dist/util/index.cjs +1 -1
- package/dist/util/index.js +16 -15
- package/dist/util/object/index.cjs +1 -1
- package/dist/util/object/index.js +4 -3
- package/dist/util/object/object.test.unit.d.ts +1 -0
- package/dist/util/object/object.util.cjs +1 -1
- package/dist/util/object/object.util.d.ts +10 -30
- package/dist/util/object/object.util.js +102 -69
- package/dist/util/serializer/serializer.test.unit.d.ts +1 -0
- package/dist/util/serializer/serializer.util.cjs +1 -1
- package/dist/util/serializer/serializer.util.js +19 -16
- package/dist/util/string/string.test.unit.d.ts +1 -0
- package/dist/util/string/string.util.cjs +1 -1
- package/dist/util/string/string.util.d.ts +4 -3
- package/dist/util/string/string.util.js +32 -41
- package/dist/util/validate/validate.test.unit.d.ts +1 -0
- package/dist/util/validate/validate.util.cjs +1 -1
- package/dist/util/validate/validate.util.js +9 -9
- package/package.json +49 -52
- /package/dist/node_modules/.pnpm/{vitest@4.0.9_@types_debug@4.1.12_@types_node@24.10.1_jiti@2.6.1_jsdom@27.2.0_sass@1.94.0_tsx@4.20.6_yaml@2.8.1 → vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.3.0_sass@1.97.0_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.cjs +0 -0
- /package/dist/node_modules/.pnpm/{vitest@4.0.9_@types_debug@4.1.12_@types_node@24.10.1_jiti@2.6.1_jsdom@27.2.0_sass@1.94.0_tsx@4.20.6_yaml@2.8.1 → vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.3.0_sass@1.97.0_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.js +0 -0
|
@@ -1,291 +1,319 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { resolveWorkingPath as
|
|
1
|
+
import F from "fs-extra";
|
|
2
|
+
import { resolveWorkingPath as s, join as y } from "./path.util.js";
|
|
3
3
|
import { E_CommandType as e } from "../command/command.type.js";
|
|
4
4
|
import { formatCommand as g, rawCommand as D } from "../command/command.util.js";
|
|
5
|
-
import { setupPackages as
|
|
6
|
-
import { E_PackageType as
|
|
7
|
-
import { getEnv as
|
|
8
|
-
var
|
|
9
|
-
for (var
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
for (var
|
|
13
|
-
H.call(
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
var C = (
|
|
5
|
+
import { setupPackages as b } from "../package/package.util.js";
|
|
6
|
+
import { E_PackageType as n } from "../package/package.type.js";
|
|
7
|
+
import { getEnv as w } from "../../config/env/env.util.js";
|
|
8
|
+
var j = Object.defineProperty, L = Object.getOwnPropertySymbols, B = Object.prototype.hasOwnProperty, H = Object.prototype.propertyIsEnumerable, P = (c, E, o) => E in c ? j(c, E, { enumerable: !0, configurable: !0, writable: !0, value: o }) : c[E] = o, U = (c, E) => {
|
|
9
|
+
for (var o in E || (E = {}))
|
|
10
|
+
B.call(E, o) && P(c, o, E[o]);
|
|
11
|
+
if (L)
|
|
12
|
+
for (var o of L(E))
|
|
13
|
+
H.call(E, o) && P(c, o, E[o]);
|
|
14
|
+
return c;
|
|
15
|
+
}, J = (c, E, o) => new Promise((p, I) => {
|
|
16
|
+
var C = (_) => {
|
|
17
17
|
try {
|
|
18
|
-
O(
|
|
18
|
+
O(o.next(_));
|
|
19
19
|
} catch (T) {
|
|
20
20
|
I(T);
|
|
21
21
|
}
|
|
22
|
-
}, N = (
|
|
22
|
+
}, N = (_) => {
|
|
23
23
|
try {
|
|
24
|
-
O(
|
|
24
|
+
O(o.throw(_));
|
|
25
25
|
} catch (T) {
|
|
26
26
|
I(T);
|
|
27
27
|
}
|
|
28
|
-
}, O = (
|
|
29
|
-
O((
|
|
28
|
+
}, O = (_) => _.done ? p(_.value) : Promise.resolve(_.value).then(C, N);
|
|
29
|
+
O((o = o.apply(c, E)).next());
|
|
30
30
|
});
|
|
31
|
-
const
|
|
32
|
-
CYBERSKILL_DIRECTORY:
|
|
33
|
-
WORKING_DIRECTORY:
|
|
34
|
-
PUBLIC_DIRECTORY:
|
|
35
|
-
TS_CONFIG:
|
|
36
|
-
GIT_IGNORE:
|
|
37
|
-
GIT_HOOK:
|
|
38
|
-
GIT_COMMIT_MSG:
|
|
39
|
-
SIMPLE_GIT_HOOKS_JSON:
|
|
40
|
-
PACKAGE_JSON:
|
|
41
|
-
PACKAGE_LOCK_JSON:
|
|
42
|
-
PNPM_LOCK_YAML:
|
|
43
|
-
NODE_MODULES:
|
|
44
|
-
MIGRATE_MONGO_CONFIG:
|
|
45
|
-
LINT_STAGED_CONFIG:
|
|
46
|
-
COMMITLINT_CONFIG:
|
|
47
|
-
VITEST_UNIT_CONFIG:
|
|
48
|
-
VITEST_E2E_CONFIG:
|
|
31
|
+
const x = w(), d = x.CWD, M = "@cyberskill/shared", K = "node_modules", S = "dist", W = "public", Y = "package.json", X = "package-lock.json", q = "tsconfig.json", z = ".gitignore", Z = ".simple-git-hooks.json", Q = "pnpm-lock.yaml", ee = ".git/hooks/", te = ".git/COMMIT_EDITMSG", ne = ".migrate-mongo.config.js", m = F.readJsonSync(s(Y)).name === M ? y(d, S) : y(d, K, M, S), ye = "cyberskill", ge = "src/node/cli/index.ts", A = "eslint", u = "eslint", f = "vitest", $ = "vitest", oe = "@commitlint/cli", se = "@commitlint/config-conventional", h = "commitlint", ce = "lint-staged", v = "lint-staged", Ee = "typescript", ae = "tsc", i = "tsx", V = "git", r = "pnpm", _e = "pnpm exec", me = "simple-git-hooks", Ie = "simple-git-hooks", ie = "@eslint/config-inspector", re = "eslint-config-inspector", pe = "node-modules-inspector", Ce = "node-modules-inspector", l = "migrate-mongo", G = "./node_modules/migrate-mongo/bin/migrate-mongo", R = "storybook", k = "storybook", a = {
|
|
32
|
+
CYBERSKILL_DIRECTORY: m,
|
|
33
|
+
WORKING_DIRECTORY: d,
|
|
34
|
+
PUBLIC_DIRECTORY: s(W),
|
|
35
|
+
TS_CONFIG: s(q),
|
|
36
|
+
GIT_IGNORE: s(z),
|
|
37
|
+
GIT_HOOK: s(ee),
|
|
38
|
+
GIT_COMMIT_MSG: s(te),
|
|
39
|
+
SIMPLE_GIT_HOOKS_JSON: s(Z),
|
|
40
|
+
PACKAGE_JSON: s(Y),
|
|
41
|
+
PACKAGE_LOCK_JSON: s(X),
|
|
42
|
+
PNPM_LOCK_YAML: s(Q),
|
|
43
|
+
NODE_MODULES: s(K),
|
|
44
|
+
MIGRATE_MONGO_CONFIG: s(ne),
|
|
45
|
+
LINT_STAGED_CONFIG: s(`${m}/config/lint-staged/index.js`),
|
|
46
|
+
COMMITLINT_CONFIG: s(`${m}/config/commitlint/index.js`),
|
|
47
|
+
VITEST_UNIT_CONFIG: s(`${m}/config/vitest/vitest.unit.js`),
|
|
48
|
+
VITEST_E2E_CONFIG: s(`${m}/config/vitest/vitest.e2e.js`),
|
|
49
|
+
STORYBOOK_MAIN_CONFIG: s(`${m}/config/storybook/storybook.main.js`),
|
|
50
|
+
STORYBOOK_PREVIEW_CONFIG: s(`${m}/config/storybook/storybook.preview.js`)
|
|
49
51
|
};
|
|
50
|
-
function
|
|
52
|
+
function Le({ isCurrentProject: c }) {
|
|
51
53
|
return U({
|
|
52
|
-
"pre-commit":
|
|
53
|
-
"commit-msg":
|
|
54
|
-
},
|
|
54
|
+
"pre-commit": v,
|
|
55
|
+
"commit-msg": h
|
|
56
|
+
}, c && { "pre-push": D(`${V} pull`) });
|
|
55
57
|
}
|
|
56
|
-
function t({ type:
|
|
57
|
-
const p =
|
|
58
|
-
return () =>
|
|
59
|
-
switch (
|
|
58
|
+
function t({ type: c, packages: E, command: o }) {
|
|
59
|
+
const p = E == null ? void 0 : E.reduce((I, C) => (I.some((N) => N.name === C.name) || I.push(C), I), []);
|
|
60
|
+
return () => J(null, null, function* () {
|
|
61
|
+
switch (c) {
|
|
60
62
|
case e.CLI:
|
|
61
|
-
return p != null && p.length && (yield
|
|
63
|
+
return p != null && p.length && (yield b(p, {
|
|
62
64
|
install: !0
|
|
63
|
-
})), g(D(`${
|
|
65
|
+
})), g(D(`${_e} ${o}`));
|
|
64
66
|
case e.STRING:
|
|
65
|
-
return g(D(
|
|
67
|
+
return g(D(o));
|
|
66
68
|
default:
|
|
67
69
|
throw new Error("Unsupported command type");
|
|
68
70
|
}
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
|
-
const
|
|
73
|
+
const Pe = {
|
|
72
74
|
simpleGitHooks: t({
|
|
73
75
|
type: e.CLI,
|
|
74
76
|
packages: [
|
|
75
77
|
{
|
|
76
|
-
name:
|
|
77
|
-
type:
|
|
78
|
+
name: me,
|
|
79
|
+
type: n.DEV_DEPENDENCY
|
|
78
80
|
}
|
|
79
81
|
],
|
|
80
|
-
command:
|
|
82
|
+
command: Ie
|
|
81
83
|
}),
|
|
82
84
|
eslintInspect: t({
|
|
83
85
|
type: e.CLI,
|
|
84
86
|
packages: [
|
|
85
87
|
{
|
|
86
|
-
name:
|
|
87
|
-
type:
|
|
88
|
+
name: ie,
|
|
89
|
+
type: n.DEV_DEPENDENCY
|
|
88
90
|
}
|
|
89
91
|
],
|
|
90
|
-
command:
|
|
92
|
+
command: re
|
|
91
93
|
}),
|
|
92
94
|
nodeModulesInspect: t({
|
|
93
95
|
type: e.CLI,
|
|
94
96
|
packages: [
|
|
95
97
|
{
|
|
96
|
-
name:
|
|
97
|
-
type:
|
|
98
|
+
name: pe,
|
|
99
|
+
type: n.DEV_DEPENDENCY
|
|
98
100
|
}
|
|
99
101
|
],
|
|
100
|
-
command:
|
|
102
|
+
command: Ce
|
|
101
103
|
}),
|
|
102
104
|
eslintCheck: t({
|
|
103
105
|
type: e.CLI,
|
|
104
106
|
packages: [
|
|
105
107
|
{
|
|
106
108
|
name: A,
|
|
107
|
-
type:
|
|
109
|
+
type: n.DEV_DEPENDENCY
|
|
108
110
|
}
|
|
109
111
|
],
|
|
110
|
-
command: `${u} ${
|
|
112
|
+
command: `${u} ${a.WORKING_DIRECTORY} --no-cache`
|
|
111
113
|
}),
|
|
112
114
|
eslintFix: t({
|
|
113
115
|
type: e.CLI,
|
|
114
116
|
packages: [
|
|
115
117
|
{
|
|
116
118
|
name: A,
|
|
117
|
-
type:
|
|
119
|
+
type: n.DEV_DEPENDENCY
|
|
118
120
|
}
|
|
119
121
|
],
|
|
120
|
-
command: `${u} ${
|
|
122
|
+
command: `${u} ${a.WORKING_DIRECTORY} --fix --no-cache`
|
|
121
123
|
}),
|
|
122
124
|
typescriptCheck: t({
|
|
123
125
|
type: e.CLI,
|
|
124
126
|
packages: [
|
|
125
127
|
{
|
|
126
|
-
name:
|
|
127
|
-
type:
|
|
128
|
+
name: Ee,
|
|
129
|
+
type: n.DEV_DEPENDENCY
|
|
128
130
|
}
|
|
129
131
|
],
|
|
130
|
-
command: `${
|
|
132
|
+
command: `${ae} -p ${a.TS_CONFIG} --noEmit`
|
|
131
133
|
}),
|
|
132
134
|
testUnit: t({
|
|
133
135
|
type: e.CLI,
|
|
134
136
|
packages: [
|
|
135
137
|
{
|
|
136
138
|
name: f,
|
|
137
|
-
type:
|
|
139
|
+
type: n.DEV_DEPENDENCY
|
|
138
140
|
}
|
|
139
141
|
],
|
|
140
|
-
command: `${$} --config ${
|
|
142
|
+
command: `${$} --config ${a.VITEST_UNIT_CONFIG}`
|
|
141
143
|
}),
|
|
142
144
|
testE2e: t({
|
|
143
145
|
type: e.CLI,
|
|
144
146
|
packages: [
|
|
145
147
|
{
|
|
146
148
|
name: f,
|
|
147
|
-
type:
|
|
149
|
+
type: n.DEV_DEPENDENCY
|
|
148
150
|
}
|
|
149
151
|
],
|
|
150
|
-
command: `${$} --config ${
|
|
152
|
+
command: `${$} --config ${a.VITEST_E2E_CONFIG}`
|
|
151
153
|
}),
|
|
152
|
-
mongoMigrateCreate: (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
154
|
+
mongoMigrateCreate: (c) => {
|
|
155
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(c))
|
|
156
|
+
throw new Error("Migration name must only contain alphanumeric characters, underscores, and hyphens.");
|
|
157
|
+
return t({
|
|
158
|
+
type: e.CLI,
|
|
159
|
+
packages: [
|
|
160
|
+
{
|
|
161
|
+
name: i,
|
|
162
|
+
type: n.DEPENDENCY
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: l,
|
|
166
|
+
type: n.DEPENDENCY
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
command: `${i} ${G} create ${c} -f ${a.MIGRATE_MONGO_CONFIG}`
|
|
170
|
+
})();
|
|
171
|
+
},
|
|
166
172
|
mongoMigrateUp: t({
|
|
167
173
|
type: e.CLI,
|
|
168
174
|
packages: [
|
|
169
175
|
{
|
|
170
|
-
name:
|
|
171
|
-
type:
|
|
176
|
+
name: i,
|
|
177
|
+
type: n.DEPENDENCY
|
|
172
178
|
},
|
|
173
179
|
{
|
|
174
180
|
name: l,
|
|
175
|
-
type:
|
|
181
|
+
type: n.DEPENDENCY
|
|
176
182
|
}
|
|
177
183
|
],
|
|
178
|
-
command: `${
|
|
184
|
+
command: `${i} ${G} up -f ${a.MIGRATE_MONGO_CONFIG}`
|
|
179
185
|
}),
|
|
180
186
|
mongoMigrateDown: t({
|
|
181
187
|
type: e.CLI,
|
|
182
188
|
packages: [
|
|
183
189
|
{
|
|
184
|
-
name:
|
|
185
|
-
type:
|
|
190
|
+
name: i,
|
|
191
|
+
type: n.DEPENDENCY
|
|
186
192
|
},
|
|
187
193
|
{
|
|
188
194
|
name: l,
|
|
189
|
-
type:
|
|
195
|
+
type: n.DEPENDENCY
|
|
190
196
|
}
|
|
191
197
|
],
|
|
192
|
-
command: `${
|
|
198
|
+
command: `${i} ${G} down -f ${a.MIGRATE_MONGO_CONFIG}`
|
|
193
199
|
}),
|
|
194
200
|
commitLint: t({
|
|
195
201
|
type: e.CLI,
|
|
196
202
|
packages: [
|
|
197
203
|
{
|
|
198
|
-
name:
|
|
199
|
-
type:
|
|
204
|
+
name: oe,
|
|
205
|
+
type: n.DEV_DEPENDENCY
|
|
200
206
|
},
|
|
201
207
|
{
|
|
202
|
-
name:
|
|
203
|
-
type:
|
|
208
|
+
name: se,
|
|
209
|
+
type: n.DEV_DEPENDENCY
|
|
204
210
|
}
|
|
205
211
|
],
|
|
206
|
-
command: `${
|
|
212
|
+
command: `${h} --edit ${a.GIT_COMMIT_MSG} --config ${a.COMMITLINT_CONFIG}`
|
|
207
213
|
}),
|
|
208
214
|
lintStaged: t({
|
|
209
215
|
type: e.CLI,
|
|
210
216
|
packages: [
|
|
211
217
|
{
|
|
212
|
-
name:
|
|
213
|
-
type:
|
|
218
|
+
name: ce,
|
|
219
|
+
type: n.DEV_DEPENDENCY
|
|
214
220
|
}
|
|
215
221
|
],
|
|
216
|
-
command: `${
|
|
222
|
+
command: `${v} --config ${a.LINT_STAGED_CONFIG}`
|
|
217
223
|
}),
|
|
218
224
|
configureGitHook: t({
|
|
219
225
|
type: e.STRING,
|
|
220
|
-
command: `${
|
|
226
|
+
command: `${V} config core.hooksPath ${a.GIT_HOOK}`
|
|
221
227
|
}),
|
|
222
228
|
build: t({
|
|
223
229
|
type: e.STRING,
|
|
224
|
-
command: `${
|
|
230
|
+
command: `${r} run --if-present build`
|
|
225
231
|
}),
|
|
226
232
|
pnpmInstallStandard: t({
|
|
227
233
|
type: e.STRING,
|
|
228
|
-
command: `${
|
|
234
|
+
command: `${r} install --ignore-scripts`
|
|
229
235
|
}),
|
|
230
236
|
pnpmInstallLegacy: t({
|
|
231
237
|
type: e.STRING,
|
|
232
|
-
command: `${
|
|
238
|
+
command: `${r} install --ignore-scripts --legacy-peer-deps`
|
|
233
239
|
}),
|
|
234
240
|
pnpmInstallForce: t({
|
|
235
241
|
type: e.STRING,
|
|
236
|
-
command: `${
|
|
242
|
+
command: `${r} install --ignore-scripts --force`
|
|
237
243
|
}),
|
|
238
244
|
pnpmPruneStore: t({
|
|
239
245
|
type: e.STRING,
|
|
240
|
-
command: `${
|
|
246
|
+
command: `${r} store prune`
|
|
241
247
|
}),
|
|
242
248
|
pnpmCleanCache: t({
|
|
243
249
|
type: e.STRING,
|
|
244
|
-
command: `${
|
|
250
|
+
command: `${r} cache delete`
|
|
251
|
+
}),
|
|
252
|
+
storybookDev: t({
|
|
253
|
+
type: e.CLI,
|
|
254
|
+
packages: [
|
|
255
|
+
{
|
|
256
|
+
name: R,
|
|
257
|
+
type: n.DEV_DEPENDENCY
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
command: `${k} dev`
|
|
261
|
+
}),
|
|
262
|
+
storybookBuild: t({
|
|
263
|
+
type: e.CLI,
|
|
264
|
+
packages: [
|
|
265
|
+
{
|
|
266
|
+
name: R,
|
|
267
|
+
type: n.DEV_DEPENDENCY
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
command: `${k} build`
|
|
245
271
|
})
|
|
246
272
|
};
|
|
247
273
|
export {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
274
|
+
S as BUILD_DIRECTORY,
|
|
275
|
+
h as COMMIT_LINT_CLI,
|
|
276
|
+
se as COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME,
|
|
277
|
+
oe as COMMIT_LINT_PACKAGE_NAME,
|
|
278
|
+
ye as CYBERSKILL_CLI,
|
|
279
|
+
ge as CYBERSKILL_CLI_PATH,
|
|
280
|
+
m as CYBERSKILL_DIRECTORY,
|
|
281
|
+
M as CYBERSKILL_PACKAGE_NAME,
|
|
256
282
|
u as ESLINT_CLI,
|
|
257
|
-
|
|
258
|
-
|
|
283
|
+
re as ESLINT_INSPECT_CLI,
|
|
284
|
+
ie as ESLINT_INSPECT_PACKAGE_NAME,
|
|
259
285
|
A as ESLINT_PACKAGE_NAME,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
286
|
+
V as GIT_CLI,
|
|
287
|
+
te as GIT_COMMIT_EDITMSG,
|
|
288
|
+
ee as GIT_HOOK,
|
|
289
|
+
z as GIT_IGNORE,
|
|
290
|
+
v as LINT_STAGED_CLI,
|
|
291
|
+
ce as LINT_STAGED_PACKAGE_NAME,
|
|
266
292
|
G as MIGRATE_MONGO_CLI,
|
|
267
|
-
|
|
293
|
+
ne as MIGRATE_MONGO_CONFIG,
|
|
268
294
|
l as MIGRATE_MONGO_PACKAGE_NAME,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
295
|
+
K as NODE_MODULES,
|
|
296
|
+
Ce as NODE_MODULES_INSPECT_CLI,
|
|
297
|
+
pe as NODE_MODULES_INSPECT_PACKAGE_NAME,
|
|
298
|
+
Y as PACKAGE_JSON,
|
|
299
|
+
X as PACKAGE_LOCK_JSON,
|
|
300
|
+
a as PATH,
|
|
301
|
+
r as PNPM_CLI,
|
|
302
|
+
_e as PNPM_EXEC_CLI,
|
|
303
|
+
Q as PNPM_LOCK_YAML,
|
|
304
|
+
W as PUBLIC_DIRECTORY,
|
|
305
|
+
me as SIMPLE_GIT_HOOKS_PACKAGE_NAME,
|
|
306
|
+
Ie as SIMPLE_GIT_HOOK_CLI,
|
|
307
|
+
Z as SIMPLE_GIT_HOOK_JSON,
|
|
308
|
+
k as STORYBOOK_CLI,
|
|
309
|
+
R as STORYBOOK_PACKAGE_NAME,
|
|
310
|
+
q as TSCONFIG_JSON,
|
|
311
|
+
ae as TSC_CLI,
|
|
312
|
+
Ee as TSC_PACKAGE_NAME,
|
|
313
|
+
i as TSX_CLI,
|
|
286
314
|
$ as VITEST_CLI,
|
|
287
315
|
f as VITEST_PACKAGE_NAME,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
316
|
+
d as WORKING_DIRECTORY,
|
|
317
|
+
Pe as command,
|
|
318
|
+
Le as createGitHooksConfig
|
|
291
319
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as pathNode } from 'node:path';
|
|
2
|
-
export declare const path: pathNode
|
|
3
|
-
export declare const dirname:
|
|
2
|
+
export declare const path: typeof pathNode;
|
|
3
|
+
export declare const dirname: typeof pathNode.dirname;
|
|
4
4
|
/**
|
|
5
5
|
* Resolves a path relative to the current working directory.
|
|
6
6
|
* This function creates an absolute path by combining the current working directory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./storage.constant.cjs"),_=require("./storage.util.cjs");exports.NODE_FS_DRIVER_NAME=E.NODE_FS_DRIVER_NAME;exports.STORAGE_INSTANCE_NAME=E.STORAGE_INSTANCE_NAME;exports.STORAGE_KEY_EXTENSION=E.STORAGE_KEY_EXTENSION;exports.STORAGE_STORE_NAME=E.STORAGE_STORE_NAME;exports.storage=_.storage;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NODE_FS_DRIVER_NAME as N, STORAGE_INSTANCE_NAME as A, STORAGE_KEY_EXTENSION as S, STORAGE_STORE_NAME as O } from "./storage.constant.js";
|
|
2
|
+
import { storage as T } from "./storage.util.js";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
+
N as NODE_FS_DRIVER_NAME,
|
|
5
|
+
A as STORAGE_INSTANCE_NAME,
|
|
6
|
+
S as STORAGE_KEY_EXTENSION,
|
|
7
|
+
O as STORAGE_STORE_NAME,
|
|
8
|
+
T as storage
|
|
4
9
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E="localforage-node-fs",_=".json",N="cyberskill",S="node-storage";exports.NODE_FS_DRIVER_NAME=E;exports.STORAGE_INSTANCE_NAME=N;exports.STORAGE_KEY_EXTENSION=_;exports.STORAGE_STORE_NAME=S;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as localForage } from 'localforage';
|
|
2
|
+
export type LocalForageDriver = Parameters<typeof localForage.defineDriver>[0];
|
|
3
|
+
export interface NodeLocalForageOptions {
|
|
4
|
+
driver?: string | string[];
|
|
5
|
+
size?: number;
|
|
6
|
+
version?: number;
|
|
7
|
+
description?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
storeName?: string;
|
|
10
|
+
baseDir?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface NodeFsDriverState {
|
|
13
|
+
baseDir: string;
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("localforage"),o=require("node:fs/promises"),D=require("node:path"),c=require("./storage.constant.cjs"),I=require("../../config/env/env.util.cjs"),s=require("../log/log.util.cjs");var n=(e,r,t)=>new Promise((i,y)=>{var h=u=>{try{v(t.next(u))}catch(_){y(_)}},O=u=>{try{v(t.throw(u))}catch(_){y(_)}},v=u=>u.done?i(u.value):Promise.resolve(u.value).then(h,O);v((t=t.apply(e,r)).next())});const E=I.getEnv(),l={baseDir:E.CYBERSKILL_STORAGE_DIRECTORY};function m(e){return`${encodeURIComponent(e)}${c.STORAGE_KEY_EXTENSION}`}function N(e){return decodeURIComponent(e.slice(0,-c.STORAGE_KEY_EXTENSION.length))}function R(e,r){return D.join(r,m(e))}const d={_driver:c.NODE_FS_DRIVER_NAME,_support:!0,_initStorage(e){return n(this,null,function*(){try{const r=typeof e=="object"&&e!==null&&"baseDir"in e?e.baseDir:void 0;typeof r=="string"&&r.length>0?l.baseDir=r:l.baseDir=E.CYBERSKILL_STORAGE_DIRECTORY,yield o.mkdir(l.baseDir,{recursive:!0})}catch(r){throw s.log.error("[Storage:init]",r),r}})},clear(){return n(this,null,function*(){const{baseDir:e}=l;yield o.rm(e,{recursive:!0,force:!0}),yield o.mkdir(e,{recursive:!0})})},getItem(e){return n(this,null,function*(){const{baseDir:r}=l,t=R(e,r);try{const i=yield o.readFile(t,"utf8");return JSON.parse(i)}catch(i){if(i.code==="ENOENT")return null;throw i}})},iterate(e){return n(this,null,function*(){const r=yield d.keys();let t=1;for(const i of r){const y=yield d.getItem(i),h=e(y,i,t);if(h!==void 0)return h;t+=1}})},key(e){return n(this,null,function*(){var r;return(r=(yield d.keys())[e])!=null?r:null})},keys(){return n(this,null,function*(){const{baseDir:e}=l;try{return(yield o.readdir(e)).filter(t=>t.endsWith(c.STORAGE_KEY_EXTENSION)).map(N)}catch(r){if(r.code==="ENOENT")return[];throw r}})},length(){return n(this,null,function*(){return(yield d.keys()).length})},removeItem(e){return n(this,null,function*(){const{baseDir:r}=l,t=R(e,r);yield o.rm(t,{force:!0})})},setItem(e,r){return n(this,null,function*(){const{baseDir:t}=l,i=R(e,t);return yield o.mkdir(t,{recursive:!0}),yield o.writeFile(i,JSON.stringify(r),"utf8"),r})}};let a=null,S=null;function f(){return n(this,null,function*(){return a?(yield a,S):(a=n(null,null,function*(){yield g.defineDriver(d),l.baseDir=E.CYBERSKILL_STORAGE_DIRECTORY;const e=yield g.getDriver(c.NODE_FS_DRIVER_NAME),r={baseDir:l.baseDir,name:c.STORAGE_INSTANCE_NAME,storeName:c.STORAGE_STORE_NAME};yield e._initStorage(r),S=e}).catch(e=>{throw a=null,e}),yield a,S)})}const T={get(e){return n(this,null,function*(){try{const t=yield(yield f()).getItem(e);return t!=null?t:null}catch(r){return s.catchError(r,{returnValue:null})}})},set(e,r){return n(this,null,function*(){try{yield(yield f()).setItem(e,r)}catch(t){s.catchError(t)}})},remove(e){return n(this,null,function*(){try{yield(yield f()).removeItem(e)}catch(r){s.catchError(r)}})},keys(){return n(this,null,function*(){try{const r=yield(yield f()).keys();return Array.isArray(r)?r:(s.log.warn("[Storage:keys] Invalid keys response:",r),[])}catch(e){return s.catchError(e,{returnValue:[]})}})},getLogLink(e){return n(this,null,function*(){try{return`${D.join(E.CYBERSKILL_STORAGE_DIRECTORY,m(e))} (key: ${e})`}catch(r){return s.catchError(r,{returnValue:null})}})}};exports.storage=T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Persistent storage utility object for data persistence across application sessions.
|
|
3
|
-
* This object provides methods for storing, retrieving, and managing data using
|
|
3
|
+
* This object provides methods for storing, retrieving, and managing data using localForage,
|
|
4
4
|
* with automatic initialization and error handling.
|
|
5
5
|
*/
|
|
6
6
|
export declare const storage: {
|