dotcom-tool-kit 3.4.3 → 3.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAc,WAAW,EAAE,MAAM,UAAU,CAAA;AAalD,wBAA8B,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA2D/E"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAc,WAAW,EAAE,MAAM,UAAU,CAAA;AAalD,wBAA8B,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAyD/E"}
package/lib/install.js CHANGED
@@ -6,14 +6,14 @@ const options_1 = require("@dotcom-tool-kit/options");
6
6
  const groupBy_1 = tslib_1.__importDefault(require("lodash/groupBy"));
7
7
  const config_1 = require("./config");
8
8
  const postInstall_1 = require("./postInstall");
9
- // implementation of the Array.some method that supports asynchronous predicates
10
- async function asyncSome(arr, pred) {
9
+ // implementation of the Array.every method that supports asynchronous predicates
10
+ async function asyncEvery(arr, pred) {
11
11
  for (const val of arr) {
12
- if (await pred(val)) {
13
- return true;
12
+ if (!(await pred(val))) {
13
+ return false;
14
14
  }
15
15
  }
16
- return false;
16
+ return true;
17
17
  }
18
18
  async function installHooks(logger) {
19
19
  const config = await (0, config_1.loadConfig)(logger);
@@ -23,24 +23,18 @@ async function installHooks(logger) {
23
23
  }
24
24
  }
25
25
  const errors = [];
26
- // HACK: achieve backwards compatibility with older versions of the circleci
27
- // plugin that required a postinstall function to run instead of the new
28
- // commitInstall method. remove in major update of cli.
29
- let usesNewCircleCIGroup = false;
30
26
  // group hooks without an installGroup separately so that their check()
31
27
  // method runs independently
32
28
  const groups = (0, groupBy_1.default)(config.hooks, (hook) => hook.installGroup ?? '__' + hook.id);
33
- for (const [groupId, group] of Object.entries(groups)) {
29
+ for (const group of Object.values(groups)) {
34
30
  try {
35
- if (await asyncSome(group, async (hook) => !(await hook.check()))) {
31
+ const allChecksPassed = await asyncEvery(group, (hook) => hook.check());
32
+ if (!allChecksPassed) {
36
33
  let state = undefined;
37
34
  for (const hook of group) {
38
35
  state = await hook.install(state);
39
36
  }
40
37
  if (state) {
41
- if (groupId === 'circleci') {
42
- usesNewCircleCIGroup = true;
43
- }
44
38
  try {
45
39
  await group[0].commitInstall(state);
46
40
  }
@@ -64,6 +58,10 @@ async function installHooks(logger) {
64
58
  }
65
59
  }
66
60
  }
61
+ // HACK: achieve backwards compatibility with older versions of the circleci
62
+ // plugin that required a postinstall function to run instead of the new
63
+ // commitInstall method. remove in major update of cli.
64
+ const usesNewCircleCIGroup = Object.keys(groups).includes('circleci');
67
65
  if (!usesNewCircleCIGroup) {
68
66
  await (0, postInstall_1.postInstall)(logger);
69
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotcom-tool-kit",
3
- "version": "3.4.3",
3
+ "version": "3.4.4",
4
4
  "description": "modern, maintainable, modular developer tooling for FT.com projects",
5
5
  "author": "FT.com Platforms Team <platforms-team.customer-products@ft.com>",
6
6
  "license": "MIT",