minimaz-cli 0.2.1 â 0.3.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/README.md +102 -33
- package/bin/cli.js +12 -1
- package/package.json +9 -8
- package/src/commands/build.js +0 -1
- package/src/commands/clear.js +0 -1
- package/src/commands/help.js +0 -2
- package/src/commands/init.js +0 -1
- package/src/commands/template.js +0 -1
- package/src/commands/version.js +0 -1
- package/src/templates/default/minimaz.config.json +0 -26
- package/src/templates/default/public/assets/.gitkeep +0 -0
- package/src/templates/default/public/favicon.ico +0 -0
- package/src/templates/default/src/index.html +0 -80
- package/src/templates/default/src/pages/about.html +0 -46
- package/src/templates/default/src/script.js +0 -1
- package/src/templates/default/src/style.css +0 -99
- package/src/templates/gitignore +0 -2
- package/src/templates/simple/minimaz.config.json +0 -26
- package/src/templates/simple/public/assets/.gitkeep +0 -0
- package/src/templates/simple/public/favicon.ico +0 -0
- package/src/templates/simple/src/index.html +0 -15
- package/src/templates/simple/src/pages/page.html +0 -11
- package/src/templates/simple/src/script.js +0 -1
- package/src/templates/simple/src/style.css +0 -0
- package/src/utils/functions.js +0 -1
- package/src/utils/loadConfig.js +0 -1
- package/src/utils/logService.js +0 -1
- package/src/utils/postInstall.js +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Minimaz
|
|
1
|
+
# Minimaz CLI ð
|
|
2
2
|
|
|
3
3
|
**Minimaz** is a minimal, low-dependency static site builder and project initializer focused on speed, simplicity, and clean output.
|
|
4
4
|
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* ðŠ Optional path replacements for asset links
|
|
14
14
|
* ðŠķ Lightweight and fast â ideal for small static or utility projects
|
|
15
15
|
* ðĨ Usable with `minimaz` or its alias `mz`
|
|
16
|
+
* ðŧ NPM integration and optional Git repository initialization
|
|
17
|
+
* âą Interactive prompts with 60s timeout
|
|
16
18
|
|
|
17
19
|
## ðĶ Installation
|
|
18
20
|
|
|
@@ -28,9 +30,9 @@ npx minimaz version
|
|
|
28
30
|
Or using the alias:
|
|
29
31
|
|
|
30
32
|
```bash
|
|
31
|
-
npx mz
|
|
32
|
-
npx mz
|
|
33
|
-
npx mz
|
|
33
|
+
npx mz i my-site
|
|
34
|
+
npx mz b
|
|
35
|
+
npx mz v
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
## ð Project Structure
|
|
@@ -41,6 +43,8 @@ my-site/
|
|
|
41
43
|
âââ public/ # Static assets (images, fonts, etc.)
|
|
42
44
|
âââ src/ # HTML, CSS, JS, TS files
|
|
43
45
|
âââ minimaz.config.json
|
|
46
|
+
âââ package.json # Optional, created if npm init is used
|
|
47
|
+
âââ .gitignore # Default gitignore copied from template
|
|
44
48
|
âââ ...
|
|
45
49
|
```
|
|
46
50
|
|
|
@@ -53,6 +57,10 @@ Customize your build using a `minimaz.config.json` file:
|
|
|
53
57
|
"src": "src",
|
|
54
58
|
"dist": "dist",
|
|
55
59
|
"public": "public",
|
|
60
|
+
"bundling": {
|
|
61
|
+
"css": true,
|
|
62
|
+
"js": true
|
|
63
|
+
},
|
|
56
64
|
"minify": {
|
|
57
65
|
"html": true,
|
|
58
66
|
"css": true,
|
|
@@ -65,45 +73,88 @@ Customize your build using a `minimaz.config.json` file:
|
|
|
65
73
|
"folders": {
|
|
66
74
|
"src": "",
|
|
67
75
|
"public": "public"
|
|
68
|
-
}
|
|
76
|
+
},
|
|
69
77
|
"styles": [
|
|
70
|
-
"
|
|
71
|
-
"
|
|
78
|
+
"../node_modules/some-package/dist/library.css",
|
|
79
|
+
"C:/Users/YourUser/Desktop/custom.css"
|
|
72
80
|
],
|
|
73
81
|
"scripts": [
|
|
74
|
-
"
|
|
75
|
-
"
|
|
82
|
+
"../node_modules/some-package/dist/library.js",
|
|
83
|
+
"D:/Scripts/custom.js"
|
|
76
84
|
]
|
|
77
85
|
}
|
|
78
86
|
```
|
|
79
87
|
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* If omitted, fallback defaults are
|
|
88
|
+
* styles (optional): array of .css files to include in the build, can be inside src, node_modules, or any absolute/relative path on your system.
|
|
89
|
+
* scripts (optional): array of .js files to include in the build, can also point outside src.
|
|
90
|
+
* If omitted, fallback defaults are style.css and script.js.
|
|
91
|
+
* `bundling.css` / `bundling.js`: controls whether listed CSS/JS files are concatenated into a single `style.css` / `script.js`.
|
|
92
|
+
* `minify.html`, `minify.css`, `minify.js`, `minify.ts`: enable minification for the corresponding file types. TypeScript files are compiled to JS before minification.
|
|
83
93
|
|
|
84
|
-
|
|
94
|
+
**Tip**: Using external paths is useful for including library CSS/JS without copying them into your project.
|
|
85
95
|
|
|
86
|
-
|
|
87
|
-
minimaz build # Build and minify the site (uses config or defaults)
|
|
88
|
-
minimaz clear # Clears dist folder
|
|
89
|
-
minimaz init <project-name> # Create a new project using global templates
|
|
90
|
-
minimaz help # Show help message
|
|
91
|
-
minimaz template <path> # Save a new template from specified path (or current dir)
|
|
92
|
-
minimaz template -list # List available templates
|
|
93
|
-
minimaz template -delete <name> # Delete a saved template
|
|
94
|
-
minimaz version # Display Minimaz version
|
|
95
|
-
```
|
|
96
|
+
## ð Commands
|
|
96
97
|
|
|
97
|
-
### Commands Aliases
|
|
98
98
|
```bash
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
mz
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
# -----------------------------
|
|
100
|
+
# Build
|
|
101
|
+
# -----------------------------
|
|
102
|
+
minimaz build # Build and minify the project
|
|
103
|
+
mz b # alias
|
|
104
|
+
|
|
105
|
+
# -----------------------------
|
|
106
|
+
# Clear
|
|
107
|
+
# -----------------------------
|
|
108
|
+
minimaz clear # Delete the dist folder
|
|
109
|
+
mz c # alias
|
|
110
|
+
|
|
111
|
+
# -----------------------------
|
|
112
|
+
# Init
|
|
113
|
+
# -----------------------------
|
|
114
|
+
minimaz init <project-name> # Initialize a new project with default template
|
|
115
|
+
mz i <project-name> # alias
|
|
116
|
+
|
|
117
|
+
minimaz init <project-name> --template <name> # Use a specific template
|
|
118
|
+
mz i <project-name> -t <name> # alias
|
|
119
|
+
|
|
120
|
+
minimaz init <project-name> --npm # Initialize npm project
|
|
121
|
+
minimaz init <project-name> --git # Initialize git repository
|
|
122
|
+
|
|
123
|
+
# Specify git provider or remote URL
|
|
124
|
+
minimaz init <project-name> --git --gitprovider <provider-or-url>
|
|
125
|
+
mz i <project-name> --git --gitprovider github # alias example
|
|
126
|
+
|
|
127
|
+
# -----------------------------
|
|
128
|
+
# Help
|
|
129
|
+
# -----------------------------
|
|
130
|
+
minimaz help # Show general help
|
|
131
|
+
mz h # alias
|
|
132
|
+
minimaz help <command> # Show help for a specific command
|
|
133
|
+
mz h build # alias example
|
|
134
|
+
|
|
135
|
+
# -----------------------------
|
|
136
|
+
# Template management
|
|
137
|
+
# -----------------------------
|
|
138
|
+
minimaz template <template-path> # Save current folder as a template
|
|
139
|
+
minimaz t <template-path> # alias
|
|
140
|
+
|
|
141
|
+
minimaz template --list # List available global templates
|
|
142
|
+
minimaz t -l # alias
|
|
143
|
+
|
|
144
|
+
minimaz template --delete <template-name> # Delete a saved template
|
|
145
|
+
minimaz t -d <template-name> # alias
|
|
146
|
+
|
|
147
|
+
minimaz template --update <template-name> # Update a specific template from current folder
|
|
148
|
+
minimaz t -u <template-name> # alias
|
|
149
|
+
|
|
150
|
+
minimaz template --update # Update all templates from node_modules
|
|
151
|
+
minimaz t -u # alias
|
|
152
|
+
|
|
153
|
+
# -----------------------------
|
|
154
|
+
# Version
|
|
155
|
+
# -----------------------------
|
|
156
|
+
minimaz version # Show Minimaz CLI version
|
|
157
|
+
mz v # alias
|
|
107
158
|
```
|
|
108
159
|
|
|
109
160
|
## ð Templates
|
|
@@ -118,4 +169,22 @@ Use them to quickly initialize consistent projects across environments.
|
|
|
118
169
|
|
|
119
170
|
## ð License
|
|
120
171
|
|
|
121
|
-
MIT
|
|
172
|
+
MIT
|
|
173
|
+
|
|
174
|
+
```txt
|
|
175
|
+
|
|
176
|
+
_ _
|
|
177
|
+
/)\___/(\
|
|
178
|
+
/.--. .__.\ _-'''-_
|
|
179
|
+
/\_(O) (O)_/\ /\ | / \ ____ ____ ________ __ __
|
|
180
|
+
_.-._(_c_)_.-./\ \ / / /) [__ \ / __] [ __ _] [ ] [ ]
|
|
181
|
+
(__(((______)))__--''/ // ] \/ [ ______ [_/ /'/ _____ ] [ ] [ _____ ______
|
|
182
|
+
|__||_||_||_||__|| / ) [ [\ /] ] [ / \] /'/ _ / /__\\ [ ] [ ] / /__\\[ / \]
|
|
183
|
+
| || || || || || |/ _] [_\/_] [_ ] [ _/'/__/ ]\ \___ ] [ ] [ \ \___ ] [
|
|
184
|
+
|__||_||_||_||__||__| [_____][_____][___] [________] \___/ [___][___] \___/ [___]
|
|
185
|
+
|
|
186
|
+
MrZeller
|
|
187
|
+
Website: zellerindustries.com
|
|
188
|
+
Mail: info@zellerindustries.com
|
|
189
|
+
|
|
190
|
+
```
|
package/bin/cli.js
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
var ht=Object.defineProperty;var u=(t,e)=>()=>(t&&(e=t(t=0)),e);var vt=(t,e)=>{for(var i in e)ht(t,i,{get:e[i],enumerable:!0})};import g from"fs-extra";import h from"path";import O from"clean-css";import{minify as bt}from"html-minifier-terser";import{minify as z}from"terser";async function F(){let t=await I(),e=d(),i=h.resolve(e,t.dist);if(await R(i),await g.ensureDir(i),!t.folders||Object.keys(t.folders).length===0){r("warn","No folders defined in config. Nothing to build.");return}for(let[n,s]of Object.entries(t.folders))r("debug",`Building folder: ${n} -> /${s}`),await xt(n,s,t,i);r("success",`Build completed. Output saved in /${t.dist}`)}async function xt(t,e,i,n){let s=d([t]),o=h.join(n,e);if(!await g.pathExists(s)){r("warn",`Folder not found: ${t}`);return}let a={css:[],js:[]};await Y(s,o,i,a),t===i.src&&await Et(a,i,n),r("success",`Processed folder: ${t} -> /${e}`)}async function Y(t,e,i,n){await g.ensureDir(e);for(let s of await g.readdir(t)){let o=h.join(t,s),a=h.join(e,s);if((await g.stat(o)).isDirectory()){await Y(o,a,i,n);continue}await $t(o,a,i,n)}}async function $t(t,e,i,n){switch(r("debug",`Processing file: ${t}`),h.extname(t).toLowerCase()){case".html":await Ct(t,e,i);break;case".css":{jt(t,e,i,n.css);break}case".js":{Pt(t,e,i,n.js);break}default:await g.copy(t,e)}}async function Ct(t,e,i){let n=await S(t,i.replace),s=/<script([^>]*)>([\s\S]*?)<\/script>/gi,o=0,a="",m;for(;(m=s.exec(n))!==null;){let[l,v,b]=m;if(a+=n.slice(o,m.index),o=m.index+l.length,/src=/i.test(v)){a+=l;continue}let j=(v.match(/type=["']([^"']+)["']/i)?.[1]||"").toLowerCase(),H=/module/i.test(j),yt=/nomodule/i.test(v);if(j==="application/json")try{let $=JSON.stringify(JSON.parse(b));a+=`<script${v}>${$}</script>`}catch($){r("warn",`Invalid JSON in ${t}: ${$}`),a+=l}else if(j===""||j==="text/javascript"||H||yt)try{let $=await z(b,{format:{semicolons:!0},module:H});a+=`<script${v}>${$.code||""}</script>`}catch($){r("warn",`JS minify error in ${t}: ${$}`),a+=l}else a+=l}a+=n.slice(o),i.minify?.html&&(a=await bt(a,{collapseWhitespace:!0,removeComments:!0,minifyCSS:i.minify.css,minifyJS:!1})),await g.outputFile(e,a)}async function jt(t,e,i,n){let s=await S(t,i.replace);if(i.bundling?.css)n.push(s);else{let o=s;if(i.minify?.css){let a=new O().minify(s);a.warnings.length&&a.warnings.forEach(m=>r("warn",m)),o=a.styles}await g.outputFile(e,o)}}async function Pt(t,e,i,n){let s=await S(t,i.replace);if(i.bundling?.js)n.push(s);else{let o=s;i.minify?.js&&(o=(await z(s)).code??""),await g.outputFile(e,o)}}async function Et(t,e,i){await N(e.styles,t.css,e,"css",!!e.bundling?.css,i),await N(e.scripts,t.js,e,"js",!!e.bundling?.js,i),e.bundling?.css&&await zt(t.css,e,i),e.bundling?.js&&await St(t.js,e,i)}async function N(t,e,i,n,s,o){if(t?.length)for(let a of t){let m=d([a]);if(!await g.pathExists(m)){r("warn",`File not found: ${a}`);continue}let l=await g.readFile(m,"utf-8");if(l=M(l,i.replace),s)e.push(l);else{if(n==="css"&&i.minify?.css){let b=new O().minify(l);b.warnings.length&&b.warnings.forEach(j=>r("warn",j)),l=b.styles}else if(n==="js"&&i.minify?.js)try{l=(await z(l)).code??""}catch(b){r("warn",`JS minify failed for external file ${a}: ${b}`)}let v=h.basename(a);await g.outputFile(h.join(o,v),l),r("info",`Copied external ${n} file: ${v}`)}}}async function zt(t,e,i){if(!t.length)return;let n=t.join("");if(e.minify?.css){let s=new O().minify(n);s.warnings.length&&s.warnings.forEach(o=>r("warn",o)),n=s.styles}await g.outputFile(h.join(i,"style.css"),n)}async function St(t,e,i){if(!t.length)return;let n=t.join("");if(e.minify?.js)try{n=(await z(n)).code??""}catch(s){r("warn",`JS minify failed: ${s}`)}n&&await g.outputFile(h.join(i,"script.js"),n)}var V=u(()=>{"use strict";f()});import k from"fs-extra";import K from"path";async function G(t,e){let i=K.join(await T(),e.template),n=d([t]);if(!await k.pathExists(i))throw new Error(`Template '${e.template}' not found.`);if(await k.pathExists(n))throw new Error(`Target directory '${n}' already exists.`);e.npm=e.npm??(await y("Init NPM? [Y/n]:","y")).startsWith("y"),e.git=e.git??(await y("Init Git repository? [Y/n]:","y")).startsWith("y"),e.git&&!e.gitprovider&&(e.gitprovider=e.gitprovider??await y("Select a provider or paste a url to connect your existing repo (cli tools needed) [LOCAL/github/gitlab]:","local")),r("debug",`Copying template from '${i}' to '${n}'`),await k.copy(i,n),r("debug","Initializing gitignore..."),await A(Z,K.join(n,".gitignore")),e.npm&&await q(n,t),e.git&&await X(t,n,e.gitprovider),r("success",`Project '${t}' created using template '${e.template}'.`)}var Q=u(()=>{"use strict";f()});function D(t){if(t){let e=B[t];if(!e){console.log(`No help found for command: ${t}
|
|
3
|
+
`);return}if(console.log(e.usage,`
|
|
4
|
+
${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:
|
|
5
|
+
`);for(let e of Object.values(B)){if(console.log(e.usage,`
|
|
6
|
+
${e.description}`),e.options){console.log(" Options:");for(let[i,n]of Object.entries(e.options))console.log(` ${i} ${n}`)}console.log("")}}var tt=u(()=>{"use strict";f()});import w from"fs-extra";import C from"path";async function J(t,e){let i=await T();if(t.list)return await Ft(i);if(t.delete)return await Dt(i,t.delete);if(await Ot(i,e),t.update)return typeof t.update=="string"&&t.update.trim()?await Rt(i,t.update.trim()):await Tt(i)}async function Rt(t,e){let i=d([]),n=C.join(t,e);if(!await w.pathExists(n))throw new Error(`Template '${e}' not found in ~/.minimaz/templates`);if(!(await y(`Update '${e}' with current directory? [Y/n]:`,"y")).startsWith("y")){r("info","Update cancelled.");return}try{await w.copy(i,n,{overwrite:!0}),r("success",`Template '${e}' updated from current directory.`)}catch{throw new Error(`Failed to update '${e}'`)}}async function Tt(t){let e=it(),i=await w.readdir(e);if(!(await y("Update local templates overwriting them with defaults? [Y/n]:","y")).startsWith("y")){r("info","Update cancelled.");return}try{for(let n of i){let s=C.join(e,n),o=C.join(t,n);await w.copy(s,o,{overwrite:!0}),r("success",`Updated '${n}'`)}r("info","\u2728 All templates and files updated successfully.")}catch(n){throw new Error(`Update failed: ${n.message}`)}}async function Dt(t,e){let i=C.join(t,e);if(!await w.pathExists(i))throw new Error(`Template not found: ${e}`);if(!(await y(`Confirm delete '${e}'? [Y/n]:`,"y")).startsWith("y")){r("info","Delete cancelled.");return}try{await w.remove(i),r("success",`Template '${e}' deleted.`)}catch(n){throw new Error(`Delete error: ${n.message}`)}}async function Ot(t,e){let i=d(e?[e]:[]);if(!await w.pathExists(i))if(r("warn",`Path not found: ${i}`),(await y("Use current directory instead? [Y/n]:","y")).startsWith("y"))i=process.cwd();else throw new Error("Operation cancelled.");try{await w.ensureDir(t);let n=C.join(t,C.basename(i));if(await w.pathExists(n)&&!(await y(`Template '${C.basename(n)}' already exists. Overwrite? [y/N]:`,"n")).startsWith("y")){r("info","Save cancelled.");return}await w.copy(i,n,{overwrite:!0}),r("success",`Template saved to ${n}`)}catch(n){throw new Error(`Failed to save template: ${n.message}`)}}async function Ft(t){let e=await w.readdir(t);if(e.length===0){r("info","No global templates available.");return}r("info","Available global templates:");for(let i=0;i<e.length;i++)console.log(`${i} - ${e[i]}`)}var et=u(()=>{"use strict";f()});async function U(){R()}var nt=u(()=>{"use strict";f()});async function _(){let t=d(["package.json"]),{version:e}=await st(t);if(typeof e!="string")throw new Error("Invalid or missing version in package.json");console.log("==========================================",`
|
|
7
|
+
`,`minimaz-cli version: ${e}`,`
|
|
8
|
+
`,"==========================================")}var rt=u(()=>{"use strict";f()});var ot=u(()=>{"use strict"});import Mt from"readline";import c from"fs-extra";import p from"path";import It from"cross-spawn";import{homedir as at}from"os";import{execSync as kt}from"child_process";function lt(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,m]=n.slice(2).split("=");e[a]=m;continue}let s=n.replace(/^-+/,""),o=t[i+1];o&&!o.startsWith("-")?(e[s]=o,i++):e[s]=!0}return e}function y(t,e=""){return new Promise(i=>{let n=Mt.createInterface({input:process.stdin,output:process.stdout}),s=setTimeout(()=>{n.close(),i(e)},6e4);n.question(`\u2753 ${t} `,o=>{clearTimeout(s),n.close(),i(o.trim()||e)}),n.on("SIGINT",()=>{clearTimeout(s),n.close(),process.exit(130)})})}function M(t,e={}){return Object.entries(e).reduce((i,[n,s])=>{let o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(o,"gi");return i.replace(a,s)},t)}async function S(t,e){try{let i=await c.readFile(t,"utf8");return e&&(i=M(i,e)),i}catch(i){return r("error",`Failed to read file ${t}: ${i.message}`),""}}function L(){try{let t=kt("npm config get prefix",{encoding:"utf8"}).trim();if(!t)throw new Error("Empty npm prefix");return process.platform==="win32"?p.join(t,"node_modules","minimaz-cli"):p.join(t,"lib","node_modules","minimaz-cli")}catch{return process.platform==="win32"?p.join(process.env.APPDATA||"","npm","node_modules","minimaz-cli"):"/usr/local/lib/node_modules/minimaz-cli"}}async function Gt(){return await W(),p.join(at(),".minimaz")}async function T(){return p.join(await Gt(),"templates")}function it(){let t=p.join(L(),"src","templates");if(t)throw new Error("Failed to resolve node_modules templates path");return t}async function W(){let t=p.join(at(),".minimaz"),e=p.join(t,"templates"),i=p.join(L(),"src","templates"),n=p.join(t,"settings.json");try{await c.ensureDir(t),await c.pathExists(n)||(await c.outputJson(n,{createdAt:new Date().toISOString(),templatesPath:e,npmGlobalPath:L()},{spaces:2}),r("success",`Created settings.json at ${n}`));let s=await c.pathExists(e),o=s?(await c.readdir(e)).length===0:!0;if(s||(await c.ensureDir(e),r("success","Created global templates directory.")),!o){r("debug","Global templates directory not empty. Skipping copy.");return}if(await c.pathExists(i))for(let a of await c.readdir(i))await c.copy(p.join(i,a),p.join(e,a)),r("success",`Copied template '${a}'.`);else r("warn","Default templates directory not found.");r("success","Default templates setup completed.")}catch(s){throw r("error",`Failed to create global templates directory: ${s.message}`),s}}function P(t,e,i){return new Promise((n,s)=>{r("debug",`Running: ${t} ${e.join(" ")}`);let o=It(t,e,{cwd:i,stdio:"inherit"});o.on("error",s),o.on("close",a=>a===0?n():s(new Error(`${t} exited with code ${a}`)))})}async function A(t,e){let i=typeof t=="string"?t.endsWith(`
|
|
9
|
+
`)?t:t+`
|
|
10
|
+
`:JSON.stringify(t,null,2)+`
|
|
11
|
+
`;try{await c.outputFile(e,i)}catch(n){throw new Error(`Failed to create file at '${e}': ${n.message}`)}}async function q(t,e){r("info","Initializing NPM..."),await A({name:e,...mt},p.join(t,"package.json")),await P("npm",["install"],t)}async function X(t,e,i,n="origin"){r("info","Initializing Git repository..."),await P("git",["init"],e),i?(await At(t,e,i,n),r("success","Git repository initialized.")):r("info","Git repository initialized locally (no remote).")}async function At(t,e,i,n="origin"){if(console.log(i,n,t,e),/^https?:\/\//.test(i)||i.startsWith("git@")){r("info",`Connecting existing remote '${i}'`),await P("git",["remote","add",n,i],e);return}if(i==="github"){r("info",`Creating GitHub repository '${t}'`),await P("gh",["repo","create",t,"--private","--source=.","--remote",n],e);return}if(i==="gitlab"){r("info",`Creating GitLab repository '${t}'`);let s=process.env.GITLAB_USER;if(!s)throw new Error("GITLAB_USER environment variable not set");await P("glab",["repo","create",t,"--source=."],e),await P("git",["remote","add",n,`git@gitlab.com:${s}/${t}.git`],e);return}throw new Error(`Unsupported git provider or remote: '${i}'`)}async function R(t){let e=t?p.isAbsolute(t)?t:d([t]):p.resolve(process.cwd(),(await I()).dist??"dist"),i=process.cwd();if(e===i||e.length<=i.length)throw new Error(`Refusing to delete unsafe directory: ${e}`);if(!await c.pathExists(e)){r("debug",`No dist folder found: ${e}`);return}await c.remove(e),r("success",`Cleared ${e}`)}async function I(){let t=d(["minimaz.config.json"]),e;return await c.pathExists(t)?(e=await c.readJson(t),r("success","Loaded config from minimaz.config.json")):(e=JSON.parse(JSON.stringify(gt)),r("warn","No minimaz.config.json found. Using default config")),e}function ct(t){process.env.VERBOSE=t?"true":"false",r("debug",`VERBOSE = ${process.env.VERBOSE}`),process.env.CLI_WORKDIR=process.cwd(),r("debug",`CLI_WORKDIR = ${process.env.CLI_WORKDIR}`)}function d(t=[]){return p.resolve(process.env.CLI_WORKDIR??process.cwd(),...t)}async function st(t){return await c.readJson(t)}var pt=u(()=>{"use strict";f()});var mt,Z,gt,B,x,dt=u(()=>{"use strict";mt={version:"0.0.1",license:"ISC",type:"commonjs",scripts:{build:"mz b",start:"npx mz b && npx serve dist/"},devDependencies:{"minimaz-cli":"latest",serve:"latest"}},Z=`dist
|
|
12
|
+
.vscode
|
|
13
|
+
node_modules`,gt={src:"src",dist:"dist",public:"public",bundling:{css:!0,js:!0},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"}},B={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"}},x={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",blue:"\x1B[34m",gray:"\x1B[90m"}});function r(t="info",e){let i={error:E("[ --- ERROR ----- ] ",x.red),warn:E("[ --- WARN ------ ] ",x.yellow),success:E("[ --- SUCCESS --- ] ",x.green),info:E("[ --- INFO ------ ] ",x.blue),debug:E("[ --- DEBUG ----- ] ",x.gray)},n=process.env.VERBOSE==="true";if(t==="debug"&&!n)return;let o=`${n?E(`[${Bt()}] `,x.gray):""}${i[t]} ${e}`;switch(t){case"error":console.error(o);break;case"warn":console.warn(o);break;default:console.log(o);break}}function E(t,e){return`${e}${t}${x.reset}`}function Bt(t=new Date){let e=l=>l.toString().padStart(2,"0"),i=t.getFullYear(),n=e(t.getMonth()+1),s=e(t.getDate()),o=e(t.getHours()),a=e(t.getMinutes()),m=e(t.getSeconds());return`${i}-${n}-${s} ${o}:${a}:${m}`}var ut=u(()=>{"use strict";f()});var f=u(()=>{"use strict";V();Q();tt();et();nt();rt();ot();pt();dt();ut()});var ft={};vt(ft,{postInstall:()=>Jt});async function Jt(){try{r("info","Running Post Install..."),await W(),r("success","Postinstall: Global templates setup completed")}catch(t){r("error",`Postinstall setup failed: ${t.message}`)}}var wt=u(()=>{"use strict";f()});f();process.env.npm_lifecycle_event==="postinstall"&&(Promise.resolve().then(()=>(wt(),ft)).then(({postInstall:t})=>t()),process.exit(0));async function Ut(){let t=lt(process.argv.slice(2)),e=t._[0]||"",i=t._[1];ct(!!t.v),(e==="help"||t.h||t.help)&&(D(i||(t.h||t.help?e:void 0)),process.exit(0));let n={build:async()=>F(),clear:()=>U(),init:async()=>{await G(i||"minimaz-project",{template:t.template||t.t||"default",npm:t.npm,git:t.git,gitremote:t.gitremote,gitprovider:t.gitprovider})},template:async()=>{await J({list:t.l||t.list,delete:t.d||t.delete,update:t.u||t.update})},version:()=>_(),b:()=>n.build(),c:()=>n.clear(),i:()=>n.init(),t:()=>n.template(),v:()=>n.version()};try{n[e]?(r("info",`Executing command '${e}'...`),await n[e]()):(r("error",`Unknown command '${e}'. Use 'minimaz help' to see available commands.`),D())}catch(s){r("error",s instanceof Error?process.env.DEBUG?s.stack??s.message:s.message:String(s)),process.exit(1)}}Ut();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minimaz-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Minimal project initializer and builder CLI",
|
|
5
5
|
"author": "MrZeller",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
"README.md",
|
|
13
13
|
"package.json"
|
|
14
14
|
],
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/zeller-dev/minimaz-cli.git"
|
|
18
|
-
},
|
|
19
15
|
"keywords": [
|
|
20
16
|
"cli",
|
|
21
17
|
"minimal",
|
|
@@ -24,19 +20,24 @@
|
|
|
24
20
|
"project",
|
|
25
21
|
"starter"
|
|
26
22
|
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/zeller-dev/minimaz-cli.git"
|
|
26
|
+
},
|
|
27
27
|
"homepage": "https://github.com/zeller-dev/minimaz-cli#readme",
|
|
28
28
|
"bugs": {
|
|
29
29
|
"url": "https://github.com/zeller-dev/minimaz-cli/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"clean-css": "^5.3.3",
|
|
33
|
+
"cross-spawn": "^7.0.6",
|
|
33
34
|
"fs-extra": "^11.3.0",
|
|
34
35
|
"html-minifier-terser": "^7.2.0",
|
|
35
36
|
"terser": "^5.44.0"
|
|
36
37
|
},
|
|
37
|
-
"postinstall": "node
|
|
38
|
+
"postinstall": "node dist/bin/cli.js",
|
|
38
39
|
"bin": {
|
|
39
|
-
"minimaz": "
|
|
40
|
-
"mz": "
|
|
40
|
+
"minimaz": "bin/cli.js",
|
|
41
|
+
"mz": "bin/cli.js"
|
|
41
42
|
}
|
|
42
43
|
}
|
package/src/commands/build.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import s from"fs-extra";import r from"path";import F from"clean-css";import{minify as $}from"html-minifier-terser";import{minify as b}from"terser";import{loadConfig as k}from"../utils/loadConfig.js";import{log as a}from"../utils/logService.js";import{applyReplacements as h,getFile as g}from"../utils/functions.js";async function H(){try{const t=await k(),l=r.resolve(process.cwd(),t.dist||"dist");await s.remove(l),await s.ensureDir(l);async function j(f,m){const w=r.resolve(process.cwd(),f),S=r.join(l,m);if(!await s.pathExists(w)){a("warn",`Folder not found: ${f}`);return}const p=[],u=[];async function y(i,n){await s.ensureDir(n);for(const e of await s.readdir(i)){const c=r.join(i,e),d=r.join(n,e),v=await s.stat(c),C=r.extname(e).toLowerCase();if(v.isDirectory()){await y(c,d);continue}try{switch(C){case".html":{let o=await g(c,t.replace);t.minify?.html&&(o=await $(o,{collapseWhitespace:!0,removeComments:!0,minifyJS:t.minify?.ts,minifyCSS:t.minify?.css})),await s.outputFile(d,o);break}case".css":{const o=await g(c,t.replace);p.push(o);break}case".js":{const o=await g(c,t.replace);u.push(o);break}default:await s.copy(c,d);break}}catch(o){a("error",`Failed to process file: ${c} - ${o.message}`)}}}if(await y(w,S),f===t.src)try{if(t.styles?.length)for(const i of t.styles){const n=r.resolve(process.cwd(),i);if(await s.pathExists(n)){let e=await s.readFile(n,"utf-8");e=h(e,t.replace),p.push(e)}else a("warn",`Style file not found: ${i}`)}if(t.scripts?.length)for(const i of t.scripts){const n=r.resolve(process.cwd(),i);if(await s.pathExists(n)){let e=await s.readFile(n,"utf-8");e=h(e,t.replace),u.push(e)}else a("warn",`Script file not found: ${i}`)}if(p.length>0){let i=p.join("");t.minify?.css&&(i=new F().minify(i).styles),await s.outputFile(r.join(l,"style.css"),i)}if(u.length>0){let i=u.join("");t.minify?.js&&(i=(await b(i)).code??""),i&&await s.outputFile(r.join(l,"script.js"),i)}}catch(i){a("error",`Failed to merge CSS/JS: ${i.message}`)}a("success",`Processed folder: ${f} -> /${m}`)}if(t.folders&&Object.keys(t.folders).length>0)for(const[f,m]of Object.entries(t.folders))await j(f,m);else a("warn","No folders defined in config. Nothing to build.");a("success",`Build completed. Output saved in /${t.dist}`)}catch(t){a("error",`Build failed: ${t.message}`)}}export{H as build};
|
package/src/commands/clear.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import t from"path";import r from"fs-extra";import{loadConfig as e}from"../utils/loadConfig.js";import{log as i}from"../utils/logService.js";async function m(){const s=await e(),o=t.resolve(process.cwd(),s.dist||"dist");if(!r.existsSync(o)){i("info",`No dist folder found: ${o}`);return}r.remove(o),i("success",`Cleared ${o}`)}export{m as clear};
|
package/src/commands/help.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function t(){console.log(["Usage:",""," minimaz init | i <project-name>",' Create a new project (default: "minimaz-site")'," Options:",' --template | -t <template-name> Use a global template (default: "default")',""," minimaz build | b"," Build and minify files into the dist folder",""," minimaz template | t [path]"," 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",""," minimaz help | h"," Show this help message",""," minimaz clear | c"," Clear the dist folder",""," minimaz version | v"," Show Minimaz version"].join(`
|
|
2
|
-
`))}export{t as help};
|
package/src/commands/init.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import t from"fs-extra";import i from"path";import g from"os";import{log as n}from"../utils/logService.js";import{createGlobalDir as p}from"../utils/functions.js";async function j(s,o={}){const e=i.join(g.homedir(),".minimaz");await t.pathExists(e)||(n("info",`Global folder '${e}' not found. Creating...`),await p());const a=i.join(e,"templates",o.template||"default"),m=i.resolve(process.cwd(),s);if(!await t.pathExists(a))throw new Error(`Template '${o.template}' not found.`);try{await t.copy(a,m);const r=i.join(a,"..","gitignore"),c=i.join(m,".gitignore");await t.pathExists(r)&&(await t.copy(r,c),n("info",".gitignore added to project.")),n("success",`Project '${s}' created using template '${o.template}'.`)}catch(r){throw new Error(`Failed to create project: ${r.message}`)}}export{j as init};
|
package/src/commands/template.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import o from"fs-extra";import w from"os";import n from"path";import{log as a}from"../utils/logService.js";import{askQuestion as c,listTemplates as m,getGlobalNodeModulesPath as f}from"../utils/functions.js";async function j(s,e={}){const t=n.join(w.homedir(),".minimaz","templates"),r=e.delete||e.d,i=e.update||e.u;if(r)return await g(t,r);if(e.list||e.l)return await m(t);if(i!==void 0)return typeof i=="string"&&i.trim()?await u(t,i.trim()):await p(t);await y(t,s)}async function u(s,e){const t=n.resolve(process.cwd()),r=n.join(s,e);if(!await o.pathExists(r))throw new Error(`Template '${e}' not found in ~/.minimaz/templates`);const i=await c(`\u2753 Update template '${e}' with current directory? (Y/N) `);if(i!=="y"&&i!==""){a("info","Update cancelled.");return}try{await o.copy(t,r,{overwrite:!0}),a("success",`Template '${e}' updated from current directory.`)}catch(d){throw new Error(`Failed to update '${e}': ${d.message}`)}}async function p(s){const e=n.join(f(),"src","templates");if(!await o.pathExists(e))throw new Error("'node_modules/minimaz/src/templates' not found.");const t=await o.readdir(e),r=await c("\u26A0\uFE0F Update local templates overwriting them with defaults? (Y/N): ");if(r!=="y"&&r!==""){a("info","Update cancelled.");return}try{for(const i of t){const d=n.join(e,i),l=n.join(s,i);await o.copy(d,l,{overwrite:!0}),a("success",`Updated '${i}'`)}a("info","\u2728 All templates and files updated successfully.")}catch(i){throw new Error(`Update failed: ${i.message}`)}}async function g(s,e){if(!e)throw new Error("No template name specified to delete.");const t=n.join(s,e);if(!await o.pathExists(t))throw new Error(`Template not found: ${e}`);if((await c(`\u2753 Confirm delete '${e}'? (Y/N) `)).toLowerCase()!=="y"){a("info","Delete cancelled.");return}try{await o.remove(t),a("success",`Template '${e}' deleted.`)}catch(i){throw new Error(`Delete error: ${i.message}`)}}async function y(s,e){let t=e?n.resolve(process.cwd(),e):process.cwd();if(!await o.pathExists(t)){a("warn",`Path not found: ${t}`);const r=(await c("\u2753 Use current directory instead? (Y/N): ")).trim().toLowerCase();if(r!=="y"&&r!=="")throw new Error("Operation cancelled.");t=process.cwd()}try{await o.ensureDir(s);const r=n.join(s,n.basename(t));await o.copy(t,r),a("success",`Template saved to ${r}`)}catch(r){throw new Error(`Failed to save template: ${r.message}`)}}export{j as template};
|
package/src/commands/version.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"path";import s from"fs-extra";import{log as n}from"../utils/logService.js";async function c(){try{const o=e.resolve(process.cwd(),"package.json"),{version:r}=await s.readJson(o);if(typeof r!="string")throw new Error("Invalid or missing version in package.json");console.log(r)}catch(o){n("error",`Unable to read package.json: ${o}`),process.exit(1)}}export{c as version};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"src": "src",
|
|
3
|
-
"dist": "dist",
|
|
4
|
-
"public": "public",
|
|
5
|
-
"minify": {
|
|
6
|
-
"html": true,
|
|
7
|
-
"css": true,
|
|
8
|
-
"js": true,
|
|
9
|
-
"ts": true
|
|
10
|
-
},
|
|
11
|
-
"replace": {
|
|
12
|
-
"../public/": "public/"
|
|
13
|
-
},
|
|
14
|
-
"styles": [
|
|
15
|
-
"style.css",
|
|
16
|
-
"style-2.css"
|
|
17
|
-
],
|
|
18
|
-
"scripts": [
|
|
19
|
-
"script.js",
|
|
20
|
-
"script-2.js"
|
|
21
|
-
],
|
|
22
|
-
"folders": {
|
|
23
|
-
"src": "",
|
|
24
|
-
"public": "public"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
File without changes
|
|
Binary file
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Welcome to Minimaz</title>
|
|
7
|
-
<link rel="stylesheet" href="style.css" />
|
|
8
|
-
<link rel="icon" href="../public/favicon.ico" type="image/x-icon" />
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<header>
|
|
12
|
-
<nav>
|
|
13
|
-
<a class="btn active" href="#">Home</a>
|
|
14
|
-
<a class="btn" href="pages/about.html">About</a>
|
|
15
|
-
<a class="btn" href="https://github.com/zeller-dev/minimaz" target="_blank">GitHub</a>
|
|
16
|
-
</nav>
|
|
17
|
-
</header>
|
|
18
|
-
|
|
19
|
-
<main class="container">
|
|
20
|
-
<h1>ð Welcome to Minimaz</h1>
|
|
21
|
-
<p><strong>Minimaz</strong> is a minimal static site builder designed for speed and simplicity. It helps you:</p>
|
|
22
|
-
<ul>
|
|
23
|
-
<li>ðĄ Organize your files with a simple structure</li>
|
|
24
|
-
<li>âïļ Automatically build and minify HTML, CSS, JS, and TS</li>
|
|
25
|
-
<li>ð Customize file inclusion order using <code>minimaz.config.json</code></li>
|
|
26
|
-
</ul>
|
|
27
|
-
|
|
28
|
-
<h2>ð§ Getting Started</h2>
|
|
29
|
-
<p>Install and use Minimaz with the following commands:</p>
|
|
30
|
-
<pre><code># ðĻ Initialize a new project
|
|
31
|
-
npx minimaz init my-site
|
|
32
|
-
|
|
33
|
-
# ðïļ Build the site
|
|
34
|
-
npx minimaz build
|
|
35
|
-
|
|
36
|
-
# ðĶ Save template or list/delete existing ones
|
|
37
|
-
npx minimaz template <path> [--list|-l] [--delete|-d]
|
|
38
|
-
|
|
39
|
-
# ðŽ Show help guide
|
|
40
|
-
npx minimaz help</code></pre>
|
|
41
|
-
|
|
42
|
-
<h2>ð Project Structure</h2>
|
|
43
|
-
<pre><code>my-site/
|
|
44
|
-
âââ src/ # Source files (HTML, CSS, JS, TS)
|
|
45
|
-
âââ public/ # Static assets (images, fonts, etc.)
|
|
46
|
-
âââ dist/ # Output directory (auto-generated)
|
|
47
|
-
âââ minimaz.config.json # Configuration file</code></pre>
|
|
48
|
-
|
|
49
|
-
<h2>âïļ Configuration</h2>
|
|
50
|
-
<pre><code>{
|
|
51
|
-
"src": "src",
|
|
52
|
-
"dist": "dist",
|
|
53
|
-
"public": "public",
|
|
54
|
-
"minify": { "html": true, "css": true, "js": true, "ts": true },
|
|
55
|
-
"replace": { "../public/": "public/" },
|
|
56
|
-
"styles": [ "reset.css", "style.css", "theme.css" ],
|
|
57
|
-
"scripts": [ "libs/jquery.js", "utils.js", "script.js" ]
|
|
58
|
-
}</code></pre>
|
|
59
|
-
|
|
60
|
-
<h2>ðĪ Production</h2>
|
|
61
|
-
<p>The final output will be generated in the <code>dist/</code> folder, ready for deployment.</p>
|
|
62
|
-
|
|
63
|
-
<h2>â Available Commands</h2>
|
|
64
|
-
<ul>
|
|
65
|
-
<li><code>init</code> / <code>i</code> â Initialize a new project</li>
|
|
66
|
-
<li><code>build</code> / <code>b</code> â Build and minify the project</li>
|
|
67
|
-
<li><code>help</code> / <code>h</code> â Show the help message</li>
|
|
68
|
-
<li><code>template</code> / <code>t</code> â Manage templates (with <code>--list</code> and <code>--delete</code> options)</li>
|
|
69
|
-
</ul>
|
|
70
|
-
|
|
71
|
-
<p>You're ready to build fast and clean static websites. Happy coding! ð ïļ</p>
|
|
72
|
-
</main>
|
|
73
|
-
|
|
74
|
-
<footer>
|
|
75
|
-
<p>© 2025 Minimaz. All rights reserved.</p>
|
|
76
|
-
</footer>
|
|
77
|
-
|
|
78
|
-
<script src="script.js"></script>
|
|
79
|
-
</body>
|
|
80
|
-
</html>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Welcome to Minimaz</title>
|
|
8
|
-
<link rel="stylesheet" href="../style.css" />
|
|
9
|
-
<link rel="shortcut icon" href="../../public/favicon.ico" type="image/x-icon">
|
|
10
|
-
|
|
11
|
-
</head>
|
|
12
|
-
|
|
13
|
-
<body>
|
|
14
|
-
<header>
|
|
15
|
-
<nav>
|
|
16
|
-
<a class='btn' href="../index.html">Home</a>
|
|
17
|
-
<a class='btn active' href="pages/about.html">About</a>
|
|
18
|
-
<a class='btn' target="_blank" href="https://github.com/zeller-dev/minimaz">GitHub</a>
|
|
19
|
-
</nav>
|
|
20
|
-
</header>
|
|
21
|
-
<div class="container">
|
|
22
|
-
<h1>About Minimaz</h1>
|
|
23
|
-
<p><strong>Minimaz</strong> is a minimal build tool that helps you quickly scaffold and minify HTML, CSS, and
|
|
24
|
-
JavaScript projects.</p>
|
|
25
|
-
|
|
26
|
-
<h2>Features</h2>
|
|
27
|
-
<ul>
|
|
28
|
-
<li>Zero-config HTML/CSS/JS minification</li>
|
|
29
|
-
<li>Folder structure based on <code>src</code>, <code>public</code>, and <code>dist</code></li>
|
|
30
|
-
<li>Simple CLI with <code>init</code>, <code>build</code>, and <code>help</code> commands</li>
|
|
31
|
-
</ul>
|
|
32
|
-
|
|
33
|
-
<h2>Getting Started</h2>
|
|
34
|
-
<pre><code>$ minimaz init my-project
|
|
35
|
-
$ cd my-project
|
|
36
|
-
$ minimaz build</code></pre>
|
|
37
|
-
|
|
38
|
-
<p>Learn more or contribute on <a href="#">GitHub</a>.</p>
|
|
39
|
-
</div>
|
|
40
|
-
<footer>
|
|
41
|
-
<p>© 2023 Minimaz. All rights reserved.</p>
|
|
42
|
-
</footer>
|
|
43
|
-
<script src="../script.js"></script>
|
|
44
|
-
</body>
|
|
45
|
-
|
|
46
|
-
</html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
console.log('Minimaz is ready!')
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--primary-color: #338ca8;
|
|
3
|
-
--background-color: #222;
|
|
4
|
-
--foreground-color: #f5f5f5;
|
|
5
|
-
--code-bg: #333;
|
|
6
|
-
--code-text: #eeeeff;
|
|
7
|
-
font-size: 16px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
* {
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
header,
|
|
15
|
-
footer {
|
|
16
|
-
background-color: var(--code-bg);
|
|
17
|
-
padding:1rem;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
body {
|
|
21
|
-
font-family: 'Segoe UI', sans-serif;
|
|
22
|
-
margin: 0;
|
|
23
|
-
background: var(--background-color);
|
|
24
|
-
color: var(--foreground-color);
|
|
25
|
-
line-height: 1.6;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.container {
|
|
29
|
-
max-width: 800px;
|
|
30
|
-
margin: auto;
|
|
31
|
-
padding: 1rem;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
h1,
|
|
35
|
-
h2,
|
|
36
|
-
h3 {
|
|
37
|
-
color: var(--primary-color);
|
|
38
|
-
margin-top: 2rem;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
p {
|
|
42
|
-
margin: 1rem 0;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
code {
|
|
46
|
-
background: var(--code-bg);
|
|
47
|
-
color: var(--code-text);
|
|
48
|
-
padding: 0.2rem 0.4rem;
|
|
49
|
-
border-radius: 4px;
|
|
50
|
-
font-family: monospace;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
pre {
|
|
54
|
-
background: var(--code-bg);
|
|
55
|
-
color: #ddd;
|
|
56
|
-
padding: 1rem;
|
|
57
|
-
overflow-x: auto;
|
|
58
|
-
border-radius: 6px;
|
|
59
|
-
font-family: monospace;
|
|
60
|
-
border-left: 4px solid var(--primary-color);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
a {
|
|
64
|
-
color: var(--primary-color);
|
|
65
|
-
text-decoration: none;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.btn {
|
|
69
|
-
transition: all 0.15s ease-in-out;
|
|
70
|
-
background-color: var(--primary-color);
|
|
71
|
-
border: none;
|
|
72
|
-
color: #fff;
|
|
73
|
-
padding: 10px 20px;
|
|
74
|
-
font-size: 1rem;
|
|
75
|
-
margin: .5rem .2rem;
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
border-radius: 5px;
|
|
78
|
-
display: inline-block;
|
|
79
|
-
text-align: center;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.btn:hover {
|
|
83
|
-
opacity: 0.85;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.btn.active {
|
|
87
|
-
background-color: var(--code-bg);
|
|
88
|
-
color: #fff;
|
|
89
|
-
pointer-events: none;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
header {
|
|
93
|
-
font-weight: 600;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
footer p {
|
|
97
|
-
text-align: center;
|
|
98
|
-
margin: 0;
|
|
99
|
-
}
|
package/src/templates/gitignore
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"src": "src",
|
|
3
|
-
"dist": "dist",
|
|
4
|
-
"public": "public",
|
|
5
|
-
"minify": {
|
|
6
|
-
"html": true,
|
|
7
|
-
"css": true,
|
|
8
|
-
"js": true,
|
|
9
|
-
"ts": true
|
|
10
|
-
},
|
|
11
|
-
"replace": {
|
|
12
|
-
"../public/": "public/"
|
|
13
|
-
},
|
|
14
|
-
"styles": [
|
|
15
|
-
"style.css",
|
|
16
|
-
"style-2.css"
|
|
17
|
-
],
|
|
18
|
-
"scripts": [
|
|
19
|
-
"script.js",
|
|
20
|
-
"script-2.js"
|
|
21
|
-
],
|
|
22
|
-
"folders": {
|
|
23
|
-
"src": "",
|
|
24
|
-
"public": "public"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
File without changes
|
|
Binary file
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Welcome to Minimaz</title>
|
|
8
|
-
<link rel="stylesheet" href="style.css" />
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<script src="script.js"></script>
|
|
13
|
-
</body>
|
|
14
|
-
|
|
15
|
-
</html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
console.log('Minimaz is ready!')
|
|
File without changes
|
package/src/utils/functions.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import f from"readline";import s from"fs-extra";import n from"path";import g from"os";import{log as o}from"./logService.js";import{execSync as u}from"child_process";function P(t){const i={_:[]};for(let e=0;e<t.length;e++){const r=t[e];if(r.startsWith("-")){const a=r.startsWith("--")?r.slice(2):r.slice(1),l=t[e+1],m=!!l&&!l.startsWith("-");i[a]=m?l:!0,m&&e++}else i._.push(r)}return i}function D(t){return new Promise(i=>{const e=f.createInterface({input:process.stdin,output:process.stdout});e.question(t,r=>{e.close(),i(r.trim())})})}async function A(t){if(!await s.pathExists(t)){o("info","No templates directory found.");return}const i=await s.readdir(t);i.length===0?o("info","No global templates available."):(o("info","Available global templates:"),i.forEach(e=>o("info",`- ${e}`)))}function d(t,i={}){for(const[e,r]of Object.entries(i))t=t.split(e).join(r);return t}async function E(t,i){try{let e=await s.readFile(t,"utf-8");return i&&(e=d(e,i)),e}catch(e){return o("error",`Failed to read file ${t}: ${e.message}`),""}}function p(){try{const t=u("npm config get prefix",{encoding:"utf-8"}).trim();if(!t)throw new Error("Empty prefix");return process.platform==="win32"?n.join(t,"node_modules","minimaz-cli"):n.join(t,"lib","node_modules","minimaz-cli")}catch{return process.platform==="win32"?n.join(process.env.APPDATA||"","npm","node_modules","minimaz-cli"):"/usr/local/lib/node_modules/minimaz-cli"}}async function _(){const t=n.join(g.homedir(),".minimaz"),i=n.join(t,"templates"),e=n.join(p(),"src","templates"),r=n.join(t,"settings.json");console.log(e);try{if(await s.ensureDir(t),!await s.pathExists(r)){const c={createdAt:new Date().toISOString(),templatesPath:i,npmGlobalPath:p()};await s.outputJson(r,c,{spaces:2}),o("success",`Created settings.json at ${r}`)}const a=await s.pathExists(i),l=a?(await s.readdir(i)).length===0:!0;if(a||(await s.ensureDir(i),o("success","Created global templates directory.")),!l){o("info","Global templates directory not empty. Skipping copy.");return}const m=await s.readdir(e);console.log(m);for(const c of await s.readdir(e))await s.copy(n.join(e,c),n.join(i,c)),o("success",`Copied template '${c}'.`);o("success","Default templates setup completed.")}catch(a){throw o("error",`Failed to create global templates directory: ${a.message}`),a}}export{d as applyReplacements,D as askQuestion,_ as createGlobalDir,E as getFile,p as getGlobalNodeModulesPath,A as listTemplates,P as parseArgs};
|
package/src/utils/loadConfig.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import t from"fs-extra";import f from"path";import{log as s}from"./logService.js";const e={src:"src",dist:"dist",public:"public",minify:{html:!0,css:!0,js:!0,ts:!0},replace:{"../public/":"public/"},folders:{src:"",public:"public"}};function a(o,n){const r={...o};for(const i of Object.keys(n))n[i]&&typeof n[i]=="object"&&!Array.isArray(n[i])?r[i]=o[i]?a(o[i],n[i]):n[i]:i in o||(r[i]=n[i]);return r}async function p(){const o=f.resolve(process.cwd(),"minimaz.config.json");let n={};if(await t.pathExists(o))try{n=await t.readJson(o),s("info","Loaded config from minimaz.config.json")}catch(i){throw new Error(`Failed to parse minimaz.config.json: ${i.message}`)}else s("info","No minimaz.config.json found. Using default config");return a(n,e)}export{p as loadConfig};
|
package/src/utils/logService.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function c(o="log",n){const r={error:"\u274C",warn:"\u26A0\uFE0F",success:"\u2705",info:"\u2139\uFE0F",log:"\u{1F4C1}"};o==="error"?console.error(r[o]," ",n):o==="warn"?console.warn(r[o]," ",n):console.log(r[o]||r.log," ",n)}export{c as log};
|
package/src/utils/postInstall.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createGlobalDir as s}from"./functions.js";import{log as e}from"./logService.js";async function a(){try{await s(),e("success","Postinstall: Global templates setup completed.")}catch(t){e("error",`Postinstall setup failed: ${t.message}`)}}a();
|