UNPKG

chore-cli

Version:

️TypeScript development infrastructure generator.

3 lines (2 loc) 1.71 kB
var u=Object.create;var o=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var d=t=>o(t,"__esModule",{value:!0});var E=(t,i)=>{d(t);for(var r in i)o(t,r,{get:i[r],enumerable:!0})},k=(t,i,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of g(i))!b.call(t,e)&&e!=="default"&&o(t,e,{get:()=>i[e],enumerable:!(r=x(i,e))||r.enumerable});return t},y=t=>k(d(o(t!=null?u($(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var c=(t,i,r)=>new Promise((e,f)=>{var p=a=>{try{l(r.next(a))}catch(w){f(w)}},m=a=>{try{l(r.throw(a))}catch(w){f(w)}},l=a=>a.done?e(a.value):Promise.resolve(a.value).then(p,m);l((r=r.apply(t,i)).next())});E(exports,{ensureUsabilityOfPath:()=>z,fileExists:()=>P});var s=y(require("fs-extra")),h=y(require("./with_spinner")),n=y(require("./colorizer"));const z=t=>c(void 0,null,function*(){const i=()=>c(void 0,null,function*(){if(!!(yield(0,s.pathExists)(t))&&!(yield(0,s.lstat)(t)).isDirectory())throw new Error(`\u{1F6A8} path ${(0,n.colorizePath)(t)} already exists and it is not a directory.`)});try{yield(0,h.withSpinner)(i,{start:`\u{1F477} Checking usability ${(0,n.colorizePath)("<project-path>")}`,success:`\u{1F3D7} The development infrastructure will be generated in ${(0,n.colorizePath)(t)}`,failed:`\u{1F6A8} path ${(0,n.colorizePath)(t)} already exists and it is not a directory.`})}catch(r){console.warn(r)}}),P=t=>c(void 0,null,function*(){return(yield(0,s.pathExists)(t))&&(yield(0,s.lstat)(t)).isFile()});0&&(module.exports={ensureUsabilityOfPath,fileExists}); //# sourceMappingURL=path_helper.js.map