@maizzle/framework 6.0.0-rc.0 → 6.0.0-rc.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/bin/maizzle.mjs +1 -1
- package/dist/build.mjs +25 -7
- package/dist/build.mjs.map +1 -1
- package/dist/config/index.mjs +25 -1
- package/dist/config/index.mjs.map +1 -1
- package/dist/render/createRenderer.d.mts +4 -0
- package/dist/render/createRenderer.d.mts.map +1 -1
- package/dist/render/createRenderer.mjs +10 -4
- package/dist/render/createRenderer.mjs.map +1 -1
- package/dist/render/index.mjs +5 -1
- package/dist/render/index.mjs.map +1 -1
- package/dist/serve.mjs +4 -1
- package/dist/serve.mjs.map +1 -1
- package/dist/types/config.d.mts +20 -0
- package/dist/types/config.d.mts.map +1 -1
- package/node_modules/@clack/core/CHANGELOG.md +87 -4
- package/node_modules/@clack/core/README.md +1 -1
- package/node_modules/@clack/core/dist/index.d.mts +186 -48
- package/node_modules/@clack/core/dist/index.mjs +10 -14
- package/node_modules/@clack/core/dist/index.mjs.map +1 -1
- package/node_modules/@clack/core/package.json +7 -9
- package/node_modules/@clack/prompts/CHANGELOG.md +171 -7
- package/node_modules/@clack/prompts/README.md +66 -3
- package/node_modules/@clack/prompts/dist/index.d.mts +302 -76
- package/node_modules/@clack/prompts/dist/index.mjs +134 -84
- package/node_modules/@clack/prompts/dist/index.mjs.map +1 -1
- package/node_modules/@clack/prompts/package.json +14 -10
- package/node_modules/citty/LICENSE +0 -15
- package/node_modules/citty/README.md +166 -69
- package/node_modules/citty/dist/index.d.mts +88 -56
- package/node_modules/citty/dist/index.mjs +399 -437
- package/node_modules/citty/package.json +28 -35
- package/node_modules/giget/README.md +59 -11
- package/node_modules/giget/dist/THIRD-PARTY-LICENSES.md +205 -0
- package/node_modules/giget/dist/_chunks/giget.mjs +508 -0
- package/node_modules/giget/dist/_chunks/libs/citty.mjs +269 -0
- package/node_modules/giget/dist/_chunks/libs/nypm.d.mts +1 -0
- package/node_modules/giget/dist/_chunks/libs/nypm.mjs +669 -0
- package/node_modules/giget/dist/_chunks/libs/tar.mjs +2931 -0
- package/node_modules/giget/dist/_chunks/rolldown-runtime.mjs +14 -0
- package/node_modules/giget/dist/cli.d.mts +1 -0
- package/node_modules/giget/dist/cli.mjs +89 -111
- package/node_modules/giget/dist/index.d.mts +46 -35
- package/node_modules/giget/dist/index.mjs +2 -22
- package/node_modules/giget/package.json +32 -45
- package/node_modules/maizzle/README.md +140 -0
- package/node_modules/maizzle/bin/maizzle.mjs +5 -0
- package/node_modules/maizzle/dist/commands/new.d.mts +7 -0
- package/node_modules/maizzle/dist/commands/new.mjs +278 -0
- package/node_modules/{@maizzle/cli → maizzle}/dist/index.d.mts +1 -1
- package/node_modules/maizzle/dist/index.mjs +44 -0
- package/node_modules/{commander → maizzle/node_modules/commander}/Readme.md +94 -67
- package/node_modules/{commander → maizzle/node_modules/commander}/lib/argument.js +5 -4
- package/node_modules/{commander → maizzle/node_modules/commander}/lib/command.js +154 -39
- package/node_modules/{commander → maizzle/node_modules/commander}/lib/help.js +77 -39
- package/node_modules/{commander → maizzle/node_modules/commander}/lib/option.js +16 -3
- package/node_modules/{commander → maizzle/node_modules/commander}/package-support.json +4 -1
- package/node_modules/{commander → maizzle/node_modules/commander}/package.json +8 -8
- package/node_modules/{commander → maizzle/node_modules/commander}/typings/index.d.ts +71 -3
- package/node_modules/{@maizzle/cli → maizzle}/package.json +13 -11
- package/node_modules/tinyexec/README.md +49 -3
- package/node_modules/tinyexec/dist/main.d.mts +25 -14
- package/node_modules/tinyexec/dist/main.mjs +148 -100
- package/node_modules/tinyexec/package.json +9 -8
- package/package.json +3 -3
- package/node_modules/@clack/core/dist/index.cjs +0 -15
- package/node_modules/@clack/core/dist/index.cjs.map +0 -1
- package/node_modules/@clack/core/dist/index.d.cts +0 -211
- package/node_modules/@clack/core/dist/index.d.ts +0 -211
- package/node_modules/@clack/prompts/dist/index.cjs +0 -87
- package/node_modules/@clack/prompts/dist/index.cjs.map +0 -1
- package/node_modules/@clack/prompts/dist/index.d.cts +0 -165
- package/node_modules/@clack/prompts/dist/index.d.ts +0 -165
- package/node_modules/@maizzle/cli/README.md +0 -58
- package/node_modules/@maizzle/cli/dist/index.mjs +0 -42
- package/node_modules/citty/dist/index.cjs +0 -475
- package/node_modules/citty/dist/index.d.cts +0 -80
- package/node_modules/citty/dist/index.d.ts +0 -80
- package/node_modules/consola/LICENSE +0 -47
- package/node_modules/consola/README.md +0 -352
- package/node_modules/consola/basic.d.ts +0 -1
- package/node_modules/consola/browser.d.ts +0 -1
- package/node_modules/consola/core.d.ts +0 -1
- package/node_modules/consola/dist/basic.cjs +0 -32
- package/node_modules/consola/dist/basic.d.cts +0 -23
- package/node_modules/consola/dist/basic.d.mts +0 -21
- package/node_modules/consola/dist/basic.d.ts +0 -23
- package/node_modules/consola/dist/basic.mjs +0 -24
- package/node_modules/consola/dist/browser.cjs +0 -84
- package/node_modules/consola/dist/browser.d.cts +0 -23
- package/node_modules/consola/dist/browser.d.mts +0 -21
- package/node_modules/consola/dist/browser.d.ts +0 -23
- package/node_modules/consola/dist/browser.mjs +0 -76
- package/node_modules/consola/dist/chunks/prompt.cjs +0 -288
- package/node_modules/consola/dist/chunks/prompt.mjs +0 -280
- package/node_modules/consola/dist/core.cjs +0 -517
- package/node_modules/consola/dist/core.d.cts +0 -459
- package/node_modules/consola/dist/core.d.mts +0 -459
- package/node_modules/consola/dist/core.d.ts +0 -459
- package/node_modules/consola/dist/core.mjs +0 -512
- package/node_modules/consola/dist/index.cjs +0 -663
- package/node_modules/consola/dist/index.d.cts +0 -24
- package/node_modules/consola/dist/index.d.mts +0 -22
- package/node_modules/consola/dist/index.d.ts +0 -24
- package/node_modules/consola/dist/index.mjs +0 -651
- package/node_modules/consola/dist/shared/consola.DCGIlDNP.cjs +0 -75
- package/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +0 -72
- package/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +0 -288
- package/node_modules/consola/dist/shared/consola.DwRq1yyg.cjs +0 -312
- package/node_modules/consola/dist/utils.cjs +0 -64
- package/node_modules/consola/dist/utils.d.cts +0 -286
- package/node_modules/consola/dist/utils.d.mts +0 -286
- package/node_modules/consola/dist/utils.d.ts +0 -286
- package/node_modules/consola/dist/utils.mjs +0 -54
- package/node_modules/consola/lib/index.cjs +0 -10
- package/node_modules/consola/package.json +0 -136
- package/node_modules/consola/utils.d.ts +0 -1
- package/node_modules/create-maizzle/README.md +0 -86
- package/node_modules/create-maizzle/bin/create-maizzle.mjs +0 -4
- package/node_modules/create-maizzle/node_modules/@clack/core/CHANGELOG.md +0 -340
- package/node_modules/create-maizzle/node_modules/@clack/core/LICENSE +0 -9
- package/node_modules/create-maizzle/node_modules/@clack/core/README.md +0 -22
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.d.mts +0 -349
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.mjs +0 -11
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.mjs.map +0 -1
- package/node_modules/create-maizzle/node_modules/@clack/core/package.json +0 -60
- package/node_modules/create-maizzle/node_modules/@clack/prompts/CHANGELOG.md +0 -576
- package/node_modules/create-maizzle/node_modules/@clack/prompts/LICENSE +0 -9
- package/node_modules/create-maizzle/node_modules/@clack/prompts/README.md +0 -270
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.d.mts +0 -391
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.mjs +0 -137
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.mjs.map +0 -1
- package/node_modules/create-maizzle/node_modules/@clack/prompts/package.json +0 -65
- package/node_modules/create-maizzle/package.json +0 -47
- package/node_modules/create-maizzle/src/index.js +0 -242
- package/node_modules/defu/LICENSE +0 -21
- package/node_modules/defu/README.md +0 -171
- package/node_modules/defu/dist/defu.cjs +0 -77
- package/node_modules/defu/dist/defu.d.cts +0 -31
- package/node_modules/defu/dist/defu.d.mts +0 -29
- package/node_modules/defu/dist/defu.d.ts +0 -31
- package/node_modules/defu/dist/defu.mjs +0 -69
- package/node_modules/defu/lib/defu.cjs +0 -10
- package/node_modules/defu/lib/defu.d.cts +0 -12
- package/node_modules/defu/package.json +0 -48
- package/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +0 -468
- package/node_modules/node-fetch-native/LICENSE +0 -114
- package/node_modules/node-fetch-native/README.md +0 -225
- package/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +0 -2
- package/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +0 -2
- package/node_modules/node-fetch-native/dist/index.cjs +0 -1
- package/node_modules/node-fetch-native/dist/index.mjs +0 -1
- package/node_modules/node-fetch-native/dist/native.cjs +0 -1
- package/node_modules/node-fetch-native/dist/native.mjs +0 -1
- package/node_modules/node-fetch-native/dist/node.cjs +0 -19
- package/node_modules/node-fetch-native/dist/node.mjs +0 -19
- package/node_modules/node-fetch-native/dist/polyfill.cjs +0 -1
- package/node_modules/node-fetch-native/dist/polyfill.mjs +0 -1
- package/node_modules/node-fetch-native/dist/proxy-stub.cjs +0 -1
- package/node_modules/node-fetch-native/dist/proxy-stub.mjs +0 -1
- package/node_modules/node-fetch-native/dist/proxy.cjs +0 -58
- package/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs +0 -1
- package/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs +0 -1
- package/node_modules/node-fetch-native/index.d.ts +0 -1
- package/node_modules/node-fetch-native/lib/empty.cjs +0 -0
- package/node_modules/node-fetch-native/lib/empty.mjs +0 -0
- package/node_modules/node-fetch-native/lib/index.cjs +0 -11
- package/node_modules/node-fetch-native/lib/index.d.cts +0 -10
- package/node_modules/node-fetch-native/lib/index.d.mts +0 -10
- package/node_modules/node-fetch-native/lib/index.d.ts +0 -10
- package/node_modules/node-fetch-native/lib/native.cjs +0 -11
- package/node_modules/node-fetch-native/lib/polyfill.d.cts +0 -1
- package/node_modules/node-fetch-native/lib/polyfill.d.mts +0 -1
- package/node_modules/node-fetch-native/lib/polyfill.d.ts +0 -1
- package/node_modules/node-fetch-native/lib/proxy.d.ts +0 -32
- package/node_modules/node-fetch-native/node.d.ts +0 -1
- package/node_modules/node-fetch-native/package.json +0 -138
- package/node_modules/node-fetch-native/polyfill.d.ts +0 -1
- package/node_modules/node-fetch-native/proxy.d.ts +0 -1
- package/node_modules/nypm/node_modules/citty/LICENSE +0 -21
- package/node_modules/nypm/node_modules/citty/README.md +0 -231
- package/node_modules/nypm/node_modules/citty/dist/index.d.mts +0 -112
- package/node_modules/nypm/node_modules/citty/dist/index.mjs +0 -425
- package/node_modules/nypm/node_modules/citty/package.json +0 -42
- /package/node_modules/{nypm/node_modules/citty → citty}/dist/THIRD-PARTY-LICENSES.md +0 -0
- /package/node_modules/{nypm/node_modules/citty → citty}/dist/_chunks/libs/scule.mjs +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/LICENSE +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/component.d.mts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/component.mjs +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/config.d.mts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/config.mjs +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/layout.d.mts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/layout.mjs +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/scaffold.d.mts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/scaffold.mjs +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/stubs/component.vue +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/stubs/config.ts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/stubs/layout.vue +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/stubs/template.vue +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/template.d.mts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/template.mjs +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/LICENSE +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/esm.mjs +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/index.js +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/lib/error.js +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/lib/suggestSimilar.js +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/typings/esm.d.mts +0 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { downloadTemplate } from "giget";
|
|
2
|
+
import color from "picocolors";
|
|
3
|
+
import * as p from "@clack/prompts";
|
|
4
|
+
import { rm } from "node:fs/promises";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { execFileSync } from "node:child_process";
|
|
7
|
+
import { detectPackageManager, installDependencies } from "nypm";
|
|
8
|
+
//#region src/commands/new.ts
|
|
9
|
+
const starters = [
|
|
10
|
+
{
|
|
11
|
+
label: "Default",
|
|
12
|
+
value: "maizzle/maizzle",
|
|
13
|
+
path: "gh:maizzle/maizzle#master"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "v4.x",
|
|
17
|
+
value: "maizzle/starter-v4",
|
|
18
|
+
path: "gh:maizzle/starter-v4#master"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "API",
|
|
22
|
+
value: "maizzle/starter-api",
|
|
23
|
+
path: "gh:maizzle/starter-api#main"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "AMP4Email",
|
|
27
|
+
value: "maizzle/starter-amp4email",
|
|
28
|
+
path: "gh:maizzle/starter-amp4email#master"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "Liquid",
|
|
32
|
+
value: "maizzle/starter-liquid",
|
|
33
|
+
path: "gh:maizzle/starter-liquid#master"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "Mailchimp",
|
|
37
|
+
value: "maizzle/starter-mailchimp",
|
|
38
|
+
path: "gh:maizzle/starter-mailchimp#main"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: "Markdown",
|
|
42
|
+
value: "maizzle/starter-markdown",
|
|
43
|
+
path: "gh:maizzle/starter-markdown#main"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: "RSS",
|
|
47
|
+
value: "maizzle/starter-rss",
|
|
48
|
+
path: "gh:maizzle/starter-rss#master"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "WordPress API",
|
|
52
|
+
value: "maizzle/starter-wordpress-api",
|
|
53
|
+
path: "gh:maizzle/starter-wordpress-api#master"
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
function renderHeader() {
|
|
57
|
+
const lines = [
|
|
58
|
+
" ███╗ ███╗ █████╗ ██╗ ███████╗ ███████╗ ██╗ ███████╗",
|
|
59
|
+
" ████╗ ████║ ██╔══██╗ ██║ ╚══███╔╝ ╚══███╔╝ ██║ ██╔════╝",
|
|
60
|
+
" ██╔████╔██║ ███████║ ██║ ███╔╝ ███╔╝ ██║ █████╗ ",
|
|
61
|
+
" ██║╚██╔╝██║ ██╔══██║ ██║ ███╔╝ ███╔╝ ██║ ██╔══╝ ",
|
|
62
|
+
" ██║ ╚═╝ ██║ ██║ ██║ ██║ ███████╗ ███████╗ ███████╗ ███████╗",
|
|
63
|
+
" ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝ ╚══════╝ ╚══════╝"
|
|
64
|
+
];
|
|
65
|
+
const gradients = {
|
|
66
|
+
Aurora: [
|
|
67
|
+
51,
|
|
68
|
+
50,
|
|
69
|
+
49,
|
|
70
|
+
48,
|
|
71
|
+
47,
|
|
72
|
+
41
|
|
73
|
+
],
|
|
74
|
+
Cyberpunk: [
|
|
75
|
+
201,
|
|
76
|
+
165,
|
|
77
|
+
129,
|
|
78
|
+
93,
|
|
79
|
+
57,
|
|
80
|
+
21
|
|
81
|
+
],
|
|
82
|
+
Ember: [
|
|
83
|
+
227,
|
|
84
|
+
221,
|
|
85
|
+
215,
|
|
86
|
+
209,
|
|
87
|
+
203,
|
|
88
|
+
197
|
|
89
|
+
],
|
|
90
|
+
Rose: [
|
|
91
|
+
213,
|
|
92
|
+
212,
|
|
93
|
+
211,
|
|
94
|
+
210,
|
|
95
|
+
209,
|
|
96
|
+
203
|
|
97
|
+
],
|
|
98
|
+
Lavender: [
|
|
99
|
+
183,
|
|
100
|
+
177,
|
|
101
|
+
171,
|
|
102
|
+
135,
|
|
103
|
+
99,
|
|
104
|
+
63
|
|
105
|
+
],
|
|
106
|
+
Mint: [
|
|
107
|
+
122,
|
|
108
|
+
121,
|
|
109
|
+
120,
|
|
110
|
+
119,
|
|
111
|
+
85,
|
|
112
|
+
84
|
|
113
|
+
],
|
|
114
|
+
Ocean: [
|
|
115
|
+
51,
|
|
116
|
+
45,
|
|
117
|
+
39,
|
|
118
|
+
33,
|
|
119
|
+
27,
|
|
120
|
+
26
|
|
121
|
+
],
|
|
122
|
+
Sunset: [
|
|
123
|
+
214,
|
|
124
|
+
208,
|
|
125
|
+
202,
|
|
126
|
+
196,
|
|
127
|
+
160,
|
|
128
|
+
124
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
const names = Object.keys(gradients);
|
|
132
|
+
const gradient = gradients[names[Math.floor(Math.random() * names.length)]];
|
|
133
|
+
console.log("");
|
|
134
|
+
for (let i = 0; i < lines.length; i++) {
|
|
135
|
+
const c = gradient[i];
|
|
136
|
+
console.log(`\x1b[38;5;${c}m${lines[i]}\x1b[0m`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async function newProject(starterArg, dirArg, options = {}) {
|
|
140
|
+
let project;
|
|
141
|
+
if (starterArg) {
|
|
142
|
+
const dirInput = dirArg || `./${starterArg.split("/").pop().replace(".git", "")}`;
|
|
143
|
+
if (existsSync(dirInput)) {
|
|
144
|
+
console.error(`Error: directory ${dirInput} already exists.`);
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
project = {
|
|
148
|
+
starter: starterArg,
|
|
149
|
+
path: dirInput,
|
|
150
|
+
install: options.install ?? false,
|
|
151
|
+
pm: options.pm || "npm"
|
|
152
|
+
};
|
|
153
|
+
} else {
|
|
154
|
+
console.clear();
|
|
155
|
+
renderHeader();
|
|
156
|
+
console.log(`\n${color.dim("Quickly build HTML emails with Tailwind CSS.")}\n`);
|
|
157
|
+
console.log(`Docs: https://maizzle.com \nGitHub: https://github.com/maizzle\n`);
|
|
158
|
+
p.intro(`${color.bgBlack(color.white(" maizzle new "))}`);
|
|
159
|
+
project = await p.group({
|
|
160
|
+
path: () => p.text({
|
|
161
|
+
message: "Where should we create your project?",
|
|
162
|
+
placeholder: "./maizzle",
|
|
163
|
+
validate: (value) => {
|
|
164
|
+
if (!value) return "Please enter a path.";
|
|
165
|
+
if (value[0] !== ".") return "Please enter a relative path.";
|
|
166
|
+
if (existsSync(value)) return "That directory already exists. Please enter a different path.";
|
|
167
|
+
}
|
|
168
|
+
}),
|
|
169
|
+
starter: async () => {
|
|
170
|
+
const starter = await p.select({
|
|
171
|
+
message: "Select a Starter",
|
|
172
|
+
initialValue: "maizzle/maizzle",
|
|
173
|
+
options: [
|
|
174
|
+
{
|
|
175
|
+
value: "maizzle/maizzle",
|
|
176
|
+
label: "Default"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
value: "custom",
|
|
180
|
+
label: "Custom"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
value: "maizzle6-beta",
|
|
184
|
+
label: "Maizzle 6 (beta)"
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
if (starter === "maizzle6-beta") return "maizzle/maizzle#next";
|
|
189
|
+
if (starter === "custom") {
|
|
190
|
+
const customStarter = await p.select({
|
|
191
|
+
message: "Select a custom Starter",
|
|
192
|
+
initialValue: "maizzle/maizzle",
|
|
193
|
+
options: [...starters, {
|
|
194
|
+
value: "git",
|
|
195
|
+
label: "Git",
|
|
196
|
+
hint: "user/repo"
|
|
197
|
+
}]
|
|
198
|
+
});
|
|
199
|
+
if (customStarter === "git") return p.text({
|
|
200
|
+
message: "Enter a `user/repo` path or a full Git repository URL.",
|
|
201
|
+
validate: (value) => {
|
|
202
|
+
if (!value) return "Please enter a value.";
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
return customStarter;
|
|
206
|
+
}
|
|
207
|
+
return starter;
|
|
208
|
+
},
|
|
209
|
+
install: () => p.confirm({
|
|
210
|
+
message: "Install dependencies?",
|
|
211
|
+
initialValue: true
|
|
212
|
+
}),
|
|
213
|
+
pm: async ({ results }) => {
|
|
214
|
+
if (!results.install) return "npm";
|
|
215
|
+
const detected = await detectPackageManager(process.cwd()).catch(() => null);
|
|
216
|
+
return p.select({
|
|
217
|
+
message: "Select a package manager",
|
|
218
|
+
initialValue: detected?.name || "npm",
|
|
219
|
+
options: [
|
|
220
|
+
{
|
|
221
|
+
value: "npm",
|
|
222
|
+
label: "npm"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
value: "pnpm",
|
|
226
|
+
label: "pnpm"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
value: "yarn",
|
|
230
|
+
label: "yarn"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
value: "bun",
|
|
234
|
+
label: "bun"
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}, { onCancel: () => {
|
|
240
|
+
p.cancel("💀");
|
|
241
|
+
process.exit(0);
|
|
242
|
+
} });
|
|
243
|
+
}
|
|
244
|
+
const spinner = p.spinner();
|
|
245
|
+
spinner.start("Creating project");
|
|
246
|
+
const starter = starters.find((s) => s.value === project.starter);
|
|
247
|
+
const source = starter ? starter.path : project.starter;
|
|
248
|
+
await downloadTemplate(source.includes(":") ? source : `gh:${source}`, { dir: project.path });
|
|
249
|
+
await rm(`${project.path}/.github`, {
|
|
250
|
+
recursive: true,
|
|
251
|
+
force: true
|
|
252
|
+
});
|
|
253
|
+
spinner.stop(`Created project in ${project.path}`);
|
|
254
|
+
if (project.install) {
|
|
255
|
+
try {
|
|
256
|
+
execFileSync(project.pm, ["--version"], { stdio: "ignore" });
|
|
257
|
+
} catch {
|
|
258
|
+
p.log.error(`${project.pm} is not installed. Please install it first.`);
|
|
259
|
+
process.exit(1);
|
|
260
|
+
}
|
|
261
|
+
spinner.start("Installing dependencies");
|
|
262
|
+
const startTime = Date.now();
|
|
263
|
+
await installDependencies({
|
|
264
|
+
cwd: project.path,
|
|
265
|
+
silent: true,
|
|
266
|
+
packageManager: project.pm
|
|
267
|
+
});
|
|
268
|
+
spinner.stop(`Installed dependencies ${color.gray((Date.now() - startTime) / 1e3 + "s")}`);
|
|
269
|
+
}
|
|
270
|
+
const pm = project.pm || "npm";
|
|
271
|
+
const runCmd = pm === "yarn" ? "yarn dev" : `${pm} run dev`;
|
|
272
|
+
const nextSteps = `cd ${project.path} \n\n${project.install ? "" : `${pm} install\n\n`}${runCmd}`;
|
|
273
|
+
p.note(nextSteps, "Next steps:");
|
|
274
|
+
p.outro(`Documentation: https://maizzle.com/docs \n\n Components: https://mailviews.com`);
|
|
275
|
+
process.exit(0);
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
export { newProject as default };
|
|
@@ -3,6 +3,6 @@ interface Framework {
|
|
|
3
3
|
serve: (options?: any) => Promise<any>;
|
|
4
4
|
build: (options?: any) => Promise<any>;
|
|
5
5
|
}
|
|
6
|
-
declare function bootstrap(framework
|
|
6
|
+
declare function bootstrap(framework?: Framework): Promise<void>;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { bootstrap as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import newProject from "./commands/new.mjs";
|
|
2
|
+
import makeConfig from "./commands/make/config.mjs";
|
|
3
|
+
import makeLayout from "./commands/make/layout.mjs";
|
|
4
|
+
import makeTemplate from "./commands/make/template.mjs";
|
|
5
|
+
import makeComponent from "./commands/make/component.mjs";
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
//#region src/index.ts
|
|
8
|
+
async function bootstrap(framework) {
|
|
9
|
+
const program = new Command();
|
|
10
|
+
program.name("maizzle").description("Maizzle CLI").version("1.0.0");
|
|
11
|
+
if (framework) {
|
|
12
|
+
program.command("serve").description("Start the Maizzle dev server with HMR").option("-c, --config <path>", "Path to maizzle config file").option("-p, --port <number>", "Dev server port").option("--host [address]", "Expose on network").action(async (options) => {
|
|
13
|
+
await framework.serve({
|
|
14
|
+
config: options.config,
|
|
15
|
+
port: options.port ? parseInt(options.port, 10) : void 0,
|
|
16
|
+
host: options.host
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
program.command("build").description("Build email templates to HTML").option("-c, --config <path>", "Path to maizzle config file").option("-o, --output <path>", "Output directory").action(async (options) => {
|
|
20
|
+
await framework.build({
|
|
21
|
+
config: options.config,
|
|
22
|
+
output: options.output
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
program.command("new [starter] [directory]").description("Create a new Maizzle project").option("-i, --install", "Install dependencies").option("--pm <manager>", "Package manager to use").action(async (starter, directory, options) => {
|
|
27
|
+
await newProject(starter, directory, options);
|
|
28
|
+
});
|
|
29
|
+
program.command("make:config [name]").description("Create a new config file").action(async (name) => {
|
|
30
|
+
await makeConfig(name);
|
|
31
|
+
});
|
|
32
|
+
program.command("make:layout [filepath]").description("Create a new layout").action(async (filepath) => {
|
|
33
|
+
await makeLayout(filepath);
|
|
34
|
+
});
|
|
35
|
+
program.command("make:template [filepath]").description("Create a new template").action(async (filepath) => {
|
|
36
|
+
await makeTemplate(filepath);
|
|
37
|
+
});
|
|
38
|
+
program.command("make:component [filepath]").description("Create a new component").action(async (filepath) => {
|
|
39
|
+
await makeComponent(filepath);
|
|
40
|
+
});
|
|
41
|
+
await program.parseAsync(process.argv);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { bootstrap as default };
|