@cyberskill/shared 1.108.0 → 1.109.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.
Files changed (55) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +13 -0
  2. package/dist/_tsup-dts-rollup.d.ts +13 -0
  3. package/dist/configs/config.util.cjs +1 -1
  4. package/dist/configs/config.util.js +1 -1
  5. package/dist/configs/index.cjs +1 -1
  6. package/dist/configs/index.js +1 -1
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.d.cts +2 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +1 -1
  11. package/dist/nodejs/cli/cli.util.cjs +1 -1
  12. package/dist/nodejs/cli/cli.util.js +1 -1
  13. package/dist/nodejs/cli/index.cjs +1 -1
  14. package/dist/nodejs/cli/index.js +1 -1
  15. package/dist/nodejs/command/command.util.cjs +1 -1
  16. package/dist/nodejs/command/command.util.js +1 -1
  17. package/dist/nodejs/command/index.cjs +1 -1
  18. package/dist/nodejs/command/index.js +1 -1
  19. package/dist/nodejs/fs/fs.util.cjs +1 -1
  20. package/dist/nodejs/fs/fs.util.d.cts +1 -0
  21. package/dist/nodejs/fs/fs.util.d.ts +1 -0
  22. package/dist/nodejs/fs/fs.util.js +1 -1
  23. package/dist/nodejs/fs/index.cjs +1 -1
  24. package/dist/nodejs/fs/index.d.cts +1 -0
  25. package/dist/nodejs/fs/index.d.ts +1 -0
  26. package/dist/nodejs/fs/index.js +1 -1
  27. package/dist/nodejs/index.cjs +1 -1
  28. package/dist/nodejs/index.d.cts +2 -0
  29. package/dist/nodejs/index.d.ts +2 -0
  30. package/dist/nodejs/index.js +1 -1
  31. package/dist/nodejs/mongo/index.cjs +1 -1
  32. package/dist/nodejs/mongo/index.js +1 -1
  33. package/dist/nodejs/mongo/mongo.util.cjs +1 -1
  34. package/dist/nodejs/mongo/mongo.util.js +1 -1
  35. package/dist/nodejs/package/index.cjs +1 -1
  36. package/dist/nodejs/package/index.js +1 -1
  37. package/dist/nodejs/package/package.util.cjs +1 -1
  38. package/dist/nodejs/package/package.util.js +1 -1
  39. package/dist/nodejs/path/index.cjs +1 -1
  40. package/dist/nodejs/path/index.d.cts +1 -0
  41. package/dist/nodejs/path/index.d.ts +1 -0
  42. package/dist/nodejs/path/index.js +1 -1
  43. package/dist/nodejs/path/path.constant.cjs +1 -1
  44. package/dist/nodejs/path/path.constant.js +1 -1
  45. package/dist/nodejs/path/path.util.cjs +1 -1
  46. package/dist/nodejs/path/path.util.d.cts +1 -0
  47. package/dist/nodejs/path/path.util.d.ts +1 -0
  48. package/dist/nodejs/path/path.util.js +1 -1
  49. package/dist/react/index.cjs +1 -1
  50. package/dist/react/index.js +1 -1
  51. package/dist/react/vitest/index.cjs +1 -1
  52. package/dist/react/vitest/index.js +1 -1
  53. package/dist/react/vitest/vitest.unit.cjs +1 -1
  54. package/dist/react/vitest/vitest.unit.js +1 -1
  55. package/package.json +2 -2
@@ -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"dotenv";import{bool as y,cleanEnv as _,str as I}from"envalid";import E from"node:os";import b from"node:path";import C from"node:process";h.config();function S(){var e={DEBUG:C.env.DEBUG||!1,CWD:C.env.CWD||C.cwd(),CYBERSKILL_STORAGE_DIRECTORY:C.env.CYBERSKILL_STORAGE_DIRECTORY||b.join(E.homedir(),v)};return _(e,{DEBUG:y(),CWD:I(),CYBERSKILL_STORAGE_DIRECTORY:I()})}p(S,"getEnv");var O=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as T}from"node:child_process";import w from"node:process";import*as G from"node:util";var R=function(e){return e.Error="error",e.Warning="warning",e}({});import N from"chalk";import L from"consola";import{GraphQLError as k}from"graphql";var P=S();P.DEBUG||(L.level=4);function D(e){var t=N[e];return typeof t=="function"?t:N.green}p(D,"chalkKeyword");var U={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,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){L.box(N.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,c=e.message;L.log("".concat(N.gray("File:")," ").concat(N.blue("".concat(t).concat(r?":".concat(r):"")))),o&&L.log(" ".concat(D(n)("Rule:")," ").concat(o)),L.log(" ".concat(D(n)("Message:")," ").concat(c))}),L.box(D(n)("".concat(e," : ").concat(t.length))),L.log(N.gray("─".repeat(40)))}};var j={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import A from"node-fetch";import F from"fs-extra";var M=F.lstatSync,x=F.readdirSync,K=F.mkdirSync,Y=F.readFileSync,B=F.writeFileSync,W=F.appendFileSync,J=F.unlinkSync,H=F.statSync,$=F.readJsonSync,q=F.writeJsonSync;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 F.pathExistsSync(e)})}p(Q,"pathExistsSync");var V=S();function z(e){var t=eE(V.CWD,ew);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 U.warn("Failed to read package.json: ".concat(e.message)),!1}}p(z,"getPackage");function X(e){return /*#__PURE__*/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,A("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(X,"getLatestPackageVersion");function Z(e,t){return /*#__PURE__*/r(function(){var n,r,o,c,a,s,u,l,d,p,m,g,v,h,y,_,I,E,b,C,S;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,4,,5]);n=z(e);if(!n)return[2,i({},j)];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];I=h;return[3,3];case 1:return[4,X(e)];case 2:I=f.sent();f.label=3;case 3:y=I,_=d||h===y;if(!_&&(t===null||t===void 0?void 0:t.update)){;b=p?"dependencies":m?"devDependencies":null;b&&((E=l[b])===null||E===void 0?void 0:E[e])!==y&&(l[b]=(C=l[b])!==null&&C!==void 0?C:{},l[b][e]=y,q(u,l),U.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:d,installedPath:u,file:l,isUpToDate:_}];case 4:S=f.sent();return[2,(U.error('Error checking package "'.concat(e,'": ').concat(S.message)),i({},j))];case 5:return[2]}})})()}p(Z,"checkPackage");function ee(){return /*#__PURE__*/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();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(ee,"installDependencies");function et(e,t){return /*#__PURE__*/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(e8.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 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 U.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=S();function eo(){return /*#__PURE__*/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 /*#__PURE__*/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,(U.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,eo()];case 1:r.sent();return[4,en.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 /*#__PURE__*/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();U.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,eo()];case 1:n.sent();return[4,en.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 /*#__PURE__*/r(function(){return f(this,function(t){try{return[2,"".concat(er.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(U.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var ea=S(),ei=G.promisify(T);function es(e){return"error_list:".concat(e)}p(es,"getErrorListKey");function eu(e){return /*#__PURE__*/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 /*#__PURE__*/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&&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(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;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===R.Error?R.Error:R.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]===R.Error?R.Error:R.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:R.Error,message:(_=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&_!==void 0?_:"",rule:(I=m===null||m===void 0?void 0:(f=m[2])===null||f===void 0?void 0:f.trim())!==null&&I!==void 0?I:""}):n.push(e.trim())}}),t.length&&eu(t),ea.DEBUG&&n.length&&(U.warn("Unmatched lines:"),n.forEach(function(e){return U.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?R.Error:R.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 /*#__PURE__*/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;w.on("SIGINT",function(){U.warn("Process interrupted. Terminating..."),n.abort(),w.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&&U.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(eS," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eZ," ").concat(eV," ").concat(eF," ").concat(e):"".concat(eZ," ").concat(eA," ").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 /*#__PURE__*/r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);U.start("".concat(e)),ea.DEBUG&&U.info("→ ".concat(t));return[4,ed(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(ev,"runCommand");import{join as eh,resolve as ey}from"node:path";var e_=S();function eI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return ey.apply(void 0,[e_.CWD].concat(s(t)))}p(eI,"resolveWorkingPath");function eE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return eh.apply(void 0,s(t))}p(eE,"join");var eb=S(),eC=eb.CWD,eS="@cyberskill/shared",eO="node_modules",eT="dist",ew="package.json",eG="package-lock.json",eR="tsconfig.json",eN=".gitignore",eL=".simple-git-hooks.json",ek="pnpm-lock.yaml",eP=".git/hooks/",eD=".git/COMMIT_EDITMSG",eU=".migrate-mongo.config.js",ej=eE(eC,eO,eS,eT),eA="cyberskill",eF="src/nodejs/cli/index.ts",eM="eslint",ex="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",e7="./node_modules/migrate-mongo/bin/migrate-mongo",e8={CYBERSKILL_DIRECTORY:ej,WORKING_DIRECTORY:eC,TS_CONFIG:eI(eR),GIT_IGNORE:eI(eN),GIT_HOOK:eI(eP),GIT_COMMIT_MSG:eI(eD),SIMPLE_GIT_HOOKS_JSON:eI(eL),PACKAGE_JSON:eI(ew),PACKAGE_LOCK_JSON:eI(eG),PNPM_LOCK_YAML:eI(ek),NODE_MODULES:eI(eO),MIGRATE_MONGO_CONFIG:eI(eU),LINT_STAGED_CONFIG:eI("".concat(ej,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eI("".concat(ej,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eI("".concat(ej,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eI("".concat(ej,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eI("".concat(ej,"/react/vitest/vitest.e2e.js"))};function e9(e,t,n){return /*#__PURE__*/r(function(){return f(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case O.CLI:return[3,1];case O.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 /*#__PURE__*/r(function(){return f(this,function(r){return[2,e9(e,t,n)]})})()}}p(te,"commandFactory");var tt={simpleGitHooks:te(O.CLI,e0,e1),eslintInspect:te(O.CLI,e2,e3),nodeModulesInspect:te(O.CLI,e4,e5),eslintCheck:te(O.CLI,eM,"".concat(ex," ").concat(e8.WORKING_DIRECTORY)),eslintFix:te(O.CLI,eM,"".concat(ex," ").concat(e8.WORKING_DIRECTORY," --fix")),typescriptCheck:te(O.CLI,eq,"".concat(eQ," -p ").concat(e8.TS_CONFIG," --noEmit")),configureGitHook:te(O.STRING,"".concat(ez," config core.hooksPath ").concat(e8.GIT_HOOK)),testUnit:te(O.CLI,eK,"".concat(eB," --config ").concat(e8.UNIT_TEST_CONFIG)),testE2e:te(O.CLI,"".concat(eK," ").concat(eY),"".concat(eB," --config ").concat(e8.E2E_TEST_CONFIG)),mongoMigrateCreate:p(function(e){return te(O.CLI,e6,"".concat(eV," ").concat(e7," create ").concat(e," -f ").concat(e8.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:te(O.CLI,e6,"".concat(eV," ").concat(e7," up -f ").concat(e8.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:te(O.CLI,e6,"".concat(eV," ").concat(e7," down -f ").concat(e8.MIGRATE_MONGO_CONFIG)),commitLint:te(O.CLI,eW,"".concat(eJ," --edit ").concat(e8.GIT_COMMIT_MSG," --config ").concat(e8.COMMITLINT_CONFIG)),lintStaged:te(O.CLI,eH,"".concat(e$," --config ").concat(e8.LINT_STAGED_CONFIG)),stageBuildDirectory:te(O.STRING,"".concat(ez," add ").concat(eT)),build:te(O.STRING,"".concat(eX," run build")),pnpmInstallStandard:te(O.STRING,"".concat(eX," install")),pnpmInstallLegacy:te(O.STRING,"".concat(eX," install --legacy-peer-deps")),pnpmInstallForce:te(O.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:[e8.UNIT_TEST_SETUP_CONFIG]}},e))}p(tn,"vitestUnit");export{tn as vitestUnit};
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"dotenv";import{bool as y,cleanEnv as _,str as I}from"envalid";import E from"node:os";import b from"node:path";import C from"node:process";h.config();function S(){var e={DEBUG:C.env.DEBUG||!1,CWD:C.env.CWD||C.cwd(),CYBERSKILL_STORAGE_DIRECTORY:C.env.CYBERSKILL_STORAGE_DIRECTORY||b.join(E.homedir(),v)};return _(e,{DEBUG:y(),CWD:I(),CYBERSKILL_STORAGE_DIRECTORY:I()})}p(S,"getEnv");var O=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as T}from"node:child_process";import w from"node:process";import*as G from"node:util";var R=function(e){return e.Error="error",e.Warning="warning",e}({});import N from"chalk";import L from"consola";import{GraphQLError as k}from"graphql";var P=S();P.DEBUG||(L.level=4);function D(e){var t=N[e];return typeof t=="function"?t:N.green}p(D,"chalkKeyword");var U={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,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){L.box(N.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,c=e.message;L.log("".concat(N.gray("File:")," ").concat(N.blue("".concat(t).concat(r?":".concat(r):"")))),o&&L.log(" ".concat(D(n)("Rule:")," ").concat(o)),L.log(" ".concat(D(n)("Message:")," ").concat(c))}),L.box(D(n)("".concat(e," : ").concat(t.length))),L.log(N.gray("─".repeat(40)))}};var j={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import A from"node-fetch";import F from"fs-extra";var M=F.lstatSync,x=F.readdirSync,K=F.mkdirSync,Y=F.readFileSync,B=F.writeFileSync,W=F.appendFileSync,J=F.unlinkSync,H=F.statSync,$=F.readJsonSync,q=F.writeJsonSync;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 F.pathExistsSync(e)})}p(Q,"pathExistsSync");var V=S();function z(e){var t=eb(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 U.warn("Failed to read package.json: ".concat(e.message)),!1}}p(z,"getPackage");function X(e){return /*#__PURE__*/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,A("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(X,"getLatestPackageVersion");function Z(e,t){return /*#__PURE__*/r(function(){var n,r,o,c,a,s,u,l,d,p,m,g,v,h,y,_,I,E,b,C,S;return f(this,function(f){switch(f.label){case 0:f.trys.push([0,4,,5]);n=z(e);if(!n)return[2,i({},j)];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];I=h;return[3,3];case 1:return[4,X(e)];case 2:I=f.sent();f.label=3;case 3:y=I,_=d||h===y;if(!_&&(t===null||t===void 0?void 0:t.update)){;b=p?"dependencies":m?"devDependencies":null;b&&((E=l[b])===null||E===void 0?void 0:E[e])!==y&&(l[b]=(C=l[b])!==null&&C!==void 0?C:{},l[b][e]=y,q(u,l),U.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:d,installedPath:u,file:l,isUpToDate:_}];case 4:S=f.sent();return[2,(U.error('Error checking package "'.concat(e,'": ').concat(S.message)),i({},j))];case 5:return[2]}})})()}p(Z,"checkPackage");function ee(){return /*#__PURE__*/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 tn.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:p(function(){return tn.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:p(function(){return tn.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();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(ee,"installDependencies");function et(e,t){return /*#__PURE__*/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(e9.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 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 U.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=S();function eo(){return /*#__PURE__*/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 /*#__PURE__*/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,(U.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,eo()];case 1:r.sent();return[4,en.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 /*#__PURE__*/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();U.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,eo()];case 1:n.sent();return[4,en.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 /*#__PURE__*/r(function(){return f(this,function(t){try{return[2,"".concat(er.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(U.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var ea=S(),ei=G.promisify(T);function es(e){return"error_list:".concat(e)}p(es,"getErrorListKey");function eu(e){return /*#__PURE__*/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 /*#__PURE__*/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&&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(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;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===R.Error?R.Error:R.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]===R.Error?R.Error:R.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:R.Error,message:(_=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&_!==void 0?_:"",rule:(I=m===null||m===void 0?void 0:(f=m[2])===null||f===void 0?void 0:f.trim())!==null&&I!==void 0?I:""}):n.push(e.trim())}}),t.length&&eu(t),ea.DEBUG&&n.length&&(U.warn("Unmatched lines:"),n.forEach(function(e){return U.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?R.Error:R.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 /*#__PURE__*/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;w.on("SIGINT",function(){U.warn("Process interrupted. Terminating..."),n.abort(),w.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&&U.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(e0," ").concat(eO," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e0," ").concat(ez," ").concat(eM," ").concat(e):"".concat(e0," ").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 /*#__PURE__*/r(function(){var n;return f(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);U.start("".concat(e)),ea.DEBUG&&U.info("→ ".concat(t));return[4,ed(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(ev,"runCommand");import eh,{join as ey,resolve as e_}from"node:path";var eI=S();function eE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return e_.apply(void 0,[eI.CWD].concat(s(t)))}p(eE,"resolveWorkingPath");function eb(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return ey.apply(void 0,s(t))}p(eb,"join");var eC=S(),eS=eC.CWD,eO="@cyberskill/shared",eT="node_modules",ew="dist",eG="package.json",eR="package-lock.json",eN="tsconfig.json",eL=".gitignore",ek=".simple-git-hooks.json",eP="pnpm-lock.yaml",eD=".git/hooks/",eU=".git/COMMIT_EDITMSG",ej=".migrate-mongo.config.js",eA=eb(eS,eT,eO,ew),eF="cyberskill",eM="src/nodejs/cli/index.ts",ex="eslint",eK="eslint",eY="vitest",eB="playwright",eW="vitest",eJ="@commitlint/cli",eH="commitlint",e$="lint-staged",eq="lint-staged",eQ="typescript",eV="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:eA,WORKING_DIRECTORY:eS,TS_CONFIG:eE(eN),GIT_IGNORE:eE(eL),GIT_HOOK:eE(eD),GIT_COMMIT_MSG:eE(eU),SIMPLE_GIT_HOOKS_JSON:eE(ek),PACKAGE_JSON:eE(eG),PACKAGE_LOCK_JSON:eE(eR),PNPM_LOCK_YAML:eE(eP),NODE_MODULES:eE(eT),MIGRATE_MONGO_CONFIG:eE(ej),LINT_STAGED_CONFIG:eE("".concat(eA,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eE("".concat(eA,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eE("".concat(eA,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eE("".concat(eA,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eE("".concat(eA,"/react/vitest/vitest.e2e.js"))};function te(e,t,n){return /*#__PURE__*/r(function(){return f(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case O.CLI:return[3,1];case O.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(e0," ").concat(n))))];case 3:return[2,eg(ep(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}p(te,"buildCommand");function tt(e,t,n){return function(){return /*#__PURE__*/r(function(){return f(this,function(r){return[2,te(e,t,n)]})})()}}p(tt,"commandFactory");var tn={simpleGitHooks:tt(O.CLI,e1,e2),eslintInspect:tt(O.CLI,e3,e4),nodeModulesInspect:tt(O.CLI,e5,e6),eslintCheck:tt(O.CLI,ex,"".concat(eK," ").concat(e9.WORKING_DIRECTORY)),eslintFix:tt(O.CLI,ex,"".concat(eK," ").concat(e9.WORKING_DIRECTORY," --fix")),typescriptCheck:tt(O.CLI,eQ,"".concat(eV," -p ").concat(e9.TS_CONFIG," --noEmit")),configureGitHook:tt(O.STRING,"".concat(eX," config core.hooksPath ").concat(e9.GIT_HOOK)),testUnit:tt(O.CLI,eY,"".concat(eW," --config ").concat(e9.UNIT_TEST_CONFIG)),testE2e:tt(O.CLI,"".concat(eY," ").concat(eB),"".concat(eW," --config ").concat(e9.E2E_TEST_CONFIG)),mongoMigrateCreate:p(function(e){return tt(O.CLI,e7,"".concat(ez," ").concat(e8," create ").concat(e," -f ").concat(e9.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:tt(O.CLI,e7,"".concat(ez," ").concat(e8," up -f ").concat(e9.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:tt(O.CLI,e7,"".concat(ez," ").concat(e8," down -f ").concat(e9.MIGRATE_MONGO_CONFIG)),commitLint:tt(O.CLI,eJ,"".concat(eH," --edit ").concat(e9.GIT_COMMIT_MSG," --config ").concat(e9.COMMITLINT_CONFIG)),lintStaged:tt(O.CLI,e$,"".concat(eq," --config ").concat(e9.LINT_STAGED_CONFIG)),stageBuildDirectory:tt(O.STRING,"".concat(eX," add ").concat(ew)),build:tt(O.STRING,"".concat(eZ," run build")),pnpmInstallStandard:tt(O.STRING,"".concat(eZ," install")),pnpmInstallLegacy:tt(O.STRING,"".concat(eZ," install --legacy-peer-deps")),pnpmInstallForce:tt(O.STRING,"".concat(eZ," install --force"))};function tr(e){return g(i({plugins:[m()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[e9.UNIT_TEST_SETUP_CONFIG]}},e))}p(tr,"vitestUnit");export{tr as vitestUnit};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cyberskill/shared",
3
3
  "type": "module",
4
- "version": "1.108.0",
4
+ "version": "1.109.0",
5
5
  "description": "CyberSkill Shared",
6
6
  "author": "Stephen Cheng",
7
7
  "license": "MIT",
@@ -243,7 +243,7 @@
243
243
  "mongoose": "8.13.2",
244
244
  "mongoose-aggregate-paginate-v2": "1.1.4",
245
245
  "mongoose-paginate-v2": "1.9.0",
246
- "next-intl": "4.0.3",
246
+ "next-intl": "4.1.0",
247
247
  "node-fetch": "3.3.2",
248
248
  "node-persist": "4.0.4",
249
249
  "ora": "8.2.0",