@cyberskill/shared 1.127.0 → 1.129.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 +2 -2
- package/dist/_tsup-dts-rollup.d.cts +57 -44
- package/dist/_tsup-dts-rollup.d.ts +57 -44
- package/dist/configs/commitlint/index.cjs +1 -1
- package/dist/configs/commitlint/index.js +1 -1
- package/dist/configs/config.util.cjs +1 -1
- package/dist/configs/config.util.js +1 -1
- package/dist/configs/index.cjs +1 -1
- package/dist/configs/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +1 -1
- package/dist/{nodejs → node}/apollo-server/apollo-server.util.cjs +1 -1
- package/dist/{nodejs → node}/apollo-server/apollo-server.util.js +1 -1
- package/dist/{nodejs → node}/apollo-server/index.cjs +1 -1
- package/dist/{nodejs → node}/apollo-server/index.js +1 -1
- package/dist/node/cli/cli.util.cjs +2 -0
- package/dist/node/cli/cli.util.js +2 -0
- package/dist/node/cli/index.cjs +1 -0
- package/dist/node/cli/index.js +1 -0
- package/dist/node/command/command.util.cjs +1 -0
- package/dist/node/command/command.util.js +1 -0
- package/dist/node/command/index.cjs +1 -0
- package/dist/node/command/index.js +1 -0
- package/dist/{nodejs → node}/express/express.util.cjs +1 -1
- package/dist/{nodejs → node}/express/express.util.js +1 -1
- package/dist/{nodejs → node}/express/index.cjs +1 -1
- package/dist/{nodejs → node}/express/index.js +1 -1
- package/dist/node/fs/fs.util.cjs +1 -0
- package/dist/node/fs/fs.util.js +1 -0
- package/dist/node/fs/index.cjs +1 -0
- package/dist/node/fs/index.js +1 -0
- package/dist/node/index.cjs +1 -0
- package/dist/{nodejs → node}/index.d.cts +6 -5
- package/dist/{nodejs → node}/index.d.ts +6 -5
- package/dist/node/index.js +1 -0
- package/dist/node/mongo/index.cjs +1 -0
- package/dist/node/mongo/index.js +1 -0
- package/dist/node/mongo/mongo.util.cjs +1 -0
- package/dist/node/mongo/mongo.util.js +1 -0
- package/dist/node/package/index.cjs +1 -0
- package/dist/{nodejs → node}/package/index.d.cts +5 -5
- package/dist/{nodejs → node}/package/index.d.ts +5 -5
- package/dist/node/package/index.js +1 -0
- package/dist/node/package/package.type.cjs +1 -0
- package/dist/node/package/package.type.d.cts +4 -0
- package/dist/node/package/package.type.d.ts +4 -0
- package/dist/node/package/package.type.js +1 -0
- package/dist/node/package/package.util.cjs +1 -0
- package/dist/{nodejs → node}/package/package.util.d.cts +2 -2
- package/dist/{nodejs → node}/package/package.util.d.ts +2 -2
- package/dist/node/package/package.util.js +1 -0
- package/dist/node/path/index.cjs +1 -0
- package/dist/{nodejs → node}/path/index.d.cts +1 -0
- package/dist/{nodejs → node}/path/index.d.ts +1 -0
- package/dist/node/path/index.js +1 -0
- package/dist/node/path/path.constant.cjs +1 -0
- package/dist/{nodejs → node}/path/path.constant.d.cts +1 -0
- package/dist/{nodejs → node}/path/path.constant.d.ts +1 -0
- package/dist/node/path/path.constant.js +1 -0
- package/dist/node/storage/index.cjs +1 -0
- package/dist/node/storage/index.js +1 -0
- package/dist/node/storage/storage.util.cjs +1 -0
- package/dist/node/storage/storage.util.js +1 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/next-intl/index.cjs +1 -1
- package/dist/react/next-intl/index.js +1 -1
- package/dist/react/next-intl/next-intl.provider.cjs +1 -1
- package/dist/react/next-intl/next-intl.provider.js +1 -1
- package/dist/react/storage/index.cjs +1 -1
- package/dist/react/storage/index.js +1 -1
- package/dist/react/storage/storage.hook.cjs +1 -1
- package/dist/react/storage/storage.hook.js +1 -1
- package/dist/react/storage/storage.util.cjs +1 -1
- package/dist/react/storage/storage.util.js +1 -1
- package/dist/react/vitest/index.cjs +1 -1
- package/dist/react/vitest/index.js +1 -1
- package/dist/react/vitest/vitest.unit.cjs +1 -1
- package/dist/react/vitest/vitest.unit.js +1 -1
- package/package.json +75 -74
- package/public/wiki/convention.md +1 -1
- package/dist/nodejs/cli/cli.util.cjs +0 -2
- package/dist/nodejs/cli/cli.util.js +0 -2
- package/dist/nodejs/cli/index.cjs +0 -1
- package/dist/nodejs/cli/index.js +0 -1
- package/dist/nodejs/command/command.util.cjs +0 -1
- package/dist/nodejs/command/command.util.js +0 -1
- package/dist/nodejs/command/index.cjs +0 -1
- package/dist/nodejs/command/index.js +0 -1
- package/dist/nodejs/fs/fs.util.cjs +0 -1
- package/dist/nodejs/fs/fs.util.js +0 -1
- package/dist/nodejs/fs/index.cjs +0 -1
- package/dist/nodejs/fs/index.js +0 -1
- package/dist/nodejs/index.cjs +0 -1
- package/dist/nodejs/index.js +0 -1
- package/dist/nodejs/mongo/index.cjs +0 -1
- package/dist/nodejs/mongo/index.js +0 -1
- package/dist/nodejs/mongo/mongo.util.cjs +0 -1
- package/dist/nodejs/mongo/mongo.util.js +0 -1
- package/dist/nodejs/package/index.cjs +0 -1
- package/dist/nodejs/package/index.js +0 -1
- package/dist/nodejs/package/package.constant.cjs +0 -1
- package/dist/nodejs/package/package.constant.d.cts +0 -1
- package/dist/nodejs/package/package.constant.d.ts +0 -1
- package/dist/nodejs/package/package.constant.js +0 -1
- package/dist/nodejs/package/package.type.cjs +0 -1
- package/dist/nodejs/package/package.type.d.cts +0 -3
- package/dist/nodejs/package/package.type.d.ts +0 -3
- package/dist/nodejs/package/package.type.js +0 -0
- package/dist/nodejs/package/package.util.cjs +0 -1
- package/dist/nodejs/package/package.util.js +0 -1
- package/dist/nodejs/path/index.cjs +0 -1
- package/dist/nodejs/path/index.js +0 -1
- package/dist/nodejs/path/path.constant.cjs +0 -1
- package/dist/nodejs/path/path.constant.js +0 -1
- package/dist/nodejs/storage/index.cjs +0 -1
- package/dist/nodejs/storage/index.js +0 -1
- package/dist/nodejs/storage/storage.util.cjs +0 -1
- package/dist/nodejs/storage/storage.util.js +0 -1
- /package/dist/{nodejs → node}/apollo-server/apollo-server.type.cjs +0 -0
- /package/dist/{nodejs → node}/apollo-server/apollo-server.type.d.cts +0 -0
- /package/dist/{nodejs → node}/apollo-server/apollo-server.type.d.ts +0 -0
- /package/dist/{nodejs → node}/apollo-server/apollo-server.type.js +0 -0
- /package/dist/{nodejs → node}/apollo-server/apollo-server.util.d.cts +0 -0
- /package/dist/{nodejs → node}/apollo-server/apollo-server.util.d.ts +0 -0
- /package/dist/{nodejs → node}/apollo-server/index.d.cts +0 -0
- /package/dist/{nodejs → node}/apollo-server/index.d.ts +0 -0
- /package/dist/{nodejs → node}/cli/cli.util.d.cts +0 -0
- /package/dist/{nodejs → node}/cli/cli.util.d.ts +0 -0
- /package/dist/{nodejs → node}/cli/index.d.cts +0 -0
- /package/dist/{nodejs → node}/cli/index.d.ts +0 -0
- /package/dist/{nodejs → node}/command/command.type.cjs +0 -0
- /package/dist/{nodejs → node}/command/command.type.d.cts +0 -0
- /package/dist/{nodejs → node}/command/command.type.d.ts +0 -0
- /package/dist/{nodejs → node}/command/command.type.js +0 -0
- /package/dist/{nodejs → node}/command/command.util.d.cts +0 -0
- /package/dist/{nodejs → node}/command/command.util.d.ts +0 -0
- /package/dist/{nodejs → node}/command/index.d.cts +0 -0
- /package/dist/{nodejs → node}/command/index.d.ts +0 -0
- /package/dist/{nodejs → node}/express/express.type.cjs +0 -0
- /package/dist/{nodejs → node}/express/express.type.d.cts +0 -0
- /package/dist/{nodejs → node}/express/express.type.d.ts +0 -0
- /package/dist/{nodejs → node}/express/express.type.js +0 -0
- /package/dist/{nodejs → node}/express/express.util.d.cts +0 -0
- /package/dist/{nodejs → node}/express/express.util.d.ts +0 -0
- /package/dist/{nodejs → node}/express/index.d.cts +0 -0
- /package/dist/{nodejs → node}/express/index.d.ts +0 -0
- /package/dist/{nodejs → node}/fs/fs.type.cjs +0 -0
- /package/dist/{nodejs → node}/fs/fs.type.d.cts +0 -0
- /package/dist/{nodejs → node}/fs/fs.type.d.ts +0 -0
- /package/dist/{nodejs → node}/fs/fs.type.js +0 -0
- /package/dist/{nodejs → node}/fs/fs.util.d.cts +0 -0
- /package/dist/{nodejs → node}/fs/fs.util.d.ts +0 -0
- /package/dist/{nodejs → node}/fs/index.d.cts +0 -0
- /package/dist/{nodejs → node}/fs/index.d.ts +0 -0
- /package/dist/{nodejs → node}/log/index.cjs +0 -0
- /package/dist/{nodejs → node}/log/index.d.cts +0 -0
- /package/dist/{nodejs → node}/log/index.d.ts +0 -0
- /package/dist/{nodejs → node}/log/index.js +0 -0
- /package/dist/{nodejs → node}/log/log.type.cjs +0 -0
- /package/dist/{nodejs → node}/log/log.type.d.cts +0 -0
- /package/dist/{nodejs → node}/log/log.type.d.ts +0 -0
- /package/dist/{nodejs → node}/log/log.type.js +0 -0
- /package/dist/{nodejs → node}/log/log.util.cjs +0 -0
- /package/dist/{nodejs → node}/log/log.util.d.cts +0 -0
- /package/dist/{nodejs → node}/log/log.util.d.ts +0 -0
- /package/dist/{nodejs → node}/log/log.util.js +0 -0
- /package/dist/{nodejs → node}/mongo/index.d.cts +0 -0
- /package/dist/{nodejs → node}/mongo/index.d.ts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.constant.cjs +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.constant.d.cts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.constant.d.ts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.constant.js +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.type.cjs +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.type.d.cts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.type.d.ts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.type.js +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.util.d.cts +0 -0
- /package/dist/{nodejs → node}/mongo/mongo.util.d.ts +0 -0
- /package/dist/{nodejs → node}/path/path.util.cjs +0 -0
- /package/dist/{nodejs → node}/path/path.util.d.cts +0 -0
- /package/dist/{nodejs → node}/path/path.util.d.ts +0 -0
- /package/dist/{nodejs → node}/path/path.util.js +0 -0
- /package/dist/{nodejs → node}/storage/index.d.cts +0 -0
- /package/dist/{nodejs → node}/storage/index.d.ts +0 -0
- /package/dist/{nodejs → node}/storage/storage.util.d.cts +0 -0
- /package/dist/{nodejs → node}/storage/storage.util.d.ts +0 -0
- /package/dist/{nodejs → node}/ws/index.cjs +0 -0
- /package/dist/{nodejs → node}/ws/index.d.cts +0 -0
- /package/dist/{nodejs → node}/ws/index.d.ts +0 -0
- /package/dist/{nodejs → node}/ws/index.js +0 -0
- /package/dist/{nodejs → node}/ws/ts.util.cjs +0 -0
- /package/dist/{nodejs → node}/ws/ts.util.d.cts +0 -0
- /package/dist/{nodejs → node}/ws/ts.util.d.ts +0 -0
- /package/dist/{nodejs → node}/ws/ts.util.js +0 -0
- /package/dist/{nodejs → node}/ws/ws.type.cjs +0 -0
- /package/dist/{nodejs → node}/ws/ws.type.d.cts +0 -0
- /package/dist/{nodejs → node}/ws/ws.type.d.ts +0 -0
- /package/dist/{nodejs → node}/ws/ws.type.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(t){if(Array.isArray(t))return e(t)}function n(e,t,n,r,o,c,a){try{var i=e[c](a);var s=i.value}catch(e){n(e);return}if(i.done){t(s)}else{Promise.resolve(s).then(r,o)}}function r(e){return function(){var t=this,r=arguments;return new Promise(function(o,c){var a=e.apply(t,r);function i(e){n(a,o,c,i,s,"next",e)}function s(e){n(a,o,c,i,s,"throw",e)}i(undefined)})}}function o(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function c(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){o(e,t,n[t])})}return e}function s(e){return t(e)||c(e)||l(e)||a()}function u(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function f(e,t){var n,r,o,c={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=i(0),a["throw"]=i(1),a["return"]=i(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(t){return s([e,t])}}function s(i){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,i[0]&&(c=0)),c)try{if(n=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:c.label++;return{value:i[1],done:false};case 5:c.label++;r=i[1];i=[0];continue;case 7:i=c.ops.pop();c.trys.pop();continue;default:if(!(o=c.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){c=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(i[0]===6&&c.label<o[1]){c.label=o[1];o=i;break}if(o&&c.label<o[2]){c.label=o[2];c.ops.push(i);break}if(o[2])c.ops.pop();c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e];r=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var d=Object.defineProperty;var p=function(e,t){return d(e,"name",{value:t,configurable:!0})};import m from"@vitejs/plugin-react-swc";import{defineConfig as g}from"vitest/config";function v(e){return g(i({plugins:[m()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}p(v,"vitestE2E");import h from"@vitejs/plugin-react-swc";import{defineConfig as y}from"vitest/config";var I=".cyberskill-storage";import b from"@dotenvx/dotenvx";import{bool as E,cleanEnv as C,str as S}from"envalid";import w from"node:os";import O from"node:path";import T from"node:process";var G=!1;function _(){G||(b.config(),G=!0)}p(_,"loadEnvFile");function N(){_();var e=C(T.env,{CWD:S({default:T.cwd()}),DEBUG:E({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:S({default:O.join(w.homedir(),I)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}p(N,"getEnv");var L=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as k}from"node:child_process";import R from"node:process";import*as D from"node:util";var j=function(e){return e.Error="error",e.Warning="warning",e}({});import x from"chalk";import A from"consola";import{GraphQLError as F}from"graphql";var P=N();P.DEBUG||(A.level=4);function M(e){var t=x[e];return typeof t=="function"?t:x.green}p(M,"chalkKeyword");var U={silent:A.silent,level:A.level,fatal:A.fatal,error:A.error,warn:A.warn,log:A.log,info:A.info,success:A.success,ready:A.ready,start:A.start,box:A.box,debug:A.debug,trace:A.trace,verbose:A.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){A.box(x.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,c=e.message;A.log("".concat(x.gray("File:")," ").concat(x.blue("".concat(t).concat(r?":".concat(r):"")))),o&&A.log(" ".concat(M(n)("Rule:")," ").concat(o)),A.log(" ".concat(M(n)("Message:")," ").concat(c))}),A.box(M(n)("".concat(e," : ").concat(t.length))),A.log(x.gray("─".repeat(40)))}};var K={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import Y from"node-fetch";import B from"fs-extra";var W=B.lstatSync,J=B.readdirSync,H=B.mkdirSync,$=B.readFileSync,q=B.unlinkSync,Q=B.statSync,V=B.readJsonSync;function z(e,t,n){B.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}p(z,"writeFileSync");function X(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return B.pathExistsSync(e)})}p(X,"pathExistsSync");var Z=N();function ee(e){var t=ew(Z.CWD,eL);if(!X(t))return!1;try{var n=V(t),r=n.name,o=n.dependencies,c=o===void 0?{}:o,a=n.devDependencies,i=a===void 0?{}:a,s=r===e,u=e in c,l=e in i;return s||u||l?{path:t,file:n,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return U.warn("Failed to read package.json: ".concat(e.message)),!1}}p(ee,"getPackage");function et(e){return r(function(){var t,n,r,o;return f(this,function(c){switch(c.label){case 0:c.trys.push([0,3,,4]);return[4,Y("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=c.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=c.sent(),r=n.version;return[2,r];case 3:o=c.sent();throw U.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})})()}p(et,"getLatestPackageVersion");function en(e,t){return r(function(){var n,r,o,c,a,s,u,l,d,p,m,g,v,h,y,I,b,E,C,S,w;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,4,,5]);n=ee(e);if(!n)return[2,i({},K)];u=n.path,l=n.file,d=n.isCurrentProject,p=n.isDepend,m=n.isDevDepend,g=(r=l.dependencies)!==null&&r!==void 0?r:{},v=(o=l.devDependencies)!==null&&o!==void 0?o:{},h=d?(c=l.version)!==null&&c!==void 0?c:"0.0.0":p?(a=g[e])!==null&&a!==void 0?a:"0.0.0":m?(s=v[e])!==null&&s!==void 0?s:"0.0.0":"0.0.0";if(!d)return[3,1];b=h;return[3,3];case 1:return[4,et(e)];case 2:b=f.sent();f.label=3;case 3:y=b,I=d||h===y;if(!I&&(t===null||t===void 0?void 0:t.update)){;C=p?"dependencies":m?"devDependencies":null;C&&((E=l[C])===null||E===void 0?void 0:E[e])!==y&&(l[C]=(S=l[C])!==null&&S!==void 0?S:{},l[C][e]=y,z(u,JSON.stringify(l,null,4)),U.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:d,installedPath:u,file:l,isUpToDate:I}];case 4:w=f.sent();return[2,(U.error('Error checking package "'.concat(e,'": ').concat(w.message)),i({},K))];case 5:return[2]}})})()}p(en,"checkPackage");function er(){return r(function(){var e,t,n,r,o,c,a,i,s,u,l,d;return f(this,function(f){switch(f.label){case 0:e=[{command:p(function(){return to.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:p(function(){return to.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:p(function(){return to.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);o=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(c=o.next()).done))return[3,8];a=c.value,i=a.command,s=a.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,eI("".concat(s," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();U.warn("Installation attempt failed: ".concat(s)),U.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}p(er,"installDependencies");function eo(e,t){return r(function(){var n,r,o,c,a,u,l,d,p,m,g;return f(this,function(f){switch(f.label){case 0:if(!X(tt.PACKAGE_JSON)){U.error("package.json not found. Aborting setup.");return[2]}f.label=1;case 1:f.trys.push([1,13,,14]);n=s(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return en(e,i({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=f.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,er()];case 3:r=f.sent();f.label=4;case 4:r;c=true,a=false,u=undefined;f.label=5;case 5:f.trys.push([5,10,11,12]);l=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();f.label=6;case 6:if(!!(c=(d=l.next()).done))return[3,9];p=d.value;return[4,p()];case 7:f.sent();f.label=8;case 8:c=true;return[3,6];case 9:return[3,12];case 10:m=f.sent();a=true;u=m;return[3,12];case 11:try{if(!c&&l.return!=null){l.return()}}finally{if(a){throw u}}return[7];case 12:return[3,14];case 13:g=f.sent();throw U.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}p(eo,"setupPackages");import ec from"node-persist";var ea=N();function ei(){return r(function(){var e;return f(this,function(t){switch(t.label){case 0:e=ec.defaultInstance;if(e)return[3,2];return[4,ec.init({dir:ea.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}p(ei,"initNodePersist");var es={get:function e(e){return r(function(){var t,n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ei()];case 1:r.sent();return[4,ec.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(U.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ei()];case 1:r.sent();return[4,ec.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();U.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ei()];case 1:n.sent();return[4,ec.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();U.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ei()];case 1:n.sent();return[4,ec.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(U.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(U.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return f(this,function(t){try{return[2,"".concat(ea.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(U.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eu=N(),el=D.promisify(k);function ef(e){return"error_list:".concat(e)}p(ef,"getErrorListKey");function ed(e){return r(function(){var t,n,o;return f(this,function(c){switch(c.label){case 0:if(e.length===0)return[2];t=Date.now(),n=ef(t);c.label=1;case 1:c.trys.push([1,3,,4]);return[4,es.set(n,{errors:e,timestamp:t})];case 2:c.sent(),setTimeout(function(){return r(function(){var e;return f(this,function(t){switch(t.label){case 0:return[4,es.getLogLink(n)];case 1:e=t.sent();e&&U.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:o=c.sent();U.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})})()}p(ed,"saveErrorListToStorage");function ep(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,c=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,a=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,s,u,l,f;var d=o.exec(e)||[],p=c.exec(e)||[],m=a.exec(e)||[];var g,v,h,y,I,b;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===j.Error?j.Error:j.Warning,message:(g=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&g!==void 0?g:"",rule:(v=d===null||d===void 0?void 0:(s=d[5])===null||s===void 0?void 0:s.trim())!==null&&v!==void 0?v:""}):p.length?t.push({file:(h=p===null||p===void 0?void 0:p[1])!==null&&h!==void 0?h:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===j.Error?j.Error:j.Warning,message:(y=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):m.length?t.push({file:"commitlint",type:j.Error,message:(I=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&I!==void 0?I:"",rule:(b=m===null||m===void 0?void 0:(f=m[2])===null||f===void 0?void 0:f.trim())!==null&&b!==void 0?b:""}):n.push(e.trim())}}),t.length&&ed(t),eu.DEBUG&&n.length&&(U.warn("Unmatched lines:"),n.forEach(function(e){return U.info(" ".concat(e))}))}p(ep,"parseTextErrors");function em(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,c=e.column,a=e.ruleId,i=e.message;n.push({type:r===2?j.Error:j.Warning,file:t,position:"".concat(o,":").concat(c),rule:a,message:i})})}),n.length&&ed(n)}catch(t){ep(e)}}p(em,"parseCommandOutput");function eg(e){return r(function(e){var t,n,r,o,c,a,i,s,u;var l=arguments;return f(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:em;n=new AbortController;R.on("SIGINT",function(){U.warn("Process interrupted. Terminating..."),n.abort(),R.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,el(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,c=r.stderr;[o,c].forEach(function(e){return e&&t(e)});f.label=3;case 3:return[3,5];case 4:a=f.sent();i=a.stdout,s=a.stderr,u=a.message;[i,s].forEach(function(e){return e&&t(e)}),!s&&!i&&U.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}p(eg,"executeCommand");function ev(e){return{raw:!0,cmd:e}}p(ev,"rawCommand");function eh(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(e2," ").concat(eG," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e2," ").concat(eZ," ").concat(eK," ").concat(e):"".concat(e2," ").concat(eU," ").concat(e)}p(eh,"formatCLI");function ey(e,t){return typeof e=="function"?eh(e(t),t):(typeof e==="undefined"?"undefined":u(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eh(e,t):e}p(ey,"formatCommand");function eI(e,t){return r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);U.start("".concat(e)),eu.DEBUG&&U.info("→ ".concat(t));return[4,eg(t)];case 1:r.sent(),U.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw U.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}p(eI,"runCommand");import eb from"node:path";var eE=N(),eC=eb;function eS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eC).resolve.apply(r,[eE.CWD].concat(s(t)))}p(eS,"resolveWorkingPath");function ew(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eC).join.apply(r,s(t))}p(ew,"join");var eO=N(),eT=eO.CWD,eG="@cyberskill/shared",e_="node_modules",eN="dist",eL="package.json",ek="package-lock.json",eR="tsconfig.json",eD=".gitignore",ej=".simple-git-hooks.json",ex="pnpm-lock.yaml",eA=".git/hooks/",eF=".git/COMMIT_EDITMSG",eP=".migrate-mongo.config.js",eM=ew(eT,e_,eG,eN),eU="cyberskill",eK="src/nodejs/cli/index.ts",eY="eslint",eB="eslint",eW="vitest",eJ="playwright",eH="vitest",e$="@commitlint/cli",eq="commitlint",eQ="lint-staged",eV="lint-staged",ez="typescript",eX="tsc",eZ="tsx",e0="git",e1="pnpm",e2="pnpm exec",e3="simple-git-hooks",e4="simple-git-hooks",e5="@eslint/config-inspector",e6="eslint-config-inspector",e8="node-modules-inspector",e7="node-modules-inspector",e9="migrate-mongo",te="./node_modules/migrate-mongo/bin/migrate-mongo",tt={CYBERSKILL_DIRECTORY:eM,WORKING_DIRECTORY:eT,TS_CONFIG:eS(eR),GIT_IGNORE:eS(eD),GIT_HOOK:eS(eA),GIT_COMMIT_MSG:eS(eF),SIMPLE_GIT_HOOKS_JSON:eS(ej),PACKAGE_JSON:eS(eL),PACKAGE_LOCK_JSON:eS(ek),PNPM_LOCK_YAML:eS(ex),NODE_MODULES:eS(e_),MIGRATE_MONGO_CONFIG:eS(eP),LINT_STAGED_CONFIG:eS("".concat(eM,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:eS("".concat(eM,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:eS("".concat(eM,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eS("".concat(eM,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eS("".concat(eM,"/react/vitest/vitest.e2e.js"))};function tn(e,t,n){return r(function(){return f(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case L.CLI:return[3,1];case L.STRING:return[3,3]}return[3,4];case 1:return[4,eo(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),ey(ev("".concat(e2," ").concat(n))))];case 3:return[2,ey(ev(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}p(tn,"buildCommand");function tr(e,t,n){return function(){return r(function(){return f(this,function(r){return[2,tn(e,t,n)]})})()}}p(tr,"commandFactory");var to={simpleGitHooks:tr(L.CLI,e3,e4),eslintInspect:tr(L.CLI,e5,e6),nodeModulesInspect:tr(L.CLI,e8,e7),eslintCheck:tr(L.CLI,eY,"".concat(eB," ").concat(tt.WORKING_DIRECTORY," --no-cache")),eslintFix:tr(L.CLI,eY,"".concat(eB," ").concat(tt.WORKING_DIRECTORY," --fix --no-cache")),typescriptCheck:tr(L.CLI,ez,"".concat(eX," -p ").concat(tt.TS_CONFIG," --noEmit")),configureGitHook:tr(L.STRING,"".concat(e0," config core.hooksPath ").concat(tt.GIT_HOOK)),testUnit:tr(L.CLI,eW,"".concat(eH," --config ").concat(tt.UNIT_TEST_CONFIG)),testE2e:tr(L.CLI,"".concat(eW," ").concat(eJ),"".concat(eH," --config ").concat(tt.E2E_TEST_CONFIG)),mongoMigrateCreate:p(function(e){return tr(L.CLI,e9,"".concat(eZ," ").concat(te," create ").concat(e," -f ").concat(tt.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:tr(L.CLI,e9,"".concat(eZ," ").concat(te," up -f ").concat(tt.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:tr(L.CLI,e9,"".concat(eZ," ").concat(te," down -f ").concat(tt.MIGRATE_MONGO_CONFIG)),commitLint:tr(L.CLI,e$,"".concat(eq," --edit ").concat(tt.GIT_COMMIT_MSG," --config ").concat(tt.COMMITLINT_CONFIG)),lintStaged:tr(L.CLI,eQ,"".concat(eV," --config ").concat(tt.LINT_STAGED_CONFIG)),stageBuildDirectory:tr(L.STRING,"".concat(e0," add ").concat(eN)),build:tr(L.STRING,"".concat(e1," run build")),pnpmInstallStandard:tr(L.STRING,"".concat(e1," install")),pnpmInstallLegacy:tr(L.STRING,"".concat(e1," install --legacy-peer-deps")),pnpmInstallForce:tr(L.STRING,"".concat(e1," install --force"))};function tc(e){return y(i({plugins:[h()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tt.UNIT_TEST_SETUP_CONFIG]}},e))}p(tc,"vitestUnit");export{v as vitestE2E,tc as vitestUnit};
|
|
1
|
+
function e(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function n(n){if(Array.isArray(n))return e(n)}function t(e,n,t,r,o,a,c){try{var i=e[a](c);var s=i.value}catch(e){t(e);return}if(i.done){n(s)}else{Promise.resolve(s).then(r,o)}}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,a){var c=e.apply(n,r);function i(e){t(c,o,a,i,s,"next",e)}function s(e){t(c,o,a,i,s,"throw",e)}i(undefined)})}}function o(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}r.forEach(function(n){o(e,n,t[n])})}return e}function s(e){return n(e)||a(e)||l(e)||c()}function u(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(n,t){if(!n)return;if(typeof n==="string")return e(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor)r=n.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(n,t)}function f(e,n){var t,r,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},c=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return c.next=i(0),c["throw"]=i(1),c["return"]=i(2),typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function i(e){return function(n){return s([e,n])}}function s(i){if(t)throw new TypeError("Generator is already executing.");while(c&&(c=0,i[0]&&(a=0)),a)try{if(t=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;r=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e];r=0}finally{t=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var m=Object.defineProperty;var p=function(e,n){return m(e,"name",{value:n,configurable:!0})};import d from"@vitejs/plugin-react-swc";import{defineConfig as E}from"vitest/config";function g(e){return E(i({plugins:[d()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}p(g,"vitestE2E");import y from"@vitejs/plugin-react-swc";import{defineConfig as v}from"vitest/config";import h from"fs-extra";var _=".cyberskill-storage";import D from"@dotenvx/dotenvx";import{bool as I,cleanEnv as C,str as N}from"envalid";import b from"node:os";import S from"node:path";import O from"node:process";var P=!1;function T(){P||(D.config(),P=!0)}p(T,"loadEnvFile");function w(){T();var e=C(O.env,{CWD:N({default:O.cwd()}),DEBUG:I({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:N({default:S.join(b.homedir(),_)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}p(w,"getEnv");var G=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as R}from"node:child_process";import k from"node:process";import*as L from"node:util";var U=function(e){return e.Error="error",e.Warning="warning",e}({});import A from"chalk";import j from"consola";import{GraphQLError as Y}from"graphql";var x=w();x.DEBUG||(j.level=4);function F(e){var n=A[e];return typeof n=="function"?n:A.green}p(F,"chalkKeyword");var M={silent:j.silent,level:j.level,fatal:j.fatal,error:j.error,warn:j.warn,log:j.log,info:j.info,success:j.success,ready:j.ready,start:j.start,box:j.box,debug:j.debug,trace:j.trace,verbose:j.verbose,printBoxedLog:function e(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(n===null||n===void 0?void 0:n.length)){j.box(A.green(e));return}n.forEach(function(e){var n=e.file,r=e.position,o=e.rule,a=e.message;j.log("".concat(A.gray("File:")," ").concat(A.blue("".concat(n).concat(r?":".concat(r):"")))),o&&j.log(" ".concat(F(t)("Rule:")," ").concat(o)),j.log(" ".concat(F(t)("Message:")," ").concat(a))}),j.box(F(t)("".concat(e," : ").concat(n.length))),j.log(A.gray("─".repeat(40)))}};var V=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import K from"node-fetch";import B from"fs-extra";var J=B.lstatSync,W=B.readdirSync,H=B.mkdirSync,$=B.readFileSync,q=B.unlinkSync,Q=B.statSync,z=B.readJsonSync;function X(e,n,t){B.writeFileSync(e,n,t!==null&&t!==void 0?t:"utf-8")}p(X,"writeFileSync");function Z(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}return n.every(function(e){return B.pathExistsSync(e)})}p(Z,"pathExistsSync");var ee=w();function en(e){return /*#__PURE__*/r(function(){var n,t,r,o;return f(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,K("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:n=a.sent();if(!n.ok)throw new Error("Failed to fetch latest version: ".concat(n.status," ").concat(n.statusText));return[4,n.json()];case 2:t=a.sent(),r=t.version;return[2,r];case 3:o=a.sent();throw M.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})})()}p(en,"getLatestPackageVersion");function et(e){return /*#__PURE__*/r(function(){var n,t,r,o,a,c,i,s,u,l,m,p,d,E,g,y,v,h,_;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,2,,3]);if(!Z(nt.PACKAGE_JSON))return[2,{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===V.DEPENDENCY,isDevDependency:e.type===V.DEV_DEPENDENCY,installedPath:"",file:{}}];n=z(nt.PACKAGE_JSON),t=n.name,r=n.version,o=r===void 0?"":r,a=n.dependencies,c=a===void 0?{}:a,i=n.devDependencies,s=i===void 0?{}:i;if(e.name===t)return[2,{name:t,currentVersion:o,latestVersion:o,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===V.DEPENDENCY,isDevDependency:e.type===V.DEV_DEPENDENCY,installedPath:nt.PACKAGE_JSON,file:n}];u=e.name in c,l=e.name in s;return[4,en(e.name)];case 1:m=f.sent();if(!u&&!l)return[2,{name:e.name,currentVersion:"",latestVersion:m,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===V.DEPENDENCY,isDevDependency:e.type===V.DEV_DEPENDENCY,installedPath:"",file:{}}];E=(d=(p=c[e.name])!==null&&p!==void 0?p:s[e.name])!==null&&d!==void 0?d:"",g=eb(ee.CWD,eT,e.name,eG);if(!Z(g))return[2,{name:e.name,currentVersion:"",latestVersion:m,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:u,isDevDependency:l,installedPath:"",file:{}}];y=z(g),v=y.version,h=v===void 0?"":v;return[2,E!==h?{name:e.name,currentVersion:h||E,latestVersion:m,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:u,isDevDependency:l,installedPath:g,file:y}:{name:e.name,currentVersion:E,latestVersion:m,isCurrentProject:!1,isInstalled:!0,isUpToDate:E===m,isDependency:u,isDevDependency:l,installedPath:g,file:y}];case 2:_=f.sent();throw M.error('Error getting package "'.concat(e.name,'": ').concat(_.message)),_;case 3:return[2]}})})()}p(et,"getPackage");function er(e){return /*#__PURE__*/r(function(){var n,t,r,o,a;return f(this,function(c){try{;r=z(nt.PACKAGE_JSON),o=(n=r.dependencies)!==null&&n!==void 0?n:{},a=(t=r.devDependencies)!==null&&t!==void 0?t:{};e.isDependency?o[e.name]=e.latestVersion:e.isDevDependency&&(a[e.name]=e.latestVersion),X(nt.PACKAGE_JSON,JSON.stringify(r,null,4)),M.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(n){throw M.error('Error updating package "'.concat(e.name,'": ').concat(n.message)),n}return[2]})})()}p(er,"updatePackage");function eo(){return /*#__PURE__*/r(function(){var e,n,t,r,o,a,c,i,s,u,l,m,d;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,12,,13]);e=[{command:p(function(){return no.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:p(function(){return no.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:p(function(){return no.pnpmInstallForce()},"command"),message:"Retrying with force install"}];n=true,t=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);o=e[Symbol.iterator]();f.label=2;case 2:if(!!(n=(a=o.next()).done))return[3,8];c=a.value,i=c.command,s=c.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,e_("".concat(s," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();M.warn("Installation attempt failed: ".concat(s)),M.error("Details: ".concat(l.message));return[3,7];case 7:n=true;return[3,2];case 8:return[3,11];case 9:m=f.sent();t=true;r=m;return[3,11];case 10:try{if(!n&&o.return!=null){o.return()}}finally{if(t){throw r}}return[7];case 11:return[3,13];case 12:d=f.sent();throw M.error("Failed to install dependencies: ".concat(d.message)),d;case 13:return[2]}})})()}p(eo,"installDependencies");function ea(e,n){return /*#__PURE__*/r(function(){var t,r,o,a,c,i,s,u,l,m,p;return f(this,function(f){switch(f.label){case 0:if(!Z(nt.PACKAGE_JSON)){M.error("package.json not found. Aborting setup.");return[2]}f.label=1;case 1:f.trys.push([1,14,,15]);return[4,Promise.all(e.map(et))];case 2:t=f.sent().filter(function(e){return!e.isCurrentProject&&(!e.isInstalled||!e.isUpToDate)});r=t.length>0;if(!r)return[3,5];return[4,Promise.all(t.map(er))];case 3:f.sent();return[4,eo()];case 4:r=f.sent();f.label=5;case 5:r;a=true,c=false,i=undefined;f.label=6;case 6:f.trys.push([6,11,12,13]);s=((o=n===null||n===void 0?void 0:n.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();f.label=7;case 7:if(!!(a=(u=s.next()).done))return[3,10];l=u.value;return[4,l()];case 8:f.sent();f.label=9;case 9:a=true;return[3,7];case 10:return[3,13];case 11:m=f.sent();c=true;i=m;return[3,13];case 12:try{if(!a&&s.return!=null){s.return()}}finally{if(c){throw i}}return[7];case 13:return[3,15];case 14:p=f.sent();throw M.error('Failed to setup "'.concat(e.map(function(e){return e.name}).join(", "),'": ').concat(p.message)),p;case 15:return[2]}})})()}p(ea,"setupPackages");import ec from"node-persist";var ei=w();function es(){return /*#__PURE__*/r(function(){var e;return f(this,function(n){switch(n.label){case 0:e=ec.defaultInstance;if(e)return[3,2];return[4,ec.init({dir:ei.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=n.sent();n.label=2;case 2:e;return[2]}})})()}p(es,"initNodePersist");var eu={get:function e(e){return /*#__PURE__*/r(function(){var n,t;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,es()];case 1:r.sent();return[4,ec.getItem(e)];case 2:return[2,(n=r.sent())!==null&&n!==void 0?n:null];case 3:t=r.sent();return[2,(M.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,n){return /*#__PURE__*/r(function(){var t;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,es()];case 1:r.sent();return[4,ec.setItem(e,n)];case 2:r.sent();return[3,4];case 3:t=r.sent();M.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/r(function(){var n;return f(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,es()];case 1:t.sent();return[4,ec.removeItem(e)];case 2:t.sent();return[3,4];case 3:n=t.sent();M.error('[Storage:remove] Error removing key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/r(function(){var e,n;return f(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,es()];case 1:t.sent();return[4,ec.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(M.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:n=t.sent();return[2,(M.error("[Storage:keys] Error getting keys:",n),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/r(function(){return f(this,function(n){try{return[2,"".concat(ei.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(M.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var el=w(),ef=L.promisify(R);function em(e){return"error_list:".concat(e)}p(em,"getErrorListKey");function ep(e){return /*#__PURE__*/r(function(){var n,t,o;return f(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];n=Date.now(),t=em(n);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,eu.set(t,{errors:e,timestamp:n})];case 2:a.sent(),setTimeout(function(){return /*#__PURE__*/r(function(){var e;return f(this,function(n){switch(n.label){case 0:return[4,eu.getLogLink(t)];case 1:e=n.sent();e&&M.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:o=a.sent();M.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})})()}p(ep,"saveErrorListToStorage");function ed(e){var n=[],t=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,s,u,l,f;var m=o.exec(e)||[],p=a.exec(e)||[],d=c.exec(e)||[];var E,g,y,v,h,_;m.length&&r?n.push({file:r,position:"".concat(m[1],":").concat(m[2]),type:m[3]===U.Error?U.Error:U.Warning,message:(E=m===null||m===void 0?void 0:(i=m[4])===null||i===void 0?void 0:i.trim())!==null&&E!==void 0?E:"",rule:(g=m===null||m===void 0?void 0:(s=m[5])===null||s===void 0?void 0:s.trim())!==null&&g!==void 0?g:""}):p.length?n.push({file:(y=p===null||p===void 0?void 0:p[1])!==null&&y!==void 0?y:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===U.Error?U.Error:U.Warning,message:(v=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&v!==void 0?v:""}):d.length?n.push({file:"commitlint",type:U.Error,message:(h=d===null||d===void 0?void 0:(l=d[1])===null||l===void 0?void 0:l.trim())!==null&&h!==void 0?h:"",rule:(_=d===null||d===void 0?void 0:(f=d[2])===null||f===void 0?void 0:f.trim())!==null&&_!==void 0?_:""}):t.push(e.trim())}}),n.length&&ep(n),el.DEBUG&&t.length&&(M.warn("Unmatched lines:"),t.forEach(function(e){return M.info(" ".concat(e))}))}p(ed,"parseTextErrors");function eE(e){try{var n=JSON.parse(e),t=[];n.forEach(function(e){var n=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,a=e.column,c=e.ruleId,i=e.message;t.push({type:r===2?U.Error:U.Warning,file:n,position:"".concat(o,":").concat(a),rule:c,message:i})})}),t.length&&ep(t)}catch(n){ed(e)}}p(eE,"parseCommandOutput");function eg(e){return /*#__PURE__*/r(function(e){var n,t,r,o,a,c,i,s,u;var l=arguments;return f(this,function(f){switch(f.label){case 0:n=l.length>1&&l[1]!==void 0?l[1]:eE;t=new AbortController;k.on("SIGINT",function(){M.warn("Process interrupted. Terminating..."),t.abort(),k.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,ef(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:r=f.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&n(e)});f.label=3;case 3:return[3,5];case 4:c=f.sent();i=c.stdout,s=c.stderr,u=c.message;[i,s].forEach(function(e){return e&&n(e)}),!s&&!i&&M.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}p(eg,"executeCommand");function ey(e){return{raw:!0,cmd:e}}p(ey,"rawCommand");function ev(e,n){return(n===null||n===void 0?void 0:n.isCurrentProject)?"".concat(e3," ").concat(e0," ").concat(eV," ").concat(e):"".concat(e3," ").concat(eM," ").concat(e)}p(ev,"formatCLI");function eh(e,n){return typeof e=="function"?ev(e(n),n):(typeof e==="undefined"?"undefined":u(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?ev(e,n):e}p(eh,"formatCommand");function e_(e,n){return /*#__PURE__*/r(function(){var t;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);M.start("".concat(e)),el.DEBUG&&M.info("→ ".concat(n));return[4,eg(n)];case 1:r.sent(),M.success("".concat(e," done."));return[3,3];case 2:t=r.sent();throw M.error("".concat(e," failed: ").concat(t.message)),t;case 3:return[2]}})})()}p(e_,"runCommand");import eD from"node:path";var eI=w(),eC=eD;function eN(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=eC).resolve.apply(r,[eI.CWD].concat(s(n)))}p(eN,"resolveWorkingPath");function eb(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=eC).join.apply(r,s(n))}p(eb,"join");var eS=w(),eO=eS.CWD,eP="@cyberskill/shared",eT="node_modules",ew="dist",eG="package.json",eR="package-lock.json",ek="tsconfig.json",eL=".gitignore",eU=".simple-git-hooks.json",eA="pnpm-lock.yaml",ej=".git/hooks/",eY=".git/COMMIT_EDITMSG",ex=".migrate-mongo.config.js",eF=function(){var e=h.readJsonSync(eN(eG)).name===eP?eO:eb(eO,eT,eP);return eb(e,ew)}(),eM="cyberskill",eV="src/node/cli/index.ts",eK="eslint",eB="eslint",eJ="vitest";var eW="vitest",eH="@commitlint/cli",e$="@commitlint/config-conventional",eq="commitlint",eQ="lint-staged",ez="lint-staged",eX="typescript",eZ="tsc",e0="tsx",e1="git",e2="pnpm",e3="pnpm exec",e4="simple-git-hooks",e5="simple-git-hooks",e6="@eslint/config-inspector",e7="eslint-config-inspector",e8="node-modules-inspector",e9="node-modules-inspector",ne="migrate-mongo",nn="./node_modules/migrate-mongo/bin/migrate-mongo",nt={CYBERSKILL_DIRECTORY:eF,WORKING_DIRECTORY:eO,TS_CONFIG:eN(ek),GIT_IGNORE:eN(eL),GIT_HOOK:eN(ej),GIT_COMMIT_MSG:eN(eY),SIMPLE_GIT_HOOKS_JSON:eN(eU),PACKAGE_JSON:eN(eG),PACKAGE_LOCK_JSON:eN(eR),PNPM_LOCK_YAML:eN(eA),NODE_MODULES:eN(eT),MIGRATE_MONGO_CONFIG:eN(ex),LINT_STAGED_CONFIG:eN("".concat(eF,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:eN("".concat(eF,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:eN("".concat(eF,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eN("".concat(eF,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eN("".concat(eF,"/react/vitest/vitest.e2e.js"))};function nr(e){var n=e.type,t=e.packages,o=e.command;var a=t===null||t===void 0?void 0:t.reduce(function(e,n){return e.some(function(e){return e.name===n.name})||e.push(n),e},[]);return function(){return /*#__PURE__*/r(function(){var e;return f(this,function(t){switch(t.label){case 0:switch(n){case G.CLI:return[3,1];case G.STRING:return[3,4]}return[3,5];case 1:e=a===null||a===void 0?void 0:a.length;if(!e)return[3,3];return[4,ea(a,{update:!0})];case 2:e=t.sent();t.label=3;case 3:return[2,(e,eh(ey("".concat(e3," ").concat(o))))];case 4:return[2,eh(ey(o))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}p(nr,"buildCommand");var no={simpleGitHooks:nr({type:G.CLI,packages:[{name:e4,type:V.DEV_DEPENDENCY}],command:e5}),eslintInspect:nr({type:G.CLI,packages:[{name:e6,type:V.DEV_DEPENDENCY}],command:e7}),nodeModulesInspect:nr({type:G.CLI,packages:[{name:e8,type:V.DEV_DEPENDENCY}],command:e9}),eslintCheck:nr({type:G.CLI,packages:[{name:eK,type:V.DEV_DEPENDENCY}],command:"".concat(eB," ").concat(nt.WORKING_DIRECTORY," --no-cache")}),eslintFix:nr({type:G.CLI,packages:[{name:eK,type:V.DEV_DEPENDENCY}],command:"".concat(eB," ").concat(nt.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:nr({type:G.CLI,packages:[{name:eX,type:V.DEPENDENCY}],command:"".concat(eZ," -p ").concat(nt.TS_CONFIG," --noEmit")}),testUnit:nr({type:G.CLI,packages:[{name:eJ,type:V.DEV_DEPENDENCY}],command:"".concat(eW," --config ").concat(nt.UNIT_TEST_CONFIG)}),testE2e:nr({type:G.CLI,packages:[{name:eJ,type:V.DEV_DEPENDENCY}],command:"".concat(eW," --config ").concat(nt.E2E_TEST_CONFIG)}),mongoMigrateCreate:p(function(e){return nr({type:G.CLI,packages:[{name:ne,type:V.DEPENDENCY}],command:"".concat(e0," ").concat(nn," create ").concat(e," -f ").concat(nt.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:nr({type:G.CLI,packages:[{name:ne,type:V.DEPENDENCY}],command:"".concat(e0," ").concat(nn," up -f ").concat(nt.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:nr({type:G.CLI,packages:[{name:ne,type:V.DEPENDENCY}],command:"".concat(e0," ").concat(nn," down -f ").concat(nt.MIGRATE_MONGO_CONFIG)}),commitLint:nr({type:G.CLI,packages:[{name:eH,type:V.DEV_DEPENDENCY},{name:e$,type:V.DEV_DEPENDENCY}],command:"".concat(eq," --edit ").concat(nt.GIT_COMMIT_MSG," --config ").concat(nt.COMMITLINT_CONFIG)}),lintStaged:nr({type:G.CLI,packages:[{name:eQ,type:V.DEV_DEPENDENCY}],command:"".concat(ez," --config ").concat(nt.LINT_STAGED_CONFIG)}),configureGitHook:nr({type:G.STRING,command:"".concat(e1," config core.hooksPath ").concat(nt.GIT_HOOK)}),stageBuildDirectory:nr({type:G.STRING,command:"".concat(e1," add ").concat(ew)}),build:nr({type:G.STRING,command:"".concat(e2," run build")}),pnpmInstallStandard:nr({type:G.STRING,command:"".concat(e2," install")}),pnpmInstallLegacy:nr({type:G.STRING,command:"".concat(e2," install --legacy-peer-deps")}),pnpmInstallForce:nr({type:G.STRING,command:"".concat(e2," install --force")})};function na(e){return v(i({plugins:[y()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[nt.UNIT_TEST_SETUP_CONFIG]}},e))}p(na,"vitestUnit");export{g as vitestE2E,na as vitestUnit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(t){if(Array.isArray(t))return e(t)}function n(e,t,n,r,o,a,c){try{var i=e[a](c);var u=i.value}catch(e){n(e);return}if(i.done){t(u)}else{Promise.resolve(u).then(r,o)}}function r(e){return function(){var t=this,r=arguments;return new Promise(function(o,a){var c=e.apply(t,r);function i(e){n(c,o,a,i,u,"next",e)}function u(e){n(c,o,a,i,u,"throw",e)}i(undefined)})}}function o(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){o(e,t,n[t])})}return e}function u(e){return t(e)||a(e)||l(e)||c()}function s(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function f(e,t){var n,r,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},c=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return c.next=i(0),c["throw"]=i(1),c["return"]=i(2),typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function i(e){return function(t){return u([e,t])}}function u(i){if(n)throw new TypeError("Generator is already executing.");while(c&&(c=0,i[0]&&(a=0)),a)try{if(n=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;r=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e];r=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var d=Object.create;var v=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var y=function(e,t){return v(e,"name",{value:t,configurable:!0})};var I=function(e,t){for(var n in t)v(e,n,{get:t[n],enumerable:!0})},b=function(e,t,n,r){var o=true,a=false,c=undefined;if(t&&(typeof t==="undefined"?"undefined":s(t))=="object"||typeof t=="function")try{var i=function(){var o=l.value;!h.call(e,o)&&o!==n&&v(e,o,{get:function(){return t[o]},enumerable:!(r=p(t,o))||r.enumerable})};for(var u=g(t)[Symbol.iterator](),l;!(o=(l=u.next()).done);o=true)i()}catch(e){a=true;c=e}finally{try{if(!o&&u.return!=null){u.return()}}finally{if(a){throw c}}}return e};var O=function(e,t,n){return n=e!=null?d(m(e)):{},b(t||!e||!e.__esModule?v(n,"default",{value:e,enumerable:!0}):n,e)},E=function(e){return b(v({},"__esModule",{value:!0}),e)};var S={};I(S,{vitestUnit:function(){return tf}});module.exports=E(S);var C=O(require("@vitejs/plugin-react-swc"),1),T=require("vitest/config");var w=".cyberskill-storage";var _=O(require("@dotenvx/dotenvx"),1),G=require("envalid"),N=O(require("os"),1),L=O(require("path"),1),k=O(require("process"),1);var R=!1;function j(){R||(_.default.config(),R=!0)}y(j,"loadEnvFile");function D(){j();var e=(0,G.cleanEnv)(k.default.env,{CWD:(0,G.str)({default:k.default.cwd()}),DEBUG:(0,G.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,G.str)({default:L.default.join(N.default.homedir(),w)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}y(D,"getEnv");var x=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var P=require("child_process"),A=O(require("process"),1),M=O(require("util"),1);var F=function(e){return e.Error="error",e.Warning="warning",e}({});var U=O(require("chalk"),1),K=O(require("consola"),1),q=require("graphql");var Y=D();Y.DEBUG||(K.default.level=4);function B(e){var t=U.default[e];return typeof t=="function"?t:U.default.green}y(B,"chalkKeyword");var W={silent:K.default.silent,level:K.default.level,fatal:K.default.fatal,error:K.default.error,warn:K.default.warn,log:K.default.log,info:K.default.info,success:K.default.success,ready:K.default.ready,start:K.default.start,box:K.default.box,debug:K.default.debug,trace:K.default.trace,verbose:K.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){K.default.box(U.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,a=e.message;K.default.log("".concat(U.default.gray("File:")," ").concat(U.default.blue("".concat(t).concat(r?":".concat(r):"")))),o&&K.default.log(" ".concat(B(n)("Rule:")," ").concat(o)),K.default.log(" ".concat(B(n)("Message:")," ").concat(a))}),K.default.box(B(n)("".concat(e," : ").concat(t.length))),K.default.log(U.default.gray("─".repeat(40)))}};var J={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var H=O(require("node-fetch"),1);var $=O(require("fs-extra"),1);var V=$.default,z=V.lstatSync,Q=V.readdirSync,X=V.mkdirSync,Z=V.readFileSync,ee=V.unlinkSync,et=V.statSync,en=$.default.readJsonSync;function er(e,t,n){$.default.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}y(er,"writeFileSync");function eo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return $.default.pathExistsSync(e)})}y(eo,"pathExistsSync");var ea=D();function ec(e){var t=eL(ea.CWD,eP);if(!eo(t))return!1;try{var n=en(t),r=n.name,o=n.dependencies,a=o===void 0?{}:o,c=n.devDependencies,i=c===void 0?{}:c,u=r===e,s=e in a,l=e in i;return u||s||l?{path:t,file:n,isCurrentProject:u,isDepend:s,isDevDepend:l}:!1}catch(e){return W.warn("Failed to read package.json: ".concat(e.message)),!1}}y(ec,"getPackage");function ei(e){return r(function(){var t,n,r,o;return f(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,(0,H.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=a.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=a.sent(),r=n.version;return[2,r];case 3:o=a.sent();throw W.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})})()}y(ei,"getLatestPackageVersion");function eu(e,t){return r(function(){var n,r,o,a,c,u,s,l,d,v,p,g,m,h,y,I,b,O,E,S,C;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,4,,5]);n=ec(e);if(!n)return[2,i({},J)];s=n.path,l=n.file,d=n.isCurrentProject,v=n.isDepend,p=n.isDevDepend,g=(r=l.dependencies)!==null&&r!==void 0?r:{},m=(o=l.devDependencies)!==null&&o!==void 0?o:{},h=d?(a=l.version)!==null&&a!==void 0?a:"0.0.0":v?(c=g[e])!==null&&c!==void 0?c:"0.0.0":p?(u=m[e])!==null&&u!==void 0?u:"0.0.0":"0.0.0";if(!d)return[3,1];b=h;return[3,3];case 1:return[4,ei(e)];case 2:b=f.sent();f.label=3;case 3:y=b,I=d||h===y;if(!I&&(t===null||t===void 0?void 0:t.update)){;E=v?"dependencies":p?"devDependencies":null;E&&((O=l[E])===null||O===void 0?void 0:O[e])!==y&&(l[E]=(S=l[E])!==null&&S!==void 0?S:{},l[E][e]=y,er(s,JSON.stringify(l,null,4)),W.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:d,installedPath:s,file:l,isUpToDate:I}];case 4:C=f.sent();return[2,(W.error('Error checking package "'.concat(e,'": ').concat(C.message)),i({},J))];case 5:return[2]}})})()}y(eu,"checkPackage");function es(){return r(function(){var e,t,n,r,o,a,c,i,u,s,l,d;return f(this,function(f){switch(f.label){case 0:e=[{command:y(function(){return tl.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:y(function(){return tl.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:y(function(){return tl.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);o=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(a=o.next()).done))return[3,8];c=a.value,i=c.command,u=c.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:s=f.sent();return[4,eT("".concat(u," using: ").concat(s),s)];case 5:f.sent();return[2];case 6:l=f.sent();W.warn("Installation attempt failed: ".concat(u)),W.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}y(es,"installDependencies");function el(e,t){return r(function(){var n,r,o,a,c,s,l,d,v,p,g;return f(this,function(f){switch(f.label){case 0:if(!eo(ti.PACKAGE_JSON)){W.error("package.json not found. Aborting setup.");return[2]}f.label=1;case 1:f.trys.push([1,13,,14]);n=u(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eu(e,i({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=f.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,es()];case 3:r=f.sent();f.label=4;case 4:r;a=true,c=false,s=undefined;f.label=5;case 5:f.trys.push([5,10,11,12]);l=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();f.label=6;case 6:if(!!(a=(d=l.next()).done))return[3,9];v=d.value;return[4,v()];case 7:f.sent();f.label=8;case 8:a=true;return[3,6];case 9:return[3,12];case 10:p=f.sent();c=true;s=p;return[3,12];case 11:try{if(!a&&l.return!=null){l.return()}}finally{if(c){throw s}}return[7];case 12:return[3,14];case 13:g=f.sent();throw W.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}y(el,"setupPackages");var ef=O(require("node-persist"),1);var ed=D();function ev(){return r(function(){var e;return f(this,function(t){switch(t.label){case 0:e=ef.default.defaultInstance;if(e)return[3,2];return[4,ef.default.init({dir:ed.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}y(ev,"initNodePersist");var ep={get:function e(e){return r(function(){var t,n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,ef.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(W.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,ef.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();W.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,ef.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();W.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,ef.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(W.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(W.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return f(this,function(t){try{return[2,"".concat(ed.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(W.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eg=D(),em=M.promisify(P.exec);function eh(e){return"error_list:".concat(e)}y(eh,"getErrorListKey");function ey(e){return r(function(){var t,n,o;return f(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=eh(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,ep.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(function(){return r(function(){var e;return f(this,function(t){switch(t.label){case 0:return[4,ep.getLogLink(n)];case 1:e=t.sent();e&&W.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:o=a.sent();W.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})})()}y(ey,"saveErrorListToStorage");function eI(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,u,s,l,f;var d=o.exec(e)||[],v=a.exec(e)||[],p=c.exec(e)||[];var g,m,h,y,I,b;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===F.Error?F.Error:F.Warning,message:(g=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&g!==void 0?g:"",rule:(m=d===null||d===void 0?void 0:(u=d[5])===null||u===void 0?void 0:u.trim())!==null&&m!==void 0?m:""}):v.length?t.push({file:(h=v===null||v===void 0?void 0:v[1])!==null&&h!==void 0?h:"",position:"".concat(v[2],":").concat(v[3]),type:v[4]===F.Error?F.Error:F.Warning,message:(y=v===null||v===void 0?void 0:(s=v[5])===null||s===void 0?void 0:s.trim())!==null&&y!==void 0?y:""}):p.length?t.push({file:"commitlint",type:F.Error,message:(I=p===null||p===void 0?void 0:(l=p[1])===null||l===void 0?void 0:l.trim())!==null&&I!==void 0?I:"",rule:(b=p===null||p===void 0?void 0:(f=p[2])===null||f===void 0?void 0:f.trim())!==null&&b!==void 0?b:""}):n.push(e.trim())}}),t.length&&ey(t),eg.DEBUG&&n.length&&(W.warn("Unmatched lines:"),n.forEach(function(e){return W.info(" ".concat(e))}))}y(eI,"parseTextErrors");function eb(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,a=e.column,c=e.ruleId,i=e.message;n.push({type:r===2?F.Error:F.Warning,file:t,position:"".concat(o,":").concat(a),rule:c,message:i})})}),n.length&&ey(n)}catch(t){eI(e)}}y(eb,"parseCommandOutput");function eO(e){return r(function(e){var t,n,r,o,a,c,i,u,s;var l=arguments;return f(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eb;n=new AbortController;A.default.on("SIGINT",function(){W.warn("Process interrupted. Terminating..."),n.abort(),A.default.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,em(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&t(e)});f.label=3;case 3:return[3,5];case 4:c=f.sent();i=c.stdout,u=c.stderr,s=c.message;[i,u].forEach(function(e){return e&&t(e)}),!u&&!i&&W.error("Command failed: ".concat(s));return[3,5];case 5:return[2]}})}).apply(this,arguments)}y(eO,"executeCommand");function eE(e){return{raw:!0,cmd:e}}y(eE,"rawCommand");function eS(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(e7," ").concat(ej," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e7," ").concat(e5," ").concat(eH," ").concat(e):"".concat(e7," ").concat(eJ," ").concat(e)}y(eS,"formatCLI");function eC(e,t){return typeof e=="function"?eS(e(t),t):(typeof e==="undefined"?"undefined":s(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eS(e,t):e}y(eC,"formatCommand");function eT(e,t){return r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);W.start("".concat(e)),eg.DEBUG&&W.info("→ ".concat(t));return[4,eO(t)];case 1:r.sent(),W.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw W.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}y(eT,"runCommand");var ew=O(require("path"),1);var e_=D(),eG=ew.default;function eN(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eG).resolve.apply(r,[e_.CWD].concat(u(t)))}y(eN,"resolveWorkingPath");function eL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eG).join.apply(r,u(t))}y(eL,"join");var ek=D(),eR=ek.CWD,ej="@cyberskill/shared",eD="node_modules",ex="dist",eP="package.json",eA="package-lock.json",eM="tsconfig.json",eF=".gitignore",eU=".simple-git-hooks.json",eK="pnpm-lock.yaml",eq=".git/hooks/",eY=".git/COMMIT_EDITMSG",eB=".migrate-mongo.config.js",eW=eL(eR,eD,ej,ex),eJ="cyberskill",eH="src/nodejs/cli/index.ts",e$="eslint",eV="eslint",ez="vitest",eQ="playwright",eX="vitest",eZ="@commitlint/cli",e0="commitlint",e1="lint-staged",e2="lint-staged",e3="typescript",e4="tsc",e5="tsx",e6="git",e8="pnpm",e7="pnpm exec",e9="simple-git-hooks",te="simple-git-hooks",tt="@eslint/config-inspector",tn="eslint-config-inspector",tr="node-modules-inspector",to="node-modules-inspector",ta="migrate-mongo",tc="./node_modules/migrate-mongo/bin/migrate-mongo",ti={CYBERSKILL_DIRECTORY:eW,WORKING_DIRECTORY:eR,TS_CONFIG:eN(eM),GIT_IGNORE:eN(eF),GIT_HOOK:eN(eq),GIT_COMMIT_MSG:eN(eY),SIMPLE_GIT_HOOKS_JSON:eN(eU),PACKAGE_JSON:eN(eP),PACKAGE_LOCK_JSON:eN(eA),PNPM_LOCK_YAML:eN(eK),NODE_MODULES:eN(eD),MIGRATE_MONGO_CONFIG:eN(eB),LINT_STAGED_CONFIG:eN("".concat(eW,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:eN("".concat(eW,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:eN("".concat(eW,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eN("".concat(eW,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eN("".concat(eW,"/react/vitest/vitest.e2e.js"))};function tu(e,t,n){return r(function(){return f(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case x.CLI:return[3,1];case x.STRING:return[3,3]}return[3,4];case 1:return[4,el(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),eC(eE("".concat(e7," ").concat(n))))];case 3:return[2,eC(eE(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}y(tu,"buildCommand");function ts(e,t,n){return function(){return r(function(){return f(this,function(r){return[2,tu(e,t,n)]})})()}}y(ts,"commandFactory");var tl={simpleGitHooks:ts(x.CLI,e9,te),eslintInspect:ts(x.CLI,tt,tn),nodeModulesInspect:ts(x.CLI,tr,to),eslintCheck:ts(x.CLI,e$,"".concat(eV," ").concat(ti.WORKING_DIRECTORY," --no-cache")),eslintFix:ts(x.CLI,e$,"".concat(eV," ").concat(ti.WORKING_DIRECTORY," --fix --no-cache")),typescriptCheck:ts(x.CLI,e3,"".concat(e4," -p ").concat(ti.TS_CONFIG," --noEmit")),configureGitHook:ts(x.STRING,"".concat(e6," config core.hooksPath ").concat(ti.GIT_HOOK)),testUnit:ts(x.CLI,ez,"".concat(eX," --config ").concat(ti.UNIT_TEST_CONFIG)),testE2e:ts(x.CLI,"".concat(ez," ").concat(eQ),"".concat(eX," --config ").concat(ti.E2E_TEST_CONFIG)),mongoMigrateCreate:y(function(e){return ts(x.CLI,ta,"".concat(e5," ").concat(tc," create ").concat(e," -f ").concat(ti.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:ts(x.CLI,ta,"".concat(e5," ").concat(tc," up -f ").concat(ti.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:ts(x.CLI,ta,"".concat(e5," ").concat(tc," down -f ").concat(ti.MIGRATE_MONGO_CONFIG)),commitLint:ts(x.CLI,eZ,"".concat(e0," --edit ").concat(ti.GIT_COMMIT_MSG," --config ").concat(ti.COMMITLINT_CONFIG)),lintStaged:ts(x.CLI,e1,"".concat(e2," --config ").concat(ti.LINT_STAGED_CONFIG)),stageBuildDirectory:ts(x.STRING,"".concat(e6," add ").concat(ex)),build:ts(x.STRING,"".concat(e8," run build")),pnpmInstallStandard:ts(x.STRING,"".concat(e8," install")),pnpmInstallLegacy:ts(x.STRING,"".concat(e8," install --legacy-peer-deps")),pnpmInstallForce:ts(x.STRING,"".concat(e8," install --force"))};function tf(e){return(0,T.defineConfig)(i({plugins:[(0,C.default)()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[ti.UNIT_TEST_SETUP_CONFIG]}},e))}y(tf,"vitestUnit");0&&(module.exports={vitestUnit:vitestUnit});
|
|
1
|
+
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(t){if(Array.isArray(t))return e(t)}function n(e,t,n,r,a,o,c){try{var i=e[o](c);var s=i.value}catch(e){n(e);return}if(i.done){t(s)}else{Promise.resolve(s).then(r,a)}}function r(e){return function(){var t=this,r=arguments;return new Promise(function(a,o){var c=e.apply(t,r);function i(e){n(c,a,o,i,s,"next",e)}function s(e){n(c,a,o,i,s,"throw",e)}i(undefined)})}}function a(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){a(e,t,n[t])})}return e}function s(e){return t(e)||o(e)||l(e)||c()}function u(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function f(e,t){var n,r,a,o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},c=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return c.next=i(0),c["throw"]=i(1),c["return"]=i(2),typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function i(e){return function(t){return s([e,t])}}function s(i){if(n)throw new TypeError("Generator is already executing.");while(c&&(c=0,i[0]&&(o=0)),o)try{if(n=1,r&&(a=i[0]&2?r["return"]:i[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;if(r=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(a=o.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(i[0]===6&&o.label<a[1]){o.label=a[1];a=i;break}if(a&&o.label<a[2]){o.label=a[2];o.ops.push(i);break}if(a[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];r=0}finally{n=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var d=Object.create;var p=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var y=function(e,t){return p(e,"name",{value:t,configurable:!0})};var _=function(e,t){for(var n in t)p(e,n,{get:t[n],enumerable:!0})},h=function(e,t,n,r){var a=true,o=false,c=undefined;if(t&&(typeof t==="undefined"?"undefined":u(t))=="object"||typeof t=="function")try{var i=function(){var a=l.value;!E.call(e,a)&&a!==n&&p(e,a,{get:function(){return t[a]},enumerable:!(r=m(t,a))||r.enumerable})};for(var s=v(t)[Symbol.iterator](),l;!(a=(l=s.next()).done);a=true)i()}catch(e){o=true;c=e}finally{try{if(!a&&s.return!=null){s.return()}}finally{if(o){throw c}}}return e};var D=function(e,t,n){return n=e!=null?d(g(e)):{},h(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)},I=function(e){return h(p({},"__esModule",{value:!0}),e)};var C={};_(C,{vitestUnit:function(){return td}});module.exports=I(C);var N=D(require("@vitejs/plugin-react-swc"),1),b=require("vitest/config");var O=D(require("fs-extra"),1);var P=".cyberskill-storage";var S=D(require("@dotenvx/dotenvx"),1),T=require("envalid"),w=D(require("os"),1),G=D(require("path"),1),R=D(require("process"),1);var k=!1;function L(){k||(S.default.config(),k=!0)}y(L,"loadEnvFile");function U(){L();var e=(0,T.cleanEnv)(R.default.env,{CWD:(0,T.str)({default:R.default.cwd()}),DEBUG:(0,T.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,T.str)({default:G.default.join(w.default.homedir(),P)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}y(U,"getEnv");var j=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var A=require("child_process"),Y=D(require("process"),1),x=D(require("util"),1);var M=function(e){return e.Error="error",e.Warning="warning",e}({});var F=D(require("chalk"),1),V=D(require("consola"),1),K=require("graphql");var q=U();q.DEBUG||(V.default.level=4);function B(e){var t=F.default[e];return typeof t=="function"?t:F.default.green}y(B,"chalkKeyword");var J={silent:V.default.silent,level:V.default.level,fatal:V.default.fatal,error:V.default.error,warn:V.default.warn,log:V.default.log,info:V.default.info,success:V.default.success,ready:V.default.ready,start:V.default.start,box:V.default.box,debug:V.default.debug,trace:V.default.trace,verbose:V.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){V.default.box(F.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,a=e.rule,o=e.message;V.default.log("".concat(F.default.gray("File:")," ").concat(F.default.blue("".concat(t).concat(r?":".concat(r):"")))),a&&V.default.log(" ".concat(B(n)("Rule:")," ").concat(a)),V.default.log(" ".concat(B(n)("Message:")," ").concat(o))}),V.default.box(B(n)("".concat(e," : ").concat(t.length))),V.default.log(F.default.gray("─".repeat(40)))}};var W=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});var H=D(require("node-fetch"),1);var $=D(require("fs-extra"),1),z=D(require("path"),1);var Q=$.default,X=Q.lstatSync,Z=Q.readdirSync,ee=Q.mkdirSync,et=Q.readFileSync,en=Q.unlinkSync,er=Q.statSync,ea=$.default.readJsonSync;function eo(e,t,n){$.default.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}y(eo,"writeFileSync");function ec(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return $.default.pathExistsSync(e)})}y(ec,"pathExistsSync");var ei=U();function es(e){return /*#__PURE__*/r(function(){var t,n,r,a;return f(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,(0,H.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=o.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=o.sent(),r=n.version;return[2,r];case 3:a=o.sent();throw J.error('Failed to fetch version for "'.concat(e,'": ').concat(a.message)),a;case 4:return[2]}})})()}y(es,"getLatestPackageVersion");function eu(e){return /*#__PURE__*/r(function(){var t,n,r,a,o,c,i,s,u,l,d,p,m,v,g,E,y,_,h;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,2,,3]);if(!ec(tu.PACKAGE_JSON))return[2,{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===W.DEPENDENCY,isDevDependency:e.type===W.DEV_DEPENDENCY,installedPath:"",file:{}}];t=ea(tu.PACKAGE_JSON),n=t.name,r=t.version,a=r===void 0?"":r,o=t.dependencies,c=o===void 0?{}:o,i=t.devDependencies,s=i===void 0?{}:i;if(e.name===n)return[2,{name:n,currentVersion:a,latestVersion:a,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===W.DEPENDENCY,isDevDependency:e.type===W.DEV_DEPENDENCY,installedPath:tu.PACKAGE_JSON,file:t}];u=e.name in c,l=e.name in s;return[4,es(e.name)];case 1:d=f.sent();if(!u&&!l)return[2,{name:e.name,currentVersion:"",latestVersion:d,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===W.DEPENDENCY,isDevDependency:e.type===W.DEV_DEPENDENCY,installedPath:"",file:{}}];v=(m=(p=c[e.name])!==null&&p!==void 0?p:s[e.name])!==null&&m!==void 0?m:"",g=eR(ei.CWD,ej,e.name,eY);if(!ec(g))return[2,{name:e.name,currentVersion:"",latestVersion:d,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:u,isDevDependency:l,installedPath:"",file:{}}];E=ea(g),y=E.version,_=y===void 0?"":y;return[2,v!==_?{name:e.name,currentVersion:_||v,latestVersion:d,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:u,isDevDependency:l,installedPath:g,file:E}:{name:e.name,currentVersion:v,latestVersion:d,isCurrentProject:!1,isInstalled:!0,isUpToDate:v===d,isDependency:u,isDevDependency:l,installedPath:g,file:E}];case 2:h=f.sent();throw J.error('Error getting package "'.concat(e.name,'": ').concat(h.message)),h;case 3:return[2]}})})()}y(eu,"getPackage");function el(e){return /*#__PURE__*/r(function(){var t,n,r,a,o;return f(this,function(c){try{;r=ea(tu.PACKAGE_JSON),a=(t=r.dependencies)!==null&&t!==void 0?t:{},o=(n=r.devDependencies)!==null&&n!==void 0?n:{};e.isDependency?a[e.name]=e.latestVersion:e.isDevDependency&&(o[e.name]=e.latestVersion),eo(tu.PACKAGE_JSON,JSON.stringify(r,null,4)),J.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(t){throw J.error('Error updating package "'.concat(e.name,'": ').concat(t.message)),t}return[2]})})()}y(el,"updatePackage");function ef(){return /*#__PURE__*/r(function(){var e,t,n,r,a,o,c,i,s,u,l,d,p;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,12,,13]);e=[{command:y(function(){return tf.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:y(function(){return tf.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:y(function(){return tf.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);a=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(o=a.next()).done))return[3,8];c=o.value,i=c.command,s=c.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,eP("".concat(s," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();J.warn("Installation attempt failed: ".concat(s)),J.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw r}}return[7];case 11:return[3,13];case 12:p=f.sent();throw J.error("Failed to install dependencies: ".concat(p.message)),p;case 13:return[2]}})})()}y(ef,"installDependencies");function ed(e,t){return /*#__PURE__*/r(function(){var n,r,a,o,c,i,s,u,l,d,p;return f(this,function(f){switch(f.label){case 0:if(!ec(tu.PACKAGE_JSON)){J.error("package.json not found. Aborting setup.");return[2]}f.label=1;case 1:f.trys.push([1,14,,15]);return[4,Promise.all(e.map(eu))];case 2:n=f.sent().filter(function(e){return!e.isCurrentProject&&(!e.isInstalled||!e.isUpToDate)});r=n.length>0;if(!r)return[3,5];return[4,Promise.all(n.map(el))];case 3:f.sent();return[4,ef()];case 4:r=f.sent();f.label=5;case 5:r;o=true,c=false,i=undefined;f.label=6;case 6:f.trys.push([6,11,12,13]);s=((a=t===null||t===void 0?void 0:t.postInstallActions)!==null&&a!==void 0?a:[])[Symbol.iterator]();f.label=7;case 7:if(!!(o=(u=s.next()).done))return[3,10];l=u.value;return[4,l()];case 8:f.sent();f.label=9;case 9:o=true;return[3,7];case 10:return[3,13];case 11:d=f.sent();c=true;i=d;return[3,13];case 12:try{if(!o&&s.return!=null){s.return()}}finally{if(c){throw i}}return[7];case 13:return[3,15];case 14:p=f.sent();throw J.error('Failed to setup "'.concat(e.map(function(e){return e.name}).join(", "),'": ').concat(p.message)),p;case 15:return[2]}})})()}y(ed,"setupPackages");var ep=D(require("node-persist"),1);var em=U();function ev(){return /*#__PURE__*/r(function(){var e;return f(this,function(t){switch(t.label){case 0:e=ep.default.defaultInstance;if(e)return[3,2];return[4,ep.default.init({dir:em.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}y(ev,"initNodePersist");var eg={get:function e(e){return /*#__PURE__*/r(function(){var t,n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,ep.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(J.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,ep.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();J.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/r(function(){var t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,ep.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();J.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/r(function(){var e,t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,ep.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(J.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(J.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/r(function(){return f(this,function(t){try{return[2,"".concat(em.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(J.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eE=U(),ey=x.promisify(A.exec);function e_(e){return"error_list:".concat(e)}y(e_,"getErrorListKey");function eh(e){return /*#__PURE__*/r(function(){var t,n,a;return f(this,function(o){switch(o.label){case 0:if(e.length===0)return[2];t=Date.now(),n=e_(t);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,eg.set(n,{errors:e,timestamp:t})];case 2:o.sent(),setTimeout(function(){return /*#__PURE__*/r(function(){var e;return f(this,function(t){switch(t.label){case 0:return[4,eg.getLogLink(n)];case 1:e=t.sent();e&&J.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:a=o.sent();J.error("Failed to save errors: ".concat(a.message));return[3,4];case 4:return[2]}})})()}y(eh,"saveErrorListToStorage");function eD(e){var t=[],n=[],r="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,s,u,l,f;var d=a.exec(e)||[],p=o.exec(e)||[],m=c.exec(e)||[];var v,g,E,y,_,h;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===M.Error?M.Error:M.Warning,message:(v=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&v!==void 0?v:"",rule:(g=d===null||d===void 0?void 0:(s=d[5])===null||s===void 0?void 0:s.trim())!==null&&g!==void 0?g:""}):p.length?t.push({file:(E=p===null||p===void 0?void 0:p[1])!==null&&E!==void 0?E:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===M.Error?M.Error:M.Warning,message:(y=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):m.length?t.push({file:"commitlint",type:M.Error,message:(_=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&_!==void 0?_:"",rule:(h=m===null||m===void 0?void 0:(f=m[2])===null||f===void 0?void 0:f.trim())!==null&&h!==void 0?h:""}):n.push(e.trim())}}),t.length&&eh(t),eE.DEBUG&&n.length&&(J.warn("Unmatched lines:"),n.forEach(function(e){return J.info(" ".concat(e))}))}y(eD,"parseTextErrors");function eI(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,a=e.line,o=e.column,c=e.ruleId,i=e.message;n.push({type:r===2?M.Error:M.Warning,file:t,position:"".concat(a,":").concat(o),rule:c,message:i})})}),n.length&&eh(n)}catch(t){eD(e)}}y(eI,"parseCommandOutput");function eC(e){return /*#__PURE__*/r(function(e){var t,n,r,a,o,c,i,s,u;var l=arguments;return f(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eI;n=new AbortController;Y.default.on("SIGINT",function(){J.warn("Process interrupted. Terminating..."),n.abort(),Y.default.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,ey(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),a=r.stdout,o=r.stderr;[a,o].forEach(function(e){return e&&t(e)});f.label=3;case 3:return[3,5];case 4:c=f.sent();i=c.stdout,s=c.stderr,u=c.message;[i,s].forEach(function(e){return e&&t(e)}),!s&&!i&&J.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}y(eC,"executeCommand");function eN(e){return{raw:!0,cmd:e}}y(eN,"rawCommand");function eb(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(te," ").concat(e7," ").concat(e$," ").concat(e):"".concat(te," ").concat(eH," ").concat(e)}y(eb,"formatCLI");function eO(e,t){return typeof e=="function"?eb(e(t),t):(typeof e==="undefined"?"undefined":u(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eb(e,t):e}y(eO,"formatCommand");function eP(e,t){return /*#__PURE__*/r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);J.start("".concat(e)),eE.DEBUG&&J.info("→ ".concat(t));return[4,eC(t)];case 1:r.sent(),J.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw J.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}y(eP,"runCommand");var eS=D(require("path"),1);var eT=U(),ew=eS.default;function eG(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ew).resolve.apply(r,[eT.CWD].concat(s(t)))}y(eG,"resolveWorkingPath");function eR(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ew).join.apply(r,s(t))}y(eR,"join");var ek=U(),eL=ek.CWD,eU="@cyberskill/shared",ej="node_modules",eA="dist",eY="package.json",ex="package-lock.json",eM="tsconfig.json",eF=".gitignore",eV=".simple-git-hooks.json",eK="pnpm-lock.yaml",eq=".git/hooks/",eB=".git/COMMIT_EDITMSG",eJ=".migrate-mongo.config.js",eW=function(){var e=O.default.readJsonSync(eG(eY)).name===eU?eL:eR(eL,ej,eU);return eR(e,eA)}(),eH="cyberskill",e$="src/node/cli/index.ts",ez="eslint",eQ="eslint",eX="vitest";var eZ="vitest",e0="@commitlint/cli",e1="@commitlint/config-conventional",e2="commitlint",e3="lint-staged",e4="lint-staged",e5="typescript",e6="tsc",e7="tsx",e8="git",e9="pnpm",te="pnpm exec",tt="simple-git-hooks",tn="simple-git-hooks",tr="@eslint/config-inspector",ta="eslint-config-inspector",to="node-modules-inspector",tc="node-modules-inspector",ti="migrate-mongo",ts="./node_modules/migrate-mongo/bin/migrate-mongo",tu={CYBERSKILL_DIRECTORY:eW,WORKING_DIRECTORY:eL,TS_CONFIG:eG(eM),GIT_IGNORE:eG(eF),GIT_HOOK:eG(eq),GIT_COMMIT_MSG:eG(eB),SIMPLE_GIT_HOOKS_JSON:eG(eV),PACKAGE_JSON:eG(eY),PACKAGE_LOCK_JSON:eG(ex),PNPM_LOCK_YAML:eG(eK),NODE_MODULES:eG(ej),MIGRATE_MONGO_CONFIG:eG(eJ),LINT_STAGED_CONFIG:eG("".concat(eW,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:eG("".concat(eW,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:eG("".concat(eW,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eG("".concat(eW,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eG("".concat(eW,"/react/vitest/vitest.e2e.js"))};function tl(e){var t=e.type,n=e.packages,a=e.command;var o=n===null||n===void 0?void 0:n.reduce(function(e,t){return e.some(function(e){return e.name===t.name})||e.push(t),e},[]);return function(){return /*#__PURE__*/r(function(){var e;return f(this,function(n){switch(n.label){case 0:switch(t){case j.CLI:return[3,1];case j.STRING:return[3,4]}return[3,5];case 1:e=o===null||o===void 0?void 0:o.length;if(!e)return[3,3];return[4,ed(o,{update:!0})];case 2:e=n.sent();n.label=3;case 3:return[2,(e,eO(eN("".concat(te," ").concat(a))))];case 4:return[2,eO(eN(a))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}y(tl,"buildCommand");var tf={simpleGitHooks:tl({type:j.CLI,packages:[{name:tt,type:W.DEV_DEPENDENCY}],command:tn}),eslintInspect:tl({type:j.CLI,packages:[{name:tr,type:W.DEV_DEPENDENCY}],command:ta}),nodeModulesInspect:tl({type:j.CLI,packages:[{name:to,type:W.DEV_DEPENDENCY}],command:tc}),eslintCheck:tl({type:j.CLI,packages:[{name:ez,type:W.DEV_DEPENDENCY}],command:"".concat(eQ," ").concat(tu.WORKING_DIRECTORY," --no-cache")}),eslintFix:tl({type:j.CLI,packages:[{name:ez,type:W.DEV_DEPENDENCY}],command:"".concat(eQ," ").concat(tu.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:tl({type:j.CLI,packages:[{name:e5,type:W.DEPENDENCY}],command:"".concat(e6," -p ").concat(tu.TS_CONFIG," --noEmit")}),testUnit:tl({type:j.CLI,packages:[{name:eX,type:W.DEV_DEPENDENCY}],command:"".concat(eZ," --config ").concat(tu.UNIT_TEST_CONFIG)}),testE2e:tl({type:j.CLI,packages:[{name:eX,type:W.DEV_DEPENDENCY}],command:"".concat(eZ," --config ").concat(tu.E2E_TEST_CONFIG)}),mongoMigrateCreate:y(function(e){return tl({type:j.CLI,packages:[{name:ti,type:W.DEPENDENCY}],command:"".concat(e7," ").concat(ts," create ").concat(e," -f ").concat(tu.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:tl({type:j.CLI,packages:[{name:ti,type:W.DEPENDENCY}],command:"".concat(e7," ").concat(ts," up -f ").concat(tu.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:tl({type:j.CLI,packages:[{name:ti,type:W.DEPENDENCY}],command:"".concat(e7," ").concat(ts," down -f ").concat(tu.MIGRATE_MONGO_CONFIG)}),commitLint:tl({type:j.CLI,packages:[{name:e0,type:W.DEV_DEPENDENCY},{name:e1,type:W.DEV_DEPENDENCY}],command:"".concat(e2," --edit ").concat(tu.GIT_COMMIT_MSG," --config ").concat(tu.COMMITLINT_CONFIG)}),lintStaged:tl({type:j.CLI,packages:[{name:e3,type:W.DEV_DEPENDENCY}],command:"".concat(e4," --config ").concat(tu.LINT_STAGED_CONFIG)}),configureGitHook:tl({type:j.STRING,command:"".concat(e8," config core.hooksPath ").concat(tu.GIT_HOOK)}),stageBuildDirectory:tl({type:j.STRING,command:"".concat(e8," add ").concat(eA)}),build:tl({type:j.STRING,command:"".concat(e9," run build")}),pnpmInstallStandard:tl({type:j.STRING,command:"".concat(e9," install")}),pnpmInstallLegacy:tl({type:j.STRING,command:"".concat(e9," install --legacy-peer-deps")}),pnpmInstallForce:tl({type:j.STRING,command:"".concat(e9," install --force")})};function td(e){return(0,b.defineConfig)(i({plugins:[(0,N.default)()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tu.UNIT_TEST_SETUP_CONFIG]}},e))}y(td,"vitestUnit");0&&(module.exports={vitestUnit:vitestUnit});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(t){if(Array.isArray(t))return e(t)}function n(e,t,n,r,o,c,a){try{var i=e[c](a);var s=i.value}catch(e){n(e);return}if(i.done){t(s)}else{Promise.resolve(s).then(r,o)}}function r(e){return function(){var t=this,r=arguments;return new Promise(function(o,c){var a=e.apply(t,r);function i(e){n(a,o,c,i,s,"next",e)}function s(e){n(a,o,c,i,s,"throw",e)}i(undefined)})}}function o(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function c(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){o(e,t,n[t])})}return e}function s(e){return t(e)||c(e)||l(e)||a()}function u(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function f(e,t){var n,r,o,c={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=i(0),a["throw"]=i(1),a["return"]=i(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(t){return s([e,t])}}function s(i){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,i[0]&&(c=0)),c)try{if(n=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:c.label++;return{value:i[1],done:false};case 5:c.label++;r=i[1];i=[0];continue;case 7:i=c.ops.pop();c.trys.pop();continue;default:if(!(o=c.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){c=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(i[0]===6&&c.label<o[1]){c.label=o[1];o=i;break}if(o&&c.label<o[2]){c.label=o[2];c.ops.push(i);break}if(o[2])c.ops.pop();c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e];r=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var d=Object.defineProperty;var p=function(e,t){return d(e,"name",{value:t,configurable:!0})};import m from"@vitejs/plugin-react-swc";import{defineConfig as g}from"vitest/config";var v=".cyberskill-storage";import h from"@dotenvx/dotenvx";import{bool as y,cleanEnv as I,str as b}from"envalid";import E from"node:os";import C from"node:path";import S from"node:process";var O=!1;function T(){O||(h.config(),O=!0)}p(T,"loadEnvFile");function w(){T();var e=I(S.env,{CWD:b({default:S.cwd()}),DEBUG:y({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:b({default:C.join(E.homedir(),v)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}p(w,"getEnv");var G=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as _}from"node:child_process";import N from"node:process";import*as L from"node:util";var k=function(e){return e.Error="error",e.Warning="warning",e}({});import R from"chalk";import D from"consola";import{GraphQLError as j}from"graphql";var x=w();x.DEBUG||(D.level=4);function A(e){var t=R[e];return typeof t=="function"?t:R.green}p(A,"chalkKeyword");var F={silent:D.silent,level:D.level,fatal:D.fatal,error:D.error,warn:D.warn,log:D.log,info:D.info,success:D.success,ready:D.ready,start:D.start,box:D.box,debug:D.debug,trace:D.trace,verbose:D.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){D.box(R.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,c=e.message;D.log("".concat(R.gray("File:")," ").concat(R.blue("".concat(t).concat(r?":".concat(r):"")))),o&&D.log(" ".concat(A(n)("Rule:")," ").concat(o)),D.log(" ".concat(A(n)("Message:")," ").concat(c))}),D.box(A(n)("".concat(e," : ").concat(t.length))),D.log(R.gray("─".repeat(40)))}};var P={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import M from"node-fetch";import U from"fs-extra";var K=U.lstatSync,Y=U.readdirSync,B=U.mkdirSync,W=U.readFileSync,J=U.unlinkSync,H=U.statSync,$=U.readJsonSync;function q(e,t,n){U.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}p(q,"writeFileSync");function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return U.pathExistsSync(e)})}p(Q,"pathExistsSync");var V=w();function z(e){var t=eE(V.CWD,eG);if(!Q(t))return!1;try{var n=$(t),r=n.name,o=n.dependencies,c=o===void 0?{}:o,a=n.devDependencies,i=a===void 0?{}:a,s=r===e,u=e in c,l=e in i;return s||u||l?{path:t,file:n,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return F.warn("Failed to read package.json: ".concat(e.message)),!1}}p(z,"getPackage");function X(e){return r(function(){var t,n,r,o;return f(this,function(c){switch(c.label){case 0:c.trys.push([0,3,,4]);return[4,M("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=c.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=c.sent(),r=n.version;return[2,r];case 3:o=c.sent();throw F.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})})()}p(X,"getLatestPackageVersion");function Z(e,t){return r(function(){var n,r,o,c,a,s,u,l,d,p,m,g,v,h,y,I,b,E,C,S,O;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,4,,5]);n=z(e);if(!n)return[2,i({},P)];u=n.path,l=n.file,d=n.isCurrentProject,p=n.isDepend,m=n.isDevDepend,g=(r=l.dependencies)!==null&&r!==void 0?r:{},v=(o=l.devDependencies)!==null&&o!==void 0?o:{},h=d?(c=l.version)!==null&&c!==void 0?c:"0.0.0":p?(a=g[e])!==null&&a!==void 0?a:"0.0.0":m?(s=v[e])!==null&&s!==void 0?s:"0.0.0":"0.0.0";if(!d)return[3,1];b=h;return[3,3];case 1:return[4,X(e)];case 2:b=f.sent();f.label=3;case 3:y=b,I=d||h===y;if(!I&&(t===null||t===void 0?void 0:t.update)){;C=p?"dependencies":m?"devDependencies":null;C&&((E=l[C])===null||E===void 0?void 0:E[e])!==y&&(l[C]=(S=l[C])!==null&&S!==void 0?S:{},l[C][e]=y,q(u,JSON.stringify(l,null,4)),F.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:d,installedPath:u,file:l,isUpToDate:I}];case 4:O=f.sent();return[2,(F.error('Error checking package "'.concat(e,'": ').concat(O.message)),i({},P))];case 5:return[2]}})})()}p(Z,"checkPackage");function ee(){return r(function(){var e,t,n,r,o,c,a,i,s,u,l,d;return f(this,function(f){switch(f.label){case 0:e=[{command:p(function(){return tt.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:p(function(){return tt.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:p(function(){return tt.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);o=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(c=o.next()).done))return[3,8];a=c.value,i=a.command,s=a.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,ev("".concat(s," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();F.warn("Installation attempt failed: ".concat(s)),F.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}p(ee,"installDependencies");function et(e,t){return r(function(){var n,r,o,c,a,u,l,d,p,m,g;return f(this,function(f){switch(f.label){case 0:if(!Q(e7.PACKAGE_JSON)){F.error("package.json not found. Aborting setup.");return[2]}f.label=1;case 1:f.trys.push([1,13,,14]);n=s(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return Z(e,i({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=f.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,ee()];case 3:r=f.sent();f.label=4;case 4:r;c=true,a=false,u=undefined;f.label=5;case 5:f.trys.push([5,10,11,12]);l=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();f.label=6;case 6:if(!!(c=(d=l.next()).done))return[3,9];p=d.value;return[4,p()];case 7:f.sent();f.label=8;case 8:c=true;return[3,6];case 9:return[3,12];case 10:m=f.sent();a=true;u=m;return[3,12];case 11:try{if(!c&&l.return!=null){l.return()}}finally{if(a){throw u}}return[7];case 12:return[3,14];case 13:g=f.sent();throw F.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}p(et,"setupPackages");import en from"node-persist";var er=w();function eo(){return r(function(){var e;return f(this,function(t){switch(t.label){case 0:e=en.defaultInstance;if(e)return[3,2];return[4,en.init({dir:er.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}p(eo,"initNodePersist");var ec={get:function e(e){return r(function(){var t,n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eo()];case 1:r.sent();return[4,en.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(F.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eo()];case 1:r.sent();return[4,en.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();F.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eo()];case 1:n.sent();return[4,en.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();F.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,t;return f(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eo()];case 1:n.sent();return[4,en.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(F.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(F.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return f(this,function(t){try{return[2,"".concat(er.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(F.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var ea=w(),ei=L.promisify(_);function es(e){return"error_list:".concat(e)}p(es,"getErrorListKey");function eu(e){return r(function(){var t,n,o;return f(this,function(c){switch(c.label){case 0:if(e.length===0)return[2];t=Date.now(),n=es(t);c.label=1;case 1:c.trys.push([1,3,,4]);return[4,ec.set(n,{errors:e,timestamp:t})];case 2:c.sent(),setTimeout(function(){return r(function(){var e;return f(this,function(t){switch(t.label){case 0:return[4,ec.getLogLink(n)];case 1:e=t.sent();e&&F.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:o=c.sent();F.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})})()}p(eu,"saveErrorListToStorage");function el(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,c=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,a=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,s,u,l,f;var d=o.exec(e)||[],p=c.exec(e)||[],m=a.exec(e)||[];var g,v,h,y,I,b;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===k.Error?k.Error:k.Warning,message:(g=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&g!==void 0?g:"",rule:(v=d===null||d===void 0?void 0:(s=d[5])===null||s===void 0?void 0:s.trim())!==null&&v!==void 0?v:""}):p.length?t.push({file:(h=p===null||p===void 0?void 0:p[1])!==null&&h!==void 0?h:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===k.Error?k.Error:k.Warning,message:(y=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):m.length?t.push({file:"commitlint",type:k.Error,message:(I=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&I!==void 0?I:"",rule:(b=m===null||m===void 0?void 0:(f=m[2])===null||f===void 0?void 0:f.trim())!==null&&b!==void 0?b:""}):n.push(e.trim())}}),t.length&&eu(t),ea.DEBUG&&n.length&&(F.warn("Unmatched lines:"),n.forEach(function(e){return F.info(" ".concat(e))}))}p(el,"parseTextErrors");function ef(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,c=e.column,a=e.ruleId,i=e.message;n.push({type:r===2?k.Error:k.Warning,file:t,position:"".concat(o,":").concat(c),rule:a,message:i})})}),n.length&&eu(n)}catch(t){el(e)}}p(ef,"parseCommandOutput");function ed(e){return r(function(e){var t,n,r,o,c,a,i,s,u;var l=arguments;return f(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:ef;n=new AbortController;N.on("SIGINT",function(){F.warn("Process interrupted. Terminating..."),n.abort(),N.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,ei(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,c=r.stderr;[o,c].forEach(function(e){return e&&t(e)});f.label=3;case 3:return[3,5];case 4:a=f.sent();i=a.stdout,s=a.stderr,u=a.message;[i,s].forEach(function(e){return e&&t(e)}),!s&&!i&&F.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}p(ed,"executeCommand");function ep(e){return{raw:!0,cmd:e}}p(ep,"rawCommand");function em(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eZ," ").concat(eO," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eZ," ").concat(eV," ").concat(eP," ").concat(e):"".concat(eZ," ").concat(eF," ").concat(e)}p(em,"formatCLI");function eg(e,t){return typeof e=="function"?em(e(t),t):(typeof e==="undefined"?"undefined":u(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?em(e,t):e}p(eg,"formatCommand");function ev(e,t){return r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);F.start("".concat(e)),ea.DEBUG&&F.info("→ ".concat(t));return[4,ed(t)];case 1:r.sent(),F.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw F.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}p(ev,"runCommand");import eh from"node:path";var ey=w(),eI=eh;function eb(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eI).resolve.apply(r,[ey.CWD].concat(s(t)))}p(eb,"resolveWorkingPath");function eE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eI).join.apply(r,s(t))}p(eE,"join");var eC=w(),eS=eC.CWD,eO="@cyberskill/shared",eT="node_modules",ew="dist",eG="package.json",e_="package-lock.json",eN="tsconfig.json",eL=".gitignore",ek=".simple-git-hooks.json",eR="pnpm-lock.yaml",eD=".git/hooks/",ej=".git/COMMIT_EDITMSG",ex=".migrate-mongo.config.js",eA=eE(eS,eT,eO,ew),eF="cyberskill",eP="src/nodejs/cli/index.ts",eM="eslint",eU="eslint",eK="vitest",eY="playwright",eB="vitest",eW="@commitlint/cli",eJ="commitlint",eH="lint-staged",e$="lint-staged",eq="typescript",eQ="tsc",eV="tsx",ez="git",eX="pnpm",eZ="pnpm exec",e0="simple-git-hooks",e1="simple-git-hooks",e2="@eslint/config-inspector",e3="eslint-config-inspector",e4="node-modules-inspector",e5="node-modules-inspector",e6="migrate-mongo",e8="./node_modules/migrate-mongo/bin/migrate-mongo",e7={CYBERSKILL_DIRECTORY:eA,WORKING_DIRECTORY:eS,TS_CONFIG:eb(eN),GIT_IGNORE:eb(eL),GIT_HOOK:eb(eD),GIT_COMMIT_MSG:eb(ej),SIMPLE_GIT_HOOKS_JSON:eb(ek),PACKAGE_JSON:eb(eG),PACKAGE_LOCK_JSON:eb(e_),PNPM_LOCK_YAML:eb(eR),NODE_MODULES:eb(eT),MIGRATE_MONGO_CONFIG:eb(ex),LINT_STAGED_CONFIG:eb("".concat(eA,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:eb("".concat(eA,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:eb("".concat(eA,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eb("".concat(eA,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eb("".concat(eA,"/react/vitest/vitest.e2e.js"))};function e9(e,t,n){return r(function(){return f(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case G.CLI:return[3,1];case G.STRING:return[3,3]}return[3,4];case 1:return[4,et(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),eg(ep("".concat(eZ," ").concat(n))))];case 3:return[2,eg(ep(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}p(e9,"buildCommand");function te(e,t,n){return function(){return r(function(){return f(this,function(r){return[2,e9(e,t,n)]})})()}}p(te,"commandFactory");var tt={simpleGitHooks:te(G.CLI,e0,e1),eslintInspect:te(G.CLI,e2,e3),nodeModulesInspect:te(G.CLI,e4,e5),eslintCheck:te(G.CLI,eM,"".concat(eU," ").concat(e7.WORKING_DIRECTORY," --no-cache")),eslintFix:te(G.CLI,eM,"".concat(eU," ").concat(e7.WORKING_DIRECTORY," --fix --no-cache")),typescriptCheck:te(G.CLI,eq,"".concat(eQ," -p ").concat(e7.TS_CONFIG," --noEmit")),configureGitHook:te(G.STRING,"".concat(ez," config core.hooksPath ").concat(e7.GIT_HOOK)),testUnit:te(G.CLI,eK,"".concat(eB," --config ").concat(e7.UNIT_TEST_CONFIG)),testE2e:te(G.CLI,"".concat(eK," ").concat(eY),"".concat(eB," --config ").concat(e7.E2E_TEST_CONFIG)),mongoMigrateCreate:p(function(e){return te(G.CLI,e6,"".concat(eV," ").concat(e8," create ").concat(e," -f ").concat(e7.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:te(G.CLI,e6,"".concat(eV," ").concat(e8," up -f ").concat(e7.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:te(G.CLI,e6,"".concat(eV," ").concat(e8," down -f ").concat(e7.MIGRATE_MONGO_CONFIG)),commitLint:te(G.CLI,eW,"".concat(eJ," --edit ").concat(e7.GIT_COMMIT_MSG," --config ").concat(e7.COMMITLINT_CONFIG)),lintStaged:te(G.CLI,eH,"".concat(e$," --config ").concat(e7.LINT_STAGED_CONFIG)),stageBuildDirectory:te(G.STRING,"".concat(ez," add ").concat(ew)),build:te(G.STRING,"".concat(eX," run build")),pnpmInstallStandard:te(G.STRING,"".concat(eX," install")),pnpmInstallLegacy:te(G.STRING,"".concat(eX," install --legacy-peer-deps")),pnpmInstallForce:te(G.STRING,"".concat(eX," install --force"))};function tn(e){return g(i({plugins:[m()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[e7.UNIT_TEST_SETUP_CONFIG]}},e))}p(tn,"vitestUnit");export{tn as vitestUnit};
|
|
1
|
+
function e(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function n(n){if(Array.isArray(n))return e(n)}function t(e,n,t,r,o,a,c){try{var i=e[a](c);var s=i.value}catch(e){t(e);return}if(i.done){n(s)}else{Promise.resolve(s).then(r,o)}}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,a){var c=e.apply(n,r);function i(e){t(c,o,a,i,s,"next",e)}function s(e){t(c,o,a,i,s,"throw",e)}i(undefined)})}}function o(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}r.forEach(function(n){o(e,n,t[n])})}return e}function s(e){return n(e)||a(e)||l(e)||c()}function u(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(n,t){if(!n)return;if(typeof n==="string")return e(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor)r=n.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(n,t)}function f(e,n){var t,r,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},c=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return c.next=i(0),c["throw"]=i(1),c["return"]=i(2),typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function i(e){return function(n){return s([e,n])}}function s(i){if(t)throw new TypeError("Generator is already executing.");while(c&&(c=0,i[0]&&(a=0)),a)try{if(t=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;r=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e];r=0}finally{t=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var m=Object.defineProperty;var p=function(e,n){return m(e,"name",{value:n,configurable:!0})};import d from"@vitejs/plugin-react-swc";import{defineConfig as E}from"vitest/config";import g from"fs-extra";var y=".cyberskill-storage";import v from"@dotenvx/dotenvx";import{bool as _,cleanEnv as h,str as D}from"envalid";import I from"node:os";import C from"node:path";import N from"node:process";var b=!1;function S(){b||(v.config(),b=!0)}p(S,"loadEnvFile");function O(){S();var e=h(N.env,{CWD:D({default:N.cwd()}),DEBUG:_({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:D({default:C.join(I.homedir(),y)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}p(O,"getEnv");var P=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as T}from"node:child_process";import G from"node:process";import*as w from"node:util";var R=function(e){return e.Error="error",e.Warning="warning",e}({});import k from"chalk";import L from"consola";import{GraphQLError as U}from"graphql";var A=O();A.DEBUG||(L.level=4);function Y(e){var n=k[e];return typeof n=="function"?n:k.green}p(Y,"chalkKeyword");var j={silent:L.silent,level:L.level,fatal:L.fatal,error:L.error,warn:L.warn,log:L.log,info:L.info,success:L.success,ready:L.ready,start:L.start,box:L.box,debug:L.debug,trace:L.trace,verbose:L.verbose,printBoxedLog:function e(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(n===null||n===void 0?void 0:n.length)){L.box(k.green(e));return}n.forEach(function(e){var n=e.file,r=e.position,o=e.rule,a=e.message;L.log("".concat(k.gray("File:")," ").concat(k.blue("".concat(n).concat(r?":".concat(r):"")))),o&&L.log(" ".concat(Y(t)("Rule:")," ").concat(o)),L.log(" ".concat(Y(t)("Message:")," ").concat(a))}),L.box(Y(t)("".concat(e," : ").concat(n.length))),L.log(k.gray("─".repeat(40)))}};var x=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import F from"node-fetch";import M from"fs-extra";var V=M.lstatSync,K=M.readdirSync,B=M.mkdirSync,J=M.readFileSync,W=M.unlinkSync,H=M.statSync,$=M.readJsonSync;function q(e,n,t){M.writeFileSync(e,n,t!==null&&t!==void 0?t:"utf-8")}p(q,"writeFileSync");function Q(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}return n.every(function(e){return M.pathExistsSync(e)})}p(Q,"pathExistsSync");var z=O();function X(e){return /*#__PURE__*/r(function(){var n,t,r,o;return f(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,F("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:n=a.sent();if(!n.ok)throw new Error("Failed to fetch latest version: ".concat(n.status," ").concat(n.statusText));return[4,n.json()];case 2:t=a.sent(),r=t.version;return[2,r];case 3:o=a.sent();throw j.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})})()}p(X,"getLatestPackageVersion");function Z(e){return /*#__PURE__*/r(function(){var n,t,r,o,a,c,i,s,u,l,m,p,d,E,g,y,v,_,h;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,2,,3]);if(!Q(e9.PACKAGE_JSON))return[2,{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===x.DEPENDENCY,isDevDependency:e.type===x.DEV_DEPENDENCY,installedPath:"",file:{}}];n=$(e9.PACKAGE_JSON),t=n.name,r=n.version,o=r===void 0?"":r,a=n.dependencies,c=a===void 0?{}:a,i=n.devDependencies,s=i===void 0?{}:i;if(e.name===t)return[2,{name:t,currentVersion:o,latestVersion:o,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===x.DEPENDENCY,isDevDependency:e.type===x.DEV_DEPENDENCY,installedPath:e9.PACKAGE_JSON,file:n}];u=e.name in c,l=e.name in s;return[4,X(e.name)];case 1:m=f.sent();if(!u&&!l)return[2,{name:e.name,currentVersion:"",latestVersion:m,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===x.DEPENDENCY,isDevDependency:e.type===x.DEV_DEPENDENCY,installedPath:"",file:{}}];E=(d=(p=c[e.name])!==null&&p!==void 0?p:s[e.name])!==null&&d!==void 0?d:"",g=eI(z.CWD,eS,e.name,eP);if(!Q(g))return[2,{name:e.name,currentVersion:"",latestVersion:m,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:u,isDevDependency:l,installedPath:"",file:{}}];y=$(g),v=y.version,_=v===void 0?"":v;return[2,E!==_?{name:e.name,currentVersion:_||E,latestVersion:m,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:u,isDevDependency:l,installedPath:g,file:y}:{name:e.name,currentVersion:E,latestVersion:m,isCurrentProject:!1,isInstalled:!0,isUpToDate:E===m,isDependency:u,isDevDependency:l,installedPath:g,file:y}];case 2:h=f.sent();throw j.error('Error getting package "'.concat(e.name,'": ').concat(h.message)),h;case 3:return[2]}})})()}p(Z,"getPackage");function ee(e){return /*#__PURE__*/r(function(){var n,t,r,o,a;return f(this,function(c){try{;r=$(e9.PACKAGE_JSON),o=(n=r.dependencies)!==null&&n!==void 0?n:{},a=(t=r.devDependencies)!==null&&t!==void 0?t:{};e.isDependency?o[e.name]=e.latestVersion:e.isDevDependency&&(a[e.name]=e.latestVersion),q(e9.PACKAGE_JSON,JSON.stringify(r,null,4)),j.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(n){throw j.error('Error updating package "'.concat(e.name,'": ').concat(n.message)),n}return[2]})})()}p(ee,"updatePackage");function en(){return /*#__PURE__*/r(function(){var e,n,t,r,o,a,c,i,s,u,l,m,d;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,12,,13]);e=[{command:p(function(){return nn.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:p(function(){return nn.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:p(function(){return nn.pnpmInstallForce()},"command"),message:"Retrying with force install"}];n=true,t=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);o=e[Symbol.iterator]();f.label=2;case 2:if(!!(n=(a=o.next()).done))return[3,8];c=a.value,i=c.command,s=c.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,ey("".concat(s," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();j.warn("Installation attempt failed: ".concat(s)),j.error("Details: ".concat(l.message));return[3,7];case 7:n=true;return[3,2];case 8:return[3,11];case 9:m=f.sent();t=true;r=m;return[3,11];case 10:try{if(!n&&o.return!=null){o.return()}}finally{if(t){throw r}}return[7];case 11:return[3,13];case 12:d=f.sent();throw j.error("Failed to install dependencies: ".concat(d.message)),d;case 13:return[2]}})})()}p(en,"installDependencies");function et(e,n){return /*#__PURE__*/r(function(){var t,r,o,a,c,i,s,u,l,m,p;return f(this,function(f){switch(f.label){case 0:if(!Q(e9.PACKAGE_JSON)){j.error("package.json not found. Aborting setup.");return[2]}f.label=1;case 1:f.trys.push([1,14,,15]);return[4,Promise.all(e.map(Z))];case 2:t=f.sent().filter(function(e){return!e.isCurrentProject&&(!e.isInstalled||!e.isUpToDate)});r=t.length>0;if(!r)return[3,5];return[4,Promise.all(t.map(ee))];case 3:f.sent();return[4,en()];case 4:r=f.sent();f.label=5;case 5:r;a=true,c=false,i=undefined;f.label=6;case 6:f.trys.push([6,11,12,13]);s=((o=n===null||n===void 0?void 0:n.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();f.label=7;case 7:if(!!(a=(u=s.next()).done))return[3,10];l=u.value;return[4,l()];case 8:f.sent();f.label=9;case 9:a=true;return[3,7];case 10:return[3,13];case 11:m=f.sent();c=true;i=m;return[3,13];case 12:try{if(!a&&s.return!=null){s.return()}}finally{if(c){throw i}}return[7];case 13:return[3,15];case 14:p=f.sent();throw j.error('Failed to setup "'.concat(e.map(function(e){return e.name}).join(", "),'": ').concat(p.message)),p;case 15:return[2]}})})()}p(et,"setupPackages");import er from"node-persist";var eo=O();function ea(){return /*#__PURE__*/r(function(){var e;return f(this,function(n){switch(n.label){case 0:e=er.defaultInstance;if(e)return[3,2];return[4,er.init({dir:eo.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=n.sent();n.label=2;case 2:e;return[2]}})})()}p(ea,"initNodePersist");var ec={get:function e(e){return /*#__PURE__*/r(function(){var n,t;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ea()];case 1:r.sent();return[4,er.getItem(e)];case 2:return[2,(n=r.sent())!==null&&n!==void 0?n:null];case 3:t=r.sent();return[2,(j.error('[Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,n){return /*#__PURE__*/r(function(){var t;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ea()];case 1:r.sent();return[4,er.setItem(e,n)];case 2:r.sent();return[3,4];case 3:t=r.sent();j.error('[Storage:set] Error setting key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/r(function(){var n;return f(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,ea()];case 1:t.sent();return[4,er.removeItem(e)];case 2:t.sent();return[3,4];case 3:n=t.sent();j.error('[Storage:remove] Error removing key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/r(function(){var e,n;return f(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,ea()];case 1:t.sent();return[4,er.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(j.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:n=t.sent();return[2,(j.error("[Storage:keys] Error getting keys:",n),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/r(function(){return f(this,function(n){try{return[2,"".concat(eo.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(j.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var ei=O(),es=w.promisify(T);function eu(e){return"error_list:".concat(e)}p(eu,"getErrorListKey");function el(e){return /*#__PURE__*/r(function(){var n,t,o;return f(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];n=Date.now(),t=eu(n);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,ec.set(t,{errors:e,timestamp:n})];case 2:a.sent(),setTimeout(function(){return /*#__PURE__*/r(function(){var e;return f(this,function(n){switch(n.label){case 0:return[4,ec.getLogLink(t)];case 1:e=n.sent();e&&j.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:o=a.sent();j.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})})()}p(el,"saveErrorListToStorage");function ef(e){var n=[],t=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,s,u,l,f;var m=o.exec(e)||[],p=a.exec(e)||[],d=c.exec(e)||[];var E,g,y,v,_,h;m.length&&r?n.push({file:r,position:"".concat(m[1],":").concat(m[2]),type:m[3]===R.Error?R.Error:R.Warning,message:(E=m===null||m===void 0?void 0:(i=m[4])===null||i===void 0?void 0:i.trim())!==null&&E!==void 0?E:"",rule:(g=m===null||m===void 0?void 0:(s=m[5])===null||s===void 0?void 0:s.trim())!==null&&g!==void 0?g:""}):p.length?n.push({file:(y=p===null||p===void 0?void 0:p[1])!==null&&y!==void 0?y:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===R.Error?R.Error:R.Warning,message:(v=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&v!==void 0?v:""}):d.length?n.push({file:"commitlint",type:R.Error,message:(_=d===null||d===void 0?void 0:(l=d[1])===null||l===void 0?void 0:l.trim())!==null&&_!==void 0?_:"",rule:(h=d===null||d===void 0?void 0:(f=d[2])===null||f===void 0?void 0:f.trim())!==null&&h!==void 0?h:""}):t.push(e.trim())}}),n.length&&el(n),ei.DEBUG&&t.length&&(j.warn("Unmatched lines:"),t.forEach(function(e){return j.info(" ".concat(e))}))}p(ef,"parseTextErrors");function em(e){try{var n=JSON.parse(e),t=[];n.forEach(function(e){var n=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,a=e.column,c=e.ruleId,i=e.message;t.push({type:r===2?R.Error:R.Warning,file:n,position:"".concat(o,":").concat(a),rule:c,message:i})})}),t.length&&el(t)}catch(n){ef(e)}}p(em,"parseCommandOutput");function ep(e){return /*#__PURE__*/r(function(e){var n,t,r,o,a,c,i,s,u;var l=arguments;return f(this,function(f){switch(f.label){case 0:n=l.length>1&&l[1]!==void 0?l[1]:em;t=new AbortController;G.on("SIGINT",function(){j.warn("Process interrupted. Terminating..."),t.abort(),G.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,es(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:r=f.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&n(e)});f.label=3;case 3:return[3,5];case 4:c=f.sent();i=c.stdout,s=c.stderr,u=c.message;[i,s].forEach(function(e){return e&&n(e)}),!s&&!i&&j.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}p(ep,"executeCommand");function ed(e){return{raw:!0,cmd:e}}p(ed,"rawCommand");function eE(e,n){return(n===null||n===void 0?void 0:n.isCurrentProject)?"".concat(e0," ").concat(ez," ").concat(ex," ").concat(e):"".concat(e0," ").concat(ej," ").concat(e)}p(eE,"formatCLI");function eg(e,n){return typeof e=="function"?eE(e(n),n):(typeof e==="undefined"?"undefined":u(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eE(e,n):e}p(eg,"formatCommand");function ey(e,n){return /*#__PURE__*/r(function(){var t;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);j.start("".concat(e)),ei.DEBUG&&j.info("→ ".concat(n));return[4,ep(n)];case 1:r.sent(),j.success("".concat(e," done."));return[3,3];case 2:t=r.sent();throw j.error("".concat(e," failed: ").concat(t.message)),t;case 3:return[2]}})})()}p(ey,"runCommand");import ev from"node:path";var e_=O(),eh=ev;function eD(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=eh).resolve.apply(r,[e_.CWD].concat(s(n)))}p(eD,"resolveWorkingPath");function eI(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=eh).join.apply(r,s(n))}p(eI,"join");var eC=O(),eN=eC.CWD,eb="@cyberskill/shared",eS="node_modules",eO="dist",eP="package.json",eT="package-lock.json",eG="tsconfig.json",ew=".gitignore",eR=".simple-git-hooks.json",ek="pnpm-lock.yaml",eL=".git/hooks/",eU=".git/COMMIT_EDITMSG",eA=".migrate-mongo.config.js",eY=function(){var e=g.readJsonSync(eD(eP)).name===eb?eN:eI(eN,eS,eb);return eI(e,eO)}(),ej="cyberskill",ex="src/node/cli/index.ts",eF="eslint",eM="eslint",eV="vitest";var eK="vitest",eB="@commitlint/cli",eJ="@commitlint/config-conventional",eW="commitlint",eH="lint-staged",e$="lint-staged",eq="typescript",eQ="tsc",ez="tsx",eX="git",eZ="pnpm",e0="pnpm exec",e1="simple-git-hooks",e2="simple-git-hooks",e3="@eslint/config-inspector",e4="eslint-config-inspector",e5="node-modules-inspector",e6="node-modules-inspector",e7="migrate-mongo",e8="./node_modules/migrate-mongo/bin/migrate-mongo",e9={CYBERSKILL_DIRECTORY:eY,WORKING_DIRECTORY:eN,TS_CONFIG:eD(eG),GIT_IGNORE:eD(ew),GIT_HOOK:eD(eL),GIT_COMMIT_MSG:eD(eU),SIMPLE_GIT_HOOKS_JSON:eD(eR),PACKAGE_JSON:eD(eP),PACKAGE_LOCK_JSON:eD(eT),PNPM_LOCK_YAML:eD(ek),NODE_MODULES:eD(eS),MIGRATE_MONGO_CONFIG:eD(eA),LINT_STAGED_CONFIG:eD("".concat(eY,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:eD("".concat(eY,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:eD("".concat(eY,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eD("".concat(eY,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eD("".concat(eY,"/react/vitest/vitest.e2e.js"))};function ne(e){var n=e.type,t=e.packages,o=e.command;var a=t===null||t===void 0?void 0:t.reduce(function(e,n){return e.some(function(e){return e.name===n.name})||e.push(n),e},[]);return function(){return /*#__PURE__*/r(function(){var e;return f(this,function(t){switch(t.label){case 0:switch(n){case P.CLI:return[3,1];case P.STRING:return[3,4]}return[3,5];case 1:e=a===null||a===void 0?void 0:a.length;if(!e)return[3,3];return[4,et(a,{update:!0})];case 2:e=t.sent();t.label=3;case 3:return[2,(e,eg(ed("".concat(e0," ").concat(o))))];case 4:return[2,eg(ed(o))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}p(ne,"buildCommand");var nn={simpleGitHooks:ne({type:P.CLI,packages:[{name:e1,type:x.DEV_DEPENDENCY}],command:e2}),eslintInspect:ne({type:P.CLI,packages:[{name:e3,type:x.DEV_DEPENDENCY}],command:e4}),nodeModulesInspect:ne({type:P.CLI,packages:[{name:e5,type:x.DEV_DEPENDENCY}],command:e6}),eslintCheck:ne({type:P.CLI,packages:[{name:eF,type:x.DEV_DEPENDENCY}],command:"".concat(eM," ").concat(e9.WORKING_DIRECTORY," --no-cache")}),eslintFix:ne({type:P.CLI,packages:[{name:eF,type:x.DEV_DEPENDENCY}],command:"".concat(eM," ").concat(e9.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:ne({type:P.CLI,packages:[{name:eq,type:x.DEPENDENCY}],command:"".concat(eQ," -p ").concat(e9.TS_CONFIG," --noEmit")}),testUnit:ne({type:P.CLI,packages:[{name:eV,type:x.DEV_DEPENDENCY}],command:"".concat(eK," --config ").concat(e9.UNIT_TEST_CONFIG)}),testE2e:ne({type:P.CLI,packages:[{name:eV,type:x.DEV_DEPENDENCY}],command:"".concat(eK," --config ").concat(e9.E2E_TEST_CONFIG)}),mongoMigrateCreate:p(function(e){return ne({type:P.CLI,packages:[{name:e7,type:x.DEPENDENCY}],command:"".concat(ez," ").concat(e8," create ").concat(e," -f ").concat(e9.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:ne({type:P.CLI,packages:[{name:e7,type:x.DEPENDENCY}],command:"".concat(ez," ").concat(e8," up -f ").concat(e9.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:ne({type:P.CLI,packages:[{name:e7,type:x.DEPENDENCY}],command:"".concat(ez," ").concat(e8," down -f ").concat(e9.MIGRATE_MONGO_CONFIG)}),commitLint:ne({type:P.CLI,packages:[{name:eB,type:x.DEV_DEPENDENCY},{name:eJ,type:x.DEV_DEPENDENCY}],command:"".concat(eW," --edit ").concat(e9.GIT_COMMIT_MSG," --config ").concat(e9.COMMITLINT_CONFIG)}),lintStaged:ne({type:P.CLI,packages:[{name:eH,type:x.DEV_DEPENDENCY}],command:"".concat(e$," --config ").concat(e9.LINT_STAGED_CONFIG)}),configureGitHook:ne({type:P.STRING,command:"".concat(eX," config core.hooksPath ").concat(e9.GIT_HOOK)}),stageBuildDirectory:ne({type:P.STRING,command:"".concat(eX," add ").concat(eO)}),build:ne({type:P.STRING,command:"".concat(eZ," run build")}),pnpmInstallStandard:ne({type:P.STRING,command:"".concat(eZ," install")}),pnpmInstallLegacy:ne({type:P.STRING,command:"".concat(eZ," install --legacy-peer-deps")}),pnpmInstallForce:ne({type:P.STRING,command:"".concat(eZ," install --force")})};function nt(e){return E(i({plugins:[d()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[e9.UNIT_TEST_SETUP_CONFIG]}},e))}p(nt,"vitestUnit");export{nt as vitestUnit};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberskill/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.129.0",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -54,65 +54,65 @@
|
|
|
54
54
|
"import": "./dist/constants/index.js",
|
|
55
55
|
"require": "./dist/constants/index.cjs"
|
|
56
56
|
},
|
|
57
|
-
"./
|
|
58
|
-
"types": "./dist/
|
|
59
|
-
"import": "./dist/
|
|
60
|
-
"require": "./dist/
|
|
61
|
-
},
|
|
62
|
-
"./
|
|
63
|
-
"types": "./dist/
|
|
64
|
-
"import": "./dist/
|
|
65
|
-
"require": "./dist/
|
|
66
|
-
},
|
|
67
|
-
"./
|
|
68
|
-
"types": "./dist/
|
|
69
|
-
"import": "./dist/
|
|
70
|
-
"require": "./dist/
|
|
71
|
-
},
|
|
72
|
-
"./
|
|
73
|
-
"types": "./dist/
|
|
74
|
-
"import": "./dist/
|
|
75
|
-
"require": "./dist/
|
|
76
|
-
},
|
|
77
|
-
"./
|
|
78
|
-
"types": "./dist/
|
|
79
|
-
"import": "./dist/
|
|
80
|
-
"require": "./dist/
|
|
81
|
-
},
|
|
82
|
-
"./
|
|
83
|
-
"types": "./dist/
|
|
84
|
-
"import": "./dist/
|
|
85
|
-
"require": "./dist/
|
|
86
|
-
},
|
|
87
|
-
"./
|
|
88
|
-
"types": "./dist/
|
|
89
|
-
"import": "./dist/
|
|
90
|
-
"require": "./dist/
|
|
91
|
-
},
|
|
92
|
-
"./
|
|
93
|
-
"types": "./dist/
|
|
94
|
-
"import": "./dist/
|
|
95
|
-
"require": "./dist/
|
|
96
|
-
},
|
|
97
|
-
"./
|
|
98
|
-
"types": "./dist/
|
|
99
|
-
"import": "./dist/
|
|
100
|
-
"require": "./dist/
|
|
101
|
-
},
|
|
102
|
-
"./
|
|
103
|
-
"types": "./dist/
|
|
104
|
-
"import": "./dist/
|
|
105
|
-
"require": "./dist/
|
|
106
|
-
},
|
|
107
|
-
"./
|
|
108
|
-
"types": "./dist/
|
|
109
|
-
"import": "./dist/
|
|
110
|
-
"require": "./dist/
|
|
111
|
-
},
|
|
112
|
-
"./
|
|
113
|
-
"types": "./dist/
|
|
114
|
-
"import": "./dist/
|
|
115
|
-
"require": "./dist/
|
|
57
|
+
"./node": {
|
|
58
|
+
"types": "./dist/node/index.d.ts",
|
|
59
|
+
"import": "./dist/node/index.js",
|
|
60
|
+
"require": "./dist/node/index.cjs"
|
|
61
|
+
},
|
|
62
|
+
"./node/apollo-server": {
|
|
63
|
+
"types": "./dist/node/apollo-server/index.d.ts",
|
|
64
|
+
"import": "./dist/node/apollo-server/index.js",
|
|
65
|
+
"require": "./dist/node/apollo-server/index.cjs"
|
|
66
|
+
},
|
|
67
|
+
"./node/cli": {
|
|
68
|
+
"types": "./dist/node/cli/index.d.ts",
|
|
69
|
+
"import": "./dist/node/cli/index.js",
|
|
70
|
+
"require": "./dist/node/cli/index.cjs"
|
|
71
|
+
},
|
|
72
|
+
"./node/command": {
|
|
73
|
+
"types": "./dist/node/command/index.d.ts",
|
|
74
|
+
"import": "./dist/node/command/index.js",
|
|
75
|
+
"require": "./dist/node/command/index.cjs"
|
|
76
|
+
},
|
|
77
|
+
"./node/express": {
|
|
78
|
+
"types": "./dist/node/express/index.d.ts",
|
|
79
|
+
"import": "./dist/node/express/index.js",
|
|
80
|
+
"require": "./dist/node/express/index.cjs"
|
|
81
|
+
},
|
|
82
|
+
"./node/fs": {
|
|
83
|
+
"types": "./dist/node/fs/index.d.ts",
|
|
84
|
+
"import": "./dist/node/fs/index.js",
|
|
85
|
+
"require": "./dist/node/fs/index.cjs"
|
|
86
|
+
},
|
|
87
|
+
"./node/log": {
|
|
88
|
+
"types": "./dist/node/log/index.d.ts",
|
|
89
|
+
"import": "./dist/node/log/index.js",
|
|
90
|
+
"require": "./dist/node/log/index.cjs"
|
|
91
|
+
},
|
|
92
|
+
"./node/mongo": {
|
|
93
|
+
"types": "./dist/node/mongo/index.d.ts",
|
|
94
|
+
"import": "./dist/node/mongo/index.js",
|
|
95
|
+
"require": "./dist/node/mongo/index.cjs"
|
|
96
|
+
},
|
|
97
|
+
"./node/package": {
|
|
98
|
+
"types": "./dist/node/package/index.d.ts",
|
|
99
|
+
"import": "./dist/node/package/index.js",
|
|
100
|
+
"require": "./dist/node/package/index.cjs"
|
|
101
|
+
},
|
|
102
|
+
"./node/path": {
|
|
103
|
+
"types": "./dist/node/path/index.d.ts",
|
|
104
|
+
"import": "./dist/node/path/index.js",
|
|
105
|
+
"require": "./dist/node/path/index.cjs"
|
|
106
|
+
},
|
|
107
|
+
"./node/storage": {
|
|
108
|
+
"types": "./dist/node/storage/index.d.ts",
|
|
109
|
+
"import": "./dist/node/storage/index.js",
|
|
110
|
+
"require": "./dist/node/storage/index.cjs"
|
|
111
|
+
},
|
|
112
|
+
"./node/ws": {
|
|
113
|
+
"types": "./dist/node/ws/index.d.ts",
|
|
114
|
+
"import": "./dist/node/ws/index.js",
|
|
115
|
+
"require": "./dist/node/ws/index.cjs"
|
|
116
116
|
},
|
|
117
117
|
"./react": {
|
|
118
118
|
"types": "./dist/react/index.d.ts",
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
"module": "./dist/index.js",
|
|
184
184
|
"types": "./dist/index.d.ts",
|
|
185
185
|
"bin": {
|
|
186
|
-
"cyberskill": "./dist/
|
|
186
|
+
"cyberskill": "./dist/node/cli/index.js"
|
|
187
187
|
},
|
|
188
188
|
"files": [
|
|
189
189
|
"dist",
|
|
@@ -192,22 +192,22 @@
|
|
|
192
192
|
"scripts": {
|
|
193
193
|
"build": "tsup",
|
|
194
194
|
"dev": "tsup --watch",
|
|
195
|
-
"lint": "tsx src/
|
|
196
|
-
"lint:fix": "tsx src/
|
|
197
|
-
"lint:inspect": "tsx src/
|
|
198
|
-
"reset": "tsx src/
|
|
199
|
-
"
|
|
200
|
-
"inspect": "tsx src/
|
|
201
|
-
"test:unit": "tsx src/
|
|
202
|
-
"test:e2e": "tsx src/
|
|
203
|
-
"commitlint": "tsx src/
|
|
204
|
-
"lint-staged": "tsx src/
|
|
195
|
+
"lint": "tsx src/node/cli/index.ts lint",
|
|
196
|
+
"lint:fix": "tsx src/node/cli/index.ts lint:fix",
|
|
197
|
+
"lint:inspect": "tsx src/node/cli/index.ts lint:inspect",
|
|
198
|
+
"reset": "tsx src/node/cli/index.ts reset",
|
|
199
|
+
"prepare": "tsx src/node/cli/index.ts prepare",
|
|
200
|
+
"inspect": "tsx src/node/cli/index.ts inspect",
|
|
201
|
+
"test:unit": "tsx src/node/cli/index.ts test:unit",
|
|
202
|
+
"test:e2e": "tsx src/node/cli/index.ts test:e2e",
|
|
203
|
+
"commitlint": "tsx src/node/cli/index.ts commitlint",
|
|
204
|
+
"lint-staged": "tsx src/node/cli/index.ts lint-staged"
|
|
205
205
|
},
|
|
206
206
|
"dependencies": {
|
|
207
207
|
"@antfu/eslint-config": "4.12.0",
|
|
208
208
|
"@apollo/client": "3.13.8",
|
|
209
209
|
"@apollo/server": "4.12.0",
|
|
210
|
-
"@dotenvx/dotenvx": "1.
|
|
210
|
+
"@dotenvx/dotenvx": "1.42.0",
|
|
211
211
|
"@eddeee888/gcg-typescript-resolver-files": "0.12.0",
|
|
212
212
|
"@eslint-react/eslint-plugin": "1.48.5",
|
|
213
213
|
"@graphql-codegen/cli": "5.0.5",
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
"typescript": "5.8.3",
|
|
270
270
|
"unorm": "1.6.0",
|
|
271
271
|
"uuid": "11.1.0",
|
|
272
|
-
"vite": "6.3.
|
|
272
|
+
"vite": "6.3.4",
|
|
273
273
|
"vitest": "3.1.2",
|
|
274
274
|
"vitest-browser-react": "0.1.1",
|
|
275
275
|
"ws": "8.18.1",
|
|
@@ -281,6 +281,7 @@
|
|
|
281
281
|
},
|
|
282
282
|
"devDependencies": {
|
|
283
283
|
"@commitlint/cli": "19.8.0",
|
|
284
|
+
"@commitlint/config-conventional": "19.8.0",
|
|
284
285
|
"@eslint/config-inspector": "1.0.2",
|
|
285
286
|
"@types/body-parser": "1.19.5",
|
|
286
287
|
"@types/compression": "1.7.5",
|
|
@@ -296,7 +297,7 @@
|
|
|
296
297
|
"@types/node": "22.15.3",
|
|
297
298
|
"@types/node-persist": "3.1.8",
|
|
298
299
|
"@types/react": "19.1.2",
|
|
299
|
-
"@types/react-dom": "19.1.
|
|
300
|
+
"@types/react-dom": "19.1.3",
|
|
300
301
|
"@types/unorm": "1.3.31",
|
|
301
302
|
"@types/uuid": "10.0.0",
|
|
302
303
|
"@types/ws": "8.18.1",
|
|
@@ -75,7 +75,7 @@ pnpm run dev
|
|
|
75
75
|
| **lint:fix** | Tự động sửa các lỗi có thể sửa |
|
|
76
76
|
| **lint:inspect** | Xem chi tiết các lint rule đang dùng |
|
|
77
77
|
| **reset** | Cài đặt lại dependencies |
|
|
78
|
-
| **
|
|
78
|
+
| **prepare** | Tự động nâng cấp @cyberskill/shared |
|
|
79
79
|
| **inspect** | Xem chi tiết các dependencies đang dùng |
|
|
80
80
|
|
|
81
81
|
---
|