minimaz-cli 0.1.2 โ 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 +26 -12
- package/bin/cli.js +1 -1
- package/package.json +4 -4
- package/src/commands/clear.js +1 -0
- package/src/commands/help.js +1 -1
- package/src/commands/version.js +1 -0
- package/src/utils/loadConfig.js +1 -1
- package/src/utils/logService.js +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Minimaz
|
|
1
|
+
# Minimaz, a Christmas Version ๐
|
|
2
2
|
|
|
3
|
-
**Minimaz** is a minimal,
|
|
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
|
|
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
|
|
87
|
-
minimaz
|
|
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
|
-
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Minimal project initializer and builder CLI",
|
|
5
5
|
"author": "MrZeller",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"html-minifier-terser": "^7.2.0",
|
|
35
35
|
"terser": "^5.44.0"
|
|
36
36
|
},
|
|
37
|
-
"postinstall": "node ./
|
|
37
|
+
"postinstall": "node ./src/utils/postInstall.js",
|
|
38
38
|
"bin": {
|
|
39
|
-
"minimaz": "
|
|
40
|
-
"mz": "
|
|
39
|
+
"minimaz": "./bin/cli.js",
|
|
40
|
+
"mz": "./bin/cli.js"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -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};
|
package/src/commands/help.js
CHANGED
|
@@ -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};
|
package/src/utils/loadConfig.js
CHANGED
|
@@ -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,
|
|
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};
|
package/src/utils/logService.js
CHANGED
|
@@ -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};
|