@deveco-test/deveco-cli 1.3.0-Test.13 → 1.3.0-Test.15

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.
@@ -1 +1 @@
1
- import*as L from"fs";import re from"proper-lockfile";import ne from"ora";import*as m from"fs";import*as b from"path";var G=["harmonyos-guides","harmonyos-references","best-practices","harmonyos-faqs","harmonyos-releases","harmonyos-roadmap"],N={"harmonyos-guides":"\u5F00\u53D1\u6307\u5357","harmonyos-references":"API\u53C2\u8003","best-practices":"\u6700\u4F73\u5B9E\u8DF5","harmonyos-faqs":"FAQ","harmonyos-releases":"\u7248\u672C\u8BF4\u660E","harmonyos-roadmap":"\u53D8\u66F4\u9884\u544A"};var O="1.9.1",ge=48*1024*1024;var he=Object.fromEntries(G.map((t,e)=>[N[t],e])),P=Object.fromEntries(G.map((t,e)=>[t,e]));import*as T from"fs";import*as a from"path";import{fileURLToPath as gt}from"url";import*as p from"fs";import*as mt from"path";import{homedir as Gt}from"os";import*as ut from"fs";import*as l from"path";function j(t,e){let r=l.relative(e,t);return r===""||!l.isAbsolute(r)&&!r.startsWith(`..${l.sep}`)&&r!==".."}function E(t){let e=l.resolve(t),r=[],n=e;for(;;)try{let o=ut.realpathSync(n);return r.length===0?o:l.join(o,...r.reverse())}catch(o){if(o.code!=="ENOENT")throw o;let u=l.dirname(n);if(u===n)return e;r.push(l.basename(n)),n=u}}function lt(t,e){let r=E(e),n=E(t);return j(n,r)?n:null}function Z(t){let e=t.trim();return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e}function dt(t){let e=Z(t);if(!e)throw new Error("Path must not be empty.");return E(e)}var jt="deveco-cli",H,h=class extends Error{constructor(e){super(e),this.name="CliDataDirError"}};function pt(){let t=process.env.DEVECO_CLI_DATA_DIR,r=(t===void 0||t===""?"":Z(t))||mt.join(Gt(),".local","share",jt);try{return dt(r)}catch(n){throw new h(n instanceof Error?n.message:String(n))}}async function ft(){let t=pt();await p.promises.mkdir(t,{recursive:!0});let e;try{e=await p.promises.realpath(t)}catch(n){throw new h(`DEVECO_CLI_DATA_DIR is not usable: ${n instanceof Error?n.message:String(n)}`)}if(!(await p.promises.stat(e)).isDirectory())throw new h("DEVECO_CLI_DATA_DIR must be a writable directory.");return H=e,e}function M(){if(H!==void 0)return H;let t=pt();try{if(p.existsSync(t))return p.realpathSync(t)}catch{}return t}var Zt="docs";function Q(){return a.join(M(),Zt)}function c(){return a.join(Q(),".index")}function B(){return a.join(c(),"build.lock")}function D(){return a.join(c(),"build-status.json")}function _(){return a.join(c(),"build-meta.json")}function x(){return a.join(c(),"search.db")}function A(){return a.join(c(),".tmp")}function Ht(t,e){let r=e;for(;!r.endsWith(`${a.sep}dist`)&&r!==a.dirname(r);)r=a.dirname(r);return r}function ht(t,e){return a.dirname(Ht(t,e))}function St(){let t=gt(import.meta.url),e=a.dirname(t);return t.includes(`${a.sep}dist${a.sep}`)?ht(t,e):a.join(e,"..","..","..")}function Qt(...t){let e=gt(import.meta.url),r=a.dirname(e);return e.includes(`${a.sep}dist${a.sep}`)?[a.join(ht(e,r),...t)]:[a.join(r,"..","..","..",...t)]}function yt(...t){let e=St(),r=T.realpathSync(e);for(let n of Qt(...t))try{let o=T.lstatSync(n);if(o.isSymbolicLink()||!o.isFile())throw new Error(`Unsafe documentation package asset: ${t.join("/")} must be a regular file.`);let u=T.realpathSync(n);if(!j(u,r))throw new Error(`Unsafe documentation package asset: ${t.join("/")} is outside the package.`);return u}catch(o){if(o.code!=="ENOENT")throw o}return null}function C(){return yt("docs.zip")}function X(){return yt("index.zip")}function Et(){return a.join(St(),"index","data")}import*as S from"fs";import*as I from"path";var f=["harmonyos-terms.txt","harmonyos-synonyms.json","harmonyos-stopwords.txt"],W=class extends Error{constructor(e){super(e),this.name="LexiconNotFoundError"}};var _t=null;function Xt(){if(_t)return _t;let t=c();if(f.every(o=>S.existsSync(I.join(t,o))))return t;let r=Et();if(f.every(o=>S.existsSync(I.join(r,o))))return r;throw new W("Lexicon files not found. Install the documentation index first (index.zip).")}function $(t){let e=I.join(Xt(),t);return S.readFileSync(e,"utf-8")}function xt(t,e){return S.readFileSync(I.join(e,t),"utf-8")}import*as q from"fs";import*as Wt from"yauzl";function Y(){let t=C();return t!==null&&q.existsSync(t)}import*as d from"fs";import*as g from"path";import At from"adm-zip";import*as w from"fs";import*as v from"path";var F=class extends Error{constructor(e){super(`Unsafe documentation path: ${e}`),this.name="DocPathSafetyError"}};function K(t){return t instanceof h||t instanceof F||t instanceof Error&&(t.name==="CliDataDirError"||t.name==="DocPathSafetyError")}function tt(t){return new F(t)}function $t(){return E(M())}function J(t,e,r){let n=lt(t,e);if(n===null)throw tt(`${r} resolves outside the data directory.`);return n}async function V(t,e){await w.promises.mkdir(t,{recursive:!0});let r=J(t,e,"directory");if(!(await w.promises.stat(r)).isDirectory())throw tt("path must be a directory.")}function qt(t){let e=$t();try{let r=J(t,e,"file");if(!w.statSync(r).isFile())throw tt("path must be a regular file.")}catch(r){if(r.code==="ENOENT"){J(v.dirname(t),e,"file parent");return}throw r}}async function k(t={}){let e=t.mode??"write",r=await ft();await V(Q(),r),await V(c(),r),e==="write"&&await V(A(),r);for(let n of[x(),_(),D(),B(),...f.map(o=>v.join(c(),o))])qt(n)}var et=["search.db","build-meta.json",...f],Yt=["corpus.json","corpus-offsets.json","orama.dpack"];async function Vt(t){for(let e of Yt)await d.promises.rm(g.join(t,e),{force:!0})}function Ct(t){let r=new At(t).getEntry("build-meta.json");if(!r)throw new Error("index.zip is missing build-meta.json");return JSON.parse(r.getData().toString("utf-8"))}async function Jt(t){let e=c();await d.promises.mkdir(e,{recursive:!0});for(let r of et){let n=g.join(e,r);await d.promises.rm(n,{force:!0}),await d.promises.rename(g.join(t,r),n)}await Vt(e),await d.promises.rm(A(),{recursive:!0,force:!0})}function Tt(t){let e=X();if(!e)return!1;try{let r=Ct(e);return r.indexVersion===O&&r.docsZipSha256===t&&r.segmentCount>0}catch{return!1}}async function Dt(t){await k({mode:"write"});let e=X();if(!e)throw new Error("index.zip not found");let r=Ct(e);if(r.docsZipSha256!==t)throw new Error("Bundled index.zip does not match docs.zip. Rebuild index.zip with npm run build:index.");if(r.segmentCount<=0)throw new Error("Bundled index.zip is empty");let n=A();await d.promises.rm(n,{recursive:!0,force:!0}),await d.promises.mkdir(n,{recursive:!0});let o=new At(e);for(let y of et){let ct=o.getEntry(y);if(!ct)throw new Error(`index.zip is missing ${y}`);await d.promises.writeFile(g.join(n,y),ct.getData())}let u=JSON.parse(await d.promises.readFile(g.join(n,"build-meta.json"),"utf-8"));if(!d.existsSync(g.join(n,"search.db")))throw new Error("index.zip is missing search.db");return await Jt(n),u}async function It(){await d.promises.rm(A(),{recursive:!0,force:!0});let t=c();for(let e of et)await d.promises.rm(g.join(t,e),{force:!0})}import{createHash as wt}from"crypto";import*as bt from"fs";async function z(t){return new Promise((e,r)=>{let n=wt("sha256"),o=bt.createReadStream(t);o.on("data",u=>n.update(u)),o.on("error",r),o.on("end",()=>e(n.digest("hex")))})}function Rt(t){return wt("sha256").update(t,"utf8").digest("hex")}function Lt(t,e){let r=e?xt(t,e):$(t);return Rt(r)}function Nt(t){return Lt("harmonyos-synonyms.json",t)}function Ot(t){return Lt("harmonyos-terms.txt",t)}var Kt={state:"idle",phase:0,phaseLabel:"Idle",current:0,total:0,message:"",startedAt:0,updatedAt:0,error:null};async function Pt(){try{let t=await m.promises.readFile(D(),"utf-8");return JSON.parse(t)}catch{return{...Kt}}}async function rt(t){let e=D();await m.promises.mkdir(b.dirname(e),{recursive:!0}),await m.promises.writeFile(e,JSON.stringify(t,null,2))}function Mt(t){let e=Date.now();return{state:"installing",phase:1,phaseLabel:"Preparing documentation index",current:0,total:0,message:t,startedAt:e,updatedAt:e,error:null}}async function R(t){let r={...await Pt(),...t,updatedAt:Date.now()};return await rt(r),r}async function nt(){let t=C();return t?z(t):null}async function ot(){try{let t=await m.promises.readFile(_(),"utf-8");return JSON.parse(t)}catch{return null}}async function it(t=!1){if(t)return"no-index";let e=await ot();if(!e||e.segmentCount===0)return"no-index";let r=await nt();return r&&e.docsZipSha256!==r?"docs-changed":e.indexVersion!==O?"engine-upgraded":e.termsHash!==Ot()?"terms-changed":e.synonymsHash!==Nt()?"synonyms-changed":null}function st(){if(!Y()||!m.existsSync(x())||!m.existsSync(_()))return!1;let t=b.dirname(x());if(!f.every(e=>m.existsSync(b.join(t,e))))return!1;try{let e=m.readFileSync(_(),"utf-8");return JSON.parse(e).segmentCount>0}catch{return!1}}async function Bt(t=!1){return t?!0:Y()?st()?await it()!==null:!0:!1}import{createRequire as te}from"module";var Wr=te(import.meta.url);var Ft=["harmonyos-releases","harmonyos-roadmap"],Tn=new Set(Ft.map(t=>P[t])),Dn=Ft.map(t=>`${N[t]}/`);var ee=null,vt=null;function kt(){vt?.resetCache(),ee=null,vt=null}function at(){kt()}async function zt(t,e,r){e?.start(r),await R({state:"installing",phase:1,phaseLabel:"Installing index",message:r}),await Dt(t),at(),e&&(e.text="Documentation index installed.")}async function oe(t,e){try{return await zt(t,e,"Installing documentation index\u2026"),await Ut(e),!0}catch(r){if(K(r))throw r}try{return await It(),at(),await zt(t,e,"Retrying documentation index install\u2026"),await Ut(e),!0}catch(r){if(K(r))throw r;return!1}}async function Ut(t){await R({state:"done",phase:3,phaseLabel:"Done",message:"Documentation ready.",error:null}),t?.succeed("Documentation ready.")}async function ie(t){let e=await ot(),r=e?`Documentation already up to date. Documents: ${e.segmentCount.toLocaleString()}`:"Documentation already up to date.";t?.succeed(r),await R({state:"done",message:r,error:null})}async function se(t,e){let r=t instanceof Error?t.message:String(t);throw await R({state:"error",error:r}),e?.fail(r),t}async function ae(){let t=c();await L.promises.mkdir(t,{recursive:!0});let e=B();return L.existsSync(e)||await L.promises.writeFile(e,"","utf-8"),e}async function ce(){let t=await ae();return re.lock(t,{stale:1800*1e3})}async function ue(){let t=C(),e=(t?await z(t):null)??await nt();if(!e)throw new Error("docs.zip not found");return e}async function le(t,e){let r=await ue(),n=t.force||await Bt(t.force),o=await it(t.force);if(!n&&!o&&st()){await ie(e);return}if(!(Tt(r)&&await oe(r,e)))throw new Error("Documentation index bundle is unavailable or corrupted. Reinstall the package with: npm uninstall -g @deveco/deveco-cli && npm install -g <package.tgz>")}var U=class{static async run(e={}){let r=e.background??!1,o=e.quiet??r?void 0:ne({text:"Checking documentation\u2026",color:"cyan"}),u;try{e.assumeStorageSafe||await k({mode:"write"}),u=await ce(),await rt(Mt("Starting documentation setup\u2026")),await le(e,o)}catch(y){throw u&&await se(y,o),y}finally{u&&await u()}}};var de=process.env.DEVECO_CLI_POSTINSTALL?"postinstall":"doc-init";U.run({background:!0,builtBy:de}).then(()=>{process.exit(0)}).catch(()=>{process.exit(1)});
1
+ import*as L from"fs";import re from"proper-lockfile";import ne from"ora";import*as m from"fs";import*as b from"path";var G=["harmonyos-guides","harmonyos-references","best-practices","harmonyos-faqs","harmonyos-releases","harmonyos-roadmap"],O={"harmonyos-guides":"\u5F00\u53D1\u6307\u5357","harmonyos-references":"API\u53C2\u8003","best-practices":"\u6700\u4F73\u5B9E\u8DF5","harmonyos-faqs":"FAQ","harmonyos-releases":"\u7248\u672C\u8BF4\u660E","harmonyos-roadmap":"\u53D8\u66F4\u9884\u544A"};var N="1.9.1",ge=48*1024*1024;var he=Object.fromEntries(G.map((t,e)=>[O[t],e])),P=Object.fromEntries(G.map((t,e)=>[t,e]));import*as w from"fs";import*as a from"path";import{fileURLToPath as gt}from"url";import*as p from"fs";import*as mt from"path";import{homedir as Gt}from"os";import*as ut from"fs";import*as l from"path";function j(t,e){let r=l.relative(e,t);return r===""||!l.isAbsolute(r)&&!r.startsWith(`..${l.sep}`)&&r!==".."}function E(t){let e=l.resolve(t),r=[],n=e;for(;;)try{let o=ut.realpathSync(n);return r.length===0?o:l.join(o,...r.reverse())}catch(o){if(o.code!=="ENOENT")throw o;let u=l.dirname(n);if(u===n)return e;r.push(l.basename(n)),n=u}}function lt(t,e){let r=E(e),n=E(t);return j(n,r)?n:null}function Z(t){let e=t.trim();return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e}function dt(t){let e=Z(t);if(!e)throw new Error("Path must not be empty.");return E(e)}var jt="deveco-cli",H,h=class extends Error{constructor(e){super(e),this.name="CliDataDirError"}};function pt(){let t=process.env.DEVECO_CLI_DATA_DIR,r=(t===void 0||t===""?"":Z(t))||mt.join(Gt(),".local","share",jt);try{return dt(r)}catch(n){throw new h(n instanceof Error?n.message:String(n))}}async function ft(){let t=pt();await p.promises.mkdir(t,{recursive:!0});let e;try{e=await p.promises.realpath(t)}catch(n){throw new h(`DEVECO_CLI_DATA_DIR is not usable: ${n instanceof Error?n.message:String(n)}`)}if(!(await p.promises.stat(e)).isDirectory())throw new h("DEVECO_CLI_DATA_DIR must be a writable directory.");return H=e,e}function M(){if(H!==void 0)return H;let t=pt();try{if(p.existsSync(t))return p.realpathSync(t)}catch{}return t}var Zt="docs";function Q(){return a.join(M(),Zt)}function c(){return a.join(Q(),".index")}function B(){return a.join(c(),"build.lock")}function T(){return a.join(c(),"build-status.json")}function _(){return a.join(c(),"build-meta.json")}function x(){return a.join(c(),"search.db")}function A(){return a.join(c(),".tmp")}function Ht(t,e){let r=e;for(;!r.endsWith(`${a.sep}dist`)&&r!==a.dirname(r);)r=a.dirname(r);return r}function ht(t,e){return a.dirname(Ht(t,e))}function St(){let t=gt(import.meta.url),e=a.dirname(t);return t.includes(`${a.sep}dist${a.sep}`)?ht(t,e):a.join(e,"..","..","..")}function Qt(...t){let e=gt(import.meta.url),r=a.dirname(e);return e.includes(`${a.sep}dist${a.sep}`)?[a.join(ht(e,r),...t)]:[a.join(r,"..","..","..",...t)]}function yt(...t){let e=St(),r=w.realpathSync(e);for(let n of Qt(...t))try{let o=w.lstatSync(n);if(o.isSymbolicLink()||!o.isFile())throw new Error(`Unsafe documentation package asset: ${t.join("/")} must be a regular file.`);let u=w.realpathSync(n);if(!j(u,r))throw new Error(`Unsafe documentation package asset: ${t.join("/")} is outside the package.`);return u}catch(o){if(o.code!=="ENOENT")throw o}return null}function C(){return yt("docs.zip")}function X(){return yt("index.zip")}function Et(){return a.join(St(),"index","data")}import*as S from"fs";import*as D from"path";var f=["harmonyos-terms.txt","harmonyos-synonyms.json","harmonyos-stopwords.txt"],W=class extends Error{constructor(e){super(e),this.name="LexiconNotFoundError"}};var _t=null;function Xt(){if(_t)return _t;let t=c();if(f.every(o=>S.existsSync(D.join(t,o))))return t;let r=Et();if(f.every(o=>S.existsSync(D.join(r,o))))return r;throw new W("Lexicon files not found. Install the documentation index first (index.zip).")}function $(t){let e=D.join(Xt(),t);return S.readFileSync(e,"utf-8")}function xt(t,e){return S.readFileSync(D.join(e,t),"utf-8")}import*as q from"fs";import*as Wt from"yauzl";function Y(){let t=C();return t!==null&&q.existsSync(t)}import*as d from"fs";import*as g from"path";import At from"adm-zip";import*as I from"fs";import*as v from"path";var F=class extends Error{constructor(e){super(`Unsafe documentation path: ${e}`),this.name="DocPathSafetyError"}};function K(t){return t instanceof h||t instanceof F||t instanceof Error&&(t.name==="CliDataDirError"||t.name==="DocPathSafetyError")}function tt(t){return new F(t)}function $t(){return E(M())}function J(t,e,r){let n=lt(t,e);if(n===null)throw tt(`${r} resolves outside the data directory.`);return n}async function V(t,e){await I.promises.mkdir(t,{recursive:!0});let r=J(t,e,"directory");if(!(await I.promises.stat(r)).isDirectory())throw tt("path must be a directory.")}function qt(t){let e=$t();try{let r=J(t,e,"file");if(!I.statSync(r).isFile())throw tt("path must be a regular file.")}catch(r){if(r.code==="ENOENT"){J(v.dirname(t),e,"file parent");return}throw r}}async function k(t={}){let e=t.mode??"write",r=await ft();await V(Q(),r),await V(c(),r),e==="write"&&await V(A(),r);for(let n of[x(),_(),T(),B(),...f.map(o=>v.join(c(),o))])qt(n)}var et=["search.db","build-meta.json",...f],Yt=["corpus.json","corpus-offsets.json","orama.dpack"];async function Vt(t){for(let e of Yt)await d.promises.rm(g.join(t,e),{force:!0})}function Ct(t){let r=new At(t).getEntry("build-meta.json");if(!r)throw new Error("index.zip is missing build-meta.json");return JSON.parse(r.getData().toString("utf-8"))}async function Jt(t){let e=c();await d.promises.mkdir(e,{recursive:!0});for(let r of et){let n=g.join(e,r);await d.promises.rm(n,{force:!0}),await d.promises.rename(g.join(t,r),n)}await Vt(e),await d.promises.rm(A(),{recursive:!0,force:!0})}function wt(t){let e=X();if(!e)return!1;try{let r=Ct(e);return r.indexVersion===N&&r.docsZipSha256===t&&r.segmentCount>0}catch{return!1}}async function Tt(t){await k({mode:"write"});let e=X();if(!e)throw new Error("index.zip not found");let r=Ct(e);if(r.docsZipSha256!==t)throw new Error("Bundled index.zip does not match docs.zip. Rebuild index.zip with npm run build:index.");if(r.segmentCount<=0)throw new Error("Bundled index.zip is empty");let n=A();await d.promises.rm(n,{recursive:!0,force:!0}),await d.promises.mkdir(n,{recursive:!0});let o=new At(e);for(let y of et){let ct=o.getEntry(y);if(!ct)throw new Error(`index.zip is missing ${y}`);await d.promises.writeFile(g.join(n,y),ct.getData())}let u=JSON.parse(await d.promises.readFile(g.join(n,"build-meta.json"),"utf-8"));if(!d.existsSync(g.join(n,"search.db")))throw new Error("index.zip is missing search.db");return await Jt(n),u}async function Dt(){await d.promises.rm(A(),{recursive:!0,force:!0});let t=c();for(let e of et)await d.promises.rm(g.join(t,e),{force:!0})}import{createHash as It}from"crypto";import*as bt from"fs";async function z(t){return new Promise((e,r)=>{let n=It("sha256"),o=bt.createReadStream(t);o.on("data",u=>n.update(u)),o.on("error",r),o.on("end",()=>e(n.digest("hex")))})}function Rt(t){return It("sha256").update(t,"utf8").digest("hex")}function Lt(t,e){let r=e?xt(t,e):$(t);return Rt(r)}function Ot(t){return Lt("harmonyos-synonyms.json",t)}function Nt(t){return Lt("harmonyos-terms.txt",t)}var Kt={state:"idle",phase:0,phaseLabel:"Idle",current:0,total:0,message:"",startedAt:0,updatedAt:0,error:null};async function Pt(){try{let t=await m.promises.readFile(T(),"utf-8");return JSON.parse(t)}catch{return{...Kt}}}async function rt(t){let e=T();await m.promises.mkdir(b.dirname(e),{recursive:!0}),await m.promises.writeFile(e,JSON.stringify(t,null,2))}function Mt(t){let e=Date.now();return{state:"installing",phase:1,phaseLabel:"Preparing documentation index",current:0,total:0,message:t,startedAt:e,updatedAt:e,error:null}}async function R(t){let r={...await Pt(),...t,updatedAt:Date.now()};return await rt(r),r}async function nt(){let t=C();return t?z(t):null}async function ot(){try{let t=await m.promises.readFile(_(),"utf-8");return JSON.parse(t)}catch{return null}}async function it(t=!1){if(t)return"no-index";let e=await ot();if(!e||e.segmentCount===0)return"no-index";let r=await nt();return r&&e.docsZipSha256!==r?"docs-changed":e.indexVersion!==N?"engine-upgraded":e.termsHash!==Nt()?"terms-changed":e.synonymsHash!==Ot()?"synonyms-changed":null}function st(){if(!Y()||!m.existsSync(x())||!m.existsSync(_()))return!1;let t=b.dirname(x());if(!f.every(e=>m.existsSync(b.join(t,e))))return!1;try{let e=m.readFileSync(_(),"utf-8");return JSON.parse(e).segmentCount>0}catch{return!1}}async function Bt(t=!1){return t?!0:Y()?st()?await it()!==null:!0:!1}import{createRequire as te}from"module";var Wr=te(import.meta.url);var Ft=["harmonyos-releases","harmonyos-roadmap"],wn=new Set(Ft.map(t=>P[t])),Tn=Ft.map(t=>`${O[t]}/`);var oo=Promise.resolve();var ee=null,vt=null;function kt(){vt?.resetCache(),ee=null,vt=null}function at(){kt()}async function zt(t,e,r){e?.start(r),await R({state:"installing",phase:1,phaseLabel:"Installing index",message:r}),await Tt(t),at(),e&&(e.text="Documentation index installed.")}async function oe(t,e){try{return await zt(t,e,"Installing documentation index\u2026"),await Ut(e),!0}catch(r){if(K(r))throw r}try{return await Dt(),at(),await zt(t,e,"Retrying documentation index install\u2026"),await Ut(e),!0}catch(r){if(K(r))throw r;return!1}}async function Ut(t){await R({state:"done",phase:3,phaseLabel:"Done",message:"Documentation ready.",error:null}),t?.succeed("Documentation ready.")}async function ie(t){let e=await ot(),r=e?`Documentation already up to date. Documents: ${e.segmentCount.toLocaleString()}`:"Documentation already up to date.";t?.succeed(r),await R({state:"done",message:r,error:null})}async function se(t,e){let r=t instanceof Error?t.message:String(t);throw await R({state:"error",error:r}),e?.fail(r),t}async function ae(){let t=c();await L.promises.mkdir(t,{recursive:!0});let e=B();return L.existsSync(e)||await L.promises.writeFile(e,"","utf-8"),e}async function ce(){let t=await ae();return re.lock(t,{stale:1800*1e3})}async function ue(){let t=C(),e=(t?await z(t):null)??await nt();if(!e)throw new Error("docs.zip not found");return e}async function le(t,e){let r=await ue(),n=t.force||await Bt(t.force),o=await it(t.force);if(!n&&!o&&st()){await ie(e);return}if(!(wt(r)&&await oe(r,e)))throw new Error("Documentation index bundle is unavailable or corrupted. Reinstall the package with: npm uninstall -g @deveco/deveco-cli && npm install -g <package.tgz>")}var U=class{static async run(e={}){let r=e.background??!1,o=e.quiet??r?void 0:ne({text:"Checking documentation\u2026",color:"cyan"}),u;try{e.assumeStorageSafe||await k({mode:"write"}),u=await ce(),await rt(Mt("Starting documentation setup\u2026")),await le(e,o)}catch(y){throw u&&await se(y,o),y}finally{u&&await u()}}};var de=process.env.DEVECO_CLI_POSTINSTALL?"postinstall":"doc-init";U.run({background:!0,builtBy:de}).then(()=>{process.exit(0)}).catch(()=>{process.exit(1)});
package/docs.zip CHANGED
Binary file
package/index.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deveco-test/deveco-cli",
3
- "version": "1.3.0-Test.13",
3
+ "version": "1.3.0-Test.15",
4
4
  "description": "HarmonyOS application development command line tool",
5
5
  "license": "MIT",
6
6
  "type": "module",