dotcom-tool-kit 3.1.6 → 3.2.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/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -1
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +8 -5
- package/package.json +15 -15
- package/readme.md +13 -0
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Logger } from 'winston';
|
|
2
|
+
export declare const shouldDisableNativeFetch: () => boolean;
|
|
2
3
|
export declare function runTasks(logger: Logger, hooks: string[], files?: string[]): Promise<void>;
|
|
3
4
|
export declare function listPlugins(logger: Logger): Promise<void>;
|
|
4
5
|
export { default as showHelp } from './help';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAWrC,eAAO,MAAM,wBAAwB,QAAO,OAY3C,CAAA;AAED,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmF/F;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO/D;AAED,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -3,12 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.installHooks = exports.showHelp = exports.listPlugins = exports.runTasks = void 0;
|
|
6
|
+
exports.installHooks = exports.showHelp = exports.listPlugins = exports.runTasks = exports.shouldDisableNativeFetch = void 0;
|
|
7
7
|
const error_1 = require("@dotcom-tool-kit/error");
|
|
8
8
|
const config_1 = require("./config");
|
|
9
9
|
const options_1 = require("@dotcom-tool-kit/options");
|
|
10
10
|
const logger_1 = require("@dotcom-tool-kit/logger");
|
|
11
11
|
const messages_1 = require("./messages");
|
|
12
|
+
// function that plugins can check if they need to implement their own logic to
|
|
13
|
+
// disable Node 18's native fetch
|
|
14
|
+
const shouldDisableNativeFetch = () => {
|
|
15
|
+
// disable Node 18's native fetch if the Node runtime supports it (older
|
|
16
|
+
// runtimes don't support the flag, implying they also don't use native
|
|
17
|
+
// fetch) and the user hasn't opted out of the behaviour
|
|
18
|
+
return (
|
|
19
|
+
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion --
|
|
20
|
+
* the root plugin has default options and it always exists so is always
|
|
21
|
+
* defined
|
|
22
|
+
**/
|
|
23
|
+
!(0, options_1.getOptions)('app root').allowNativeFetch &&
|
|
24
|
+
process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch'));
|
|
25
|
+
};
|
|
26
|
+
exports.shouldDisableNativeFetch = shouldDisableNativeFetch;
|
|
12
27
|
async function runTasks(logger, hooks, files) {
|
|
13
28
|
const config = await (0, config_1.loadConfig)(logger);
|
|
14
29
|
const availableHooks = Object.keys(config.hooks)
|
|
@@ -30,6 +45,9 @@ ${availableHooks}`;
|
|
|
30
45
|
}
|
|
31
46
|
}
|
|
32
47
|
await (0, config_1.checkInstall)(config);
|
|
48
|
+
if ((0, exports.shouldDisableNativeFetch)()) {
|
|
49
|
+
process.execArgv.push('--no-experimental-fetch');
|
|
50
|
+
}
|
|
33
51
|
for (const hook of hooks) {
|
|
34
52
|
const errors = [];
|
|
35
53
|
if (!config.hookTasks[hook]) {
|
package/lib/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,MAAM,EACN,YAAY,EAIZ,SAAS,EACV,MAAM,wBAAwB,CAAA;AAG/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAiB,SAAS,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAmBvE,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC,YAAY,CAAC,CAgDvE;AAoBD,wBAAsB,UAAU,CAC9B,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CA4D5B;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,MAAM,EACN,YAAY,EAIZ,SAAS,EACV,MAAM,wBAAwB,CAAA;AAG/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAiB,SAAS,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAmBvE,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC,YAAY,CAAC,CAgDvE;AAoBD,wBAAsB,UAAU,CAC9B,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CA4D5B;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAyI9F"}
|
package/lib/plugin.js
CHANGED
|
@@ -212,11 +212,14 @@ function resolvePlugin(plugin, config, logger) {
|
|
|
212
212
|
// merge options from this plugin's config with any options we've collected already
|
|
213
213
|
// TODO this is almost the exact same code as for hooks, refactor
|
|
214
214
|
for (const [id, configOptions] of Object.entries(plugin.rcFile.options)) {
|
|
215
|
-
|
|
215
|
+
// users can specify root options with the dotcom-tool-kit key to mirror
|
|
216
|
+
// the name of the root npm package
|
|
217
|
+
const pluginId = id === 'dotcom-tool-kit' ? 'app root' : id;
|
|
218
|
+
const existingOptions = config.options[pluginId];
|
|
216
219
|
const pluginOptions = {
|
|
217
220
|
options: configOptions,
|
|
218
221
|
plugin,
|
|
219
|
-
forPlugin: config.plugins[
|
|
222
|
+
forPlugin: config.plugins[pluginId]
|
|
220
223
|
};
|
|
221
224
|
if (existingOptions) {
|
|
222
225
|
const existingFromDescendent = isDescendent(plugin, existingOptions.plugin);
|
|
@@ -229,17 +232,17 @@ function resolvePlugin(plugin, config, logger) {
|
|
|
229
232
|
plugin,
|
|
230
233
|
conflicting: conflicting.concat(pluginOptions)
|
|
231
234
|
};
|
|
232
|
-
config.options[
|
|
235
|
+
config.options[pluginId] = conflict;
|
|
233
236
|
}
|
|
234
237
|
else {
|
|
235
238
|
// if we're here, any existing options are from a child plugin,
|
|
236
239
|
// so merge in overrides from the parent
|
|
237
|
-
config.options[
|
|
240
|
+
config.options[pluginId] = { ...existingOptions, ...pluginOptions };
|
|
238
241
|
}
|
|
239
242
|
}
|
|
240
243
|
else {
|
|
241
244
|
// this options key might not have been set yet, in which case use the new one
|
|
242
|
-
config.options[
|
|
245
|
+
config.options[pluginId] = pluginOptions;
|
|
243
246
|
}
|
|
244
247
|
}
|
|
245
248
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotcom-tool-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.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,17 +20,17 @@
|
|
|
20
20
|
"test": "cd ../../ ; npx jest --silent --projects core/cli"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@dotcom-tool-kit/babel": "^3.1.
|
|
24
|
-
"@dotcom-tool-kit/backend-heroku-app": "^2.1.
|
|
25
|
-
"@dotcom-tool-kit/circleci": "^5.3.
|
|
26
|
-
"@dotcom-tool-kit/circleci-deploy": "^3.2.
|
|
27
|
-
"@dotcom-tool-kit/eslint": "^3.1.
|
|
28
|
-
"@dotcom-tool-kit/frontend-app": "^3.1.
|
|
29
|
-
"@dotcom-tool-kit/heroku": "^3.2.
|
|
30
|
-
"@dotcom-tool-kit/mocha": "^3.1.
|
|
31
|
-
"@dotcom-tool-kit/n-test": "^3.2.
|
|
32
|
-
"@dotcom-tool-kit/npm": "^3.1.
|
|
33
|
-
"@dotcom-tool-kit/webpack": "^3.1.
|
|
23
|
+
"@dotcom-tool-kit/babel": "^3.1.2",
|
|
24
|
+
"@dotcom-tool-kit/backend-heroku-app": "^2.1.7",
|
|
25
|
+
"@dotcom-tool-kit/circleci": "^5.3.4",
|
|
26
|
+
"@dotcom-tool-kit/circleci-deploy": "^3.2.4",
|
|
27
|
+
"@dotcom-tool-kit/eslint": "^3.1.2",
|
|
28
|
+
"@dotcom-tool-kit/frontend-app": "^3.1.8",
|
|
29
|
+
"@dotcom-tool-kit/heroku": "^3.2.2",
|
|
30
|
+
"@dotcom-tool-kit/mocha": "^3.1.2",
|
|
31
|
+
"@dotcom-tool-kit/n-test": "^3.2.2",
|
|
32
|
+
"@dotcom-tool-kit/npm": "^3.1.2",
|
|
33
|
+
"@dotcom-tool-kit/webpack": "^3.1.3",
|
|
34
34
|
"@jest/globals": "^27.4.6",
|
|
35
35
|
"@types/lodash": "^4.14.185",
|
|
36
36
|
"@types/node": "^16.18.23",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@dotcom-tool-kit/error": "^3.1.0",
|
|
44
|
-
"@dotcom-tool-kit/logger": "^3.1.
|
|
45
|
-
"@dotcom-tool-kit/options": "^3.1.
|
|
46
|
-
"@dotcom-tool-kit/types": "^3.
|
|
44
|
+
"@dotcom-tool-kit/logger": "^3.1.1",
|
|
45
|
+
"@dotcom-tool-kit/options": "^3.1.2",
|
|
46
|
+
"@dotcom-tool-kit/types": "^3.3.0",
|
|
47
47
|
"@dotcom-tool-kit/wait-for-ok": "^3.1.0",
|
|
48
48
|
"cosmiconfig": "^7.0.0",
|
|
49
49
|
"lodash": "^4.17.21",
|
package/readme.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# dotcom-tool-kit
|
|
2
|
+
|
|
3
|
+
_(This README is for the core `dotcom-tool-kit` package that must be installed to use Tool Kit. You can find the documentation for the Tool Kit project itself at https://github.com/Financial-Times/dotcom-tool-kit/blob/main/readme.md.)_
|
|
4
|
+
|
|
5
|
+
The primary Tool Kit binary that will be invoked to handle all your hooks and tasks.
|
|
6
|
+
|
|
7
|
+
## Options
|
|
8
|
+
|
|
9
|
+
There are some global options available that will affect all plugins. All are optional but you can override them with the `dotcom-tool-kit` key.
|
|
10
|
+
|
|
11
|
+
| Key | Description | Default value |
|
|
12
|
+
|-|-|-|
|
|
13
|
+
| `allowNativeFetch` | use Node's native fetch if supported | `false` |
|