Skip to content

Commit

Permalink
build: husky changes
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Oct 15, 2023
1 parent 1853746 commit 7acdefe
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 129 deletions.
1 change: 0 additions & 1 deletion .github/husky/commit-msg → .github/hooks/commit-msg
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
3 changes: 3 additions & 0 deletions .github/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

yarn lint-staged
1 change: 0 additions & 1 deletion .github/husky/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions .github/husky/pre-commit

This file was deleted.

9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-git-hooks.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-git-hooks",
factory: function (require) {
var plugin=(()=>{var p=Object.create;var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var _=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,E)=>(typeof require<"u"?require:e)[E]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+n+'" is not supported')});var c=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),A=(n,e)=>{for(var E in e)i(n,E,{get:e[E],enumerable:!0})},C=(n,e,E,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let I of l(e))!m.call(n,I)&&I!==E&&i(n,I,{get:()=>e[I],enumerable:!(s=u(e,I))||s.enumerable});return n};var U=(n,e,E)=>(E=n!=null?p(P(n)):{},C(e||!n||!n.__esModule?i(E,"default",{value:n,enumerable:!0}):E,n)),v=n=>C(i({},"__esModule",{value:!0}),n);var L=c((M,B)=>{B.exports=[{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]}},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var T=c(a=>{"use strict";var D=L(),t=process.env;Object.defineProperty(a,"_vendors",{value:D.map(function(n){return n.constant})});a.name=null;a.isPR=null;D.forEach(function(n){let E=(Array.isArray(n.env)?n.env:[n.env]).every(function(s){return S(s)});if(a[n.constant]=E,!!E)switch(a.name=n.name,typeof n.pr){case"string":a.isPR=!!t[n.pr];break;case"object":"env"in n.pr?a.isPR=n.pr.env in t&&t[n.pr.env]!==n.pr.ne:"any"in n.pr?a.isPR=n.pr.any.some(function(s){return!!t[s]}):a.isPR=S(n.pr);break;default:a.isPR=null}});a.isCI=!!(t.CI!=="false"&&(t.BUILD_ID||t.BUILD_NUMBER||t.CI||t.CI_APP_ID||t.CI_BUILD_ID||t.CI_BUILD_NUMBER||t.CI_NAME||t.CONTINUOUS_INTEGRATION||t.RUN_ID||a.name||!1));function S(n){return typeof n=="string"?!!t[n]:"env"in n?t[n.env]&&t[n.env].includes(n.includes):"any"in n?n.any.some(function(e){return!!t[e]}):Object.keys(n).every(function(e){return t[e]===n[e]})}});var d={};A(d,{default:()=>O});var o=U(_("process")),r=_("@yarnpkg/core"),R=U(T()),N={configuration:{gitHooksPath:{description:"Path to git hooks directory (recommended: .github/hooks)",type:r.SettingsType.STRING,default:null},disableGitHooks:{description:"Disable automatic git hooks installation",type:r.SettingsType.BOOLEAN,default:R.default.isCI}},hooks:{afterAllInstalled:async n=>{let e=n.configuration.get("gitHooksPath"),E=n.configuration.get("disableGitHooks"),s=Boolean(n.cwd?.endsWith(`dlx-${o.default.pid}`));if(e&&!R.default.isCI&&!s&&!E)return r.execUtils.pipevp("git",["config","core.hooksPath",e],{cwd:n.cwd,strict:!0,stdin:o.default.stdin,stdout:o.default.stdout,stderr:o.default.stderr})}}},O=N;return v(d);})();
return plugin;
}
};
4 changes: 4 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ plugins:
spec: '@yarnpkg/plugin-workspace-tools'
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-git-hooks.cjs
spec: 'https://raw.githubusercontent.com/trufflehq/yarn-plugin-git-hooks/main/bundles/%40yarnpkg/plugin-git-hooks.js'

yarnPath: .yarn/releases/yarn-3.6.1.cjs

gitHooksPath: .github/hooks
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM node:18-alpine as base

WORKDIR /usr/src/app

ENV HUSKY=0
ENV YARN_DISABLE_GIT_HOOKS=1
ENV CI=true

RUN apk add --no-cache dumb-init python3 g++ make
Expand All @@ -16,8 +16,6 @@ COPY --chown=node:node package.json .
COPY --chown=node:node .yarnrc.yml .
COPY --chown=node:node .yarn/ .yarn/

RUN sed -i 's/"postinstall": "husky install .github\/husky"/"postinstall": ""/' ./package.json

ENTRYPOINT ["dumb-init", "--"]

# ================ #
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"scripts:migration": "node scripts/migrations.mjs",
"dockerps": "pwsh -NoLogo ./.docker/control.ps1",
"typeorm:schema:resync": "docker container rm -f postgres && docker volume rm postgres-data && docker volume create postgres-data && docker-compose -f ./.docker/docker-compose.yml up -d postgres && sleep 3 && yarn typeorm schema:sync",
"update": "yarn upgrade-interactive",
"postinstall": "husky install .github/husky"
"update": "yarn upgrade-interactive"
},
"dependencies": {
"@discordjs/builders": "^0.16.0",
Expand Down Expand Up @@ -112,13 +111,11 @@
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"jest": "^29.6.1",
"jest-mock-random": "^1.1.1",
"lint-staged": "^13.2.3",
"nock": "^13.3.2",
"prettier": "^2.8.8",
"pretty-quick": "^3.1.3",
"ts-node": "^10.9.1",
"tsc-watch": "^6.0.4",
"typescript": "~4.7.4"
Expand Down Expand Up @@ -146,6 +143,7 @@
]
},
"lint-staged": {
"*": "prettier --ignore-unknown --write",
"*.{mjs,js,ts}": "eslint --fix --ext mjs,js,ts"
},
"config": {
Expand Down
119 changes: 3 additions & 116 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2777,13 +2777,6 @@ __metadata:
languageName: node
linkType: hard

"@types/minimatch@npm:^3.0.3":
version: 3.0.5
resolution: "@types/minimatch@npm:3.0.5"
checksum: c41d136f67231c3131cf1d4ca0b06687f4a322918a3a5adddc87ce90ed9dbd175a3610adee36b106ae68c0b92c637c35e02b58c8a56c424f71d30993ea220b92
languageName: node
linkType: hard

"@types/minimist@npm:^1.2.0":
version: 1.2.2
resolution: "@types/minimist@npm:1.2.2"
Expand Down Expand Up @@ -3254,13 +3247,6 @@ __metadata:
languageName: node
linkType: hard

"array-differ@npm:^3.0.0":
version: 3.0.0
resolution: "array-differ@npm:3.0.0"
checksum: 117edd9df5c1530bd116c6e8eea891d4bd02850fd89b1b36e532b6540e47ca620a373b81feca1c62d1395d9ae601516ba538abe5e8172d41091da2c546b05fb7
languageName: node
linkType: hard

"array-ify@npm:^1.0.0":
version: 1.0.0
resolution: "array-ify@npm:1.0.0"
Expand All @@ -3282,13 +3268,6 @@ __metadata:
languageName: node
linkType: hard

"arrify@npm:^2.0.1":
version: 2.0.1
resolution: "arrify@npm:2.0.1"
checksum: 067c4c1afd182806a82e4c1cb8acee16ab8b5284fbca1ce29408e6e91281c36bb5b612f6ddfbd40a0f7a7e0c75bf2696eb94c027f6e328d6e9c52465c98e4209
languageName: node
linkType: hard

"asn1.js@npm:^5.2.0":
version: 5.4.1
resolution: "asn1.js@npm:5.4.1"
Expand Down Expand Up @@ -3935,16 +3914,6 @@ __metadata:
languageName: node
linkType: hard

"chalk@npm:^3.0.0":
version: 3.0.0
resolution: "chalk@npm:3.0.0"
dependencies:
ansi-styles: ^4.1.0
supports-color: ^7.1.0
checksum: 8e3ddf3981c4da405ddbd7d9c8d91944ddf6e33d6837756979f7840a29272a69a5189ecae0ff84006750d6d1e92368d413335eab4db5476db6e6703a1d1e0505
languageName: node
linkType: hard

"chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.1":
version: 4.1.2
resolution: "chalk@npm:4.1.2"
Expand Down Expand Up @@ -4471,7 +4440,7 @@ __metadata:
languageName: node
linkType: hard

"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3":
"cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3":
version: 7.0.3
resolution: "cross-spawn@npm:7.0.3"
dependencies:
Expand Down Expand Up @@ -5342,23 +5311,6 @@ __metadata:
languageName: node
linkType: hard

"execa@npm:^4.0.0":
version: 4.1.0
resolution: "execa@npm:4.1.0"
dependencies:
cross-spawn: ^7.0.0
get-stream: ^5.0.0
human-signals: ^1.1.1
is-stream: ^2.0.0
merge-stream: ^2.0.0
npm-run-path: ^4.0.0
onetime: ^5.1.0
signal-exit: ^3.0.2
strip-final-newline: ^2.0.0
checksum: e30d298934d9c52f90f3847704fd8224e849a081ab2b517bbc02f5f7732c24e56a21f14cb96a08256deffeb2d12b2b7cb7e2b014a12fb36f8d3357e06417ed55
languageName: node
linkType: hard

"execa@npm:^5.0.0":
version: 5.1.1
resolution: "execa@npm:5.1.1"
Expand Down Expand Up @@ -5785,15 +5737,6 @@ __metadata:
languageName: node
linkType: hard

"get-stream@npm:^5.0.0":
version: 5.2.0
resolution: "get-stream@npm:5.2.0"
dependencies:
pump: ^3.0.0
checksum: 8bc1a23174a06b2b4ce600df38d6c98d2ef6d84e020c1ddad632ad75bac4e092eeb40e4c09e0761c35fc2dbc5e7fff5dab5e763a383582c4a167dd69a905bd12
languageName: node
linkType: hard

"get-stream@npm:^6.0.0, get-stream@npm:^6.0.1":
version: 6.0.1
resolution: "get-stream@npm:6.0.1"
Expand Down Expand Up @@ -6138,13 +6081,6 @@ __metadata:
languageName: node
linkType: hard

"human-signals@npm:^1.1.1":
version: 1.1.1
resolution: "human-signals@npm:1.1.1"
checksum: d587647c9e8ec24e02821b6be7de5a0fc37f591f6c4e319b3054b43fd4c35a70a94c46fc74d8c1a43c47fde157d23acd7421f375e1c1365b09a16835b8300205
languageName: node
linkType: hard

"human-signals@npm:^2.1.0":
version: 2.1.0
resolution: "human-signals@npm:2.1.0"
Expand All @@ -6168,15 +6104,6 @@ __metadata:
languageName: node
linkType: hard

"husky@npm:^8.0.3":
version: 8.0.3
resolution: "husky@npm:8.0.3"
bin:
husky: lib/bin.js
checksum: 837bc7e4413e58c1f2946d38fb050f5d7324c6f16b0fd66411ffce5703b294bd21429e8ba58711cd331951ee86ed529c5be4f76805959ff668a337dbfa82a1b0
languageName: node
linkType: hard

"hyperscript-attribute-to-property@npm:^1.0.0":
version: 1.0.2
resolution: "hyperscript-attribute-to-property@npm:1.0.2"
Expand Down Expand Up @@ -6227,7 +6154,7 @@ __metadata:
languageName: node
linkType: hard

"ignore@npm:^5.1.4, ignore@npm:^5.2.0":
"ignore@npm:^5.2.0":
version: 5.2.4
resolution: "ignore@npm:5.2.4"
checksum: 3d4c309c6006e2621659311783eaea7ebcd41fe4ca1d78c91c473157ad6666a57a2df790fe0d07a12300d9aac2888204d7be8d59f9aaf665b1c7fcdb432517ef
Expand Down Expand Up @@ -7924,13 +7851,6 @@ __metadata:
languageName: node
linkType: hard

"mri@npm:^1.1.5":
version: 1.2.0
resolution: "mri@npm:1.2.0"
checksum: 83f515abbcff60150873e424894a2f65d68037e5a7fcde8a9e2b285ee9c13ac581b63cfc1e6826c4732de3aeb84902f7c1e16b7aff46cd3f897a0f757a894e85
languageName: node
linkType: hard

"ms@npm:2.1.2":
version: 2.1.2
resolution: "ms@npm:2.1.2"
Expand All @@ -7945,19 +7865,6 @@ __metadata:
languageName: node
linkType: hard

"multimatch@npm:^4.0.0":
version: 4.0.0
resolution: "multimatch@npm:4.0.0"
dependencies:
"@types/minimatch": ^3.0.3
array-differ: ^3.0.0
array-union: ^2.1.0
arrify: ^2.0.1
minimatch: ^3.0.4
checksum: bdb6a98dad4e919d9a1a2a0db872f44fa2337315f2fd5827d91ae005cf22f4425782bdfa97c10b80d567f0cb3c226c31f4e85f8f6a4a4be4facf9af0de1bb0c2
languageName: node
linkType: hard

"mute-stream@npm:0.0.8":
version: 0.0.8
resolution: "mute-stream@npm:0.0.8"
Expand Down Expand Up @@ -8215,7 +8122,7 @@ __metadata:
languageName: node
linkType: hard

"npm-run-path@npm:^4.0.0, npm-run-path@npm:^4.0.1":
"npm-run-path@npm:^4.0.1":
version: 4.0.1
resolution: "npm-run-path@npm:4.0.1"
dependencies:
Expand Down Expand Up @@ -8839,24 +8746,6 @@ __metadata:
languageName: node
linkType: hard

"pretty-quick@npm:^3.1.3":
version: 3.1.3
resolution: "pretty-quick@npm:3.1.3"
dependencies:
chalk: ^3.0.0
execa: ^4.0.0
find-up: ^4.1.0
ignore: ^5.1.4
mri: ^1.1.5
multimatch: ^4.0.0
peerDependencies:
prettier: ">=2.0.0"
bin:
pretty-quick: bin/pretty-quick.js
checksum: 28bdc32571e6308e049497f58a9245f272275973782b6ed7fbcf98937101cc605a81b3ab48629dba4687b7e86c87a3733febacdc0746ca4da5d1c80a0b88cf45
languageName: node
linkType: hard

"process-nextick-args@npm:~2.0.0":
version: 2.0.1
resolution: "process-nextick-args@npm:2.0.1"
Expand Down Expand Up @@ -9573,14 +9462,12 @@ __metadata:
eslint-config-prettier: ^8.8.0
eslint-plugin-prettier: ^4.2.1
he: ^1.2.0
husky: ^8.0.3
jest: ^29.6.1
jest-mock-random: ^1.1.1
lint-staged: ^13.2.3
nock: ^13.3.2
pg: ^8.11.1
prettier: ^2.8.8
pretty-quick: ^3.1.3
ts-node: ^10.9.1
tsc-watch: ^6.0.4
tslib: 1.14.1
Expand Down

0 comments on commit 7acdefe

Please sign in to comment.