Skip to content

Commit

Permalink
Set up "repo-tools" project to register Git hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
octogonz committed Feb 16, 2024
1 parent 1936727 commit feb112b
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 13 deletions.
91 changes: 91 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#-------------------------------------------------------------------------------------------------------------------
# Keep this section in sync with .gitignore
#-------------------------------------------------------------------------------------------------------------------

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# OS X temporary files
.DS_Store

# IntelliJ IDEA project files; if you want to commit IntelliJ settings, this recipe may be helpful:
# https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
.idea/
*.iml

# Heft temporary files
.heft

# build result
build
lib
temp
dist
build_*

#-------------------------------------------------------------------------------------------------------------------
# Prettier-specific overrides
#-------------------------------------------------------------------------------------------------------------------

# Machine-egnerated files
CHANGELOG.*
pnpm-lock.yaml
dist-dev
dist-prod

# We'll consider enabling this later; Prettier reformats code blocks, which affects end-user content
*.md
13 changes: 13 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Documentation for this file: https://prettier.io/docs/en/configuration.html
module.exports = {
// We use a larger print width because Prettier's word-wrapping seems to be tuned
// for plain JavaScript without type annotations
printWidth: 110,
// Microsoft style quotes
singleQuote: true,
// Preserve existing newlines
endOfLine: 'auto',
// For ES5, trailing commas cannot be used in function parameters; it is counterintuitive
// to use them for arrays only
trailingComma: 'none'
};
3 changes: 2 additions & 1 deletion packages/pnpm-sync-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@types/heft-jest": "1.0.6",
"@types/node": "18.17.15",
"typescript": "~5.3.3",
"eslint": "~8.7.0"
"eslint": "~8.7.0",
"repo-tools": "workspace:*"
}
}
3 changes: 2 additions & 1 deletion packages/pnpm-sync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@types/heft-jest": "1.0.6",
"@types/node": "18.17.15",
"typescript": "~5.3.3",
"eslint": "~8.7.0"
"eslint": "~8.7.0",
"repo-tools": "workspace:*"
}
}
4 changes: 4 additions & 0 deletions packages/repo-tools/git-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

packages/repo-tools/node_modules/.bin/pretty-quick --staged

12 changes: 12 additions & 0 deletions packages/repo-tools/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "repo-tools",
"version": "0.0.0",
"private": true,
"scripts": {
"prepare": "node scripts/install-git-hooks.js"
},
"dependencies": {
"prettier": "^3.2.5",
"pretty-quick": "^4.0.0"
}
}
8 changes: 8 additions & 0 deletions packages/repo-tools/scripts/install-git-hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const fs = require('fs');
const path = require('path');

console.log('Installing Git hooks...');
fs.copyFileSync(
path.join(__dirname, '../git-hooks/pre-commit'),
path.join(__dirname, '../../../.git/hooks/pre-commit')
);
88 changes: 83 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pnpm-sync-cli-demo/app1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"devDependencies": {
"@types/node": "^20.8.10",
"typescript": "^5.2.2"
"typescript": "^5.2.2",
"repo-tools": "workspace:*"
}
}
}
5 changes: 3 additions & 2 deletions pnpm-sync-cli-demo/app2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"devDependencies": {
"@types/node": "^20.8.10",
"typescript": "^5.2.2"
"typescript": "^5.2.2",
"repo-tools": "workspace:*"
}
}
}
5 changes: 3 additions & 2 deletions pnpm-sync-cli-demo/lib1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"devDependencies": {
"@types/node": "^20.8.10",
"typescript": "^5.2.2",
"react": "~17.0.2"
"react": "~17.0.2",
"repo-tools": "workspace:*"
}
}
}

0 comments on commit feb112b

Please sign in to comment.