dotcom-tool-kit 3.0.0 → 3.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/config.js +1 -2
- package/lib/index.js +1 -1
- package/lib/install.js +1 -1
- package/lib/messages.js +1 -2
- package/lib/plugin.js +1 -2
- package/lib/postInstall.js +1 -1
- package/lib/rc-file.js +4 -5
- package/package.json +19 -18
package/lib/config.js
CHANGED
|
@@ -25,7 +25,6 @@ async function asyncFilter(items, predicate) {
|
|
|
25
25
|
return results.filter(({ keep }) => keep).map(({ item }) => item);
|
|
26
26
|
}
|
|
27
27
|
function validateConfig(config, logger) {
|
|
28
|
-
var _a;
|
|
29
28
|
const validConfig = config;
|
|
30
29
|
const hookTaskConflicts = (0, conflict_1.findConflicts)(Object.values(config.hookTasks));
|
|
31
30
|
const hookConflicts = (0, conflict_1.findConflicts)(Object.values(config.hooks));
|
|
@@ -82,7 +81,7 @@ function validateConfig(config, logger) {
|
|
|
82
81
|
logger.silly(`skipping validation of ${pluginId} plugin as no schema can be found`);
|
|
83
82
|
continue;
|
|
84
83
|
}
|
|
85
|
-
const result = pluginSchema.safeParse(
|
|
84
|
+
const result = pluginSchema.safeParse(pluginOptions?.options ?? {});
|
|
86
85
|
if (result.success) {
|
|
87
86
|
// Set up options entry for plugins that don't have options specified
|
|
88
87
|
// explicitly. They could still have default options that are set by zod.
|
package/lib/index.js
CHANGED
|
@@ -77,7 +77,7 @@ exports.runTasks = runTasks;
|
|
|
77
77
|
async function listPlugins(logger) {
|
|
78
78
|
const config = await (0, config_1.loadConfig)(logger, { validate: false });
|
|
79
79
|
const rootPlugin = config.plugins['app root'];
|
|
80
|
-
if (rootPlugin
|
|
80
|
+
if (rootPlugin?.valid) {
|
|
81
81
|
logger.info((0, messages_1.formatPluginTree)(rootPlugin.value).join('\n'));
|
|
82
82
|
}
|
|
83
83
|
}
|
package/lib/install.js
CHANGED
|
@@ -29,7 +29,7 @@ async function installHooks(logger) {
|
|
|
29
29
|
let usesNewCircleCIGroup = false;
|
|
30
30
|
// group hooks without an installGroup separately so that their check()
|
|
31
31
|
// method runs independently
|
|
32
|
-
const groups = (0, groupBy_1.default)(config.hooks, (hook) =>
|
|
32
|
+
const groups = (0, groupBy_1.default)(config.hooks, (hook) => hook.installGroup ?? '__' + hook.id);
|
|
33
33
|
for (const [groupId, group] of Object.entries(groups)) {
|
|
34
34
|
try {
|
|
35
35
|
if (await asyncSome(group, async (hook) => !(await hook.check()))) {
|
package/lib/messages.js
CHANGED
|
@@ -91,10 +91,9 @@ Available tasks are: ${tasks.map(logger_1.styles.task).join(', ')}.
|
|
|
91
91
|
`;
|
|
92
92
|
exports.formatMissingTasks = formatMissingTasks;
|
|
93
93
|
function formatPluginTree(plugin) {
|
|
94
|
-
var _a;
|
|
95
94
|
return [
|
|
96
95
|
logger_1.styles.plugin(plugin.id),
|
|
97
|
-
...(
|
|
96
|
+
...(plugin.children ?? []).flatMap((child, childIndex, children) => formatPluginTree(child).map((line, lineIndex) => lineIndex === 0
|
|
98
97
|
? childIndex === children.length - 1
|
|
99
98
|
? `└ ${line}`
|
|
100
99
|
: `├ ${line}`
|
package/lib/plugin.js
CHANGED
|
@@ -21,7 +21,6 @@ function isDescendent(possibleAncestor, possibleDescendent) {
|
|
|
21
21
|
}
|
|
22
22
|
const indentReasons = (reasons) => reasons.replace(/\n/g, '\n ');
|
|
23
23
|
function validatePlugin(plugin) {
|
|
24
|
-
var _a, _b;
|
|
25
24
|
const errors = [];
|
|
26
25
|
const rawPlugin = plugin;
|
|
27
26
|
if (rawPlugin.tasks) {
|
|
@@ -54,7 +53,7 @@ function validatePlugin(plugin) {
|
|
|
54
53
|
return { valid: false, reasons: errors };
|
|
55
54
|
}
|
|
56
55
|
else {
|
|
57
|
-
const pluginModule = { tasks:
|
|
56
|
+
const pluginModule = { tasks: rawPlugin.tasks ?? [], hooks: rawPlugin.hooks ?? {} };
|
|
58
57
|
return { valid: true, value: pluginModule };
|
|
59
58
|
}
|
|
60
59
|
}
|
package/lib/postInstall.js
CHANGED
|
@@ -24,7 +24,7 @@ async function postInstall(logger) {
|
|
|
24
24
|
const workflows = yml.get('workflows');
|
|
25
25
|
const toolkitWorkflow = workflows.get('tool-kit');
|
|
26
26
|
const jobs = toolkitWorkflow.get('jobs');
|
|
27
|
-
jobs
|
|
27
|
+
jobs?.items.forEach((jobItem, index) => {
|
|
28
28
|
const tagsFilterConfig = { filters: { tags: { only: `${npm_1.semVerRegex}` } } };
|
|
29
29
|
if (jobItem.type === 'PLAIN') {
|
|
30
30
|
// eg. - checkout
|
package/lib/rc-file.js
CHANGED
|
@@ -9,9 +9,8 @@ exports.explorer = (0, cosmiconfig_1.cosmiconfig)('toolkit', { ignoreEmptySearch
|
|
|
9
9
|
const emptyConfig = { plugins: [], hooks: {}, options: {} };
|
|
10
10
|
let rootConfig;
|
|
11
11
|
async function loadToolKitRC(logger, root, isAppRoot) {
|
|
12
|
-
var _a, _b, _c;
|
|
13
12
|
const result = await exports.explorer.search(root);
|
|
14
|
-
if (!
|
|
13
|
+
if (!result?.config) {
|
|
15
14
|
return emptyConfig;
|
|
16
15
|
}
|
|
17
16
|
if (isAppRoot) {
|
|
@@ -26,9 +25,9 @@ async function loadToolKitRC(logger, root, isAppRoot) {
|
|
|
26
25
|
}
|
|
27
26
|
const config = result.config;
|
|
28
27
|
return {
|
|
29
|
-
plugins:
|
|
30
|
-
hooks:
|
|
31
|
-
options:
|
|
28
|
+
plugins: config.plugins ?? [],
|
|
29
|
+
hooks: config.hooks ?? {},
|
|
30
|
+
options: config.options ?? {}
|
|
32
31
|
};
|
|
33
32
|
}
|
|
34
33
|
exports.loadToolKitRC = loadToolKitRC;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotcom-tool-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.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,17 +20,17 @@
|
|
|
20
20
|
"test": "cd ../../ ; npx jest --silent --projects core/cli"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@dotcom-tool-kit/babel": "^3.
|
|
24
|
-
"@dotcom-tool-kit/backend-heroku-app": "^2.
|
|
25
|
-
"@dotcom-tool-kit/circleci": "^5.
|
|
26
|
-
"@dotcom-tool-kit/circleci-deploy": "^3.
|
|
27
|
-
"@dotcom-tool-kit/eslint": "^3.
|
|
28
|
-
"@dotcom-tool-kit/frontend-app": "^3.
|
|
29
|
-
"@dotcom-tool-kit/heroku": "^3.
|
|
30
|
-
"@dotcom-tool-kit/mocha": "^3.
|
|
31
|
-
"@dotcom-tool-kit/n-test": "^3.
|
|
32
|
-
"@dotcom-tool-kit/npm": "^3.
|
|
33
|
-
"@dotcom-tool-kit/webpack": "^3.
|
|
23
|
+
"@dotcom-tool-kit/babel": "^3.1.0",
|
|
24
|
+
"@dotcom-tool-kit/backend-heroku-app": "^2.1.1",
|
|
25
|
+
"@dotcom-tool-kit/circleci": "^5.1.1",
|
|
26
|
+
"@dotcom-tool-kit/circleci-deploy": "^3.1.1",
|
|
27
|
+
"@dotcom-tool-kit/eslint": "^3.1.0",
|
|
28
|
+
"@dotcom-tool-kit/frontend-app": "^3.1.1",
|
|
29
|
+
"@dotcom-tool-kit/heroku": "^3.1.0",
|
|
30
|
+
"@dotcom-tool-kit/mocha": "^3.1.0",
|
|
31
|
+
"@dotcom-tool-kit/n-test": "^3.1.0",
|
|
32
|
+
"@dotcom-tool-kit/npm": "^3.1.0",
|
|
33
|
+
"@dotcom-tool-kit/webpack": "^3.1.0",
|
|
34
34
|
"@jest/globals": "^27.4.6",
|
|
35
35
|
"@types/lodash": "^4.14.185",
|
|
36
36
|
"@types/node": "^16.18.23",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"winston": "^3.5.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@dotcom-tool-kit/error": "^3.
|
|
44
|
-
"@dotcom-tool-kit/logger": "^3.
|
|
45
|
-
"@dotcom-tool-kit/options": "^3.
|
|
46
|
-
"@dotcom-tool-kit/types": "^3.
|
|
47
|
-
"@dotcom-tool-kit/wait-for-ok": "^3.
|
|
43
|
+
"@dotcom-tool-kit/error": "^3.1.0",
|
|
44
|
+
"@dotcom-tool-kit/logger": "^3.1.0",
|
|
45
|
+
"@dotcom-tool-kit/options": "^3.1.0",
|
|
46
|
+
"@dotcom-tool-kit/types": "^3.1.0",
|
|
47
|
+
"@dotcom-tool-kit/wait-for-ok": "^3.1.0",
|
|
48
48
|
"cosmiconfig": "^7.0.0",
|
|
49
49
|
"lodash": "^4.17.21",
|
|
50
50
|
"minimist": "^1.2.5",
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"zod-validation-error": "^0.3.0"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
|
-
"node": "16.x"
|
|
57
|
+
"node": "16.x || 18.x",
|
|
58
|
+
"npm": "7.x || 8.x || 9.x"
|
|
58
59
|
},
|
|
59
60
|
"files": [
|
|
60
61
|
"/bin",
|