Skip to content

Commit

Permalink
fix: manage lefthook with bun instead of asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
exKAZUu committed Dec 28, 2024
1 parent 70fdd2e commit 130349b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/generators/asdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ async function core(config: PackageConfig): Promise<void> {
.split('\n')
.map((line) => {
const [name, version] = line.trim().split(/\s+/);
// To move the top of the list, we need to add a space.
// To move the top of the sorted list, we need to add a space.
return `${CORE_TOOLS.has(name) ? ' ' : ''}${name} ${version}`;
})
.sort()
// Remove added spaces.
.map((line) => line.trim());
.map((line) => line.trim())
// TODO: remove the following line after lefthook is installed via npm.
.filter((line) => !line.startsWith('lefthook'));
const lines = [...new Set(duplicatableLines)];

if (config.doesContainsPoetryLock) {
Expand All @@ -48,9 +50,6 @@ async function core(config: PackageConfig): Promise<void> {
}
if (config.doesContainsPackageJson) {
if (config.isBun) {
const lefthookVersion = await getLatestVersionFromTagOnGitHub('evilmartians', 'lefthook');
if (lefthookVersion) updateVersion(lines, 'lefthook', lefthookVersion);

const bunVersion = await getLatestVersionFromTagOnGitHub('oven-sh', 'bun');
if (bunVersion) updateVersion(lines, 'bun', bunVersion);
} else {
Expand Down
1 change: 1 addition & 0 deletions src/generators/packageJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ async function core(config: PackageConfig, rootConfig: PackageConfig, skipAdding
delete jsonObj.devDependencies['husky'];
delete jsonObj.devDependencies['pinst'];
jsonObj.scripts.prepare = 'lefthook install || true';
devDependencies.push('lefthook');
} else {
// To install the latest husky
devDependencies.push('husky');
Expand Down

0 comments on commit 130349b

Please sign in to comment.