tackl 1.0.1 → 1.0.3
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/tackl.js +20 -34
- package/package.json +1 -1
package/bin/tackl.js
CHANGED
|
@@ -28,19 +28,19 @@ const showBanner = () => {
|
|
|
28
28
|
console.log(
|
|
29
29
|
pc.bold(
|
|
30
30
|
pc.cyan(`
|
|
31
|
-
|
|
32
|
-
║
|
|
33
|
-
║ ████████╗ █████╗ ██████╗██╗ ██╗██╗
|
|
34
|
-
║ ╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝██║
|
|
35
|
-
║ ██║ ███████║██║ █████╔╝ ██║
|
|
36
|
-
║ ██║ ██╔══██║██║ ██╔═██╗ ██║
|
|
37
|
-
║ ██║ ██║ ██║╚██████╗██║ ██╗███████╗
|
|
38
|
-
║ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝
|
|
39
|
-
║
|
|
40
|
-
║
|
|
41
|
-
║
|
|
42
|
-
║
|
|
43
|
-
|
|
31
|
+
╔═════════════════════════════════════════════════╗
|
|
32
|
+
║ ║
|
|
33
|
+
║ ████████╗ █████╗ ██████╗██╗ ██╗██╗ ║
|
|
34
|
+
║ ╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝██║ ║
|
|
35
|
+
║ ██║ ███████║██║ █████╔╝ ██║ ║
|
|
36
|
+
║ ██║ ██╔══██║██║ ██╔═██╗ ██║ ║
|
|
37
|
+
║ ██║ ██║ ██║╚██████╗██║ ██╗███████╗ ║
|
|
38
|
+
║ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ║
|
|
39
|
+
║ ║
|
|
40
|
+
║ The Ultimate Next.js Starter Kit ║
|
|
41
|
+
║ with Waffl Grid System ║
|
|
42
|
+
║ ║
|
|
43
|
+
╚═════════════════════════════════════════════════╝
|
|
44
44
|
`)
|
|
45
45
|
)
|
|
46
46
|
);
|
|
@@ -58,14 +58,12 @@ ${pc.bold('Usage:')}
|
|
|
58
58
|
tackl [project-name] [options]
|
|
59
59
|
|
|
60
60
|
${pc.bold('Options:')}
|
|
61
|
-
--ref <branch> Template ref (branch or tag) (default: main)
|
|
62
61
|
--no-install Skip dependency installation
|
|
63
62
|
--no-git Skip git initialization
|
|
64
63
|
-h, --help Show this help message
|
|
65
64
|
|
|
66
65
|
${pc.bold('Examples:')}
|
|
67
66
|
tackl my-app
|
|
68
|
-
tackl my-app --ref develop
|
|
69
67
|
tackl my-app --no-install --no-git
|
|
70
68
|
|
|
71
69
|
${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
@@ -74,16 +72,10 @@ ${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
const argName = args.find(a => !a.startsWith('-'));
|
|
77
|
-
const getFlagVal = (key, fallback) => {
|
|
78
|
-
const idx = args.findIndex(a => a === key);
|
|
79
|
-
return idx >= 0 && args[idx + 1] && !args[idx + 1].startsWith('-')
|
|
80
|
-
? args[idx + 1]
|
|
81
|
-
: fallback;
|
|
82
|
-
};
|
|
83
75
|
|
|
84
76
|
const initial = {
|
|
85
77
|
name: argName,
|
|
86
|
-
ref:
|
|
78
|
+
ref: DEFAULT_REF, // Always use main branch
|
|
87
79
|
install: !args.includes('--no-install'),
|
|
88
80
|
git: !args.includes('--no-git'),
|
|
89
81
|
};
|
|
@@ -100,12 +92,6 @@ ${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
|
100
92
|
? true
|
|
101
93
|
: 'Use lowercase letters, numbers, - . _',
|
|
102
94
|
},
|
|
103
|
-
{
|
|
104
|
-
type: 'text',
|
|
105
|
-
name: 'ref',
|
|
106
|
-
message: 'Template ref (branch or tag)',
|
|
107
|
-
initial: initial.ref,
|
|
108
|
-
},
|
|
109
95
|
{
|
|
110
96
|
type: 'toggle',
|
|
111
97
|
name: 'install',
|
|
@@ -170,12 +156,12 @@ ${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
|
170
156
|
const res = await fetch(tarUrl);
|
|
171
157
|
if (!res.ok)
|
|
172
158
|
throw new Error(`Download failed: ${res.status} ${res.statusText}`);
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
159
|
+
|
|
160
|
+
// Convert response to buffer and write to file
|
|
161
|
+
const arrayBuffer = await res.arrayBuffer();
|
|
162
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
163
|
+
fs.writeFileSync(tmpTar, buffer);
|
|
164
|
+
|
|
179
165
|
log.ok('Template downloaded successfully!');
|
|
180
166
|
} catch (e) {
|
|
181
167
|
log.error(`Download failed: ${e.message}`);
|