Skip to content

Commit

Permalink
Update pre-commit hook
Browse files Browse the repository at this point in the history
Updates husky and lint-staged to the latest version. Since we are using
yarn 2, husky install is run through the postinstall script as according
to their documentation
  • Loading branch information
mmso committed Sep 8, 2021
1 parent d712f21 commit 78a73b1
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 110 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn run lint-staged
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: ./plugin-postinstall.js

yarnPath: .yarn/releases/yarn-2.4.2.cjs
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@
"scripts": {
"config-app": "packages/config/install",
"version": "yarn workspace scripts run version:applications",
"start-all": "cd utilities/local-sso && ./run.sh"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
"start-all": "cd utilities/local-sso && ./run.sh",
"postinstall": "is-ci || (husky install; yarn run config-app)"
},
"resolutions": {
"@types/jest": "^26.0.0",
Expand All @@ -26,12 +22,13 @@
"dependencies": {
"@proton/eslint-config-proton": "workspace:packages/eslint-config-proton",
"@proton/stylelint-config-proton": "workspace:packages/stylelint-config-proton",
"is-ci": "^3.0.0",
"typescript": "^4.1.3"
},
"devDependencies": {
"husky": "^4.3.6",
"lint-staged": "^10.5.3",
"prettier": "^2.2.1",
"husky": "^7.0.2",
"lint-staged": "^11.1.2",
"prettier": "^2.3.2",
"sort-package-json": "^1.48.1"
}
}
2 changes: 0 additions & 2 deletions packages/pack/bin/protonPack.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ const getPort = (basePort) => {
const writeConfig = async (configFile) => {
const configPath = path.resolve('./src/app/config.ts');
await fs.writeFile(configPath, configFile);
console.log(configFile);
console.log(`✓ generated ${configPath}`);
};

const addGlobalOptions = (program) => {
Expand Down
3 changes: 0 additions & 3 deletions packages/pack/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ const LOCALES = (() => {
try {
return require(path.join(process.cwd(), 'locales', 'config', 'locales.json'));
} catch (e) {
if (!process.argv.includes('print-config')) {
console.log('No po/locales.json available yet');
}
return {};
}
})();
Expand Down
13 changes: 13 additions & 0 deletions plugin-postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
name: 'plugin-postinstall',
factory: function (require) {
var shell = require('@yarnpkg/shell');
return {
hooks: {
afterAllInstalled: function () {
shell.execute('yarn workspaces foreach --all run postinstall');
},
},
};
},
};
124 changes: 28 additions & 96 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11021,14 +11021,14 @@ __metadata:
languageName: node
linkType: hard

"commander@npm:^6.1.0, commander@npm:^6.2.0, commander@npm:^6.2.1":
"commander@npm:^6.1.0, commander@npm:^6.2.1":
version: 6.2.1
resolution: "commander@npm:6.2.1"
checksum: 47856aae6f194404122e359d8463e5e1a18f7cbab26722ce69f1379be8514bd49a160ef81a983d3d2091e3240022643354101d1276c797dcdd0b5bfc3c3f04a3
languageName: node
linkType: hard

"commander@npm:^7.0.0, commander@npm:^7.1.0":
"commander@npm:^7.0.0, commander@npm:^7.1.0, commander@npm:^7.2.0":
version: 7.2.0
resolution: "commander@npm:7.2.0"
checksum: bdc0eca5e25cd24af8440163d3c9a996785bbac4b49a590365699cdc1ed08cefbac8f268153208ab2bc5dc3cb1d3fb573fd1590c681e36e371342186bd331a4c
Expand Down Expand Up @@ -11063,13 +11063,6 @@ __metadata:
languageName: node
linkType: hard

"compare-versions@npm:^3.6.0":
version: 3.6.0
resolution: "compare-versions@npm:3.6.0"
checksum: 09525264502bda1f6667ad2429eaf5520b543d997e79e7a94b66a5896df8921cdc3a97140dfff75af6c9ba1859c872de1921c3cf8a6c48ed807bbf9f582cf093
languageName: node
linkType: hard

"component-bind@npm:1.0.0":
version: 1.0.0
resolution: "component-bind@npm:1.0.0"
Expand Down Expand Up @@ -12138,7 +12131,7 @@ __metadata:
languageName: node
linkType: hard

"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.1":
"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1":
version: 4.3.2
resolution: "debug@npm:4.3.2"
dependencies:
Expand Down Expand Up @@ -14199,23 +14192,6 @@ __metadata:
languageName: node
linkType: hard

"execa@npm:^4.1.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: 79bd736acd63aa7c0afb32cc99af21cfd70db696580686c7cd56c177857b93b78bc0b9bb2b4410f377f46c71c566c8e723987e71ef0bc9b23791bfbced02f75c
languageName: node
linkType: hard

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

"find-versions@npm:^4.0.0":
version: 4.0.0
resolution: "find-versions@npm:4.0.0"
dependencies:
semver-regex: ^3.1.2
checksum: 05174128349e522f0746cc343a509f2ce1c8c765e24968ff2ac6f82fda4e4c680f5f71c6a781ce28406d19addc32a205116ac14ee83cb2e336635dd803f56cbd
languageName: node
linkType: hard

"flat-cache@npm:^3.0.4":
version: 3.0.4
resolution: "flat-cache@npm:3.0.4"
Expand Down Expand Up @@ -16779,24 +16746,12 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"husky@npm:^4.3.6":
version: 4.3.8
resolution: "husky@npm:4.3.8"
dependencies:
chalk: ^4.0.0
ci-info: ^2.0.0
compare-versions: ^3.6.0
cosmiconfig: ^7.0.0
find-versions: ^4.0.0
opencollective-postinstall: ^2.0.2
pkg-dir: ^5.0.0
please-upgrade-node: ^3.2.0
slash: ^3.0.0
which-pm-runs: ^1.0.0
"husky@npm:^7.0.2":
version: 7.0.2
resolution: "husky@npm:7.0.2"
bin:
husky-run: bin/run.js
husky-upgrade: lib/upgrader/bin.js
checksum: 1ac4fb51ffd93547ec861f185d86bdbfbac8ee24ce60417d531dbe5222e33fc754436e87e4e2b37a44dcefdc78c151f9ba4ac57c05773f5c36377cc4eb73732b
husky: lib/bin.js
checksum: 3d1573d9ee5406e864e8170912bfadffde211535277c49f7f5da1b543a7b8e6c8ac8bae9f9cdd6b5be21ef39bb2929ca62001a7c50841d93c36454659bd3e017
languageName: node
linkType: hard

Expand Down Expand Up @@ -19595,34 +19550,33 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"lint-staged@npm:^10.5.3":
version: 10.5.4
resolution: "lint-staged@npm:10.5.4"
"lint-staged@npm:^11.1.2":
version: 11.1.2
resolution: "lint-staged@npm:11.1.2"
dependencies:
chalk: ^4.1.0
chalk: ^4.1.1
cli-truncate: ^2.1.0
commander: ^6.2.0
commander: ^7.2.0
cosmiconfig: ^7.0.0
debug: ^4.2.0
dedent: ^0.7.0
debug: ^4.3.1
enquirer: ^2.3.6
execa: ^4.1.0
listr2: ^3.2.2
log-symbols: ^4.0.0
micromatch: ^4.0.2
execa: ^5.0.0
listr2: ^3.8.2
log-symbols: ^4.1.0
micromatch: ^4.0.4
normalize-path: ^3.0.0
please-upgrade-node: ^3.2.0
string-argv: 0.3.1
stringify-object: ^3.3.0
bin:
lint-staged: bin/lint-staged.js
checksum: dbcafe3679668379fc03f3aef481c3f710794ec03dd5c3915f26a0de110977fbcb44b55ab6dfcff9e8e5789c568ea5629e92f55944fc43f6f6fa1890ee5b07ba
checksum: 0c44f4fbd9360cb68a7c80475a2c37c01adc60c3598cc0beafc27d48f49be7d696e01f2a4b96eef0d6aba3fbe547861a434910ba80ec96fda30b6b21375ae937
languageName: node
linkType: hard

"listr2@npm:^3.2.2":
version: 3.10.0
resolution: "listr2@npm:3.10.0"
"listr2@npm:^3.8.2":
version: 3.11.1
resolution: "listr2@npm:3.11.1"
dependencies:
cli-truncate: ^2.1.0
colorette: ^1.2.2
Expand All @@ -19633,7 +19587,7 @@ fsevents@^1.2.7:
wrap-ansi: ^7.0.0
peerDependencies:
enquirer: ">= 2.3.0 < 3"
checksum: 943a47f7fec0050a56bc47c5a55a723bb8633aa5092b344ea65c117b0a4fec8cd6aa76b92323a4bd70b14b3fdfd78ea1e4a16f91efe63d1f0addd2b069323933
checksum: e74d0a4297b726a5db4f681403e24a3de2aee3ef10d57b72261c92d186c05d1bbc281c59f6e77610785135ac530cef2f9961aab5d0d3dce10af2fff5fed9a4de
languageName: node
linkType: hard

Expand Down Expand Up @@ -20056,7 +20010,7 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"log-symbols@npm:^4.0.0, log-symbols@npm:^4.1.0":
"log-symbols@npm:^4.1.0":
version: 4.1.0
resolution: "log-symbols@npm:4.1.0"
dependencies:
Expand Down Expand Up @@ -22101,15 +22055,6 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"opencollective-postinstall@npm:^2.0.2":
version: 2.0.3
resolution: "opencollective-postinstall@npm:2.0.3"
bin:
opencollective-postinstall: index.js
checksum: d75b06b80eb426aaf099307ca4398f3119c8c86ff3806a95cfe234b979b80c07080040734fe2dc3c51fed5b15bd98dae88340807980bdc74aa1ebf045c74ef06
languageName: node
linkType: hard

"openpgp@npm:^4.10.7, openpgp@npm:^4.10.8":
version: 4.10.10
resolution: "openpgp@npm:4.10.10"
Expand Down Expand Up @@ -26091,9 +26036,10 @@ fsevents@^1.2.7:
dependencies:
"@proton/eslint-config-proton": "workspace:packages/eslint-config-proton"
"@proton/stylelint-config-proton": "workspace:packages/stylelint-config-proton"
husky: ^4.3.6
lint-staged: ^10.5.3
prettier: ^2.2.1
husky: ^7.0.2
is-ci: ^3.0.0
lint-staged: ^11.1.2
prettier: ^2.3.2
sort-package-json: ^1.48.1
typescript: ^4.1.3
languageName: unknown
Expand Down Expand Up @@ -26381,13 +26327,6 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"semver-regex@npm:^3.1.2":
version: 3.1.2
resolution: "semver-regex@npm:3.1.2"
checksum: 6a83740f3fc24379629be068e677c71c57e0d9df4977eb56d863f26a7830b85f14d9f1af71ca3a84df9ac70fcd9ce8821466064f5652ffa0dc343b50ded86698
languageName: node
linkType: hard

"semver@npm:2 || 3 || 4 || 5, semver@npm:^5.4.1, semver@npm:^5.5.0, semver@npm:^5.5.1, semver@npm:^5.6.0":
version: 5.7.1
resolution: "semver@npm:5.7.1"
Expand Down Expand Up @@ -30320,13 +30259,6 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"which-pm-runs@npm:^1.0.0":
version: 1.0.0
resolution: "which-pm-runs@npm:1.0.0"
checksum: 0bb79a782e98955afec8f35a3ae95c4711fdd3d0743772ee98211da67c2421fdd4c92c95c93532cc0b4dcc085d8e27f3ad2f8a9173cb632692379bd3d2818821
languageName: node
linkType: hard

"which@npm:^1.2.1, which@npm:^1.2.9, which@npm:^1.3.1":
version: 1.3.1
resolution: "which@npm:1.3.1"
Expand Down

0 comments on commit 78a73b1

Please sign in to comment.