@aex.is/zero 0.1.6 → 0.1.8
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 +23 -1
- package/assets/icon.png +0 -0
- package/assets/icon.svg +4 -0
- package/assets/social.png +0 -0
- package/bin/zero-darwin-amd64 +0 -0
- package/bin/zero-darwin-arm64 +0 -0
- package/bin/zero-linux-amd64 +0 -0
- package/bin/zero-linux-arm64 +0 -0
- package/bin/zero-windows-amd64.exe +0 -0
- package/dist/cli/bubbletea.js +57 -0
- package/dist/config/base-env.js +31 -0
- package/dist/config/frameworks.js +1 -0
- package/dist/engine/assets.js +54 -0
- package/dist/engine/env.js +5 -3
- package/dist/engine/scaffold.js +59 -3
- package/dist/engine/templates.js +496 -86
- package/dist/index.js +1 -1
- package/package.json +6 -3
- package/dist/cli/prompts.js +0 -163
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aex.is/zero",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Aexis Zero scaffolding CLI",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
13
|
+
"bin",
|
|
14
|
+
"assets",
|
|
13
15
|
"README.md",
|
|
14
16
|
"LICENSE"
|
|
15
17
|
],
|
|
@@ -18,13 +20,14 @@
|
|
|
18
20
|
},
|
|
19
21
|
"scripts": {
|
|
20
22
|
"build": "node scripts/clean-dist.cjs && tsc -p tsconfig.json",
|
|
23
|
+
"build:tui": "node scripts/build-tui.cjs",
|
|
21
24
|
"dev": "bun run src/index.ts",
|
|
22
25
|
"start": "node dist/index.js",
|
|
23
|
-
"prepublishOnly": "npm run build"
|
|
26
|
+
"prepublishOnly": "npm run build:tui && npm run build"
|
|
24
27
|
},
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@clack/prompts": "^0.7.0",
|
|
27
29
|
"execa": "^8.0.1",
|
|
30
|
+
"sharp": "^0.33.5",
|
|
28
31
|
"which": "^4.0.0"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
package/dist/cli/prompts.js
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import * as p from '@clack/prompts';
|
|
2
|
-
import { frameworks } from '../config/frameworks.js';
|
|
3
|
-
import { modules } from '../config/modules.js';
|
|
4
|
-
const introArt = [
|
|
5
|
-
' _____',
|
|
6
|
-
' / ___ \\\\',
|
|
7
|
-
' / / _ \\\\ \\\\',
|
|
8
|
-
' | |/ /| |',
|
|
9
|
-
' \\\\ \\\\_/ / /',
|
|
10
|
-
' \\\\___/_/'
|
|
11
|
-
].join('\n');
|
|
12
|
-
export async function runWizard() {
|
|
13
|
-
p.intro(`${introArt}\nAexis Zero`);
|
|
14
|
-
let directory = '.';
|
|
15
|
-
let appName = '';
|
|
16
|
-
let domain = '';
|
|
17
|
-
let framework = 'nextjs';
|
|
18
|
-
let selectedModules = [];
|
|
19
|
-
let step = 'directory';
|
|
20
|
-
while (true) {
|
|
21
|
-
if (step === 'directory') {
|
|
22
|
-
const value = await p.text({
|
|
23
|
-
message: 'Project directory',
|
|
24
|
-
placeholder: '.',
|
|
25
|
-
validate: (input) => {
|
|
26
|
-
if (typeof input !== 'string') {
|
|
27
|
-
return 'Enter a directory.';
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
if (isCancelled(value))
|
|
33
|
-
return null;
|
|
34
|
-
const normalized = String(value).trim();
|
|
35
|
-
directory = normalized.length === 0 ? '.' : normalized;
|
|
36
|
-
step = 'name';
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
if (step === 'name') {
|
|
40
|
-
const value = await p.text({
|
|
41
|
-
message: 'App name',
|
|
42
|
-
placeholder: 'my-app',
|
|
43
|
-
validate: (input) => {
|
|
44
|
-
if (typeof input !== 'string' || input.trim().length === 0) {
|
|
45
|
-
return 'App name is required.';
|
|
46
|
-
}
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
if (isCancelled(value))
|
|
51
|
-
return null;
|
|
52
|
-
appName = String(value).trim();
|
|
53
|
-
step = 'domain';
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (step === 'domain') {
|
|
57
|
-
const value = await p.text({
|
|
58
|
-
message: 'Domain (optional)',
|
|
59
|
-
placeholder: 'example.com'
|
|
60
|
-
});
|
|
61
|
-
if (isCancelled(value))
|
|
62
|
-
return null;
|
|
63
|
-
domain = String(value).trim();
|
|
64
|
-
step = 'framework';
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if (step === 'framework') {
|
|
68
|
-
const value = await p.select({
|
|
69
|
-
message: 'Framework',
|
|
70
|
-
options: frameworks.map((item) => ({
|
|
71
|
-
value: item.id,
|
|
72
|
-
label: item.label,
|
|
73
|
-
hint: item.description
|
|
74
|
-
}))
|
|
75
|
-
});
|
|
76
|
-
if (isCancelled(value))
|
|
77
|
-
return null;
|
|
78
|
-
framework = value;
|
|
79
|
-
step = 'modules';
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
if (step === 'modules') {
|
|
83
|
-
const value = await p.multiselect({
|
|
84
|
-
message: 'Modules',
|
|
85
|
-
options: modules.map((item) => ({
|
|
86
|
-
value: item.id,
|
|
87
|
-
label: item.label,
|
|
88
|
-
hint: item.description
|
|
89
|
-
})),
|
|
90
|
-
required: false
|
|
91
|
-
});
|
|
92
|
-
if (isCancelled(value))
|
|
93
|
-
return null;
|
|
94
|
-
selectedModules = value;
|
|
95
|
-
step = 'confirm';
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
if (step === 'confirm') {
|
|
99
|
-
const frameworkLabel = frameworks.find((item) => item.id === framework)?.label ?? framework;
|
|
100
|
-
const moduleLabels = selectedModules
|
|
101
|
-
.map((id) => modules.find((item) => item.id === id)?.label ?? id)
|
|
102
|
-
.join(', ');
|
|
103
|
-
p.note([
|
|
104
|
-
`Directory: ${directory}`,
|
|
105
|
-
`App name: ${appName}`,
|
|
106
|
-
`Domain: ${domain || 'None'}`,
|
|
107
|
-
`Framework: ${frameworkLabel}`,
|
|
108
|
-
`Modules: ${moduleLabels || 'None'}`
|
|
109
|
-
].join('\n'), 'Review');
|
|
110
|
-
const action = await p.select({
|
|
111
|
-
message: 'Next step',
|
|
112
|
-
options: [
|
|
113
|
-
{ value: 'continue', label: 'Continue' },
|
|
114
|
-
{ value: 'edit-directory', label: 'Edit directory' },
|
|
115
|
-
{ value: 'edit-name', label: 'Edit name' },
|
|
116
|
-
{ value: 'edit-domain', label: 'Edit domain' },
|
|
117
|
-
{ value: 'edit-framework', label: 'Edit framework' },
|
|
118
|
-
{ value: 'edit-modules', label: 'Edit modules' },
|
|
119
|
-
{ value: 'cancel', label: 'Cancel' }
|
|
120
|
-
]
|
|
121
|
-
});
|
|
122
|
-
if (isCancelled(action))
|
|
123
|
-
return null;
|
|
124
|
-
switch (action) {
|
|
125
|
-
case 'continue':
|
|
126
|
-
return {
|
|
127
|
-
directory,
|
|
128
|
-
appName,
|
|
129
|
-
domain,
|
|
130
|
-
framework,
|
|
131
|
-
modules: selectedModules
|
|
132
|
-
};
|
|
133
|
-
case 'edit-directory':
|
|
134
|
-
step = 'directory';
|
|
135
|
-
continue;
|
|
136
|
-
case 'edit-name':
|
|
137
|
-
step = 'name';
|
|
138
|
-
continue;
|
|
139
|
-
case 'edit-domain':
|
|
140
|
-
step = 'domain';
|
|
141
|
-
continue;
|
|
142
|
-
case 'edit-framework':
|
|
143
|
-
step = 'framework';
|
|
144
|
-
continue;
|
|
145
|
-
case 'edit-modules':
|
|
146
|
-
step = 'modules';
|
|
147
|
-
continue;
|
|
148
|
-
case 'cancel':
|
|
149
|
-
p.cancel('Cancelled.');
|
|
150
|
-
return null;
|
|
151
|
-
default:
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function isCancelled(value) {
|
|
158
|
-
if (p.isCancel(value)) {
|
|
159
|
-
p.cancel('Cancelled.');
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
return false;
|
|
163
|
-
}
|