minimaz-cli 0.1.0 → 0.1.2
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/LICENSE +6 -6
- package/README.md +106 -106
- package/{dist/bin → bin}/cli.js +1 -1
- package/package.json +42 -57
- package/src/commands/build.js +1 -0
- package/src/commands/help.js +2 -0
- package/src/commands/init.js +1 -0
- package/src/commands/template.js +1 -0
- package/src/templates/default/minimaz.config.json +25 -25
- package/src/templates/default/src/index.html +80 -80
- package/src/templates/default/src/pages/about.html +45 -45
- package/src/templates/default/src/script.js +1 -1
- package/src/templates/default/src/style.css +98 -98
- package/src/templates/gitignore +1 -1
- package/src/templates/simple/minimaz.config.json +25 -25
- package/src/templates/simple/src/index.html +15 -15
- package/src/templates/simple/src/pages/page.html +10 -10
- package/src/templates/simple/src/script.js +1 -1
- package/src/utils/functions.js +1 -0
- package/src/utils/loadConfig.js +1 -0
- package/src/utils/logService.js +1 -0
- package/src/utils/postInstall.js +1 -0
- package/bin/cli.ts +0 -80
- package/dist/LICENSE +0 -7
- package/dist/README.md +0 -103
- package/dist/package.json +0 -42
- package/src/commands/build.ts +0 -176
- package/src/commands/help.ts +0 -33
- package/src/commands/init.ts +0 -56
- package/src/commands/template.ts +0 -146
- package/src/utils/functions.ts +0 -161
- package/src/utils/loadConfig.ts +0 -61
- package/src/utils/logService.ts +0 -19
- package/src/utils/postInstall.ts +0 -16
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Copyright (c) 2025 Hans Zeller (info@zellerindustries.com)
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
1
|
+
Copyright (c) 2025 Hans Zeller (info@zellerindustries.com)
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
7
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
# Minimaz ⚡
|
|
2
|
-
|
|
3
|
-
**Minimaz** is a minimal, zero-dependency static site builder and project initializer focused on speed, simplicity, and clean output.
|
|
4
|
-
|
|
5
|
-
## 🚀 Features
|
|
6
|
-
|
|
7
|
-
* 📁 Initialize projects from global templates
|
|
8
|
-
* 🧩 Save, list, and delete custom templates
|
|
9
|
-
* 📝 Supports HTML, CSS, JS, and TypeScript (.ts → .js)
|
|
10
|
-
* 🧹 Minifies HTML, CSS, JS, and TS (compiled & minified)
|
|
11
|
-
* ⚙️ Configurable with a `minimaz.config.json` file
|
|
12
|
-
* ➕ Supports concatenation of additional scripts and styles
|
|
13
|
-
* 🪄 Optional path replacements for asset links
|
|
14
|
-
* 🪶 Lightweight and fast — ideal for small static or utility projects
|
|
15
|
-
* 🔥 Usable with `minimaz` or alias `mz`
|
|
16
|
-
* 🆕 Display version with `minimaz version`
|
|
17
|
-
|
|
18
|
-
## 📦 Installation
|
|
19
|
-
|
|
20
|
-
Run directly with `npx` without global install:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npx minimaz init my-site
|
|
24
|
-
cd my-site
|
|
25
|
-
npx minimaz build
|
|
26
|
-
npx minimaz version
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Or using the alias:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npx mz init my-site
|
|
33
|
-
npx mz build
|
|
34
|
-
npx mz version
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## 📁 Project Structure
|
|
38
|
-
|
|
39
|
-
```txt
|
|
40
|
-
my-site/
|
|
41
|
-
├── src/ # HTML, CSS, JS, TS files
|
|
42
|
-
├── public/ # Static assets (images, fonts, etc.)
|
|
43
|
-
├── dist/ # Output folder (generated)
|
|
44
|
-
├── minimaz.config.json
|
|
45
|
-
└── ...
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## ⚙️ Configuration
|
|
49
|
-
|
|
50
|
-
Customize your build using a `minimaz.config.json` file:
|
|
51
|
-
|
|
52
|
-
```json
|
|
53
|
-
{
|
|
54
|
-
"src": "src",
|
|
55
|
-
"dist": "dist",
|
|
56
|
-
"public": "public",
|
|
57
|
-
"minify": {
|
|
58
|
-
"html": true,
|
|
59
|
-
"css": true,
|
|
60
|
-
"js": true,
|
|
61
|
-
"ts": true
|
|
62
|
-
},
|
|
63
|
-
"replace": {
|
|
64
|
-
"../public/": "public/"
|
|
65
|
-
},
|
|
66
|
-
"styles": [
|
|
67
|
-
"style.css",
|
|
68
|
-
"theme.css"
|
|
69
|
-
],
|
|
70
|
-
"scripts": [
|
|
71
|
-
"lib.js",
|
|
72
|
-
"script.js"
|
|
73
|
-
]
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
* `styles` (optional): array of `.css` files to concatenate and minify into a single `style.css`
|
|
78
|
-
* `scripts` (optional): array of `.js` files to concatenate and minify into a single `script.js`
|
|
79
|
-
* If omitted, fallback defaults are `style.css` and `script.js`
|
|
80
|
-
|
|
81
|
-
## 🛠 Commands
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
minimaz init <project-name> # Create a new project using global templates
|
|
85
|
-
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
|
|
89
|
-
minimaz help # Show help message
|
|
90
|
-
minimaz version # Display Minimaz version
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
*All commands also work with the alias `mz`.*
|
|
94
|
-
|
|
95
|
-
## 📂 Templates
|
|
96
|
-
|
|
97
|
-
Minimaz supports global templates stored in:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
~/.minimaz/templates
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Use them to quickly initialize consistent projects across environments.
|
|
104
|
-
|
|
105
|
-
## 📄 License
|
|
106
|
-
|
|
1
|
+
# Minimaz ⚡
|
|
2
|
+
|
|
3
|
+
**Minimaz** is a minimal, zero-dependency static site builder and project initializer focused on speed, simplicity, and clean output.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
|
|
7
|
+
* 📁 Initialize projects from global templates
|
|
8
|
+
* 🧩 Save, list, and delete custom templates
|
|
9
|
+
* 📝 Supports HTML, CSS, JS, and TypeScript (.ts → .js)
|
|
10
|
+
* 🧹 Minifies HTML, CSS, JS, and TS (compiled & minified)
|
|
11
|
+
* ⚙️ Configurable with a `minimaz.config.json` file
|
|
12
|
+
* ➕ Supports concatenation of additional scripts and styles
|
|
13
|
+
* 🪄 Optional path replacements for asset links
|
|
14
|
+
* 🪶 Lightweight and fast — ideal for small static or utility projects
|
|
15
|
+
* 🔥 Usable with `minimaz` or alias `mz`
|
|
16
|
+
* 🆕 Display version with `minimaz version`
|
|
17
|
+
|
|
18
|
+
## 📦 Installation
|
|
19
|
+
|
|
20
|
+
Run directly with `npx` without global install:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx minimaz init my-site
|
|
24
|
+
cd my-site
|
|
25
|
+
npx minimaz build
|
|
26
|
+
npx minimaz version
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or using the alias:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx mz init my-site
|
|
33
|
+
npx mz build
|
|
34
|
+
npx mz version
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 📁 Project Structure
|
|
38
|
+
|
|
39
|
+
```txt
|
|
40
|
+
my-site/
|
|
41
|
+
├── src/ # HTML, CSS, JS, TS files
|
|
42
|
+
├── public/ # Static assets (images, fonts, etc.)
|
|
43
|
+
├── dist/ # Output folder (generated)
|
|
44
|
+
├── minimaz.config.json
|
|
45
|
+
└── ...
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## ⚙️ Configuration
|
|
49
|
+
|
|
50
|
+
Customize your build using a `minimaz.config.json` file:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"src": "src",
|
|
55
|
+
"dist": "dist",
|
|
56
|
+
"public": "public",
|
|
57
|
+
"minify": {
|
|
58
|
+
"html": true,
|
|
59
|
+
"css": true,
|
|
60
|
+
"js": true,
|
|
61
|
+
"ts": true
|
|
62
|
+
},
|
|
63
|
+
"replace": {
|
|
64
|
+
"../public/": "public/"
|
|
65
|
+
},
|
|
66
|
+
"styles": [
|
|
67
|
+
"style.css",
|
|
68
|
+
"theme.css"
|
|
69
|
+
],
|
|
70
|
+
"scripts": [
|
|
71
|
+
"lib.js",
|
|
72
|
+
"script.js"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
* `styles` (optional): array of `.css` files to concatenate and minify into a single `style.css`
|
|
78
|
+
* `scripts` (optional): array of `.js` files to concatenate and minify into a single `script.js`
|
|
79
|
+
* If omitted, fallback defaults are `style.css` and `script.js`
|
|
80
|
+
|
|
81
|
+
## 🛠 Commands
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
minimaz init <project-name> # Create a new project using global templates
|
|
85
|
+
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
|
|
89
|
+
minimaz help # Show help message
|
|
90
|
+
minimaz version # Display Minimaz version
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
*All commands also work with the alias `mz`.*
|
|
94
|
+
|
|
95
|
+
## 📂 Templates
|
|
96
|
+
|
|
97
|
+
Minimaz supports global templates stored in:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
~/.minimaz/templates
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Use them to quickly initialize consistent projects across environments.
|
|
104
|
+
|
|
105
|
+
## 📄 License
|
|
106
|
+
|
|
107
107
|
MIT
|
package/{dist/bin → bin}/cli.js
RENAMED
|
@@ -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),
|
|
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)}}_();
|
package/package.json
CHANGED
|
@@ -1,57 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "minimaz-cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Minimal project initializer and builder CLI",
|
|
5
|
-
"author": "MrZeller",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"files": [
|
|
9
|
-
"bin
|
|
10
|
-
"src
|
|
11
|
-
"LICENSE",
|
|
12
|
-
"README.md",
|
|
13
|
-
"package.json"
|
|
14
|
-
],
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"fs-extra": "^11.3.0",
|
|
44
|
-
"html-minifier-terser": "^7.2.0",
|
|
45
|
-
"terser": "^5.44.0"
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@types/clean-css": "^4.2.11",
|
|
49
|
-
"@types/fs-extra": "^11.0.4",
|
|
50
|
-
"@types/html-minifier-terser": "^7.0.2",
|
|
51
|
-
"@types/node": "^24.7.2",
|
|
52
|
-
"esbuild": "^0.25.10",
|
|
53
|
-
"ts-node": "^10.9.2",
|
|
54
|
-
"typescript": "^5.9.3"
|
|
55
|
-
},
|
|
56
|
-
"postinstall": "node ./dist/src/utils/postInstall.js"
|
|
57
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "minimaz-cli",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Minimal project initializer and builder CLI",
|
|
5
|
+
"author": "MrZeller",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"bin",
|
|
10
|
+
"src",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"README.md",
|
|
13
|
+
"package.json"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/zeller-dev/minimaz-cli.git"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"cli",
|
|
21
|
+
"minimal",
|
|
22
|
+
"build",
|
|
23
|
+
"init",
|
|
24
|
+
"project",
|
|
25
|
+
"starter"
|
|
26
|
+
],
|
|
27
|
+
"homepage": "https://github.com/zeller-dev/minimaz-cli#readme",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/zeller-dev/minimaz-cli/issues"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"clean-css": "^5.3.3",
|
|
33
|
+
"fs-extra": "^11.3.0",
|
|
34
|
+
"html-minifier-terser": "^7.2.0",
|
|
35
|
+
"terser": "^5.44.0"
|
|
36
|
+
},
|
|
37
|
+
"postinstall": "node ./dist/src/utils/postInstall.js",
|
|
38
|
+
"bin": {
|
|
39
|
+
"minimaz": "dist/bin/cli.js",
|
|
40
|
+
"mz": "dist/bin/cli.js"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +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(`
|
|
2
|
+
`))}export{t as help};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -1,26 +1,26 @@
|
|
|
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
|
-
}
|
|
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
26
|
}
|
|
@@ -1,80 +1,80 @@
|
|
|
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
|
+
<!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>
|