Skip to content

Commit

Permalink
style(shell): add trailing newlines (typicode#870)
Browse files Browse the repository at this point in the history
Adds trailing newlines to files generated by the `install` and `add` commands.
  • Loading branch information
valtlai authored and nikoladavitkovski committed Sep 2, 2022
1 parent f82187b commit cbf29bd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .husky/.gitignore
@@ -1 +1 @@
_
_
2 changes: 1 addition & 1 deletion src/commands/add.ts
Expand Up @@ -15,7 +15,7 @@ function createHookFile(file: string, cmd: string) {
throw new Error(`${file} already exists`)
}

const data = ['#!/bin/sh', '. "$(dirname "$0")/_/husky.sh"', '', cmd].join(
const data = ['#!/bin/sh', '. "$(dirname "$0")/_/husky.sh"', '', cmd, ''].join(
'\n'
)

Expand Down
2 changes: 1 addition & 1 deletion src/commands/install.ts
Expand Up @@ -26,7 +26,7 @@ export function install(dir = '.husky'): void {
fs.mkdirSync(path.join(dir, '_'), { recursive: true })

// Create .husky/.gitignore
fs.writeFileSync(path.join(dir, '.gitignore'), '_', 'utf-8')
fs.writeFileSync(path.join(dir, '.gitignore'), '_\n', 'utf-8')

// Copy husky.sh to .husky/_/husky.sh
fs.copyFileSync(
Expand Down

0 comments on commit cbf29bd

Please sign in to comment.