tackl 1.0.4 → 1.0.6
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 +44 -27
- package/package.json +1 -1
package/bin/tackl.js
CHANGED
|
@@ -25,9 +25,10 @@ const log = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const showBanner = () => {
|
|
28
|
+
const purple = str => `\x1b[38;2;128;0;255m${str}\x1b[0m`;
|
|
28
29
|
console.log(
|
|
29
30
|
pc.bold(
|
|
30
|
-
|
|
31
|
+
purple(`
|
|
31
32
|
╔═════════════════════════════════════════════════╗
|
|
32
33
|
║ ║
|
|
33
34
|
║ ████████╗ █████╗ ██████╗██╗ ██╗██╗ ║
|
|
@@ -58,13 +59,15 @@ ${pc.bold('Usage:')}
|
|
|
58
59
|
tackl [project-name] [options]
|
|
59
60
|
|
|
60
61
|
${pc.bold('Options:')}
|
|
61
|
-
--no-install Skip dependency installation
|
|
62
|
-
--no-git Skip git initialization
|
|
62
|
+
--no-install Skip dependency installation (default: install)
|
|
63
|
+
--no-git Skip git initialization (default: init)
|
|
63
64
|
-h, --help Show this help message
|
|
64
65
|
|
|
65
66
|
${pc.bold('Examples:')}
|
|
66
|
-
tackl my-app
|
|
67
|
-
tackl my-app --no-install
|
|
67
|
+
tackl my-app # Creates project with npm install + git init
|
|
68
|
+
tackl my-app --no-install # Creates project with git init only
|
|
69
|
+
tackl my-app --no-git # Creates project with npm install only
|
|
70
|
+
tackl my-app --no-install --no-git # Creates project only
|
|
68
71
|
|
|
69
72
|
${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
70
73
|
`);
|
|
@@ -76,8 +79,8 @@ ${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
|
76
79
|
const initial = {
|
|
77
80
|
name: argName,
|
|
78
81
|
ref: DEFAULT_REF, // Always use main branch
|
|
79
|
-
install: !args.includes('--no-install'),
|
|
80
|
-
git: !args.includes('--no-git'),
|
|
82
|
+
install: !args.includes('--no-install'), // Default: true (install)
|
|
83
|
+
git: !args.includes('--no-git'), // Default: true (init git)
|
|
81
84
|
};
|
|
82
85
|
|
|
83
86
|
// Filter out null prompts
|
|
@@ -92,22 +95,6 @@ ${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
|
92
95
|
? true
|
|
93
96
|
: 'Use lowercase letters, numbers, - . _',
|
|
94
97
|
},
|
|
95
|
-
{
|
|
96
|
-
type: 'toggle',
|
|
97
|
-
name: 'install',
|
|
98
|
-
message: 'Install dependencies?',
|
|
99
|
-
initial: initial.install,
|
|
100
|
-
active: 'yes',
|
|
101
|
-
inactive: 'no',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
type: 'toggle',
|
|
105
|
-
name: 'git',
|
|
106
|
-
message: 'Initialize git?',
|
|
107
|
-
initial: initial.git,
|
|
108
|
-
active: 'yes',
|
|
109
|
-
inactive: 'no',
|
|
110
|
-
},
|
|
111
98
|
].filter(q => q.type !== null);
|
|
112
99
|
|
|
113
100
|
const answers = await prompts(promptQuestions, {
|
|
@@ -122,9 +109,9 @@ ${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
|
122
109
|
});
|
|
123
110
|
|
|
124
111
|
const projectName = (answers.name || initial.name).trim();
|
|
125
|
-
const ref =
|
|
126
|
-
const doInstall =
|
|
127
|
-
const doGit =
|
|
112
|
+
const ref = initial.ref; // Always use main branch
|
|
113
|
+
const doInstall = initial.install; // Default: true
|
|
114
|
+
const doGit = initial.git; // Default: true
|
|
128
115
|
|
|
129
116
|
// Validate project name
|
|
130
117
|
if (!projectName) {
|
|
@@ -190,6 +177,15 @@ ${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
|
190
177
|
fs.rmSync(gitPath, { recursive: true, force: true });
|
|
191
178
|
} catch {}
|
|
192
179
|
|
|
180
|
+
// Remove any existing lock files to ensure npm is used
|
|
181
|
+
try {
|
|
182
|
+
const yarnLock = path.join(targetDir, 'yarn.lock');
|
|
183
|
+
const pnpmLock = path.join(targetDir, 'pnpm-lock.yaml');
|
|
184
|
+
if (fs.existsSync(yarnLock)) fs.unlinkSync(yarnLock);
|
|
185
|
+
if (fs.existsSync(pnpmLock)) fs.unlinkSync(pnpmLock);
|
|
186
|
+
log.step('🧹 Cleaned up lock files to ensure npm usage');
|
|
187
|
+
} catch {}
|
|
188
|
+
|
|
193
189
|
// Patch package name
|
|
194
190
|
log.step('📝 Updating project configuration...');
|
|
195
191
|
const pkg = path.join(targetDir, 'package.json');
|
|
@@ -204,10 +200,23 @@ ${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
|
204
200
|
}
|
|
205
201
|
}
|
|
206
202
|
|
|
203
|
+
// Create .npmrc to ensure npm is used
|
|
204
|
+
try {
|
|
205
|
+
const npmrcPath = path.join(targetDir, '.npmrc');
|
|
206
|
+
fs.writeFileSync(npmrcPath, 'package-lock=true\n');
|
|
207
|
+
log.step('📝 Created .npmrc to ensure npm usage');
|
|
208
|
+
} catch (e) {
|
|
209
|
+
log.warn(`Could not create .npmrc: ${e.message}`);
|
|
210
|
+
}
|
|
211
|
+
|
|
207
212
|
if (doGit) {
|
|
208
213
|
try {
|
|
209
214
|
log.step('🔧 Initializing git repository...');
|
|
210
215
|
execSync('git init', { cwd: targetDir, stdio: 'ignore' });
|
|
216
|
+
|
|
217
|
+
// Set default branch to main (not master)
|
|
218
|
+
execSync('git branch -M main', { cwd: targetDir, stdio: 'ignore' });
|
|
219
|
+
|
|
211
220
|
execSync('git add -A', { cwd: targetDir, stdio: 'ignore' });
|
|
212
221
|
execSync('git commit -m "chore: scaffold with tackl"', {
|
|
213
222
|
cwd: targetDir,
|
|
@@ -222,7 +231,16 @@ ${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
|
222
231
|
if (doInstall) {
|
|
223
232
|
try {
|
|
224
233
|
log.step('📦 Installing dependencies with npm...');
|
|
234
|
+
|
|
235
|
+
// Disable Husky during installation to prevent Git issues
|
|
236
|
+
const originalEnv = { ...process.env };
|
|
237
|
+
process.env.HUSKY = '0';
|
|
238
|
+
|
|
225
239
|
execSync('npm install', { cwd: targetDir, stdio: 'inherit' });
|
|
240
|
+
|
|
241
|
+
// Restore environment
|
|
242
|
+
process.env = originalEnv;
|
|
243
|
+
|
|
226
244
|
log.ok('Dependencies installed successfully!');
|
|
227
245
|
} catch (e) {
|
|
228
246
|
log.warn(`Install failed: ${e.message}`);
|
|
@@ -241,7 +259,6 @@ ${pc.bold('Repository:')} https://github.com/12-studio/tackl
|
|
|
241
259
|
console.log(` ${doInstall ? '2' : '3'}) npm run dev`);
|
|
242
260
|
}
|
|
243
261
|
|
|
244
|
-
|
|
245
262
|
main().catch(e => {
|
|
246
263
|
console.error(e);
|
|
247
264
|
process.exit(1);
|