dotcom-tool-kit 4.7.2 → 4.8.0
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/hash.js +3 -4
- package/lib/config/validate-plugins.js +1 -2
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -3
- package/lib/fetch.d.ts.map +1 -1
- package/lib/help.js +1 -1
- package/lib/index.js +3 -3
- package/lib/init.js +1 -2
- package/lib/install.d.ts.map +1 -1
- package/lib/install.js +3 -3
- package/lib/messages.d.ts.map +1 -1
- package/lib/messages.js +3 -3
- package/lib/plugin/entry-point.js +2 -3
- package/lib/plugin/is-descendent.js +1 -2
- package/lib/plugin/merge-commands.d.ts.map +1 -1
- package/lib/plugin/merge-hooks.d.ts.map +1 -1
- package/lib/plugin/merge-inits.d.ts.map +1 -1
- package/lib/plugin/merge-plugin-options.d.ts.map +1 -1
- package/lib/plugin/merge-task-options.d.ts.map +1 -1
- package/lib/plugin/merge-tasks.d.ts.map +1 -1
- package/lib/plugin/options.d.ts.map +1 -1
- package/lib/plugin/options.js +21 -15
- package/lib/plugin/reduce-installations.js +1 -2
- package/lib/plugin/require-resolve.d.ts +0 -1
- package/lib/plugin/require-resolve.d.ts.map +1 -1
- package/lib/plugin/resolve-root.js +1 -2
- package/lib/plugin.js +3 -4
- package/lib/rc-file.js +2 -2
- package/lib/tasks.js +2 -3
- package/package.json +15 -16
package/lib/config/hash.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.fileHash = fileHash;
|
|
4
|
+
exports.updateHashes = updateHashes;
|
|
5
|
+
exports.hasConfigChanged = hasConfigChanged;
|
|
4
6
|
const state_1 = require("@dotcom-tool-kit/state");
|
|
5
7
|
const node_crypto_1 = require("node:crypto");
|
|
6
8
|
const promises_1 = require("node:fs/promises");
|
|
@@ -19,12 +21,10 @@ async function fileHash(path) {
|
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
|
-
exports.fileHash = fileHash;
|
|
23
24
|
async function updateHashes(config) {
|
|
24
25
|
const hashes = Object.fromEntries(await Promise.all(['.toolkitrc.yml', ...config.hookManagedFiles].map(async (path) => [path, await fileHash(path)])));
|
|
25
26
|
(0, state_1.writeState)('install', hashes);
|
|
26
27
|
}
|
|
27
|
-
exports.updateHashes = updateHashes;
|
|
28
28
|
async function hasConfigChanged(logger, config) {
|
|
29
29
|
const hashes = (0, state_1.readState)('install');
|
|
30
30
|
if (!hashes) {
|
|
@@ -40,4 +40,3 @@ async function hasConfigChanged(logger, config) {
|
|
|
40
40
|
}
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
|
-
exports.hasConfigChanged = hasConfigChanged;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validatePlugins =
|
|
3
|
+
exports.validatePlugins = validatePlugins;
|
|
4
4
|
const validated_1 = require("@dotcom-tool-kit/validated");
|
|
5
5
|
function validatePlugins(config) {
|
|
6
6
|
const validatedPlugins = (0, validated_1.reduceValidated)(Object.entries(config.plugins).map(([id, plugin]) => plugin.map((p) => [id, p])));
|
|
7
7
|
return validatedPlugins.map((plugins) => ({ ...config, plugins: Object.fromEntries(plugins) }));
|
|
8
8
|
}
|
|
9
|
-
exports.validatePlugins = validatePlugins;
|
package/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAUrC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAgBpF,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAUrC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAgBpF,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,SAgB1C,CAAA;AAEF,wBAAgB,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,WAAW,CA4FtE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAC5G,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA"}
|
package/lib/config.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createConfig = void 0;
|
|
4
|
+
exports.validateConfig = validateConfig;
|
|
5
|
+
exports.loadConfig = loadConfig;
|
|
4
6
|
const plugin_1 = require("./plugin");
|
|
5
7
|
const conflict_1 = require("@dotcom-tool-kit/conflict");
|
|
6
8
|
const error_1 = require("@dotcom-tool-kit/error");
|
|
@@ -91,7 +93,6 @@ function validateConfig(config) {
|
|
|
91
93
|
}
|
|
92
94
|
return validConfig;
|
|
93
95
|
}
|
|
94
|
-
exports.validateConfig = validateConfig;
|
|
95
96
|
async function loadConfig(logger, { validate = true, root }) {
|
|
96
97
|
const config = (0, exports.createConfig)(root);
|
|
97
98
|
// start loading config and child plugins, starting from the consumer app directory
|
|
@@ -113,4 +114,3 @@ async function loadConfig(logger, { validate = true, root }) {
|
|
|
113
114
|
(0, plugin_1.resolvePlugin)(validRootPlugin, validPluginConfig, logger);
|
|
114
115
|
return validate ? validateConfig(validPluginConfig) : config;
|
|
115
116
|
}
|
|
116
|
-
exports.loadConfig = loadConfig;
|
package/lib/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AAI1E,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AAI1E,eAAO,MAAM,wBAAwB,GAAI,SAAS,WAAW,KAAG,OAK/D,CAAA"}
|
package/lib/help.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = showHelp;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const config_1 = require("./config");
|
|
5
6
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
@@ -80,4 +81,3 @@ async function showHelp(logger, commands) {
|
|
|
80
81
|
}
|
|
81
82
|
logger.info('\n');
|
|
82
83
|
}
|
|
83
|
-
exports.default = showHelp;
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.shouldDisableNativeFetch = exports.runTasks = void 0;
|
|
4
|
+
exports.listPlugins = listPlugins;
|
|
5
|
+
exports.printConfig = printConfig;
|
|
4
6
|
const tslib_1 = require("tslib");
|
|
5
7
|
const config_1 = require("./config");
|
|
6
8
|
const util_1 = tslib_1.__importDefault(require("util"));
|
|
@@ -16,9 +18,7 @@ async function listPlugins(logger) {
|
|
|
16
18
|
logger.info((0, messages_1.formatPluginTree)(rootPlugin.value).join('\n'));
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
|
-
exports.listPlugins = listPlugins;
|
|
20
21
|
async function printConfig(logger) {
|
|
21
22
|
const config = await (0, config_1.loadConfig)(logger, { validate: false, root: process.cwd() });
|
|
22
23
|
logger.info(util_1.default.inspect(config, { depth: null, colors: true }));
|
|
23
24
|
}
|
|
24
|
-
exports.printConfig = printConfig;
|
package/lib/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runInit =
|
|
3
|
+
exports.runInit = runInit;
|
|
4
4
|
const base_1 = require("@dotcom-tool-kit/base");
|
|
5
5
|
const validated_1 = require("@dotcom-tool-kit/validated");
|
|
6
6
|
const entry_point_1 = require("./plugin/entry-point");
|
|
@@ -15,4 +15,3 @@ async function runInit(logger, config) {
|
|
|
15
15
|
cwd: config.root
|
|
16
16
|
})));
|
|
17
17
|
}
|
|
18
|
-
exports.runInit = runInit;
|
package/lib/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAa,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,SAAS,EAAmC,MAAM,4BAA4B,CAAA;AA0CvF,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAa,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,SAAS,EAAmC,MAAM,4BAA4B,CAAA;AA0CvF,eAAO,MAAM,qBAAqB,GAChC,QAAQ,MAAM,EACd,QAAQ,WAAW,KAClB,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAsC3B,CAAA;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBrF;AAED,wBAA8B,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAiD/E"}
|
package/lib/install.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.loadHookInstallations = void 0;
|
|
4
|
+
exports.checkInstall = checkInstall;
|
|
5
|
+
exports.default = installHooks;
|
|
4
6
|
const tslib_1 = require("tslib");
|
|
5
7
|
const path = tslib_1.__importStar(require("path"));
|
|
6
8
|
const error_1 = require("@dotcom-tool-kit/error");
|
|
@@ -73,7 +75,6 @@ async function checkInstall(logger, config) {
|
|
|
73
75
|
}
|
|
74
76
|
await (0, hash_1.updateHashes)(config);
|
|
75
77
|
}
|
|
76
|
-
exports.checkInstall = checkInstall;
|
|
77
78
|
async function installHooks(logger) {
|
|
78
79
|
const config = await (0, config_1.loadConfig)(logger, { root: process.cwd() });
|
|
79
80
|
await (0, init_1.runInit)(logger, config);
|
|
@@ -120,4 +121,3 @@ async function installHooks(logger) {
|
|
|
120
121
|
await (0, hash_1.updateHashes)(config);
|
|
121
122
|
return config;
|
|
122
123
|
}
|
|
123
|
-
exports.default = installHooks;
|
package/lib/messages.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,cAAc,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AASzD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,cAAc,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AASzD,eAAO,MAAM,mBAAmB,GAAI,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,KAAG,MAKT,CAAA;AAOzE,eAAO,MAAM,mBAAmB,GAAI,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,KAAG,MAKT,CAAA;AAezE,eAAO,MAAM,0BAA0B,GAAI,WAAW,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAG,MAQ/E,CAAA;AAOD,eAAO,MAAM,2BAA2B,GAAI,WAAW,QAAQ,CAAC,gBAAgB,CAAC,EAAE,KAAG,MAUrF,CAAA;AAOD,eAAO,MAAM,yBAAyB,GAAI,WAAW,QAAQ,CAAC,cAAc,CAAC,EAAE,KAAG,MAUjF,CAAA;AAKD,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;AAEhD,eAAO,MAAM,mBAAmB,GAAI,aAAa,aAAa,KAAG,MAKrD,CAAA;AAEZ,eAAO,MAAM,0BAA0B,GACrC,gBAAgB,aAAa,EAAE,KAC9B,MAG2F,CAAA;AAE9F,eAAO,MAAM,yBAAyB,GACpC,eAAe,MAAM,EAAE,EACvB,gBAAgB,MAAM,EAAE,KACvB,MAaF,CAAA;AAED,eAAO,MAAM,uBAAuB,GAClC,eAAe,MAAM,EAAE,EACvB,cAAc,MAAM,EAAE,KACrB,MAaF,CAAA;AAED,eAAO,MAAM,uBAAuB,GAClC,eAAe,MAAM,EAAE,EACvB,cAAc,MAAM,EAAE,KACrB,MAaF,CAAA;AAED,eAAO,MAAM,sBAAsB,GACjC,kBAAkB,IAAI,EAAE,KACvB,MAKF,CAAA;AAED,KAAK,OAAO,GAAG;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,cAAc,EAAE,CAAA;CAAE,CAAA;AAOhE,eAAO,MAAM,kBAAkB,GAC7B,cAAc,OAAO,EAAE,EACvB,OAAO,MAAM,EAAE,KACd,MAOF,CAAA;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAezD;AAED,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,KAAG,MAAwC,CAAA;AAMxF,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,UAiCvC"}
|
package/lib/messages.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.indentReasons = exports.formatMissingTasks = exports.formatUninstalledHooks = exports.formatUnusedHookOptions = exports.formatUnusedTaskOptions = exports.formatUnusedPluginOptions = exports.formatInvalidPluginOptions = exports.formatInvalidOption = exports.formatTaskOptionConflicts = exports.formatPluginOptionConflicts = exports.formatCommandTaskConflicts = exports.formatHookConflicts = exports.formatTaskConflicts = void 0;
|
|
4
|
+
exports.formatPluginTree = formatPluginTree;
|
|
5
|
+
exports.formatError = formatError;
|
|
4
6
|
const tslib_1 = require("tslib");
|
|
5
7
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
6
8
|
const zod_validation_error_1 = require("zod-validation-error");
|
|
@@ -133,7 +135,6 @@ function formatPluginTree(plugin) {
|
|
|
133
135
|
: `│ ${line}`))
|
|
134
136
|
];
|
|
135
137
|
}
|
|
136
|
-
exports.formatPluginTree = formatPluginTree;
|
|
137
138
|
const indentReasons = (reasons) => reasons.replace(/\n/g, '\n ');
|
|
138
139
|
exports.indentReasons = indentReasons;
|
|
139
140
|
// instanceof is unreliable across packages because of version mismatches so also use a heuristic to guess if it's a ToolKitError so we always log the details field if present
|
|
@@ -168,4 +169,3 @@ function formatError(error) {
|
|
|
168
169
|
}
|
|
169
170
|
return output + '\n';
|
|
170
171
|
}
|
|
171
|
-
exports.formatError = formatError;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.importSchemaEntryPoint = importSchemaEntryPoint;
|
|
4
|
+
exports.importEntryPoint = importEntryPoint;
|
|
4
5
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
5
6
|
const validated_1 = require("@dotcom-tool-kit/validated");
|
|
6
7
|
const tslib_1 = require("tslib");
|
|
@@ -43,7 +44,6 @@ async function importSchemaEntryPoint(entryPoint, exportName) {
|
|
|
43
44
|
]);
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
|
-
exports.importSchemaEntryPoint = importSchemaEntryPoint;
|
|
47
47
|
// the subclasses of Base have different constructor signatures so we need to omit
|
|
48
48
|
// the constructor from the type bound here so you can actually pass in a subclass
|
|
49
49
|
async function importEntryPoint(type, entryPoint) {
|
|
@@ -73,4 +73,3 @@ async function importEntryPoint(type, entryPoint) {
|
|
|
73
73
|
]);
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
exports.importEntryPoint = importEntryPoint;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDescendent =
|
|
3
|
+
exports.isDescendent = isDescendent;
|
|
4
4
|
function isDescendent(possibleAncestor, possibleDescendent) {
|
|
5
5
|
if (!possibleDescendent.parent) {
|
|
6
6
|
return false;
|
|
@@ -12,4 +12,3 @@ function isDescendent(possibleAncestor, possibleDescendent) {
|
|
|
12
12
|
return isDescendent(possibleAncestor, possibleDescendent.parent);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
exports.isDescendent = isDescendent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-commands.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIhC,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"merge-commands.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIhC,eAAO,MAAM,aAAa,GAAI,QAAQ,kBAAkB,EAAE,QAAQ,MAAM,EAAE,QAAQ,MAAM,SA4DvF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-hooks.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"merge-hooks.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,eAAO,MAAM,UAAU,GAAI,QAAQ,kBAAkB,EAAE,QAAQ,MAAM,SAwBpE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-inits.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-inits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"merge-inits.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-inits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,eAAO,MAAM,UAAU,GAAI,QAAQ,kBAAkB,EAAE,QAAQ,MAAM,SAUpE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-plugin-options.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-plugin-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAoB,MAAM,yBAAyB,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAMjE,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"merge-plugin-options.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-plugin-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAoB,MAAM,yBAAyB,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAMjE,eAAO,MAAM,kBAAkB,GAAI,QAAQ,kBAAkB,EAAE,QAAQ,MAAM,SAwC5E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-task-options.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-task-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAOjE,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"merge-task-options.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-task-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAOjE,eAAO,MAAM,gBAAgB,GAAI,QAAQ,kBAAkB,EAAE,QAAQ,MAAM,SAqC1E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-tasks.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAIjE,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"merge-tasks.d.ts","sourceRoot":"","sources":["../../src/plugin/merge-tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAIjE,eAAO,MAAM,UAAU,GAAI,QAAQ,kBAAkB,EAAE,QAAQ,MAAM,SAqBpE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/plugin/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAQ/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAG3C,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/plugin/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAQ/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAG3C,eAAO,MAAM,qBAAqB,GAChC,QAAQ,MAAM,EACd,QAAQ,kBAAkB,KACzB,OAAO,CAAC,aAAa,EAAE,CA2EzB,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,EAAE,QAAQ,kBAAkB,KAAG,IA+GjF,CAAA"}
|
package/lib/plugin/options.js
CHANGED
|
@@ -25,7 +25,16 @@ const validatePluginOptions = async (logger, config) => {
|
|
|
25
25
|
if (schemaEntrypoint) {
|
|
26
26
|
const schema = await (0, entry_point_1.importSchemaEntryPoint)({ plugin, modulePath: schemaEntrypoint });
|
|
27
27
|
if (!schema.valid) {
|
|
28
|
-
invalidOptions.push([
|
|
28
|
+
invalidOptions.push([
|
|
29
|
+
id,
|
|
30
|
+
new z.ZodError([
|
|
31
|
+
{
|
|
32
|
+
message: schema.reasons.join('\n'),
|
|
33
|
+
code: z.ZodIssueCode.custom,
|
|
34
|
+
path: []
|
|
35
|
+
}
|
|
36
|
+
])
|
|
37
|
+
]);
|
|
29
38
|
continue;
|
|
30
39
|
}
|
|
31
40
|
pluginSchema = schema.value;
|
|
@@ -101,8 +110,9 @@ const substituteOptionTags = (plugin, config) => {
|
|
|
101
110
|
const substituted = [];
|
|
102
111
|
for (const entry of entries) {
|
|
103
112
|
const subbedEntry = (0, validated_1.reduceValidated)(
|
|
104
|
-
// allow both keys and
|
|
105
|
-
entry.map((val) => {
|
|
113
|
+
// allow both keys and values to be substituted by options
|
|
114
|
+
entry.map((val, i) => {
|
|
115
|
+
const isKey = i === 0;
|
|
106
116
|
if (typeof val === 'string' && val.startsWith(rc_file_1.toolKitOptionIdent)) {
|
|
107
117
|
// check the tag path each time so that we can have a separate
|
|
108
118
|
// error for each incorrect use of the tag
|
|
@@ -115,14 +125,14 @@ const substituteOptionTags = (plugin, config) => {
|
|
|
115
125
|
// identifier
|
|
116
126
|
const optionPath = val.slice(rc_file_1.toolKitOptionIdent.length);
|
|
117
127
|
const resolvedOption = resolveOptionPath(optionPath);
|
|
118
|
-
if (typeof resolvedOption
|
|
119
|
-
return (0, validated_1.valid)(resolvedOption);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
128
|
+
if (isKey && typeof resolvedOption !== 'string') {
|
|
122
129
|
return (0, validated_1.invalid)([
|
|
123
|
-
`Option '${optionPath}'
|
|
130
|
+
`Option '${optionPath}' for the key at path '${path.join('.')}' does not resolve to a string (resolved to ${resolvedOption})`
|
|
124
131
|
]);
|
|
125
132
|
}
|
|
133
|
+
else {
|
|
134
|
+
return (0, validated_1.valid)(resolvedOption);
|
|
135
|
+
}
|
|
126
136
|
}
|
|
127
137
|
}
|
|
128
138
|
else {
|
|
@@ -130,9 +140,6 @@ const substituteOptionTags = (plugin, config) => {
|
|
|
130
140
|
}
|
|
131
141
|
}));
|
|
132
142
|
if (!subbedEntry.valid) {
|
|
133
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any --
|
|
134
|
-
* Invalid objects don't need to match the inner type
|
|
135
|
-
**/
|
|
136
143
|
substituted.push(subbedEntry);
|
|
137
144
|
continue;
|
|
138
145
|
}
|
|
@@ -155,9 +162,8 @@ const substituteOptionTags = (plugin, config) => {
|
|
|
155
162
|
substituted.push(...Object.entries(subbedValues.value).map((v) => (0, validated_1.valid)(v)));
|
|
156
163
|
}
|
|
157
164
|
else {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
**/
|
|
165
|
+
// safe to cast as invalid objects don't need to match the inner
|
|
166
|
+
// type
|
|
161
167
|
substituted.push(subbedValues);
|
|
162
168
|
}
|
|
163
169
|
}
|
|
@@ -183,7 +189,7 @@ const substituteOptionTags = (plugin, config) => {
|
|
|
183
189
|
}
|
|
184
190
|
}
|
|
185
191
|
if (plugin.rcFile) {
|
|
186
|
-
plugin.rcFile = deeplySubstitute(plugin.rcFile, []).unwrap(
|
|
192
|
+
plugin.rcFile = deeplySubstitute(plugin.rcFile, []).unwrap(`error when subsituting options (i.e., resolving ${logger_1.styles.code('!toolkit/option')} and ${logger_1.styles.code('!toolkit/if-defined')} tags)`);
|
|
187
193
|
}
|
|
188
194
|
config.resolutionTrackers.substitutedPlugins.add(plugin.id);
|
|
189
195
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reducePluginHookInstallations =
|
|
3
|
+
exports.reducePluginHookInstallations = reducePluginHookInstallations;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const conflict_1 = require("@dotcom-tool-kit/conflict");
|
|
6
6
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
@@ -76,4 +76,3 @@ async function reducePluginHookInstallations(logger, config, hookModules, plugin
|
|
|
76
76
|
...childInstallations.filter((childInstallation) => !pluginHookIds.includes(extractForHook(childInstallation)))
|
|
77
77
|
]);
|
|
78
78
|
}
|
|
79
|
-
exports.reducePluginHookInstallations = reducePluginHookInstallations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-resolve.d.ts","sourceRoot":"","sources":["../../src/plugin/require-resolve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"require-resolve.d.ts","sourceRoot":"","sources":["../../src/plugin/require-resolve.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,uBAAkB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveRoot =
|
|
3
|
+
exports.resolveRoot = resolveRoot;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const require_resolve_1 = require("./require-resolve");
|
|
@@ -25,4 +25,3 @@ function resolveRoot(id, root) {
|
|
|
25
25
|
throw error;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
exports.resolveRoot = resolveRoot;
|
package/lib/plugin.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.loadPlugin = loadPlugin;
|
|
4
|
+
exports.resolvePluginOptions = resolvePluginOptions;
|
|
5
|
+
exports.resolvePlugin = resolvePlugin;
|
|
4
6
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
5
7
|
const plugin_1 = require("@dotcom-tool-kit/plugin");
|
|
6
8
|
const validated_1 = require("@dotcom-tool-kit/validated");
|
|
@@ -52,7 +54,6 @@ async function loadPlugin(id, config, logger, parent) {
|
|
|
52
54
|
return plugin;
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
|
-
exports.loadPlugin = loadPlugin;
|
|
56
57
|
function resolvePluginOptions(plugin, config) {
|
|
57
58
|
// don't resolve plugins that have already been resolved to prevent self-conflicts
|
|
58
59
|
// between plugins included at multiple points in the tree
|
|
@@ -68,7 +69,6 @@ function resolvePluginOptions(plugin, config) {
|
|
|
68
69
|
(0, merge_plugin_options_1.mergePluginOptions)(config, plugin);
|
|
69
70
|
config.resolutionTrackers.resolvedPluginOptions.add(plugin.id);
|
|
70
71
|
}
|
|
71
|
-
exports.resolvePluginOptions = resolvePluginOptions;
|
|
72
72
|
function resolvePlugin(plugin, config, logger) {
|
|
73
73
|
// don't resolve plugins that have already been resolved to prevent self-conflicts
|
|
74
74
|
// between plugins included at multiple points in the tree
|
|
@@ -88,4 +88,3 @@ function resolvePlugin(plugin, config, logger) {
|
|
|
88
88
|
(0, merge_inits_1.mergeInits)(config, plugin);
|
|
89
89
|
config.resolutionTrackers.resolvedPlugins.add(plugin.id);
|
|
90
90
|
}
|
|
91
|
-
exports.resolvePlugin = resolvePlugin;
|
package/lib/rc-file.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toolKitIfDefinedIdent = exports.toolKitOptionIdent = void 0;
|
|
4
|
+
exports.loadToolKitRC = loadToolKitRC;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const promises_1 = tslib_1.__importDefault(require("node:fs/promises"));
|
|
6
7
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
@@ -92,4 +93,3 @@ async function loadToolKitRC(logger, root) {
|
|
|
92
93
|
init: config.init ?? []
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
|
-
exports.loadToolKitRC = loadToolKitRC;
|
package/lib/tasks.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.runTasksFromConfig = runTasksFromConfig;
|
|
4
|
+
exports.runTasks = runTasks;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const base_1 = require("@dotcom-tool-kit/base");
|
|
6
7
|
const validated_1 = require("@dotcom-tool-kit/validated");
|
|
@@ -82,9 +83,7 @@ async function runTasksFromConfig(logger, config, commands, files) {
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
exports.runTasksFromConfig = runTasksFromConfig;
|
|
86
86
|
async function runTasks(logger, commands, files) {
|
|
87
87
|
const config = await (0, config_1.loadConfig)(logger, { root: process.cwd() });
|
|
88
88
|
return runTasksFromConfig(logger, config, commands, files);
|
|
89
89
|
}
|
|
90
|
-
exports.runTasks = runTasks;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotcom-tool-kit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
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,33 +20,32 @@
|
|
|
20
20
|
"test": "cd ../../ ; npx jest --silent --projects core/cli"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@jest/globals": "^
|
|
24
|
-
"@
|
|
23
|
+
"@jest/globals": "^29.7.0",
|
|
24
|
+
"@relmify/jest-serializer-strip-ansi": "1.0.2",
|
|
25
|
+
"@types/lodash": "^4.17.16",
|
|
25
26
|
"@types/pluralize": "^0.0.33",
|
|
26
|
-
"chai": "^4.3.4",
|
|
27
27
|
"globby": "^10.0.2",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"zod": "^3.22.4"
|
|
28
|
+
"winston": "^3.17.0",
|
|
29
|
+
"zod": "^3.24.4"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
|
-
"@dotcom-tool-kit/base": "^1.2.
|
|
34
|
-
"@dotcom-tool-kit/config": "^1.1.
|
|
32
|
+
"@dotcom-tool-kit/base": "^1.2.3",
|
|
33
|
+
"@dotcom-tool-kit/config": "^1.1.1",
|
|
35
34
|
"@dotcom-tool-kit/conflict": "^1.0.1",
|
|
36
|
-
"@dotcom-tool-kit/error": "^4.1.
|
|
37
|
-
"@dotcom-tool-kit/logger": "^4.2.
|
|
35
|
+
"@dotcom-tool-kit/error": "^4.1.1",
|
|
36
|
+
"@dotcom-tool-kit/logger": "^4.2.2",
|
|
38
37
|
"@dotcom-tool-kit/plugin": "^1.1.0",
|
|
39
38
|
"@dotcom-tool-kit/schemas": "^1.9.0",
|
|
40
|
-
"@dotcom-tool-kit/state": "^4.3.
|
|
41
|
-
"@dotcom-tool-kit/validated": "^1.0.
|
|
42
|
-
"@dotcom-tool-kit/wait-for-ok": "^4.1.
|
|
39
|
+
"@dotcom-tool-kit/state": "^4.3.2",
|
|
40
|
+
"@dotcom-tool-kit/validated": "^1.0.3",
|
|
41
|
+
"@dotcom-tool-kit/wait-for-ok": "^4.1.2",
|
|
43
42
|
"endent": "^2.1.0",
|
|
44
43
|
"lodash": "^4.17.21",
|
|
45
44
|
"minimist": "^1.2.8",
|
|
46
45
|
"pluralize": "^8.0.0",
|
|
47
46
|
"pretty-format": "^29.7.0",
|
|
48
|
-
"tslib": "^2.
|
|
49
|
-
"yaml": "^2.
|
|
47
|
+
"tslib": "^2.8.1",
|
|
48
|
+
"yaml": "^2.7.1",
|
|
50
49
|
"zod-validation-error": "^2.1.0"
|
|
51
50
|
},
|
|
52
51
|
"engines": {
|