minimaz-cli 0.4.0 → 0.4.1
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/bin/cli.js +7 -7
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`),resolveDir:i,loader:"js",sourcefile:"bundle.js"},bundle:!0,format:"esm",minify:e,sourcemap:!1,write:!1});await d.outputFile(h.join(i,"script.js"),n.outputFiles[0].text),s("success",`JS bundle written to /${i}/script.js`)}catch(n){s("warn",`ESBuild JS bundle failed: ${n}`)}}function
|
|
2
|
+
var $t=Object.defineProperty;var u=(t,e)=>()=>(t&&(e=t(t=0)),e);var Pt=(t,e)=>{for(var i in e)$t(t,i,{get:e[i],enumerable:!0})};import d from"fs-extra";import h from"path";import K from"clean-css";import{minify as jt}from"html-minifier-terser";import{minify as q}from"terser";import{transform as Ct,build as Et}from"esbuild";async function M(){let t=await L(),e=h.resolve(f(),t.outDir);await O(e),await d.ensureDir(e);let i={outDir:Rt(t,e),css:[],js:[]};if(await d.ensureDir(i.outDir),!t.folders||Object.keys(t.folders).length===0){s("warn","No folders defined in config. Nothing to build.");return}for(let[n,o]of Object.entries(t.folders))s("debug",`Building folder: ${n} -> /${o}`),await Dt(f([n]),h.join(e,o),t,i);t.styles?.length&&await V(e,t.styles,i,t),t.scripts?.length&&await V(e,t.scripts,i,t),t.bundling?.css&&await Ft(i.css,!!t.minify?.css,i.outDir),t.bundling?.js&&await Ot(i.js,!!t.minify?.js,i.outDir),s("success",`Build completed. Output saved in /${t.outDir}`)}async function Dt(t,e,i,n){if(!await d.pathExists(t)){s("warn",`Folder not found: ${t}`);return}await G(t,e,i,n),s("success",`Processed folder: ${t} -> /${e}`)}async function G(t,e,i,n){await d.ensureDir(e);for(let o of await z(t)){let r=h.join(t,o),a=h.join(e,o),l=await d.stat(r);if(s("debug",`Found ${l.isDirectory()?"DIRECTORY":"FILE"}: ${o}`),l.isDirectory()){await G(r,a,i,n);continue}let y=await B(r,i.replace);if(y.length>0){let m=h.extname(r).toLowerCase();await Q({src:r,dest:a,content:y,ext:m},i,n)}}}async function Q(t,e,i){switch(s("debug",`Processing file: ${t.src}`),t.ext){case".html":await St(t,e);break;case".css":{await zt(t,i.css,!!e.bundling?.css,!!e.minify?.css);break}case".js":{await X(t,i.js,!!e.bundling?.js,!!e.minify?.js);break}case".tsx":case".ts":{await Tt(t,i.js,!!e.bundling?.js,!!e.minify?.js);break}default:await d.copy(t.src,t.dest)}}async function St(t,e){let i=/<script([^>]*)>([\s\S]*?)<\/script>/gi,n=0,o="",r;for(;(r=i.exec(t.content))!==null;){let[a,l,y]=r;if(o+=t.content.slice(n,r.index),n=r.index+a.length,/src=/i.test(l)){o+=a;continue}let m=(l.match(/type=["']([^"']+)["']/i)?.[1]||"").toLowerCase(),p=/module/i.test(m),S=/nomodule/i.test(l);if(m==="application/json")try{let c=JSON.stringify(JSON.parse(y));o+=`<script${l}>${c}</script>`}catch(c){s("warn",`Invalid JSON in ${t.src}: ${c}`),o+=a}else if(m===""||m==="text/javascript"||p||S)try{let c=await q(y,{format:{semicolons:!0},module:p});o+=`<script${l}>${c.code||""}</script>`}catch(c){s("warn",`JS minify error in ${t.src}: ${c}`),o+=a}else o+=a}o+=t.content.slice(n),e.minify?.html&&(o=await jt(o,{collapseWhitespace:!0,removeComments:!0,minifyCSS:e.minify.css,minifyJS:!1})),await d.outputFile(t.dest,o)}async function zt(t,e,i,n){if(i)e.push(t.content);else{let o=t.content;if(n){let r=new K().minify(t.content);r.warnings.length&&r.warnings.forEach(a=>s("warn",a)),o=r.styles}await d.outputFile(t.dest,o)}}async function X(t,e,i,n){if(/require\s*\(|module\.exports|exports\./.test(t.content)&&s("warn","CommonJS detected consider converting to ESM"),i)e.push(t.content);else{let o=t.content;n&&(o=(await q(o)).code??""),await d.outputFile(t.dest,o)}}async function Tt(t,e,i,n){/require\s*\(|module\.exports|exports\./.test(t.content)&&s("warn",`CommonJS detected in ${t.src}, consider converting to ESM`);let o=t.ext===".ts"?"ts":"tsx",a=(await Ct(t.content,{loader:o,target:"es2020",format:"esm",sourcemap:!1})).code,l=t.dest.replace(/\.(ts|tsx)$/i,".js");await X({src:t.src,dest:l,content:a,ext:"js"},e,i,n)}async function V(t,e,i,n){s("info","Processing externals...");for(let o of e){let r=f([o]);if(!await d.pathExists(r)){s("warn",`External not found: ${o}`);continue}if((await d.stat(r)).isDirectory()){s("debug",`Processing external folder: ${o}`),await G(r,t,n,i);continue}s("debug",`Processing external file: ${o}`);let l=h.extname(r).toLowerCase(),y=await B(r,n.replace);await Q({src:r,dest:h.join(i.outDir,h.basename(r)),content:y,ext:l},n,i)}}async function Ft(t,e,i){if(!t.length)return;let n=t.join("");if(e){let o=new K().minify(n);o.warnings.length&&o.warnings.forEach(r=>s("warn",r)),n=o.styles}await d.outputFile(h.join(i,"style.css"),n)}async function Ot(t,e,i){if(t.length)try{let n=await Et({stdin:{contents:t.join(`
|
|
3
|
+
`),resolveDir:i,loader:"js",sourcefile:"bundle.js"},bundle:!0,format:"esm",minify:e,sourcemap:!1,write:!1});await d.outputFile(h.join(i,"script.js"),n.outputFiles[0].text),s("success",`JS bundle written to /${i}/script.js`)}catch(n){s("warn",`ESBuild JS bundle failed: ${n}`)}}function Rt(t,e){return t.bundling?.outDir?h.join(e,t.bundling.outDir):e}var Z=u(()=>{"use strict";w()});import tt from"fs-extra";async function J(t,e){let i=f([t]);if(await tt.pathExists(i))throw new Error(`Target directory '${i}' already exists.`);let n=await it(e.template);s("debug",`Copying template from '${n}' to '${i}'`),await tt.copy(n,i),s("debug","Initializing minimaz.config.json..."),await j(R,[i,"minimaz.config.json"],!1),U(e.npm)&&await Mt(i,t),U(e.git)&&await kt(t,i,e.gitprovider),s("success",`Project '${t}' created using template '${e.template}'.`)}async function kt(t,e,i,n="origin"){i||(i=await P("Select a provider or paste a url to connect your existing repo (cli tools needed) [LOCAL/github/gitlab]:","local")),i=i.toLowerCase().trim(),s("info","Initializing Git repository..."),s("debug","Running git init..."),await E("git",["init"],e),i&&i!=="false"&&i!=="local"?await It(t,e,i,n):s("info","Git repository initialized locally. No remote linked."),s("debug","Initializing gitignore..."),await j(st,[e,".gitignore"]),s("success","Git repository initialized.")}async function It(t,e,i,n="origin"){if(i==="local"){s("info","Using local Git repository only. No remote linked.");return}if(/^https?:\/\//.test(i)||i.startsWith("git@")){s("info",`Connecting existing remote '${i}'`),await E("git",["remote","add",n,i],e);return}if(i==="github"){s("info",`Creating GitHub repository '${t}'`),await E("gh",["repo","create",t,"--private","--source=.","--remote",n],e);return}if(i==="gitlab"){s("info",`Creating GitLab repository '${t}'`);let o=process.env.GITLAB_USER;if(!o)throw new Error("GITLAB_USER environment variable not set");await E("glab",["repo","create",t,"--source=."],e),await E("git",["remote","add",n,`git@gitlab.com:${o}/${t}.git`],e);return}throw new Error(`Unsupported git provider or remote: '${i}'`)}async function Mt(t,e){s("info","Initializing NPM..."),await j({name:e,...nt},[t,"package.json"]),s("debug","Running npm install..."),await E("npm",["i"],t)}var et=u(()=>{"use strict";w()});function k(t){if(t){let e=A[t];if(!e){console.log(`No help found for command: ${t}
|
|
4
4
|
`);return}if(console.log(e.usage,`
|
|
5
5
|
${e.description}`),e.options){console.log(" Options:");for(let[i,n]of Object.entries(e.options))console.log(` ${i} ${n}`)}console.log("");return}console.log(`Usage:
|
|
6
6
|
`);for(let e of Object.values(A)){if(console.log(e.usage,`
|
|
7
|
-
${e.description}`),e.options){console.log(" Options:");for(let[i,n]of Object.entries(e.options))console.log(` ${i} ${n}`)}console.log("")}}var
|
|
7
|
+
${e.description}`),e.options){console.log(" Options:");for(let[i,n]of Object.entries(e.options))console.log(` ${i} ${n}`)}console.log("")}}var ot=u(()=>{"use strict";w()});import v from"fs-extra";import D from"path";async function N(t,e){let i=await _();if(t.list)return await Jt(i);if(t.delete)return await Lt(i,t.delete);if(await Ut(i,e),t.update)return typeof t.update=="string"&&t.update.trim()?await Gt(i,t.update.trim()):await Bt(i)}async function Gt(t,e){let i=f([]),n=D.join(t,e);if(!await v.pathExists(n))throw new Error(`Template '${e}' not found in ~/.minimaz/templates`);if(!(await P(`Update '${e}' with current directory? [Y/n]:`,"y")).startsWith("y")){s("info","Update cancelled.");return}try{await v.copy(i,n,{overwrite:!0}),s("success",`Template '${e}' updated from current directory.`)}catch{throw new Error(`Failed to update '${e}'`)}}async function Bt(t){let e=await I(),i=await z(e);if(!(await P("Update local templates overwriting them with defaults? [Y/n]:","y")).startsWith("y")){s("info","Update cancelled.");return}try{for(let n of i){let o=D.join(e,n),r=D.join(t,n);await v.copy(o,r,{overwrite:!0}),s("success",`Updated '${n}'`)}s("info","\u2728 All templates and files updated successfully.")}catch(n){throw new Error(`Update failed: ${n.message}`)}}async function Lt(t,e){let i=D.join(t,e);if(!await v.pathExists(i))throw new Error(`Template not found: ${e}`);if(!(await P(`Confirm delete '${e}'? [Y/n]:`,"y")).startsWith("y")){s("info","Delete cancelled.");return}try{await v.remove(i),s("success",`Template '${e}' deleted.`)}catch(n){throw new Error(`Delete error: ${n.message}`)}}async function Ut(t,e){let i=f(e?[e]:[]);if(!await v.pathExists(i))if(s("warn",`Path not found: ${i}`),(await P("Use current directory instead? [Y/n]:","y")).startsWith("y"))i=process.cwd();else throw new Error("Operation cancelled.");try{await v.ensureDir(t);let n=D.join(t,D.basename(i));if(await v.pathExists(n)&&!(await P(`Template '${D.basename(n)}' already exists. Overwrite? [y/N]:`,"n")).startsWith("y")){s("info","Save cancelled.");return}await v.copy(i,n,{overwrite:!0}),s("success",`Template saved to ${n}`)}catch(n){throw new Error(`Failed to save template: ${n.message}`)}}async function Jt(t){let e=await z(t);if(e.length===0){s("info","No global templates available.");return}s("info","Available global templates:");for(let i=0;i<e.length;i++)console.log(`${i} - ${e[i]}`)}var rt=u(()=>{"use strict";w()});async function W(){O()}var at=u(()=>{"use strict";w()});async function H(){let t=f(["package.json"]),{version:e}=await lt(t);if(typeof e!="string")throw new Error("Invalid or missing version in package.json");console.log("==========================================",`
|
|
8
8
|
`,`minimaz-cli version: ${e}`,`
|
|
9
|
-
`,"==========================================")}var
|
|
10
|
-
Run 'minimaz config' to generate it.`);return t}async function _(){s("debug","Getting global templates directory path...");let t=
|
|
9
|
+
`,"==========================================")}var ct=u(()=>{"use strict";w()});import T from"path";import b from"fs-extra";import{homedir as At}from"os";async function F(t){s("debug",""+t);let e=T.join(At(),".minimaz");await b.pathExists(e)?s("info","~/.minimaz already exists. Skipping..."):await r();let i=await I();if(!await b.pathExists(i)){s("error","Default templates directory not found. Try reinstalling minimaz or open an issue on github");return}let n=T.join(e,"templates");await b.pathExists(n)?s("info","~/.minimaz/templates already exists. Skipping..."):await a(),await l();let o=T.join(e,"settings.json");await y();async function r(){s("info","~/.minimaz doesn't exist. Generating..."),await b.ensureDir(e)}async function a(){await b.ensureDir(n),s("success",`Created templates directory at ${n}`)}async function l(){s("info","Checking default templates...");let m=await b.readdir(i);if(m.length===0){s("warn","Default templates directory is empty");return}for(let p of m){let S=T.join(i,p),c=T.join(n,p),Y=await b.pathExists(c);if(Y&&!t){s("info",`Template '${p}' already exists. Skipping...`);continue}await b.copy(S,c,{overwrite:t}),Y&&t?s("success",`Overwritten template '${p}'.`):s("success",`Copied template '${p}'.`)}}async function y(){let m=await gt(n);if(!await b.pathExists(o)||t){await j(m,[o]),t&&await b.pathExists(o)?s("success",`Overwritten settings.json at ${o}`):s("success",`Created settings.json at ${o}`);return}let p;try{p=await b.readJson(o)}catch{s("warn","Failed to read settings.json. Recreating from template..."),await j(m,[o]);return}let S=!1;for(let c of Object.keys(m))c in p||(p[c]=m[c],s("warn",`Added missing key '${c}' to settings.json`),S=!0);for(let c of Object.keys(p))c in m||s("warn",`Unknown key '${c}' found in settings.json`);S?(await j(p,[o]),s("success","Updated settings.json to match template")):s("info","settings.json is valid and up-to-date")}}var mt=u(()=>{"use strict";w()});var pt=u(()=>{"use strict"});import Nt from"readline";import g from"fs-extra";import x from"path";import _t from"cross-spawn";import{homedir as Wt}from"os";import{execSync as Ht}from"child_process";function ut(t){let e={_:[]};for(let i=0;i<t.length;i++){let n=t[i].toLowerCase();if(!n.startsWith("-")){e._.push(n);continue}if(n.startsWith("--")&&n.includes("=")){let[a,l]=n.slice(2).split("=");e[a]=l;continue}let o=n.replace(/^-+/,""),r=t[i+1];r&&!r.startsWith("-")?(e[o]=r,i++):e[o]=!0}return e}function P(t,e=""){return new Promise(i=>{let n=Nt.createInterface({input:process.stdin,output:process.stdout}),o=setTimeout(()=>{n.close(),i(e)},6e4);n.question(`\u2753 ${t} `,r=>{clearTimeout(o),n.close(),i(r.trim()||e)}),n.on("SIGINT",()=>{clearTimeout(o),n.close(),process.exit(130)})})}function Yt(t,e={}){return Object.entries(e).reduce((i,[n,o])=>{let r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(r,"gi");return i.replace(a,o)},t)}async function B(t,e){try{let i=await g.readFile(t,"utf8");return e&&(i=Yt(i,e)),i}catch(i){return s("error",`Failed to read file ${t}: ${i.message}`),""}}async function dt(){s("debug","Getting global node modules path...");try{let t=Ht("npm config get prefix",{encoding:"utf8"}).trim();if(!t)throw new Error("Empty npm prefix");return process.platform==="win32"?x.join(t,"node_modules","minimaz-cli"):x.join(t,"lib","node_modules","minimaz-cli")}catch{return process.platform==="win32"?x.join(process.env.APPDATA||"","npm","node_modules","minimaz-cli"):"/usr/local/lib/node_modules/minimaz-cli"}}async function Vt(){s("debug","Checking existence of global Minimaz directory...");let t=x.join(Wt(),".minimaz");if(!await g.pathExists(t))throw new Error(`Global Minimaz folder does not exist.
|
|
10
|
+
Run 'minimaz config' to generate it.`);return t}async function _(){s("debug","Getting global templates directory path...");let t=x.join(await Vt(),"templates");if(!await g.pathExists(t))throw new Error("Template directory not found in global directory");return t}async function it(t){s("debug",`Getting template '${t}'directory path...`);let e=x.join(await _(),t);if(!await g.pathExists(e))throw new Error(`Template '${t}' not found.`);return e}async function I(){s("debug","Getting default templates directory path...");let t=x.join(await dt(),"templates");if(!await g.pathExists(t))throw new Error("Default template folder not found");return t}function E(t,e,i){return s("debug",`Running: ${t} ${e.join(" ")}`),new Promise((n,o)=>{let r=_t(t,e,{cwd:i,stdio:"inherit"});r.on("error",o),r.on("close",a=>a===0?n():o(new Error(`${t} exited with code ${a}`)))})}async function j(t,e,i=!0){s("debug","Creating file from template...");let n=x.resolve(...e),o="";if(t!==void 0)if(typeof t=="string")o=t.endsWith(`
|
|
11
11
|
`)?t:`${t}
|
|
12
12
|
`;else if(typeof t=="object"&&t!==null)o=`${JSON.stringify(t,null,2)}
|
|
13
|
-
`;else throw new Error("Unsupported template type. Must be string or object.");try{if(!i&&await g.pathExists(n)){s("info",`File already exists at '${n}', skipping creation.`);return}await g.outputFile(n,o)}catch(r){let a=r instanceof Error?r.message:String(r);throw new Error(`Failed to create file at '${n}': ${a}`)}}async function O(t){s("debug","Removing outDir...");let e=t?
|
|
13
|
+
`;else throw new Error("Unsupported template type. Must be string or object.");try{if(!i&&await g.pathExists(n)){s("info",`File already exists at '${n}', skipping creation.`);return}await g.outputFile(n,o)}catch(r){let a=r instanceof Error?r.message:String(r);throw new Error(`Failed to create file at '${n}': ${a}`)}}async function O(t){s("debug","Removing outDir...");let e=t?x.isAbsolute(t)?t:f([t]):x.resolve(process.cwd(),(await L()).outDir??"dist"),i=process.cwd();if(e===i||e.length<=i.length)throw new Error(`Refusing to delete unsafe directory: ${e}`);if(!await g.pathExists(e)){s("debug",`No dist folder found: ${e}`);return}await g.remove(e),s("success",`Cleared ${e}`)}async function L(){let t=f(["minimaz.config.json"]),e;if(await g.pathExists(t)?(e=await g.readJson(t),s("success","Loaded config from minimaz.config.json")):(s("warn","No minimaz.config.json found. Using default config"),e=JSON.parse(JSON.stringify(R))),!e.outDir||typeof e.outDir!="string")throw new Error("Invalid config: outDir must be a string");if(!e.folders||typeof e.folders!="object")throw new Error("Invalid config: folders must be an object");return e.bundling??={outDir:""},e.minify??={},e.replace??={},e}function ft(t){s("debug","Initializing environments variables..."),process.env.VERBOSE=t?"true":"false",s("debug",`VERBOSE = ${process.env.VERBOSE}`),process.env.CLI_WORKDIR=process.cwd(),s("debug",`CLI_WORKDIR = ${process.env.CLI_WORKDIR}`)}function f(t=[]){return s("debug","Resolving current path..."),x.resolve(process.env.CLI_WORKDIR??process.cwd(),...t)}async function lt(t){if(!await g.pathExists(t))throw new Error(`NOT FOUND: '${t}' does not exist`);return await g.readJson(t)}async function z(t){return s("debug",`Reading elements of ${t}...`),await g.pathExists(t)?await g.readdir(t):(s("warn",`Directory does not exist: ${t}`),[])}function C(t,e){return`${e}${t}${$.reset}`}async function gt(t){return{createdAt:new Date().toISOString(),templatesPath:t,npmGlobalPath:await dt()}}function U(t){if(t===void 0)return!1;if(typeof t=="boolean")return t;let e=t.toLowerCase();return e==="true"||e===""}var wt=u(()=>{"use strict";w()});var nt,st,R,A,$,yt,ht=u(()=>{"use strict";w();nt={version:"0.0.1",license:"ISC",type:"commonjs",scripts:{build:"npx mz b",start:"npx mz b && npx serve dist/"},devDependencies:{"minimaz-cli":"latest",serve:"latest"}},st=`
|
|
14
14
|
node_modules
|
|
15
15
|
dist
|
|
16
16
|
.env
|
|
17
17
|
.vscode
|
|
18
18
|
.DS_Store
|
|
19
|
-
`.trim(),R={outDir:"dist",bundling:{css:{enabled:!0,outFile:"styles.css"},js:{enabled:!0,outFile:"scripts.js"},outDir:""},minify:{html:!0,css:!0,js:!0},replace:{"../public/":"public/"},styles:["style.css","style-2.css"],scripts:["script.js","script-2.js"],folders:{src:"",public:"public"}},A={init:{usage:"minimaz init | i <project-name>",description:'Create a new project (default: "minimaz-site")',options:{"--template | -t <template-name>":'Use a global template (default: "default")'}},build:{usage:"minimaz build | b",description:"Build and minify files into the dist folder"},template:{usage:"minimaz template | t [path]",description:"Save current folder as a template (no path = current folder)",options:{"--list | -l":"List available global templates","--delete | -d <template-name>":"Delete a global template"}},help:{usage:"minimaz help | h",description:"Show this help message"},clear:{usage:"minimaz clear | c",description:"Clear the dist folder"},version:{usage:"minimaz version | v",description:"Show Minimaz version"}}
|
|
19
|
+
`.trim(),R={outDir:"dist",bundling:{css:{enabled:!0,outFile:"styles.css"},js:{enabled:!0,outFile:"scripts.js"},outDir:""},minify:{html:!0,css:!0,js:!0},replace:{"../public/":"public/"},styles:["style.css","style-2.css"],scripts:["script.js","script-2.js"],folders:{src:"",public:"public"}},A={init:{usage:"minimaz init | i <project-name>",description:'Create a new project (default: "minimaz-site")',options:{"--template | -t <template-name>":'Use a global template (default: "default")'}},build:{usage:"minimaz build | b",description:"Build and minify files into the dist folder"},template:{usage:"minimaz template | t [path]",description:"Save current folder as a template (no path = current folder)",options:{"--list | -l":"List available global templates","--delete | -d <template-name>":"Delete a global template"}},help:{usage:"minimaz help | h",description:"Show this help message"},clear:{usage:"minimaz clear | c",description:"Clear the dist folder"},version:{usage:"minimaz version | v",description:"Show Minimaz version"}},$={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",blue:"\x1B[34m",gray:"\x1B[90m"},yt={error:C("[ --- ERROR ----- ] ",$.red),warn:C("[ --- WARN ------ ] ",$.yellow),success:C("[ --- SUCCESS --- ] ",$.green),info:C("[ --- INFO ------ ] ",$.blue),debug:C("[ --- DEBUG ----- ] ",$.gray)}});function s(t="info",e){let i=process.env.VERBOSE==="true";if(t==="debug"&&!i)return;let o=`${i?C(`[${Kt()}] `,$.gray):""}${yt[t]} ${e}`;switch(t){case"error":console.error(o);break;case"warn":console.warn(o);break;default:console.log(o);break}}function Kt(t=new Date){let e=y=>y.toString().padStart(2,"0"),i=t.getFullYear(),n=e(t.getMonth()+1),o=e(t.getDate()),r=e(t.getHours()),a=e(t.getMinutes()),l=e(t.getSeconds());return`${i}-${n}-${o} ${r}:${a}:${l}`}var bt=u(()=>{"use strict";w()});var w=u(()=>{"use strict";Z();et();ot();rt();at();ct();mt();pt();wt();ht();bt()});var xt={};Pt(xt,{postInstall:()=>qt});async function qt(){try{s("info","Running Post Install..."),await F(!1),s("success","Postinstall: Global templates setup completed")}catch(t){s("error",`Postinstall setup failed: ${t.message}`)}}var vt=u(()=>{"use strict";w()});w();process.env.npm_lifecycle_event==="postinstall"&&(Promise.resolve().then(()=>(vt(),xt)).then(({postInstall:t})=>t()),process.exit(0));async function Qt(){let t=ut(process.argv.slice(2)),e=t._[0]||"",i=t._[1];ft(!!t.v),(e==="help"||t.h||t.help)&&(k(i||(t.h||t.help?e:void 0)),process.exit(0));let n={build:async()=>M(),clear:()=>W(),config:async()=>F(t.overwrite===!0||t.overwrite==="true"),init:async()=>{await J(i||"minimaz-project",{template:t.template||t.t||"default",npm:t.npm,git:t.git,gitremote:t.gitremote,gitprovider:t.gitprovider})},template:async()=>{await N({list:t.l||t.list,delete:t.d||t.delete,update:t.u||t.update})},version:()=>H(),b:()=>n.build(),c:()=>n.clear(),i:()=>n.init(),t:()=>n.template(),v:()=>n.version()};try{n[e]?(s("info",`Executing command '${e}'...`),await n[e]()):(s("error",`Unknown command '${e}'. Use 'minimaz help' to see available commands.`),k())}catch(o){s("error",o instanceof Error?process.env.DEBUG?o.stack??o.message:o.message:String(o)),process.exit(1)}}Qt();
|