@cyberskill/shared 2.26.0 → 2.28.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/README.md +1 -1
- package/dist/config/config.util.cjs +1 -1
- package/dist/config/config.util.js +14 -19
- package/dist/config/eslint/index.cjs +1 -1
- package/dist/config/eslint/index.d.ts +2 -0
- package/dist/config/eslint/index.js +1 -1
- package/dist/config/vitest/vitest.e2e.cjs +1 -1
- package/dist/config/vitest/vitest.e2e.js +1 -1
- package/dist/config/vitest/vitest.unit.cjs +1 -1
- package/dist/config/vitest/vitest.unit.js +1 -1
- package/dist/node/cli/index.cjs +2 -5
- package/dist/node/cli/index.js +108 -103
- package/dist/node/command/command.util.js +1 -1
- package/dist/node/fs/fs.util.cjs +4 -1
- package/dist/node/fs/fs.util.d.ts +8 -0
- package/dist/node/fs/fs.util.js +58 -50
- package/dist/node/fs/index.cjs +1 -1
- package/dist/node/fs/index.js +13 -12
- package/dist/node/mongo/mongo.type.js +3 -3
- package/dist/node/mongo/mongo.util.cjs +2 -5
- package/dist/node/mongo/mongo.util.js +206 -211
- package/dist/node/path/index.cjs +1 -1
- package/dist/node/path/index.js +53 -51
- package/dist/node/path/path.constant.cjs +1 -1
- package/dist/node/path/path.constant.d.ts +3 -0
- package/dist/node/path/path.constant.js +63 -60
- package/dist/node/storage/storage.util.cjs +1 -1
- package/dist/node/storage/storage.util.js +1 -1
- package/dist/node/upload/upload.util.js +3 -3
- package/dist/react/apollo-client/apollo-client.component.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.component.d.ts +1 -1
- package/dist/react/apollo-client/apollo-client.component.js +4 -3
- package/dist/react/apollo-client/apollo-client.context.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.context.d.ts +1 -1
- package/dist/react/apollo-client/apollo-client.context.js +9 -8
- package/dist/react/apollo-client/apollo-client.util.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.util.js +3 -3
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +1 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.d.ts +1 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js +9 -8
- package/dist/react/apollo-error/apollo-error.component.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.component.d.ts +1 -1
- package/dist/react/apollo-error/apollo-error.component.js +2 -1
- package/dist/react/apollo-error/apollo-error.provider.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.provider.d.ts +1 -1
- package/dist/react/apollo-error/apollo-error.provider.js +4 -3
- package/dist/react/loading/loading.component.cjs +2 -2
- package/dist/react/loading/loading.component.d.ts +1 -1
- package/dist/react/loading/loading.component.js +7 -6
- package/dist/react/loading/loading.provider.cjs +1 -1
- package/dist/react/loading/loading.provider.d.ts +1 -1
- package/dist/react/loading/loading.provider.js +8 -7
- package/dist/react/next-intl/next-intl.hoc.cjs +1 -1
- package/dist/react/next-intl/next-intl.hoc.d.ts +2 -1
- package/dist/react/next-intl/next-intl.hoc.js +12 -12
- package/dist/react/next-intl/next-intl.provider.cjs +1 -1
- package/dist/react/next-intl/next-intl.provider.d.ts +1 -1
- package/dist/react/next-intl/next-intl.provider.js +5 -4
- package/dist/util/common/common.util.cjs +1 -1
- package/dist/util/common/common.util.d.ts +9 -0
- package/dist/util/common/common.util.js +33 -29
- package/dist/util/common/index.cjs +1 -1
- package/dist/util/common/index.js +6 -5
- package/dist/util/index.cjs +1 -1
- package/dist/util/index.js +23 -22
- package/dist/util/object/object.util.cjs +1 -1
- package/dist/util/object/object.util.js +40 -36
- package/package.json +45 -44
- package/dist/node/mongo/mongo.util.d.ts +0 -1040
- /package/dist/node_modules/.pnpm/{vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2 → vitest@4.0.18_@types_node@25.3.0_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.cjs +0 -0
- /package/dist/node_modules/.pnpm/{vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2 → vitest@4.0.18_@types_node@25.3.0_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.js +0 -0
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@antfu/eslint-config"),i=require("./config.type.cjs"),o=require("./eslint/index.cjs"),_=require("./vitest/vitest.e2e.cjs"),l=require("./vitest/vitest.unit.cjs"),a=require("../util/object/object.util.cjs");var f=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,E=(e,n)=>{var t={};for(var r in e)y.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&f)for(var r of f(e))n.indexOf(r)<0&&u.call(e,r)&&(t[r]=e[r]);return t};const p=(...e)=>{const t=a.deepMerge(...Array.isArray(o.default)?o.default:[o.default],...e),{ignores:r}=t,g=E(t,["ignores"]);return s({stylistic:{semi:!0,indent:4},formatters:!0,yaml:!1,react:!0},g,...Array.isArray(r)?[{ignores:r}]:[])},T={[i.E_ConfigType.ESLINT]:e=>p(e),[i.E_ConfigType.COMMITLINT]:e=>a.deepMerge(e),[i.E_ConfigType.LINT_STAGED]:e=>a.deepMerge(e),[i.E_ConfigType.VITEST_REACT_UNIT]:e=>l.vitestUnit(e),[i.E_ConfigType.VITEST_REACT_E2E]:e=>_.vitestE2E(e)};function d(e,...n){const t=T[e];if(!n||n.length===0)return t({});if(!t)throw new Error(`Unknown config type: ${e}`);return t(...n)}exports.mergeConfigs=d;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s from "@antfu/eslint-config";
|
|
2
2
|
import { E_ConfigType as o } from "./config.type.js";
|
|
3
3
|
import i from "./eslint/index.js";
|
|
4
|
-
import { vitestE2E as
|
|
5
|
-
import { vitestUnit as
|
|
4
|
+
import { vitestE2E as p } from "./vitest/vitest.e2e.js";
|
|
5
|
+
import { vitestUnit as g } from "./vitest/vitest.unit.js";
|
|
6
6
|
import { deepMerge as a } from "../util/object/object.util.js";
|
|
7
|
-
var f = Object.getOwnPropertySymbols,
|
|
7
|
+
var f = Object.getOwnPropertySymbols, l = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable, _ = (r, n) => {
|
|
8
8
|
var e = {};
|
|
9
9
|
for (var t in r)
|
|
10
|
-
|
|
10
|
+
l.call(r, t) && n.indexOf(t) < 0 && (e[t] = r[t]);
|
|
11
11
|
if (r != null && f)
|
|
12
12
|
for (var t of f(r))
|
|
13
13
|
n.indexOf(t) < 0 && E.call(r, t) && (e[t] = r[t]);
|
|
@@ -17,33 +17,28 @@ const y = (...r) => {
|
|
|
17
17
|
const e = a(
|
|
18
18
|
...Array.isArray(i) ? i : [i],
|
|
19
19
|
...r
|
|
20
|
-
), { ignores: t } = e,
|
|
21
|
-
return
|
|
20
|
+
), { ignores: t } = e, m = _(e, ["ignores"]);
|
|
21
|
+
return s(
|
|
22
22
|
{
|
|
23
23
|
stylistic: {
|
|
24
24
|
semi: !0,
|
|
25
|
-
indent: 4
|
|
26
|
-
quotes: "single"
|
|
27
|
-
},
|
|
28
|
-
formatters: {
|
|
29
|
-
css: !0,
|
|
30
|
-
html: !0,
|
|
31
|
-
markdown: "prettier"
|
|
25
|
+
indent: 4
|
|
32
26
|
},
|
|
27
|
+
formatters: !0,
|
|
33
28
|
yaml: !1,
|
|
34
29
|
react: !0
|
|
35
30
|
},
|
|
36
|
-
|
|
31
|
+
m,
|
|
37
32
|
...Array.isArray(t) ? [{ ignores: t }] : []
|
|
38
33
|
);
|
|
39
34
|
}, T = {
|
|
40
35
|
[o.ESLINT]: (r) => y(r),
|
|
41
36
|
[o.COMMITLINT]: (r) => a(r),
|
|
42
37
|
[o.LINT_STAGED]: (r) => a(r),
|
|
43
|
-
[o.VITEST_REACT_UNIT]: (r) =>
|
|
44
|
-
[o.VITEST_REACT_E2E]: (r) =>
|
|
38
|
+
[o.VITEST_REACT_UNIT]: (r) => g(r),
|
|
39
|
+
[o.VITEST_REACT_E2E]: (r) => p(r)
|
|
45
40
|
};
|
|
46
|
-
function
|
|
41
|
+
function w(r, ...n) {
|
|
47
42
|
const e = T[r];
|
|
48
43
|
if (!n || n.length === 0)
|
|
49
44
|
return e({});
|
|
@@ -52,5 +47,5 @@ function b(r, ...n) {
|
|
|
52
47
|
return e(...n);
|
|
53
48
|
}
|
|
54
49
|
export {
|
|
55
|
-
|
|
50
|
+
w as mergeConfigs
|
|
56
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("globals");function u(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const n=u(i);var c=Object.defineProperty,a=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,l=(t,e,r)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s=(t,e)=>{for(var r in e||(e={}))f.call(e,r)&&l(t,r,e[r]);if(a)for(var r of a(e))p.call(e,r)&&l(t,r,e[r]);return t};const d=[{languageOptions:{globals:s(s({},n.node),n.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}],"dot-notation":"off"},ignores:["**/node_modules/**","**/.git/**","build","dist"]}];exports.default=d;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("globals");function u(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const n=u(i);var c=Object.defineProperty,a=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,l=(t,e,r)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s=(t,e)=>{for(var r in e||(e={}))f.call(e,r)&&l(t,r,e[r]);if(a)for(var r of a(e))p.call(e,r)&&l(t,r,e[r]);return t};const d=[{languageOptions:{globals:s(s({},n.node),n.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}],"dot-notation":"off"},ignores:["**/node_modules/**","**/.git/**","build","dist",".agent"]}];exports.default=d;
|
|
@@ -373,6 +373,7 @@ declare const _default: {
|
|
|
373
373
|
HTMLFormElement: false;
|
|
374
374
|
HTMLFrameElement: false;
|
|
375
375
|
HTMLFrameSetElement: false;
|
|
376
|
+
HTMLGeolocationElement: false;
|
|
376
377
|
HTMLHeadElement: false;
|
|
377
378
|
HTMLHeadingElement: false;
|
|
378
379
|
HTMLHRElement: false;
|
|
@@ -1165,6 +1166,7 @@ declare const _default: {
|
|
|
1165
1166
|
XRView: false;
|
|
1166
1167
|
XRViewerPose: false;
|
|
1167
1168
|
XRViewport: false;
|
|
1169
|
+
XRVisibilityMaskChangeEvent: false;
|
|
1168
1170
|
XRWebGLBinding: false;
|
|
1169
1171
|
XRWebGLDepthInformation: false;
|
|
1170
1172
|
XRWebGLLayer: false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@vitejs/plugin-react-swc"),i=require("../../node_modules/.pnpm/vitest@4.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@vitejs/plugin-react-swc"),i=require("../../node_modules/.pnpm/vitest@4.0.18_@types_node@25.3.0_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.cjs"),o=require("../../util/object/object.util.cjs");function n(e){const r={plugins:[t()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}};return i.defineConfig(o.deepMerge(r,e))}exports.vitestE2E=n;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import t from "@vitejs/plugin-react-swc";
|
|
2
|
-
import { defineConfig as o } from "../../node_modules/.pnpm/vitest@4.0.
|
|
2
|
+
import { defineConfig as o } from "../../node_modules/.pnpm/vitest@4.0.18_@types_node@25.3.0_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js";
|
|
3
3
|
import { deepMerge as i } from "../../util/object/object.util.js";
|
|
4
4
|
function m(e) {
|
|
5
5
|
const r = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@vitejs/plugin-react-swc"),n=require("../../node_modules/.pnpm/vitest@4.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@vitejs/plugin-react-swc"),n=require("../../node_modules/.pnpm/vitest@4.0.18_@types_node@25.3.0_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.cjs"),s=require("../../util/object/object.util.cjs");function r(e){const t={plugins:[i()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:["./vitest.unit.setup.ts"]}};return n.defineConfig(s.deepMerge(t,e))}exports.vitestUnit=r;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import i from "@vitejs/plugin-react-swc";
|
|
2
|
-
import { defineConfig as o } from "../../node_modules/.pnpm/vitest@4.0.
|
|
2
|
+
import { defineConfig as o } from "../../node_modules/.pnpm/vitest@4.0.18_@types_node@25.3.0_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js";
|
|
3
3
|
import { deepMerge as n } from "../../util/object/object.util.js";
|
|
4
4
|
function p(t) {
|
|
5
5
|
const e = {
|
package/dist/node/cli/index.cjs
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";const
|
|
3
|
-
|
|
4
|
-
`;a.pathExistsSync(n.PATH.GIT_IGNORE)?a.readFileSync(n.PATH.GIT_IGNORE,"utf-8").split(`
|
|
5
|
-
`).includes(n.SIMPLE_GIT_HOOK_JSON)||a.appendFileSync(n.PATH.GIT_IGNORE,o):a.writeFileSync(n.PATH.GIT_IGNORE,o),yield i.runCommand("Setting up simple-git-hooks",yield n.command.simpleGitHooks())})}function G(){return t(this,null,function*(){yield y.installDependencies(),yield C()})}function b(){return t(this,null,function*(){a.removeSync(n.PATH.NODE_MODULES,n.PATH.PNPM_LOCK_YAML),yield i.runCommand("Pruning pnpm store",yield n.command.pnpmPruneStore()),yield i.runCommand("Clearing pnpm cache",yield n.command.pnpmCleanCache()),yield y.installDependencies(),yield C()})}function D(){return t(this,null,function*(){yield i.runCommand("Inspecting project dependencies",yield n.command.nodeModulesInspect())})}function B(){return t(this,null,function*(){yield i.runCommand("Running unit tests",yield n.command.testUnit())})}function N(){return t(this,null,function*(){yield i.runCommand("Running end-to-end tests",yield n.command.testE2e())})}function w(e){return t(this,null,function*(){yield i.runCommand("Creating MongoDB migration",yield n.command.mongoMigrateCreate(e))})}function H(){return t(this,null,function*(){yield i.runCommand("Running MongoDB migrations",yield n.command.mongoMigrateUp())})}function q(){return t(this,null,function*(){yield i.runCommand("Rolling back MongoDB migration",yield n.command.mongoMigrateDown())})}function x(){return t(this,null,function*(){yield i.runCommand("Starting Storybook development server",yield n.command.storybookDev())})}function F(){return t(this,null,function*(){yield i.runCommand("Building Storybook",yield n.command.storybookBuild())})}t(null,null,function*(){try{yield T(I.hideBin(u.argv)).scriptName(n.CYBERSKILL_CLI).usage("$0 <command> [options]").command("lint","Check code for linting issues",P).command("lint:fix","Fix linting issues automatically",A).command("lint:inspect","View active ESLint configuration",O).command("lint-staged","Run lint checks on staged files",M).command("commitlint","Validate commit message format",R).command("ready","Initialize project and dependencies",G).command("reset","Reset the project and reinstall dependencies",b).command("inspect","Analyze installed project dependencies",D).command("test:unit","Run unit test suite",B).command("test:e2e","Run end-to-end test suite",N).command("mongo:migrate:create <name>","Create a MongoDB migration",e=>e.positional("name",{describe:"Migration name",type:"string"}),e=>t(null,null,function*(){if(!e.name){c.log.error("Migration name is required.");return}yield w(e.name)})).command("mongo:migrate:up","Apply all MongoDB migrations",H).command("mongo:migrate:down","Rollback last MongoDB migration",q).command("storybook:dev","Start Storybook development server",x).command("storybook:build","Build Storybook for production",F).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(L()).epilog(`💡 Tip: Use "--help" with any command to see options
|
|
6
|
-
`).parse()}catch(e){c.catchError(e),u.exit(1)}});
|
|
2
|
+
"use strict";const d=require("node:process"),I=require("yargs/helpers"),T=require("yargs/yargs"),e=require("../command/command.util.cjs"),y=require("../package/package.util.cjs"),a=require("../fs/fs.util.cjs"),v=require("../path/path.util.cjs"),n=require("../path/path.constant.cjs"),u=require("../log/log.util.cjs"),f=require("../log/log.type.cjs");var t=(i,r,o)=>new Promise((l,p)=>{var A=c=>{try{m(o.next(c))}catch(g){p(g)}},S=c=>{try{m(o.throw(c))}catch(g){p(g)}},m=c=>c.done?l(c.value):Promise.resolve(c.value).then(A,S);m((o=o.apply(i,r)).next())});function M(){try{return JSON.parse(a.readFileSync(v.resolve(__dirname,"../../../package.json"),"utf-8")).version}catch(i){return"1.0.0"}}function E(){return t(this,null,function*(){a.pathExistsSync(n.PATH.TS_CONFIG)?yield e.runCommand("Performing TypeScript validation",yield n.command.typescriptCheck()):u.log.warn("No TypeScript configuration found. Skipping type check.")})}function C(i=!1){return t(this,null,function*(){const r=i?yield n.command.eslintFix():yield n.command.eslintCheck(),o=i?"Running ESLint with auto-fix":"Running ESLint check";try{yield e.runCommand(o,r,{timeout:6e4,throwOnError:!0})}catch(l){l.code==="ETIMEDOUT"||l.killed||l.signal==="SIGTERM"?(u.log.warn("Lint check timed out. Retrying with debug mode enabled..."),d.env.DEBUG="true",yield e.runCommand(`${o} (Debug Mode)`,r)):u.catchError(l)}})}function h(i,r){if(!r.length)return;const o=i==="Errors"?"red":"yellow";u.log.printBoxedLog(i==="Errors"?"✖ Errors":"⚠ Warnings",r,o)}function s(){return t(this,null,function*(){setTimeout(()=>t(null,null,function*(){const i=(yield e.getStoredErrorLists())||[],r=i.filter(l=>l.type===f.E_IssueType.Error),o=i.filter(l=>l.type===f.E_IssueType.Warning);!r.length&&!o.length?u.log.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(h("Warnings",o),h("Errors",r),r.length>0&&d.exit(1))}),0)})}function G(){return t(this,null,function*(){yield e.clearAllErrorLists();const i=yield y.getPackage({name:n.CYBERSKILL_PACKAGE_NAME});if(!i.success){u.log.error("Failed to retrieve package information. Aborting lint-staged.");return}i.result.isCurrentProject&&(yield e.runCommand(`Building package: ${n.CYBERSKILL_PACKAGE_NAME}`,yield n.command.build())),yield e.runCommand("Executing lint-staged",yield n.command.lintStaged()),s()})}function L(){return t(this,null,function*(){yield e.runCommand("Inspecting ESLint configuration",yield n.command.eslintInspect())})}function P(){return t(this,null,function*(){yield e.clearAllErrorLists(),yield E(),yield C(),s()})}function b(){return t(this,null,function*(){yield e.clearAllErrorLists(),yield E(),yield C(!0),s()})}function O(){return t(this,null,function*(){yield e.clearAllErrorLists(),yield e.runCommand("Validating commit message",yield n.command.commitLint()),s()})}function _(){return t(this,null,function*(){yield e.runCommand("Configuring Git hooks",yield n.command.configureGitHook()),a.removeSync(n.PATH.GIT_HOOK);const i=yield e.resolveCommands(n.createGitHooksConfig);a.writeFileSync(n.PATH.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(i,null,4)),a.addGitIgnoreEntry(n.PATH.GIT_IGNORE,n.SIMPLE_GIT_HOOK_JSON),yield e.runCommand("Setting up simple-git-hooks",yield n.command.simpleGitHooks())})}function k(){return t(this,null,function*(){try{yield e.runCommand(`Checking for ${n.AG_KIT_PACKAGE_NAME}`,`pnpm list -g ${n.AG_KIT_PACKAGE_NAME}`)}catch(i){yield e.runCommand(`Installing ${n.AG_KIT_PACKAGE_NAME} globally`,`pnpm i -g ${n.AG_KIT_PACKAGE_NAME}`)}a.pathExistsSync(n.PATH.DOT_AGENT)?yield e.runCommand("Updating AI agent","ag-kit update -y"):yield e.runCommand("Initializing AI agent","ag-kit init"),a.addGitIgnoreEntry(n.PATH.GIT_IGNORE,n.DOT_AGENT)})}function D(){return t(this,null,function*(){yield y.installDependencies(),yield _()})}function N(){return t(this,null,function*(){a.removeSync(n.PATH.NODE_MODULES,n.PATH.PNPM_LOCK_YAML),yield e.runCommand("Pruning pnpm store",yield n.command.pnpmPruneStore()),yield e.runCommand("Clearing pnpm cache",yield n.command.pnpmCleanCache()),yield y.installDependencies(),yield _(),yield k()})}function R(){return t(this,null,function*(){yield e.runCommand("Inspecting project dependencies",yield n.command.nodeModulesInspect())})}function B(){return t(this,null,function*(){yield e.runCommand("Running unit tests",yield n.command.testUnit())})}function K(){return t(this,null,function*(){yield e.runCommand("Running end-to-end tests",yield n.command.testE2e())})}function w(i){return t(this,null,function*(){yield e.runCommand("Creating MongoDB migration",yield n.command.mongoMigrateCreate(i))})}function H(){return t(this,null,function*(){yield e.runCommand("Running MongoDB migrations",yield n.command.mongoMigrateUp())})}function q(){return t(this,null,function*(){yield e.runCommand("Rolling back MongoDB migration",yield n.command.mongoMigrateDown())})}function x(){return t(this,null,function*(){yield e.runCommand("Starting Storybook development server",yield n.command.storybookDev())})}function U(){return t(this,null,function*(){yield e.runCommand("Building Storybook",yield n.command.storybookBuild())})}t(null,null,function*(){try{yield T(I.hideBin(d.argv)).scriptName(n.CYBERSKILL_CLI).usage("$0 <command> [options]").command("ai:setup","Setup AI agent environment",k).command("lint","Check code for linting issues",P).command("lint:fix","Fix linting issues automatically",b).command("lint:inspect","View active ESLint configuration",L).command("lint-staged","Run lint checks on staged files",G).command("commitlint","Validate commit message format",O).command("ready","Initialize project and dependencies",D).command("reset","Reset the project and reinstall dependencies",N).command("inspect","Analyze installed project dependencies",R).command("test:unit","Run unit test suite",B).command("test:e2e","Run end-to-end test suite",K).command("mongo:migrate:create <name>","Create a MongoDB migration",i=>i.positional("name",{describe:"Migration name",type:"string"}),i=>t(null,null,function*(){if(!i.name){u.log.error("Migration name is required.");return}yield w(i.name)})).command("mongo:migrate:up","Apply all MongoDB migrations",H).command("mongo:migrate:down","Rollback last MongoDB migration",q).command("storybook:dev","Start Storybook development server",x).command("storybook:build","Build Storybook for production",U).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(M()).epilog(`💡 Tip: Use "--help" with any command to see options
|
|
3
|
+
`).parse()}catch(i){u.catchError(i),d.exit(1)}});
|
package/dist/node/cli/index.js
CHANGED
|
@@ -1,175 +1,180 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { hideBin as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { getPackage as N, installDependencies as
|
|
7
|
-
import {
|
|
8
|
-
import { resolve as
|
|
9
|
-
import { CYBERSKILL_CLI as
|
|
10
|
-
import { log as
|
|
11
|
-
import { E_IssueType as
|
|
12
|
-
var
|
|
13
|
-
var
|
|
2
|
+
import d from "node:process";
|
|
3
|
+
import { hideBin as G } from "yargs/helpers";
|
|
4
|
+
import R from "yargs/yargs";
|
|
5
|
+
import { runCommand as e, clearAllErrorLists as m, getStoredErrorLists as A, resolveCommands as B } from "../command/command.util.js";
|
|
6
|
+
import { getPackage as N, installDependencies as S } from "../package/package.util.js";
|
|
7
|
+
import { pathExistsSync as I, addGitIgnoreEntry as v, removeSync as C, readFileSync as w, writeFileSync as P } from "../fs/fs.util.js";
|
|
8
|
+
import { resolve as U } from "../path/path.util.js";
|
|
9
|
+
import { CYBERSKILL_CLI as x, command as t, CYBERSKILL_PACKAGE_NAME as h, PATH as s, SIMPLE_GIT_HOOK_JSON as K, createGitHooksConfig as F, AG_KIT_PACKAGE_NAME as u, DOT_AGENT as H } from "../path/path.constant.js";
|
|
10
|
+
import { log as a, catchError as _ } from "../log/log.util.js";
|
|
11
|
+
import { E_IssueType as k } from "../log/log.type.js";
|
|
12
|
+
var i = (n, r, o) => new Promise((l, f) => {
|
|
13
|
+
var T = (c) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
p
|
|
15
|
+
y(o.next(c));
|
|
16
|
+
} catch (p) {
|
|
17
|
+
f(p);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
19
|
+
}, D = (c) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
} catch (
|
|
23
|
-
p
|
|
21
|
+
y(o.throw(c));
|
|
22
|
+
} catch (p) {
|
|
23
|
+
f(p);
|
|
24
24
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
25
|
+
}, y = (c) => c.done ? l(c.value) : Promise.resolve(c.value).then(T, D);
|
|
26
|
+
y((o = o.apply(n, r)).next());
|
|
27
27
|
});
|
|
28
|
-
function
|
|
28
|
+
function $() {
|
|
29
29
|
try {
|
|
30
30
|
return JSON.parse(
|
|
31
|
-
|
|
31
|
+
w(U(__dirname, "../../../package.json"), "utf-8")
|
|
32
32
|
).version;
|
|
33
33
|
} catch (n) {
|
|
34
34
|
return "1.0.0";
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
39
|
-
|
|
37
|
+
function M() {
|
|
38
|
+
return i(this, null, function* () {
|
|
39
|
+
I(s.TS_CONFIG) ? yield e("Performing TypeScript validation", yield t.typescriptCheck()) : a.warn("No TypeScript configuration found. Skipping type check.");
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return
|
|
44
|
-
const
|
|
42
|
+
function b(n = !1) {
|
|
43
|
+
return i(this, null, function* () {
|
|
44
|
+
const r = n ? yield t.eslintFix() : yield t.eslintCheck(), o = n ? "Running ESLint with auto-fix" : "Running ESLint check";
|
|
45
45
|
try {
|
|
46
|
-
yield
|
|
46
|
+
yield e(o, r, { timeout: 6e4, throwOnError: !0 });
|
|
47
47
|
} catch (l) {
|
|
48
|
-
l.code === "ETIMEDOUT" || l.killed || l.signal === "SIGTERM" ? (
|
|
48
|
+
l.code === "ETIMEDOUT" || l.killed || l.signal === "SIGTERM" ? (a.warn("Lint check timed out. Retrying with debug mode enabled..."), d.env.DEBUG = "true", yield e(`${o} (Debug Mode)`, r)) : _(l);
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
if (!
|
|
52
|
+
function E(n, r) {
|
|
53
|
+
if (!r.length)
|
|
54
54
|
return;
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
function
|
|
59
|
-
return
|
|
60
|
-
setTimeout(() =>
|
|
61
|
-
const n = (yield
|
|
62
|
-
!
|
|
55
|
+
const o = n === "Errors" ? "red" : "yellow";
|
|
56
|
+
a.printBoxedLog(n === "Errors" ? "✖ Errors" : "⚠ Warnings", r, o);
|
|
57
|
+
}
|
|
58
|
+
function g() {
|
|
59
|
+
return i(this, null, function* () {
|
|
60
|
+
setTimeout(() => i(null, null, function* () {
|
|
61
|
+
const n = (yield A()) || [], r = n.filter((l) => l.type === k.Error), o = n.filter((l) => l.type === k.Warning);
|
|
62
|
+
!r.length && !o.length ? a.printBoxedLog("✔ NO ISSUES FOUND", [], "green") : (E("Warnings", o), E("Errors", r), r.length > 0 && d.exit(1));
|
|
63
63
|
}), 0);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
68
|
-
yield
|
|
66
|
+
function j() {
|
|
67
|
+
return i(this, null, function* () {
|
|
68
|
+
yield m();
|
|
69
69
|
const n = yield N({ name: h });
|
|
70
70
|
if (!n.success) {
|
|
71
|
-
|
|
71
|
+
a.error("Failed to retrieve package information. Aborting lint-staged.");
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
n.result.isCurrentProject && (yield
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function K() {
|
|
78
|
-
return e(this, null, function* () {
|
|
79
|
-
yield i("Inspecting ESLint configuration", yield t.eslintInspect());
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
function j() {
|
|
83
|
-
return e(this, null, function* () {
|
|
84
|
-
yield d(), yield L(), yield O(), m();
|
|
74
|
+
n.result.isCurrentProject && (yield e(`Building package: ${h}`, yield t.build())), yield e("Executing lint-staged", yield t.lintStaged()), g();
|
|
85
75
|
});
|
|
86
76
|
}
|
|
87
77
|
function J() {
|
|
88
|
-
return
|
|
89
|
-
yield
|
|
78
|
+
return i(this, null, function* () {
|
|
79
|
+
yield e("Inspecting ESLint configuration", yield t.eslintInspect());
|
|
90
80
|
});
|
|
91
81
|
}
|
|
92
82
|
function V() {
|
|
93
|
-
return
|
|
94
|
-
yield
|
|
83
|
+
return i(this, null, function* () {
|
|
84
|
+
yield m(), yield M(), yield b(), g();
|
|
95
85
|
});
|
|
96
86
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
99
|
-
yield
|
|
100
|
-
const n = yield w(A);
|
|
101
|
-
f(s.SIMPLE_GIT_HOOKS_JSON, JSON.stringify(n, null, 4));
|
|
102
|
-
const o = `
|
|
103
|
-
${k}
|
|
104
|
-
`;
|
|
105
|
-
M(s.GIT_IGNORE) ? C(s.GIT_IGNORE, "utf-8").split(`
|
|
106
|
-
`).includes(k) || P(s.GIT_IGNORE, o) : f(s.GIT_IGNORE, o), yield i("Setting up simple-git-hooks", yield t.simpleGitHooks());
|
|
87
|
+
function z() {
|
|
88
|
+
return i(this, null, function* () {
|
|
89
|
+
yield m(), yield M(), yield b(!0), g();
|
|
107
90
|
});
|
|
108
91
|
}
|
|
109
|
-
function
|
|
110
|
-
return
|
|
111
|
-
yield
|
|
92
|
+
function W() {
|
|
93
|
+
return i(this, null, function* () {
|
|
94
|
+
yield m(), yield e("Validating commit message", yield t.commitLint()), g();
|
|
112
95
|
});
|
|
113
96
|
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
116
|
-
|
|
97
|
+
function L() {
|
|
98
|
+
return i(this, null, function* () {
|
|
99
|
+
yield e("Configuring Git hooks", yield t.configureGitHook()), C(s.GIT_HOOK);
|
|
100
|
+
const n = yield B(F);
|
|
101
|
+
P(s.SIMPLE_GIT_HOOKS_JSON, JSON.stringify(n, null, 4)), v(s.GIT_IGNORE, K), yield e("Setting up simple-git-hooks", yield t.simpleGitHooks());
|
|
117
102
|
});
|
|
118
103
|
}
|
|
119
|
-
function
|
|
120
|
-
return
|
|
121
|
-
|
|
104
|
+
function O() {
|
|
105
|
+
return i(this, null, function* () {
|
|
106
|
+
try {
|
|
107
|
+
yield e(`Checking for ${u}`, `pnpm list -g ${u}`);
|
|
108
|
+
} catch (n) {
|
|
109
|
+
yield e(`Installing ${u} globally`, `pnpm i -g ${u}`);
|
|
110
|
+
}
|
|
111
|
+
I(s.DOT_AGENT) ? yield e("Updating AI agent", "ag-kit update -y") : yield e("Initializing AI agent", "ag-kit init"), v(s.GIT_IGNORE, H);
|
|
122
112
|
});
|
|
123
113
|
}
|
|
124
|
-
function
|
|
125
|
-
return
|
|
126
|
-
yield
|
|
114
|
+
function Y() {
|
|
115
|
+
return i(this, null, function* () {
|
|
116
|
+
yield S(), yield L();
|
|
127
117
|
});
|
|
128
118
|
}
|
|
129
119
|
function q() {
|
|
130
|
-
return
|
|
131
|
-
yield
|
|
120
|
+
return i(this, null, function* () {
|
|
121
|
+
C(s.NODE_MODULES, s.PNPM_LOCK_YAML), yield e("Pruning pnpm store", yield t.pnpmPruneStore()), yield e("Clearing pnpm cache", yield t.pnpmCleanCache()), yield S(), yield L(), yield O();
|
|
132
122
|
});
|
|
133
123
|
}
|
|
134
|
-
function Q(
|
|
135
|
-
return
|
|
136
|
-
yield
|
|
124
|
+
function Q() {
|
|
125
|
+
return i(this, null, function* () {
|
|
126
|
+
yield e("Inspecting project dependencies", yield t.nodeModulesInspect());
|
|
137
127
|
});
|
|
138
128
|
}
|
|
139
129
|
function X() {
|
|
140
|
-
return
|
|
141
|
-
yield
|
|
130
|
+
return i(this, null, function* () {
|
|
131
|
+
yield e("Running unit tests", yield t.testUnit());
|
|
142
132
|
});
|
|
143
133
|
}
|
|
144
134
|
function Z() {
|
|
145
|
-
return
|
|
146
|
-
yield
|
|
135
|
+
return i(this, null, function* () {
|
|
136
|
+
yield e("Running end-to-end tests", yield t.testE2e());
|
|
147
137
|
});
|
|
148
138
|
}
|
|
149
|
-
function nn() {
|
|
150
|
-
return
|
|
151
|
-
yield
|
|
139
|
+
function nn(n) {
|
|
140
|
+
return i(this, null, function* () {
|
|
141
|
+
yield e("Creating MongoDB migration", yield t.mongoMigrateCreate(n));
|
|
152
142
|
});
|
|
153
143
|
}
|
|
154
144
|
function en() {
|
|
155
|
-
return
|
|
156
|
-
yield
|
|
145
|
+
return i(this, null, function* () {
|
|
146
|
+
yield e("Running MongoDB migrations", yield t.mongoMigrateUp());
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function tn() {
|
|
150
|
+
return i(this, null, function* () {
|
|
151
|
+
yield e("Rolling back MongoDB migration", yield t.mongoMigrateDown());
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function on() {
|
|
155
|
+
return i(this, null, function* () {
|
|
156
|
+
yield e("Starting Storybook development server", yield t.storybookDev());
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function rn() {
|
|
160
|
+
return i(this, null, function* () {
|
|
161
|
+
yield e("Building Storybook", yield t.storybookBuild());
|
|
157
162
|
});
|
|
158
163
|
}
|
|
159
|
-
|
|
164
|
+
i(null, null, function* () {
|
|
160
165
|
try {
|
|
161
|
-
yield
|
|
166
|
+
yield R(G(d.argv)).scriptName(x).usage("$0 <command> [options]").command("ai:setup", "Setup AI agent environment", O).command("lint", "Check code for linting issues", V).command("lint:fix", "Fix linting issues automatically", z).command("lint:inspect", "View active ESLint configuration", J).command("lint-staged", "Run lint checks on staged files", j).command("commitlint", "Validate commit message format", W).command("ready", "Initialize project and dependencies", Y).command("reset", "Reset the project and reinstall dependencies", q).command("inspect", "Analyze installed project dependencies", Q).command("test:unit", "Run unit test suite", X).command("test:e2e", "Run end-to-end test suite", Z).command("mongo:migrate:create <name>", "Create a MongoDB migration", (n) => n.positional("name", {
|
|
162
167
|
describe: "Migration name",
|
|
163
168
|
type: "string"
|
|
164
|
-
}), (n) =>
|
|
169
|
+
}), (n) => i(null, null, function* () {
|
|
165
170
|
if (!n.name) {
|
|
166
|
-
|
|
171
|
+
a.error("Migration name is required.");
|
|
167
172
|
return;
|
|
168
173
|
}
|
|
169
|
-
yield
|
|
170
|
-
})).command("mongo:migrate:up", "Apply all MongoDB migrations",
|
|
174
|
+
yield nn(n.name);
|
|
175
|
+
})).command("mongo:migrate:up", "Apply all MongoDB migrations", en).command("mongo:migrate:down", "Rollback last MongoDB migration", tn).command("storybook:dev", "Start Storybook development server", on).command("storybook:build", "Build Storybook for production", rn).demandCommand(1, "Please specify a valid command.").strict().help().alias("h", "help").alias("v", "version").version($()).epilog(`💡 Tip: Use "--help" with any command to see options
|
|
171
176
|
`).parse();
|
|
172
177
|
} catch (n) {
|
|
173
|
-
_(n),
|
|
178
|
+
_(n), d.exit(1);
|
|
174
179
|
}
|
|
175
180
|
});
|
|
@@ -5,7 +5,7 @@ import { storage as y } from "../storage/storage.util.js";
|
|
|
5
5
|
import { getPackage as B } from "../package/package.util.js";
|
|
6
6
|
import { CYBERSKILL_PACKAGE_NAME as M, PNPM_EXEC_CLI as T, TSX_CLI as O, CYBERSKILL_CLI_PATH as R, CYBERSKILL_CLI as b } from "../path/path.constant.js";
|
|
7
7
|
import { E_IssueType as f } from "../log/log.type.js";
|
|
8
|
-
import {
|
|
8
|
+
import { log as h, catchError as E } from "../log/log.util.js";
|
|
9
9
|
import { getEnv as N } from "../../config/env/env.util.js";
|
|
10
10
|
var a = (r, t, e) => new Promise((s, i) => {
|
|
11
11
|
var o = (u) => {
|
package/dist/node/fs/fs.util.cjs
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("fs-extra"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("fs-extra"),m=require("node:path");var _=Object.defineProperty,c=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,l=(n,e,r)=>e in n?_(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r,O=(n,e)=>{for(var r in e||(e={}))f.call(e,r)&&l(n,r,e[r]);if(c)for(var r of c(e))S.call(e,r)&&l(n,r,e[r]);return n},g=(n,e)=>{var r={};for(var t in n)f.call(n,t)&&e.indexOf(t)<0&&(r[t]=n[t]);if(n!=null&&c)for(var t of c(n))e.indexOf(t)<0&&S.call(n,t)&&(r[t]=n[t]);return r};const E=i,{lstatSync:w,readdirSync:x,mkdirSync:F,readFileSync:s,unlinkSync:b,statSync:u,createWriteStream:j}=i,h=i.readJsonSync;function d(n,e,r){i.writeFileSync(n,e,r!=null?r:"utf-8")}function p(n,e,r){i.appendFileSync(n,e,r!=null?r:"utf-8")}function y(...n){return n.every(e=>i.pathExistsSync(e))}function J(...n){n.forEach(e=>{y(e)&&i.removeSync(e)})}function P(n,e,r={}){const t=r,{extensions:a}=t,v=g(t,["extensions"]);i.copySync(n,e,O({filter:o=>u(o).isDirectory()||!a||a.length===0?!0:a.includes(m.extname(o))},v))}function k(n,e){const r=`
|
|
2
|
+
${e}
|
|
3
|
+
`;y(n)?s(n,"utf-8").split(`
|
|
4
|
+
`).includes(e)||p(n,r):d(n,r)}exports.addGitIgnoreEntry=k;exports.appendFileSync=p;exports.copySync=P;exports.createWriteStream=j;exports.fs=E;exports.lstatSync=w;exports.mkdirSync=F;exports.pathExistsSync=y;exports.readFileSync=s;exports.readJsonSync=h;exports.readdirSync=x;exports.removeSync=J;exports.statSync=u;exports.unlinkSync=b;exports.writeFileSync=d;
|
|
@@ -55,3 +55,11 @@ export declare function removeSync(...paths: string[]): void;
|
|
|
55
55
|
* @param options - Optional copy configuration including extensions filter and other fs-extra options.
|
|
56
56
|
*/
|
|
57
57
|
export declare function copySync(src: string, dest: string, options?: I_CopySyncOptions): void;
|
|
58
|
+
/**
|
|
59
|
+
* Adds an entry to the .gitignore file if it doesn't already exist.
|
|
60
|
+
* Creates the .gitignore file if it doesn't exist.
|
|
61
|
+
*
|
|
62
|
+
* @param gitIgnorePath - The absolute path to the .gitignore file.
|
|
63
|
+
* @param entry - The entry name to add (e.g. '.agent', '.simple-git-hooks.json').
|
|
64
|
+
*/
|
|
65
|
+
export declare function addGitIgnoreEntry(gitIgnorePath: string, entry: string): void;
|