minimaz-cli 0.1.3 โ†’ 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # Minimaz โšก
1
+ # Minimaz, a Christmas Version ๐ŸŽ„
2
2
 
3
- **Minimaz** is a minimal, zero-dependency static site builder and project initializer focused on speed, simplicity, and clean output.
3
+ **Minimaz** is a minimal, low-dependency static site builder and project initializer focused on speed, simplicity, and clean output.
4
4
 
5
5
  ## ๐Ÿš€ Features
6
6
 
7
- * ๐Ÿ“ Initialize projects from global templates
7
+ * ๐Ÿ“ Initialize projects from templates
8
8
  * ๐Ÿงฉ Save, list, and delete custom templates
9
9
  * ๐Ÿ“ Supports HTML, CSS, JS, and TypeScript (.ts โ†’ .js)
10
10
  * ๐Ÿงน Minifies HTML, CSS, JS, and TS (compiled & minified)
@@ -12,8 +12,7 @@
12
12
  * โž• Supports concatenation of additional scripts and styles
13
13
  * ๐Ÿช„ Optional path replacements for asset links
14
14
  * ๐Ÿชถ Lightweight and fast โ€” ideal for small static or utility projects
15
- * ๐Ÿ”ฅ Usable with `minimaz` or alias `mz`
16
- * ๐Ÿ†• Display version with `minimaz version`
15
+ * ๐Ÿ”ฅ Usable with `minimaz` or its alias `mz`
17
16
 
18
17
  ## ๐Ÿ“ฆ Installation
19
18
 
@@ -38,9 +37,9 @@ npx mz version
38
37
 
39
38
  ```txt
40
39
  my-site/
41
- โ”œโ”€โ”€ src/ # HTML, CSS, JS, TS files
42
- โ”œโ”€โ”€ public/ # Static assets (images, fonts, etc.)
43
40
  โ”œโ”€โ”€ dist/ # Output folder (generated)
41
+ โ”œโ”€โ”€ public/ # Static assets (images, fonts, etc.)
42
+ โ”œโ”€โ”€ src/ # HTML, CSS, JS, TS files
44
43
  โ”œโ”€โ”€ minimaz.config.json
45
44
  โ””โ”€โ”€ ...
46
45
  ```
@@ -63,6 +62,10 @@ Customize your build using a `minimaz.config.json` file:
63
62
  "replace": {
64
63
  "../public/": "public/"
65
64
  },
65
+ "folders": {
66
+ "src": "",
67
+ "public": "public"
68
+ }
66
69
  "styles": [
67
70
  "style.css",
68
71
  "theme.css"
@@ -81,16 +84,27 @@ Customize your build using a `minimaz.config.json` file:
81
84
  ## ๐Ÿ›  Commands
82
85
 
83
86
  ```bash
84
- minimaz init <project-name> # Create a new project using global templates
85
87
  minimaz build # Build and minify the site (uses config or defaults)
86
- minimaz template <path> # Save a new template from specified path (or current dir)
87
- minimaz template -l # List available templates
88
- minimaz template -d <name> # Delete a saved template
88
+ minimaz clear # Clears dist folder
89
+ minimaz init <project-name> # Create a new project using global templates
89
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
90
94
  minimaz version # Display Minimaz version
91
95
  ```
92
96
 
93
- *All commands also work with the alias `mz`.*
97
+ ### Commands Aliases
98
+ ```bash
99
+ mz b # Build and minify the site (uses config or defaults)
100
+ mz c # Clears dist folder
101
+ mz i <project-name> # Create a new project using global templates
102
+ mz h # Show help message
103
+ mz t <path> # Save a new template from specified path (or current dir)
104
+ mz t -l # List available templates
105
+ mz t -d <name> # Delete a saved template
106
+ mz v # Display Minimaz version
107
+ ```
94
108
 
95
109
  ## ๐Ÿ“‚ Templates
96
110
 
package/bin/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{fileURLToPath as n}from"url";import{dirname as r,join as s}from"path";import m from"fs-extra";import{build as p}from"../src/commands/build.js";import{init as c}from"../src/commands/init.js";import{help as l}from"../src/commands/help.js";import{template as d}from"../src/commands/template.js";import{log as a}from"../src/utils/logService.js";import{parseArgs as f}from"../src/utils/functions.js";const g=n(import.meta.url),v=r(g),u=s(v,"../package.json"),h=await m.readJson(u),y=h.version;async function _(){const e=f(process.argv.slice(2)),i=(e._[0]||"").toLowerCase(),o={init:async()=>{await c(e._[1]||"minimaz-project",{template:e.template||e.t||"default"})},build:async()=>p(),help:()=>l(),template:async()=>{await d(e._[1],{list:e.l||e.list,delete:e.d||e.delete,update:e.u||e.update})},version:()=>console.log(y),i:()=>o.init(),b:()=>o.build(),h:()=>o.help(),t:()=>o.template(),v:()=>o.version()};try{o[i]?await o[i]():(a("error",`Unknown command '${i}'. Use 'minimaz help' to see available commands.`),o.help())}catch(t){a("error",t instanceof Error?process.env.DEBUG?t.stack??t.message:t.message:String(t)),process.exit(1)}}_();
2
+ import{fileURLToPath as m}from"url";import{dirname as a}from"path";import{build as n}from"../src/commands/build.js";import{init as s}from"../src/commands/init.js";import{help as l}from"../src/commands/help.js";import{template as p}from"../src/commands/template.js";import{log as i}from"../src/utils/logService.js";import{parseArgs as c}from"../src/utils/functions.js";import{clear as d}from"../src/commands/clear.js";import{version as f}from"../src/commands/version.js";const v=m(import.meta.url),z=a(v);async function u(){const e=c(process.argv.slice(2)),t=(e._[0]||"").toLowerCase(),o={build:async()=>n(),clear:()=>d(),help:()=>l(),init:async()=>{await s(e._[1]||"minimaz-project",{template:e.template||e.t||"default"})},template:async()=>{await p(e._[1],{list:e.l||e.list,delete:e.d||e.delete,update:e.u||e.update})},version:()=>f(),b:()=>o.build(),c:()=>o.clear(),h:()=>o.help(),i:()=>o.init(),t:()=>o.template(),v:()=>o.version()};try{o[t]?await o[t]():(i("error",`Unknown command '${t}'. Use 'minimaz help' to see available commands.`),o.help())}catch(r){i("error",r instanceof Error?process.env.DEBUG?r.stack??r.message:r.message:String(r)),process.exit(1)}}u();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimaz-cli",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "Minimal project initializer and builder CLI",
5
5
  "author": "MrZeller",
6
6
  "license": "MIT",
@@ -0,0 +1 @@
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};
@@ -1,2 +1,2 @@
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"].join(`
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
2
  `))}export{t as help};
@@ -0,0 +1 @@
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 +1 @@
1
- import t from"fs-extra";import s from"path";import{log as a}from"./logService.js";const f={src:"src",dist:"dist",public:"public",minify:{html:!0,css:!0,js:!0},replace:{}};function e(r,i){const o={...r};for(const n in i)i[n]&&typeof i[n]=="object"&&!Array.isArray(i[n])?o[n]=e(r[n]||{},i[n]):i[n]!==void 0&&(o[n]=i[n]);return o}async function g(){const r=s.resolve(process.cwd(),"minimaz.config.json");let i={};if(await t.pathExists(r))try{i=await t.readJson(r),a("info","Loaded config from minimaz.config.tson")}catch(n){throw new Error(`Failed to parse minimaz.config.tson: ${n.message}`)}else a("info","No minimaz.config.tson found. Using default config");const o=e(f,i);if(!o.src||!o.dist)throw new Error("Invalid configuration: src and dist are required");return o}export{g as loadConfig};
1
+ import t from"fs-extra";import s from"path";import{log as a}from"./logService.js";const f={src:"src",dist:"dist",public:"public",minify:{html:!0,css:!0,js:!0,ts:!0},replace:{"../public/":"public/"},folders:{src:"",public:"public"}};function e(r,n){const o={...r};for(const i in n)n[i]&&typeof n[i]=="object"&&!Array.isArray(n[i])?o[i]=e(r[i]||{},n[i]):n[i]!==void 0&&(o[i]=n[i]);return o}async function m(){const r=s.resolve(process.cwd(),"minimaz.config.json");let n={};if(await t.pathExists(r))try{n=await t.readJson(r),a("info","Loaded config from minimaz.config.json")}catch(i){throw new Error(`Failed to parse minimaz.config.json: ${i.message}`)}else a("info","No minimaz.config.json found. Using default config");const o=e(f,n);if(!o.src||!o.dist)throw new Error("Invalid configuration: src and dist are required");return o}export{m as loadConfig};
@@ -1 +1 @@
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};
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};