dotcom-tool-kit 3.4.5 → 4.0.0-beta.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/bin/run +11 -1
- package/lib/config/hash.d.ts +6 -0
- package/lib/config/hash.d.ts.map +1 -0
- package/lib/config/hash.js +43 -0
- package/lib/config/validate-plugins.d.ts +4 -0
- package/lib/config/validate-plugins.d.ts.map +1 -0
- package/lib/config/validate-plugins.js +9 -0
- package/lib/config.d.ts +2 -54
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +62 -113
- package/lib/fetch.d.ts +2 -0
- package/lib/fetch.d.ts.map +1 -0
- package/lib/fetch.js +19 -0
- package/lib/help.d.ts +1 -1
- package/lib/help.d.ts.map +1 -1
- package/lib/help.js +72 -39
- package/lib/index.d.ts +3 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +12 -95
- package/lib/init.d.ts +4 -0
- package/lib/init.d.ts.map +1 -0
- package/lib/init.js +16 -0
- package/lib/install.d.ts +6 -1
- package/lib/install.d.ts.map +1 -1
- package/lib/install.js +69 -13
- package/lib/messages.d.ts +14 -13
- package/lib/messages.d.ts.map +1 -1
- package/lib/messages.js +38 -27
- package/lib/plugin/entry-point.d.ts +7 -0
- package/lib/plugin/entry-point.d.ts.map +1 -0
- package/lib/plugin/entry-point.js +46 -0
- package/lib/plugin/is-descendent.d.ts +3 -0
- package/lib/plugin/is-descendent.d.ts.map +1 -0
- package/lib/plugin/is-descendent.js +15 -0
- package/lib/plugin/merge-commands.d.ts +5 -0
- package/lib/plugin/merge-commands.d.ts.map +1 -0
- package/lib/plugin/merge-commands.js +59 -0
- package/lib/plugin/merge-hooks.d.ts +4 -0
- package/lib/plugin/merge-hooks.d.ts.map +1 -0
- package/lib/plugin/merge-hooks.js +29 -0
- package/lib/plugin/merge-inits.d.ts +4 -0
- package/lib/plugin/merge-inits.d.ts.map +1 -0
- package/lib/plugin/merge-inits.js +13 -0
- package/lib/plugin/merge-plugin-options.d.ts +4 -0
- package/lib/plugin/merge-plugin-options.d.ts.map +1 -0
- package/lib/plugin/merge-plugin-options.js +46 -0
- package/lib/plugin/merge-task-options.d.ts +4 -0
- package/lib/plugin/merge-task-options.d.ts.map +1 -0
- package/lib/plugin/merge-task-options.js +43 -0
- package/lib/plugin/merge-tasks.d.ts +4 -0
- package/lib/plugin/merge-tasks.d.ts.map +1 -0
- package/lib/plugin/merge-tasks.js +27 -0
- package/lib/plugin/options.d.ts +7 -0
- package/lib/plugin/options.d.ts.map +1 -0
- package/lib/plugin/options.js +170 -0
- package/lib/plugin/reduce-installations.d.ts +7 -0
- package/lib/plugin/reduce-installations.d.ts.map +1 -0
- package/lib/plugin/reduce-installations.js +59 -0
- package/lib/plugin.d.ts +4 -3
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +56 -217
- package/lib/rc-file.d.ts +4 -9
- package/lib/rc-file.d.ts.map +1 -1
- package/lib/rc-file.js +80 -20
- package/lib/tasks.d.ts +3 -0
- package/lib/tasks.d.ts.map +1 -0
- package/lib/tasks.js +92 -0
- package/package.json +28 -22
- package/lib/conflict.d.ts +0 -9
- package/lib/conflict.d.ts.map +0 -1
- package/lib/conflict.js +0 -27
- package/lib/hook.d.ts +0 -7
- package/lib/hook.d.ts.map +0 -1
- package/lib/hook.js +0 -2
- package/lib/postInstall.d.ts +0 -7
- package/lib/postInstall.d.ts.map +0 -1
- package/lib/postInstall.js +0 -53
package/lib/conflict.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withoutConflicts = exports.findConflicts = exports.isConflict = void 0;
|
|
4
|
-
function isConflict(thing) {
|
|
5
|
-
return Boolean(thing.conflicting);
|
|
6
|
-
}
|
|
7
|
-
exports.isConflict = isConflict;
|
|
8
|
-
function findConflicts(items) {
|
|
9
|
-
const conflicts = [];
|
|
10
|
-
for (const item of items) {
|
|
11
|
-
if (isConflict(item)) {
|
|
12
|
-
conflicts.push(item);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return conflicts;
|
|
16
|
-
}
|
|
17
|
-
exports.findConflicts = findConflicts;
|
|
18
|
-
function withoutConflicts(items) {
|
|
19
|
-
const nonConflicts = [];
|
|
20
|
-
for (const item of items) {
|
|
21
|
-
if (!isConflict(item)) {
|
|
22
|
-
nonConflicts.push(item);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return nonConflicts;
|
|
26
|
-
}
|
|
27
|
-
exports.withoutConflicts = withoutConflicts;
|
package/lib/hook.d.ts
DELETED
package/lib/hook.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../src/hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAEpD,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB"}
|
package/lib/hook.js
DELETED
package/lib/postInstall.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Logger } from 'winston';
|
|
2
|
-
/**
|
|
3
|
-
* This step adds the tags only filter to rest of the jobs in the workflow if there is a job that contains the semverRegex.
|
|
4
|
-
* CircleCI will only run the jobs if the rest of the jobs have the tags filter.
|
|
5
|
-
*/
|
|
6
|
-
export declare function postInstall(logger: Logger): Promise<void>;
|
|
7
|
-
//# sourceMappingURL=postInstall.d.ts.map
|
package/lib/postInstall.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postInstall.d.ts","sourceRoot":"","sources":["../src/postInstall.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC;;;GAGG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuC/D"}
|
package/lib/postInstall.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.postInstall = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const npm_1 = require("@dotcom-tool-kit/types/lib/npm");
|
|
8
|
-
const YAML = tslib_1.__importStar(require("yaml"));
|
|
9
|
-
const merge_1 = tslib_1.__importDefault(require("lodash/merge"));
|
|
10
|
-
const circleci_1 = require("@dotcom-tool-kit/types/lib/circleci");
|
|
11
|
-
/**
|
|
12
|
-
* This step adds the tags only filter to rest of the jobs in the workflow if there is a job that contains the semverRegex.
|
|
13
|
-
* CircleCI will only run the jobs if the rest of the jobs have the tags filter.
|
|
14
|
-
*/
|
|
15
|
-
async function postInstall(logger) {
|
|
16
|
-
const circleConfigPath = path_1.default.resolve(process.cwd(), '.circleci/config.yml');
|
|
17
|
-
try {
|
|
18
|
-
const rawCircleConfig = await fs_1.promises.readFile(circleConfigPath, 'utf8');
|
|
19
|
-
if (rawCircleConfig &&
|
|
20
|
-
rawCircleConfig.includes(npm_1.semVerRegex.source) &&
|
|
21
|
-
rawCircleConfig.startsWith(circleci_1.automatedComment)) {
|
|
22
|
-
logger.verbose('running postInstall step');
|
|
23
|
-
const yml = YAML.parseDocument(rawCircleConfig);
|
|
24
|
-
const workflows = yml.get('workflows');
|
|
25
|
-
const toolkitWorkflow = workflows.get('tool-kit');
|
|
26
|
-
const jobs = toolkitWorkflow.get('jobs');
|
|
27
|
-
jobs?.items.forEach((jobItem, index) => {
|
|
28
|
-
const tagsFilterConfig = { filters: { tags: { only: `${npm_1.semVerRegex}` } } };
|
|
29
|
-
if (jobItem.type === 'PLAIN') {
|
|
30
|
-
// eg. - checkout
|
|
31
|
-
const node = YAML.createNode({ [jobItem.value]: tagsFilterConfig });
|
|
32
|
-
jobs.items[index] = node;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
const job = jobItem.items[0];
|
|
36
|
-
const existingFilter = job.value.items.filter((item) => item.key.value === 'filters')[0];
|
|
37
|
-
const merged = existingFilter ? (0, merge_1.default)(existingFilter.toJSON(), tagsFilterConfig) : tagsFilterConfig;
|
|
38
|
-
const node = YAML.createNode(merged['filters']);
|
|
39
|
-
job.value.set('filters', node);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
logger.info(`writing postInstall results to file ${circleConfigPath}`);
|
|
43
|
-
await fs_1.promises.writeFile(circleConfigPath, yml.toString());
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
// Not an error if config file doesn't exist
|
|
48
|
-
if (error.code !== 'ENOENT') {
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.postInstall = postInstall;
|