dotcom-tool-kit 1.9.0 → 2.1.1
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.
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +17 -6
- package/package.json +7 -9
package/lib/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,EAAE,MAAM,EAAiB,MAAM,UAAU,CAAA;AAKhD,OAAO,EAA2B,MAAM,EAAa,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,EAAE,MAAM,EAAiB,MAAM,UAAU,CAAA;AAKhD,OAAO,EAA2B,MAAM,EAAa,MAAM,wBAAwB,CAAA;AAYnF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA2FtG;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAkFjB;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,EAAE,CAAC,CAEnB"}
|
package/lib/plugin.js
CHANGED
|
@@ -10,6 +10,17 @@ const rc_file_1 = require("./rc-file");
|
|
|
10
10
|
const error_1 = require("@dotcom-tool-kit/error");
|
|
11
11
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
12
12
|
const types_1 = require("@dotcom-tool-kit/types");
|
|
13
|
+
function isDescendent(possibleAncestor, possibleDescendent) {
|
|
14
|
+
if (!possibleDescendent.parent) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
else if (possibleDescendent.parent === possibleAncestor) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return isDescendent(possibleAncestor, possibleDescendent.parent);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
13
24
|
async function loadPluginConfig(logger, plugin, config) {
|
|
14
25
|
const { plugins = [], hooks = {}, options = {} } = await (0, rc_file_1.loadToolKitRC)(plugin.root);
|
|
15
26
|
// load any plugins requested by this plugin
|
|
@@ -28,11 +39,11 @@ async function loadPluginConfig(logger, plugin, config) {
|
|
|
28
39
|
if (!existingHookTask) {
|
|
29
40
|
return newHookTask;
|
|
30
41
|
}
|
|
31
|
-
const
|
|
32
|
-
//
|
|
42
|
+
const existingFromDescendent = isDescendent(plugin, existingHookTask.plugin);
|
|
43
|
+
// plugins can only override hook tasks from their descendents, otherwise that's a conflict
|
|
33
44
|
// return a conflict either listing this hook and the siblings,
|
|
34
45
|
// or merging in a previously-generated hook
|
|
35
|
-
if (
|
|
46
|
+
if (!existingFromDescendent) {
|
|
36
47
|
const conflicting = (0, conflict_1.isConflict)(existingHookTask) ? existingHookTask.conflicting : [existingHookTask];
|
|
37
48
|
const conflict = {
|
|
38
49
|
plugin,
|
|
@@ -56,11 +67,11 @@ async function loadPluginConfig(logger, plugin, config) {
|
|
|
56
67
|
if (!existingOptions) {
|
|
57
68
|
return pluginOptions;
|
|
58
69
|
}
|
|
59
|
-
const
|
|
60
|
-
//
|
|
70
|
+
const existingFromDescendent = isDescendent(plugin, existingOptions.plugin);
|
|
71
|
+
// plugins can only override options from their descendents, otherwise it's a conflict
|
|
61
72
|
// return a conflict either listing these options and the sibling's,
|
|
62
73
|
// or merging in previously-generated options
|
|
63
|
-
if (
|
|
74
|
+
if (!existingFromDescendent) {
|
|
64
75
|
const conflicting = (0, conflict_1.isConflict)(existingOptions) ? existingOptions.conflicting : [existingOptions];
|
|
65
76
|
const conflict = {
|
|
66
77
|
plugin,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotcom-tool-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.1",
|
|
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",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"test": "cd ../../ ; npx jest --silent --projects core/cli"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@dotcom-tool-kit/circleci": "file:../../plugins/circleci",
|
|
24
23
|
"@jest/globals": "^27.4.6",
|
|
25
24
|
"@types/lodash.merge": "^4.6.6",
|
|
26
25
|
"@types/lodash.mergewith": "^4.6.6",
|
|
@@ -31,12 +30,11 @@
|
|
|
31
30
|
"winston": "^3.5.1"
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
|
-
"@dotcom-tool-kit/error": "^
|
|
35
|
-
"@dotcom-tool-kit/
|
|
36
|
-
"@dotcom-tool-kit/
|
|
37
|
-
"@dotcom-tool-kit/
|
|
38
|
-
"@dotcom-tool-kit/
|
|
39
|
-
"@dotcom-tool-kit/wait-for-ok": "^1.9.0",
|
|
33
|
+
"@dotcom-tool-kit/error": "^2.0.0",
|
|
34
|
+
"@dotcom-tool-kit/logger": "^2.0.0",
|
|
35
|
+
"@dotcom-tool-kit/options": "^2.0.1",
|
|
36
|
+
"@dotcom-tool-kit/types": "^2.1.0",
|
|
37
|
+
"@dotcom-tool-kit/wait-for-ok": "^2.0.0",
|
|
40
38
|
"cosmiconfig": "^7.0.0",
|
|
41
39
|
"import-from": "^3.0.0",
|
|
42
40
|
"lodash.merge": "^4.6.2",
|
|
@@ -57,4 +55,4 @@
|
|
|
57
55
|
"volta": {
|
|
58
56
|
"extends": "../../package.json"
|
|
59
57
|
}
|
|
60
|
-
}
|
|
58
|
+
}
|