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
|
@@ -1,46 +1,46 @@
|
|
|
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
|
-
|
|
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
46
|
</html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
console.log('Minimaz is ready!')
|
|
1
|
+
console.log('Minimaz is ready!')
|
|
@@ -1,99 +1,99 @@
|
|
|
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;
|
|
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
99
|
}
|
package/src/templates/gitignore
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
dist
|
|
1
|
+
dist
|
|
2
2
|
.vscode
|
|
@@ -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,15 +1,15 @@
|
|
|
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
|
+
<!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,11 +1,11 @@
|
|
|
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>Document</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
|
|
10
|
-
</body>
|
|
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>Document</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
|
|
10
|
+
</body>
|
|
11
11
|
</html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
console.log('Minimaz is ready!')
|
|
1
|
+
console.log('Minimaz is ready!')
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +1 @@
|
|
|
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();
|
package/bin/cli.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { fileURLToPath } from 'url'
|
|
3
|
-
import { dirname, join } from 'path'
|
|
4
|
-
import fs from 'fs-extra'
|
|
5
|
-
|
|
6
|
-
import { build } from '../src/commands/build.js'
|
|
7
|
-
import { init } from '../src/commands/init.js'
|
|
8
|
-
import { help } from '../src/commands/help.js'
|
|
9
|
-
import { template } from '../src/commands/template.js'
|
|
10
|
-
|
|
11
|
-
import { log } from '../src/utils/logService.js'
|
|
12
|
-
import { parseArgs } from '../src/utils/functions.js'
|
|
13
|
-
|
|
14
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
15
|
-
const __dirname = dirname(__filename)
|
|
16
|
-
|
|
17
|
-
// Read version from package.json dynamically
|
|
18
|
-
const pkgPath = join(__dirname, '../package.json')
|
|
19
|
-
const pkgJson = await fs.readJson(pkgPath)
|
|
20
|
-
const version = pkgJson.version as string
|
|
21
|
-
|
|
22
|
-
async function main(): Promise<void> {
|
|
23
|
-
const args = parseArgs(process.argv.slice(2))
|
|
24
|
-
const cmd = (args._[0] || '').toLowerCase()
|
|
25
|
-
|
|
26
|
-
type CommandFn = () => Promise<void> | void
|
|
27
|
-
|
|
28
|
-
const commands: Record<string, CommandFn> = {
|
|
29
|
-
// Init Command
|
|
30
|
-
init: async () => {
|
|
31
|
-
await init(args._[1] || 'minimaz-project', {
|
|
32
|
-
template: args.template || args.t || 'default'
|
|
33
|
-
})
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
// Build Command
|
|
37
|
-
build: async () => build(),
|
|
38
|
-
|
|
39
|
-
// Help Command
|
|
40
|
-
help: () => help(),
|
|
41
|
-
|
|
42
|
-
// Template Command
|
|
43
|
-
template: async () => {
|
|
44
|
-
await template(args._[1], {
|
|
45
|
-
list: args.l || args.list,
|
|
46
|
-
delete: args.d || args.delete,
|
|
47
|
-
update: args.u || args.update
|
|
48
|
-
} as any)
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
// Version
|
|
52
|
-
version: () => console.log(version),
|
|
53
|
-
|
|
54
|
-
// Aliases
|
|
55
|
-
i: () => commands.init(),
|
|
56
|
-
b: () => commands.build(),
|
|
57
|
-
h: () => commands.help(),
|
|
58
|
-
t: () => commands.template(),
|
|
59
|
-
v: () => commands.version()
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
if (commands[cmd]) {
|
|
64
|
-
await commands[cmd]()
|
|
65
|
-
} else {
|
|
66
|
-
log('error', `Unknown command '${cmd}'. Use 'minimaz help' to see available commands.`)
|
|
67
|
-
commands.help()
|
|
68
|
-
}
|
|
69
|
-
} catch (e: any) {
|
|
70
|
-
log(
|
|
71
|
-
'error',
|
|
72
|
-
e instanceof Error
|
|
73
|
-
? process.env.DEBUG ? e.stack ?? e.message : e.message
|
|
74
|
-
: String(e)
|
|
75
|
-
)
|
|
76
|
-
process.exit(1)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
main()
|
package/dist/LICENSE
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
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/dist/README.md
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
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
|
-
|
|
17
|
-
## 📦 Installation
|
|
18
|
-
|
|
19
|
-
Run directly with `npx` without global install:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npx minimaz init my-site
|
|
23
|
-
cd my-site
|
|
24
|
-
npx minimaz build
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Or using the alias:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npx mz init my-site
|
|
31
|
-
npx mz build
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## 📁 Project Structure
|
|
35
|
-
|
|
36
|
-
```txt
|
|
37
|
-
my-site/
|
|
38
|
-
├── src/ # HTML, CSS, JS, TS files
|
|
39
|
-
├── public/ # Static assets (images, fonts, etc.)
|
|
40
|
-
├── dist/ # Output folder (generated)
|
|
41
|
-
├── minimaz.config.json
|
|
42
|
-
└── ...
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## ⚙️ Configuration
|
|
46
|
-
|
|
47
|
-
Customize your build using a `minimaz.config.json` file:
|
|
48
|
-
|
|
49
|
-
```json
|
|
50
|
-
{
|
|
51
|
-
"src": "src",
|
|
52
|
-
"dist": "dist",
|
|
53
|
-
"public": "public",
|
|
54
|
-
"minify": {
|
|
55
|
-
"html": true,
|
|
56
|
-
"css": true,
|
|
57
|
-
"js": true,
|
|
58
|
-
"ts": true
|
|
59
|
-
},
|
|
60
|
-
"replace": {
|
|
61
|
-
"../public/": "public/"
|
|
62
|
-
},
|
|
63
|
-
"styles": [
|
|
64
|
-
"style.css",
|
|
65
|
-
"theme.css"
|
|
66
|
-
],
|
|
67
|
-
"scripts": [
|
|
68
|
-
"lib.js",
|
|
69
|
-
"script.js"
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
- `styles` (optional): array of `.css` files to concatenate and minify into a single `style.css`
|
|
75
|
-
- `scripts` (optional): array of `.js` files to concatenate and minify into a single `script.js`
|
|
76
|
-
- If omitted, fallback defaults are `style.css` and `script.js`
|
|
77
|
-
|
|
78
|
-
## 🛠 Commands
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
minimaz init <project-name> # Create a new project using global templates
|
|
82
|
-
minimaz build # Build and minify the site (uses config or defaults)
|
|
83
|
-
minimaz template <path> # Save a new template from specified path (or current dir)
|
|
84
|
-
minimaz template -l # List available templates
|
|
85
|
-
minimaz template -d <name> # Delete a saved template
|
|
86
|
-
minimaz help # Show help message
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
_All commands also work with the alias `mz`._
|
|
90
|
-
|
|
91
|
-
## 📂 Templates
|
|
92
|
-
|
|
93
|
-
Minimaz supports global templates stored in:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
~/.minimaz/templates
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
Use them to quickly initialize consistent projects across environments.
|
|
100
|
-
|
|
101
|
-
## 📄 License
|
|
102
|
-
|
|
103
|
-
MIT
|
package/dist/package.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "minimaz-cli",
|
|
3
|
-
"version": "0.1.0",
|
|
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": "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": "./bin/cli.js",
|
|
40
|
-
"mz": "./bin/cli.js"
|
|
41
|
-
}
|
|
42
|
-
}
|