@teambit/workspace 0.0.844 → 0.0.847
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/dist/index.d.ts +1 -0
- package/dist/index.js.map +1 -1
- package/dist/ui/workspace/use-workspace.js +3 -0
- package/dist/ui/workspace/use-workspace.js.map +1 -1
- package/dist/workspace-component/workspace-component-loader.js +6 -0
- package/dist/workspace-component/workspace-component-loader.js.map +1 -1
- package/dist/workspace.d.ts +9 -60
- package/dist/workspace.js +29 -411
- package/dist/workspace.js.map +1 -1
- package/dist/workspace.main.runtime.js +1 -11
- package/dist/workspace.main.runtime.js.map +1 -1
- package/dist/workspace.provider.d.ts +2 -4
- package/dist/workspace.provider.js +3 -66
- package/dist/workspace.provider.js.map +1 -1
- package/dist/workspace.ui.runtime.d.ts +2 -1
- package/dist/workspace.ui.runtime.js +27 -6
- package/dist/workspace.ui.runtime.js.map +1 -1
- package/package-tar/teambit-workspace-0.0.847.tgz +0 -0
- package/package.json +33 -42
- package/{preview-1662281577904.js → preview-1662694416892.js} +2 -2
- package/ui/workspace/use-workspace.ts +3 -0
- package/workspace-component/workspace-component-loader.ts +5 -0
- package/workspace.ui.runtime.tsx +16 -6
- package/__snapshots__/pick-outdated-pkgs.spec.ts.snap +0 -171
- package/dist/__snapshots__/pick-outdated-pkgs.spec.js.snap +0 -171
- package/dist/__snapshots__/pick-outdated-pkgs.spec.ts.snap +0 -171
- package/dist/exceptions/dependency-type-not-supported-in-policy.d.ts +0 -4
- package/dist/exceptions/dependency-type-not-supported-in-policy.js +0 -27
- package/dist/exceptions/dependency-type-not-supported-in-policy.js.map +0 -1
- package/dist/exceptions/index.d.ts +0 -1
- package/dist/exceptions/index.js +0 -23
- package/dist/exceptions/index.js.map +0 -1
- package/dist/install.cmd.d.ts +0 -44
- package/dist/install.cmd.js +0 -85
- package/dist/install.cmd.js.map +0 -1
- package/dist/link/component-list-links.d.ts +0 -7
- package/dist/link/component-list-links.js +0 -98
- package/dist/link/component-list-links.js.map +0 -1
- package/dist/link/core-aspects-links.d.ts +0 -7
- package/dist/link/core-aspects-links.js +0 -95
- package/dist/link/core-aspects-links.js.map +0 -1
- package/dist/link/get-package-name-from-target.d.ts +0 -1
- package/dist/link/get-package-name-from-target.js +0 -16
- package/dist/link/get-package-name-from-target.js.map +0 -1
- package/dist/link/index.d.ts +0 -1
- package/dist/link/index.js +0 -23
- package/dist/link/index.js.map +0 -1
- package/dist/link/link-row.d.ts +0 -12
- package/dist/link/link-row.js +0 -38
- package/dist/link/link-row.js.map +0 -1
- package/dist/link/link-to-dir.d.ts +0 -2
- package/dist/link/link-to-dir.js +0 -45
- package/dist/link/link-to-dir.js.map +0 -1
- package/dist/link/link.cmd.d.ts +0 -44
- package/dist/link/link.cmd.js +0 -176
- package/dist/link/link.cmd.js.map +0 -1
- package/dist/link/nested-deps-in-nm-links.d.ts +0 -7
- package/dist/link/nested-deps-in-nm-links.js +0 -74
- package/dist/link/nested-deps-in-nm-links.js.map +0 -1
- package/dist/link/rewire-row.d.ts +0 -6
- package/dist/link/rewire-row.js +0 -31
- package/dist/link/rewire-row.js.map +0 -1
- package/dist/pick-outdated-pkgs.d.ts +0 -16
- package/dist/pick-outdated-pkgs.js +0 -308
- package/dist/pick-outdated-pkgs.js.map +0 -1
- package/dist/pick-outdated-pkgs.spec.d.ts +0 -1
- package/dist/pick-outdated-pkgs.spec.js +0 -121
- package/dist/pick-outdated-pkgs.spec.js.map +0 -1
- package/dist/uninstall.cmd.d.ts +0 -19
- package/dist/uninstall.cmd.js +0 -47
- package/dist/uninstall.cmd.js.map +0 -1
- package/dist/update.cmd.d.ts +0 -23
- package/dist/update.cmd.js +0 -47
- package/dist/update.cmd.js.map +0 -1
- package/exceptions/dependency-type-not-supported-in-policy.ts +0 -7
- package/exceptions/index.ts +0 -1
- package/install.cmd.tsx +0 -72
- package/link/component-list-links.ts +0 -50
- package/link/core-aspects-links.ts +0 -50
- package/link/get-package-name-from-target.ts +0 -5
- package/link/index.ts +0 -1
- package/link/link-row.ts +0 -20
- package/link/link-to-dir.ts +0 -13
- package/link/link.cmd.ts +0 -100
- package/link/nested-deps-in-nm-links.ts +0 -47
- package/link/rewire-row.ts +0 -17
- package/package-tar/teambit-workspace-0.0.844.tgz +0 -0
- package/uninstall.cmd.tsx +0 -23
- package/update.cmd.tsx +0 -29
package/dist/link/link.cmd.js
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
exports.LinkCommand = void 0;
|
|
13
|
-
|
|
14
|
-
function _defineProperty2() {
|
|
15
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
|
-
_defineProperty2 = function () {
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function _toolboxTime() {
|
|
25
|
-
const data = require("@teambit/toolbox.time.time-format");
|
|
26
|
-
|
|
27
|
-
_toolboxTime = function () {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return data;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function _chalk() {
|
|
35
|
-
const data = _interopRequireDefault(require("chalk"));
|
|
36
|
-
|
|
37
|
-
_chalk = function () {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _componentListLinks() {
|
|
45
|
-
const data = require("./component-list-links");
|
|
46
|
-
|
|
47
|
-
_componentListLinks = function () {
|
|
48
|
-
return data;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _coreAspectsLinks() {
|
|
55
|
-
const data = require("./core-aspects-links");
|
|
56
|
-
|
|
57
|
-
_coreAspectsLinks = function () {
|
|
58
|
-
return data;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function _nestedDepsInNmLinks() {
|
|
65
|
-
const data = require("./nested-deps-in-nm-links");
|
|
66
|
-
|
|
67
|
-
_nestedDepsInNmLinks = function () {
|
|
68
|
-
return data;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return data;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function _rewireRow() {
|
|
75
|
-
const data = require("./rewire-row");
|
|
76
|
-
|
|
77
|
-
_rewireRow = function () {
|
|
78
|
-
return data;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
return data;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function _linkToDir() {
|
|
85
|
-
const data = require("./link-to-dir");
|
|
86
|
-
|
|
87
|
-
_linkToDir = function () {
|
|
88
|
-
return data;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
return data;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
class LinkCommand {
|
|
95
|
-
constructor(
|
|
96
|
-
/**
|
|
97
|
-
* workspace extension.
|
|
98
|
-
*/
|
|
99
|
-
workspace,
|
|
100
|
-
/**
|
|
101
|
-
* logger extension.
|
|
102
|
-
*/
|
|
103
|
-
logger, docsDomain) {
|
|
104
|
-
this.workspace = workspace;
|
|
105
|
-
this.logger = logger;
|
|
106
|
-
this.docsDomain = docsDomain;
|
|
107
|
-
(0, _defineProperty2().default)(this, "name", 'link [component-names...]');
|
|
108
|
-
(0, _defineProperty2().default)(this, "alias", '');
|
|
109
|
-
(0, _defineProperty2().default)(this, "description", 'create links in the node_modules directory, to core aspects and to components in the workspace');
|
|
110
|
-
(0, _defineProperty2().default)(this, "extendedDescription", void 0);
|
|
111
|
-
(0, _defineProperty2().default)(this, "group", 'development');
|
|
112
|
-
(0, _defineProperty2().default)(this, "private", false);
|
|
113
|
-
(0, _defineProperty2().default)(this, "arguments", [{
|
|
114
|
-
name: 'component-names...',
|
|
115
|
-
description: 'names or IDs of the components to link'
|
|
116
|
-
}]);
|
|
117
|
-
(0, _defineProperty2().default)(this, "options", [['j', 'json', 'return the output as JSON'], ['', 'verbose', 'verbose output'], ['r', 'rewire', 'Replace relative paths with module paths in code (e.g. "../foo" => "@bit/foo")'], ['', 'target <dir>', 'EXPERIMENTAL. link to an external directory (similar to npm-link) so other projects could use these components'], ['', 'skip-fetching-objects', 'skip fetch missing objects from remotes before linking']]);
|
|
118
|
-
this.extendedDescription = `https://${this.docsDomain}/workspace/component-links`;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
async report([ids], opts) {
|
|
122
|
-
var _linkResults$legacyLi;
|
|
123
|
-
|
|
124
|
-
const startTime = Date.now();
|
|
125
|
-
const linkResults = await this.json([ids], opts);
|
|
126
|
-
const endTime = Date.now();
|
|
127
|
-
const numOfComponents = (_linkResults$legacyLi = linkResults.legacyLinkResults) === null || _linkResults$legacyLi === void 0 ? void 0 : _linkResults$legacyLi.length;
|
|
128
|
-
const timeDiff = (0, _toolboxTime().timeFormat)(endTime - startTime);
|
|
129
|
-
const coreAspectsLinksWithMainAspect = linkResults.coreAspectsLinks || [];
|
|
130
|
-
|
|
131
|
-
if (linkResults.teambitBitLink) {
|
|
132
|
-
coreAspectsLinksWithMainAspect.unshift(linkResults.teambitBitLink);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const numOfCoreAspects = coreAspectsLinksWithMainAspect.length;
|
|
136
|
-
const title = `Linked ${numOfComponents} components and ${numOfCoreAspects} core aspects to node_modules for workspace: ${this.workspace.name}`;
|
|
137
|
-
const coreLinks = (0, _coreAspectsLinks().CoreAspectsLinks)({
|
|
138
|
-
coreAspectsLinks: coreAspectsLinksWithMainAspect,
|
|
139
|
-
verbose: opts.verbose
|
|
140
|
-
});
|
|
141
|
-
const compsLinks = (0, _componentListLinks().ComponentListLinks)({
|
|
142
|
-
componentListLinks: linkResults.legacyLinkResults,
|
|
143
|
-
verbose: opts.verbose
|
|
144
|
-
});
|
|
145
|
-
const rewireRow = (0, _rewireRow().RewireRow)({
|
|
146
|
-
legacyCodemodResults: linkResults.legacyLinkCodemodResults
|
|
147
|
-
});
|
|
148
|
-
const nestedLinks = (0, _nestedDepsInNmLinks().NestedComponentLinksLinks)({
|
|
149
|
-
nestedDepsInNmLinks: linkResults.nestedDepsInNmLinks,
|
|
150
|
-
verbose: opts.verbose
|
|
151
|
-
});
|
|
152
|
-
const targetLinks = (0, _linkToDir().linkToDir)(linkResults.linkToDirResults);
|
|
153
|
-
const footer = `Finished. ${timeDiff}`;
|
|
154
|
-
return `${title}\n${coreLinks}\n${compsLinks}\n${rewireRow}${nestedLinks}${targetLinks}${footer}`;
|
|
155
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
async json([ids], opts) {
|
|
159
|
-
this.logger.console(`Linking components and core aspects to node_modules for workspaces: '${_chalk().default.cyan(this.workspace.name)}'`);
|
|
160
|
-
const linkOpts = {
|
|
161
|
-
legacyLink: true,
|
|
162
|
-
rewire: opts.rewire,
|
|
163
|
-
linkCoreAspects: true,
|
|
164
|
-
linkTeambitBit: true,
|
|
165
|
-
linkToDir: opts.target,
|
|
166
|
-
fetchObject: !opts.skipFetchingObjects
|
|
167
|
-
};
|
|
168
|
-
const linkResults = await this.workspace.link(linkOpts);
|
|
169
|
-
return linkResults;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
exports.LinkCommand = LinkCommand;
|
|
175
|
-
|
|
176
|
-
//# sourceMappingURL=link.cmd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["LinkCommand","constructor","workspace","logger","docsDomain","name","description","extendedDescription","report","ids","opts","startTime","Date","now","linkResults","json","endTime","numOfComponents","legacyLinkResults","length","timeDiff","timeFormat","coreAspectsLinksWithMainAspect","coreAspectsLinks","teambitBitLink","unshift","numOfCoreAspects","title","coreLinks","CoreAspectsLinks","verbose","compsLinks","ComponentListLinks","componentListLinks","rewireRow","RewireRow","legacyCodemodResults","legacyLinkCodemodResults","nestedLinks","NestedComponentLinksLinks","nestedDepsInNmLinks","targetLinks","linkToDir","linkToDirResults","footer","console","chalk","cyan","linkOpts","legacyLink","rewire","linkCoreAspects","linkTeambitBit","target","fetchObject","skipFetchingObjects","link"],"sources":["link.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { LinkResults } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport { timeFormat } from '@teambit/toolbox.time.time-format';\nimport chalk from 'chalk';\nimport { Workspace, WorkspaceLinkOptions } from '../workspace';\nimport { ComponentListLinks } from './component-list-links';\nimport { CoreAspectsLinks } from './core-aspects-links';\nimport { NestedComponentLinksLinks } from './nested-deps-in-nm-links';\nimport { RewireRow } from './rewire-row';\nimport { linkToDir } from './link-to-dir';\n\ntype LinkCommandOpts = {\n rewire: boolean;\n verbose: boolean;\n target: string;\n skipFetchingObjects?: boolean;\n};\nexport class LinkCommand implements Command {\n name = 'link [component-names...]';\n alias = '';\n description = 'create links in the node_modules directory, to core aspects and to components in the workspace';\n extendedDescription: string;\n group = 'development';\n private = false;\n arguments = [{ name: 'component-names...', description: 'names or IDs of the components to link' }];\n options = [\n ['j', 'json', 'return the output as JSON'],\n ['', 'verbose', 'verbose output'],\n ['r', 'rewire', 'Replace relative paths with module paths in code (e.g. \"../foo\" => \"@bit/foo\")'],\n [\n '',\n 'target <dir>',\n 'EXPERIMENTAL. link to an external directory (similar to npm-link) so other projects could use these components',\n ],\n ['', 'skip-fetching-objects', 'skip fetch missing objects from remotes before linking'],\n ] as CommandOptions;\n\n constructor(\n /**\n * workspace extension.\n */\n private workspace: Workspace,\n\n /**\n * logger extension.\n */\n private logger: Logger,\n\n private docsDomain: string\n ) {\n this.extendedDescription = `https://${this.docsDomain}/workspace/component-links`;\n }\n\n async report([ids]: [string[]], opts: LinkCommandOpts) {\n const startTime = Date.now();\n const linkResults = await this.json([ids], opts);\n const endTime = Date.now();\n const numOfComponents = linkResults.legacyLinkResults?.length;\n const timeDiff = timeFormat(endTime - startTime);\n const coreAspectsLinksWithMainAspect = linkResults.coreAspectsLinks || [];\n if (linkResults.teambitBitLink) {\n coreAspectsLinksWithMainAspect.unshift(linkResults.teambitBitLink);\n }\n const numOfCoreAspects = coreAspectsLinksWithMainAspect.length;\n\n const title = `Linked ${numOfComponents} components and ${numOfCoreAspects} core aspects to node_modules for workspace: ${this.workspace.name}`;\n const coreLinks = CoreAspectsLinks({\n coreAspectsLinks: coreAspectsLinksWithMainAspect,\n verbose: opts.verbose,\n });\n const compsLinks = ComponentListLinks({ componentListLinks: linkResults.legacyLinkResults, verbose: opts.verbose });\n const rewireRow = RewireRow({ legacyCodemodResults: linkResults.legacyLinkCodemodResults });\n const nestedLinks = NestedComponentLinksLinks({\n nestedDepsInNmLinks: linkResults.nestedDepsInNmLinks,\n verbose: opts.verbose,\n });\n const targetLinks = linkToDir(linkResults.linkToDirResults);\n const footer = `Finished. ${timeDiff}`;\n return `${title}\\n${coreLinks}\\n${compsLinks}\\n${rewireRow}${nestedLinks}${targetLinks}${footer}`;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async json([ids]: [string[]], opts: LinkCommandOpts): Promise<LinkResults> {\n this.logger.console(\n `Linking components and core aspects to node_modules for workspaces: '${chalk.cyan(this.workspace.name)}'`\n );\n\n const linkOpts: WorkspaceLinkOptions = {\n legacyLink: true,\n rewire: opts.rewire,\n linkCoreAspects: true,\n linkTeambitBit: true,\n linkToDir: opts.target,\n fetchObject: !opts.skipFetchingObjects,\n };\n const linkResults = await this.workspace.link(linkOpts);\n return linkResults;\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { NestedNMDepsLinksResult } from '@teambit/dependency-resolver';
|
|
2
|
-
declare type NestedComponentLinksLinksProps = {
|
|
3
|
-
nestedDepsInNmLinks?: NestedNMDepsLinksResult[];
|
|
4
|
-
verbose: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare function NestedComponentLinksLinks({ nestedDepsInNmLinks, verbose }: NestedComponentLinksLinksProps): string;
|
|
7
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.NestedComponentLinksLinks = NestedComponentLinksLinks;
|
|
9
|
-
|
|
10
|
-
function _chalk() {
|
|
11
|
-
const data = _interopRequireDefault(require("chalk"));
|
|
12
|
-
|
|
13
|
-
_chalk = function () {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return data;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _linkRow() {
|
|
21
|
-
const data = require("./link-row");
|
|
22
|
-
|
|
23
|
-
_linkRow = function () {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return data;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function NestedComponentLinksLinks({
|
|
31
|
-
nestedDepsInNmLinks,
|
|
32
|
-
verbose = false
|
|
33
|
-
}) {
|
|
34
|
-
if (!verbose) return '';
|
|
35
|
-
|
|
36
|
-
if (!nestedDepsInNmLinks || !nestedDepsInNmLinks.length) {
|
|
37
|
-
return '';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const title = _chalk().default.bold.cyan('Nested dependencies links');
|
|
41
|
-
|
|
42
|
-
const links = nestedDepsInNmLinks.map(nestedComponentLinks => NestedComponentLinks({
|
|
43
|
-
nestedComponentLinks,
|
|
44
|
-
verbose
|
|
45
|
-
})).join('\n');
|
|
46
|
-
return `${title}\n${links}\n`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function NestedComponentLinks({
|
|
50
|
-
nestedComponentLinks,
|
|
51
|
-
verbose = false
|
|
52
|
-
}) {
|
|
53
|
-
if (!nestedComponentLinks.linksDetail || nestedComponentLinks.linksDetail.length < 1) return '';
|
|
54
|
-
if (verbose) return VerboseNestedComponentLinks({
|
|
55
|
-
nestedComponentLinks
|
|
56
|
-
});
|
|
57
|
-
return '';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function VerboseNestedComponentLinks({
|
|
61
|
-
nestedComponentLinks
|
|
62
|
-
}) {
|
|
63
|
-
const id = nestedComponentLinks.componentId.toString();
|
|
64
|
-
|
|
65
|
-
const title = _chalk().default.cyan.bold(id);
|
|
66
|
-
|
|
67
|
-
const links = nestedComponentLinks.linksDetail.map(link => (0, _linkRow().VerboseLinkRow)({
|
|
68
|
-
from: link.from,
|
|
69
|
-
to: link.to
|
|
70
|
-
})).join('\n');
|
|
71
|
-
return `${title}\n${links}\n`;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
//# sourceMappingURL=nested-deps-in-nm-links.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NestedComponentLinksLinks","nestedDepsInNmLinks","verbose","length","title","chalk","bold","cyan","links","map","nestedComponentLinks","NestedComponentLinks","join","linksDetail","VerboseNestedComponentLinks","id","componentId","toString","link","VerboseLinkRow","from","to"],"sources":["nested-deps-in-nm-links.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { NestedNMDepsLinksResult } from '@teambit/dependency-resolver';\nimport { VerboseLinkRow } from './link-row';\n\ntype NestedComponentLinksLinksProps = {\n nestedDepsInNmLinks?: NestedNMDepsLinksResult[];\n verbose: boolean;\n};\n\nexport function NestedComponentLinksLinks({ nestedDepsInNmLinks, verbose = false }: NestedComponentLinksLinksProps) {\n if (!verbose) return '';\n if (!nestedDepsInNmLinks || !nestedDepsInNmLinks.length) {\n return '';\n }\n const title = chalk.bold.cyan('Nested dependencies links');\n const links = nestedDepsInNmLinks\n .map((nestedComponentLinks) =>\n NestedComponentLinks({\n nestedComponentLinks,\n verbose,\n })\n )\n .join('\\n');\n return `${title}\\n${links}\\n`;\n}\n\ntype NestedComponentLinksProps = {\n nestedComponentLinks: NestedNMDepsLinksResult;\n verbose: boolean;\n};\nfunction NestedComponentLinks({ nestedComponentLinks, verbose = false }: NestedComponentLinksProps) {\n if (!nestedComponentLinks.linksDetail || nestedComponentLinks.linksDetail.length < 1) return '';\n if (verbose) return VerboseNestedComponentLinks({ nestedComponentLinks });\n return '';\n}\n\ntype VerboseNestedComponentLinksProps = {\n nestedComponentLinks: NestedNMDepsLinksResult;\n};\nfunction VerboseNestedComponentLinks({ nestedComponentLinks }: VerboseNestedComponentLinksProps) {\n const id = nestedComponentLinks.componentId.toString();\n const title = chalk.cyan.bold(id);\n const links = nestedComponentLinks.linksDetail\n .map((link) => VerboseLinkRow({ from: link.from, to: link.to }))\n .join('\\n');\n return `${title}\\n${links}\\n`;\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAOO,SAASA,yBAAT,CAAmC;EAAEC,mBAAF;EAAuBC,OAAO,GAAG;AAAjC,CAAnC,EAA6G;EAClH,IAAI,CAACA,OAAL,EAAc,OAAO,EAAP;;EACd,IAAI,CAACD,mBAAD,IAAwB,CAACA,mBAAmB,CAACE,MAAjD,EAAyD;IACvD,OAAO,EAAP;EACD;;EACD,MAAMC,KAAK,GAAGC,gBAAA,CAAMC,IAAN,CAAWC,IAAX,CAAgB,2BAAhB,CAAd;;EACA,MAAMC,KAAK,GAAGP,mBAAmB,CAC9BQ,GADW,CACNC,oBAAD,IACHC,oBAAoB,CAAC;IACnBD,oBADmB;IAEnBR;EAFmB,CAAD,CAFV,EAOXU,IAPW,CAON,IAPM,CAAd;EAQA,OAAQ,GAAER,KAAM,KAAII,KAAM,IAA1B;AACD;;AAMD,SAASG,oBAAT,CAA8B;EAAED,oBAAF;EAAwBR,OAAO,GAAG;AAAlC,CAA9B,EAAoG;EAClG,IAAI,CAACQ,oBAAoB,CAACG,WAAtB,IAAqCH,oBAAoB,CAACG,WAArB,CAAiCV,MAAjC,GAA0C,CAAnF,EAAsF,OAAO,EAAP;EACtF,IAAID,OAAJ,EAAa,OAAOY,2BAA2B,CAAC;IAAEJ;EAAF,CAAD,CAAlC;EACb,OAAO,EAAP;AACD;;AAKD,SAASI,2BAAT,CAAqC;EAAEJ;AAAF,CAArC,EAAiG;EAC/F,MAAMK,EAAE,GAAGL,oBAAoB,CAACM,WAArB,CAAiCC,QAAjC,EAAX;;EACA,MAAMb,KAAK,GAAGC,gBAAA,CAAME,IAAN,CAAWD,IAAX,CAAgBS,EAAhB,CAAd;;EACA,MAAMP,KAAK,GAAGE,oBAAoB,CAACG,WAArB,CACXJ,GADW,CACNS,IAAD,IAAU,IAAAC,yBAAA,EAAe;IAAEC,IAAI,EAAEF,IAAI,CAACE,IAAb;IAAmBC,EAAE,EAAEH,IAAI,CAACG;EAA5B,CAAf,CADH,EAEXT,IAFW,CAEN,IAFM,CAAd;EAGA,OAAQ,GAAER,KAAM,KAAII,KAAM,IAA1B;AACD"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CodemodResult } from '@teambit/legacy/dist/consumer/component-ops/codemod-components';
|
|
2
|
-
declare type RewireRowProps = {
|
|
3
|
-
legacyCodemodResults?: CodemodResult[];
|
|
4
|
-
};
|
|
5
|
-
export declare function RewireRow({ legacyCodemodResults }: RewireRowProps): string;
|
|
6
|
-
export {};
|
package/dist/link/rewire-row.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.RewireRow = RewireRow;
|
|
9
|
-
|
|
10
|
-
function _chalk() {
|
|
11
|
-
const data = _interopRequireDefault(require("chalk"));
|
|
12
|
-
|
|
13
|
-
_chalk = function () {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return data;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function RewireRow({
|
|
21
|
-
legacyCodemodResults
|
|
22
|
-
}) {
|
|
23
|
-
if (!legacyCodemodResults || legacyCodemodResults.length < 1) return '';
|
|
24
|
-
const totalComps = legacyCodemodResults === null || legacyCodemodResults === void 0 ? void 0 : legacyCodemodResults.length;
|
|
25
|
-
const totalFiles = legacyCodemodResults.reduce((acc, curr) => {
|
|
26
|
-
return acc + curr.changedFiles.length || 0;
|
|
27
|
-
}, 0);
|
|
28
|
-
return `rewired ${_chalk().default.cyan(totalComps.toString())} components and total of ${_chalk().default.cyan(totalFiles.toString())} files\n`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=rewire-row.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["RewireRow","legacyCodemodResults","length","totalComps","totalFiles","reduce","acc","curr","changedFiles","chalk","cyan","toString"],"sources":["rewire-row.ts"],"sourcesContent":["import { CodemodResult } from '@teambit/legacy/dist/consumer/component-ops/codemod-components';\nimport chalk from 'chalk';\n\ntype RewireRowProps = {\n legacyCodemodResults?: CodemodResult[];\n};\nexport function RewireRow({ legacyCodemodResults }: RewireRowProps) {\n if (!legacyCodemodResults || legacyCodemodResults.length < 1) return '';\n const totalComps = legacyCodemodResults?.length;\n const totalFiles = legacyCodemodResults.reduce((acc, curr) => {\n return acc + curr.changedFiles.length || 0;\n }, 0);\n\n return `rewired ${chalk.cyan(totalComps.toString())} components and total of ${chalk.cyan(\n totalFiles.toString()\n )} files\\n`;\n}\n"],"mappings":";;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAKO,SAASA,SAAT,CAAmB;EAAEC;AAAF,CAAnB,EAA6D;EAClE,IAAI,CAACA,oBAAD,IAAyBA,oBAAoB,CAACC,MAArB,GAA8B,CAA3D,EAA8D,OAAO,EAAP;EAC9D,MAAMC,UAAU,GAAGF,oBAAH,aAAGA,oBAAH,uBAAGA,oBAAoB,CAAEC,MAAzC;EACA,MAAME,UAAU,GAAGH,oBAAoB,CAACI,MAArB,CAA4B,CAACC,GAAD,EAAMC,IAAN,KAAe;IAC5D,OAAOD,GAAG,GAAGC,IAAI,CAACC,YAAL,CAAkBN,MAAxB,IAAkC,CAAzC;EACD,CAFkB,EAEhB,CAFgB,CAAnB;EAIA,OAAQ,WAAUO,gBAAA,CAAMC,IAAN,CAAWP,UAAU,CAACQ,QAAX,EAAX,CAAkC,4BAA2BF,gBAAA,CAAMC,IAAN,CAC7EN,UAAU,CAACO,QAAX,EAD6E,CAE7E,UAFF;AAGD"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { OutdatedPkg } from '@teambit/dependency-resolver';
|
|
2
|
-
/**
|
|
3
|
-
* Lets the user pick the packages that should be updated.
|
|
4
|
-
*/
|
|
5
|
-
export declare function pickOutdatedPkgs(outdatedPkgs: OutdatedPkg[]): Promise<MergedOutdatedPkg[]>;
|
|
6
|
-
/**
|
|
7
|
-
* Groups the outdated packages and makes choices for enquirer's prompt.
|
|
8
|
-
*/
|
|
9
|
-
export declare function makeOutdatedPkgChoices(outdatedPkgs: OutdatedPkg[]): {
|
|
10
|
-
message: string;
|
|
11
|
-
choices: unknown;
|
|
12
|
-
}[];
|
|
13
|
-
export interface MergedOutdatedPkg extends OutdatedPkg {
|
|
14
|
-
dependentComponents?: string[];
|
|
15
|
-
hasDifferentRanges?: boolean;
|
|
16
|
-
}
|
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.array.sort.js");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.promise.js");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, "__esModule", {
|
|
14
|
-
value: true
|
|
15
|
-
});
|
|
16
|
-
exports.makeOutdatedPkgChoices = makeOutdatedPkgChoices;
|
|
17
|
-
exports.pickOutdatedPkgs = pickOutdatedPkgs;
|
|
18
|
-
|
|
19
|
-
function _defineProperty2() {
|
|
20
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
|
-
_defineProperty2 = function () {
|
|
23
|
-
return data;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function _colorizeSemverDiff() {
|
|
30
|
-
const data = _interopRequireDefault(require("@pnpm/colorize-semver-diff"));
|
|
31
|
-
|
|
32
|
-
_colorizeSemverDiff = function () {
|
|
33
|
-
return data;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function _semverDiff() {
|
|
40
|
-
const data = _interopRequireDefault(require("@pnpm/semver-diff"));
|
|
41
|
-
|
|
42
|
-
_semverDiff = function () {
|
|
43
|
-
return data;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return data;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function _lodash() {
|
|
50
|
-
const data = require("lodash");
|
|
51
|
-
|
|
52
|
-
_lodash = function () {
|
|
53
|
-
return data;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return data;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function _table() {
|
|
60
|
-
const data = require("table");
|
|
61
|
-
|
|
62
|
-
_table = function () {
|
|
63
|
-
return data;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
return data;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function _chalk() {
|
|
70
|
-
const data = _interopRequireDefault(require("chalk"));
|
|
71
|
-
|
|
72
|
-
_chalk = function () {
|
|
73
|
-
return data;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
return data;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function _enquirer() {
|
|
80
|
-
const data = require("enquirer");
|
|
81
|
-
|
|
82
|
-
_enquirer = function () {
|
|
83
|
-
return data;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
return data;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function _semver() {
|
|
90
|
-
const data = _interopRequireDefault(require("semver"));
|
|
91
|
-
|
|
92
|
-
_semver = function () {
|
|
93
|
-
return data;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
return data;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
100
|
-
|
|
101
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Lets the user pick the packages that should be updated.
|
|
105
|
-
*/
|
|
106
|
-
async function pickOutdatedPkgs(outdatedPkgs) {
|
|
107
|
-
const {
|
|
108
|
-
updateDependencies
|
|
109
|
-
} = await (0, _enquirer().prompt)({
|
|
110
|
-
choices: makeOutdatedPkgChoices(outdatedPkgs),
|
|
111
|
-
footer: '\nEnter to start updating. Ctrl-c to cancel.',
|
|
112
|
-
indicator: (state, choice) => ` ${choice.enabled ? '●' : '○'}`,
|
|
113
|
-
message: 'Choose which packages to update ' + `(Press ${_chalk().default.cyan('<space>')} to select, ` + `${_chalk().default.cyan('<a>')} to toggle all, ` + `${_chalk().default.cyan('<i>')} to invert selection)
|
|
114
|
-
${_chalk().default.green('Green')} - indicates a semantically safe update
|
|
115
|
-
${_chalk().default.red('Red')} - indicates a semantically breaking change`,
|
|
116
|
-
name: 'updateDependencies',
|
|
117
|
-
pointer: '❯',
|
|
118
|
-
styles: {
|
|
119
|
-
dark: _chalk().default.white,
|
|
120
|
-
em: _chalk().default.bgBlack.whiteBright,
|
|
121
|
-
success: _chalk().default.white
|
|
122
|
-
},
|
|
123
|
-
type: 'multiselect',
|
|
124
|
-
|
|
125
|
-
validate(value) {
|
|
126
|
-
if (value.length === 0) {
|
|
127
|
-
return 'You must choose at least one package.';
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return true;
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
j() {
|
|
134
|
-
return this.down();
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
k() {
|
|
138
|
-
return this.up();
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
result(names) {
|
|
142
|
-
// This is needed in order to have the values of the choices in the answer object.
|
|
143
|
-
// Otherwise, only the names of the selected choices would've been included.
|
|
144
|
-
return this.map(names);
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
cancel() {// By default, canceling the prompt via Ctrl+c throws an empty string.
|
|
148
|
-
// The custom cancel function prevents that behavior.
|
|
149
|
-
// Otherwise, Bit CLI would print an error and confuse users.
|
|
150
|
-
// See related issue: https://github.com/enquirer/enquirer/issues/225
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
});
|
|
154
|
-
return Object.values(updateDependencies !== null && updateDependencies !== void 0 ? updateDependencies : {}).filter(updateDependency => typeof updateDependency !== 'string');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const DEP_TYPE_PRIORITY = {
|
|
158
|
-
dependencies: 0,
|
|
159
|
-
devDependencies: 1,
|
|
160
|
-
peerDependencies: 2
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* Groups the outdated packages and makes choices for enquirer's prompt.
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
function makeOutdatedPkgChoices(outdatedPkgs) {
|
|
167
|
-
const mergedOutdatedPkgs = mergeOutdatedPkgs(outdatedPkgs);
|
|
168
|
-
mergedOutdatedPkgs.sort((pkg1, pkg2) => {
|
|
169
|
-
if (pkg1.targetField === pkg2.targetField) return pkg1.name.localeCompare(pkg2.name);
|
|
170
|
-
return DEP_TYPE_PRIORITY[pkg1.targetField] - DEP_TYPE_PRIORITY[pkg2.targetField];
|
|
171
|
-
});
|
|
172
|
-
const renderedTable = alignColumns(outdatedPkgsRows(mergedOutdatedPkgs));
|
|
173
|
-
const groupedChoices = {};
|
|
174
|
-
mergedOutdatedPkgs.forEach((outdatedPkg, index) => {
|
|
175
|
-
const context = renderContext(outdatedPkg);
|
|
176
|
-
|
|
177
|
-
if (!groupedChoices[context]) {
|
|
178
|
-
groupedChoices[context] = [];
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
groupedChoices[context].push({
|
|
182
|
-
message: renderedTable[index],
|
|
183
|
-
name: outdatedPkg.name,
|
|
184
|
-
value: outdatedPkg
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
const choices = Object.entries(groupedChoices).map(([context, subChoices]) => ({
|
|
188
|
-
message: _chalk().default.cyan(context),
|
|
189
|
-
choices: subChoices
|
|
190
|
-
}));
|
|
191
|
-
return choices;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function mergeOutdatedPkgs(outdatedPkgs) {
|
|
195
|
-
const mergedOutdatedPkgs = {};
|
|
196
|
-
const outdatedPkgsNotFromComponentModel = [];
|
|
197
|
-
|
|
198
|
-
for (const outdatedPkg of outdatedPkgs) {
|
|
199
|
-
if (outdatedPkg.source === 'component-model' && outdatedPkg.componentId) {
|
|
200
|
-
if (!mergedOutdatedPkgs[outdatedPkg.name]) {
|
|
201
|
-
mergedOutdatedPkgs[outdatedPkg.name] = _objectSpread(_objectSpread({}, (0, _lodash().omit)(outdatedPkg, ['componentId'])), {}, {
|
|
202
|
-
source: 'rootPolicy',
|
|
203
|
-
dependentComponents: [outdatedPkg.componentId]
|
|
204
|
-
});
|
|
205
|
-
} else {
|
|
206
|
-
if (mergedOutdatedPkgs[outdatedPkg.name].currentRange !== outdatedPkg.currentRange) {
|
|
207
|
-
mergedOutdatedPkgs[outdatedPkg.name].hasDifferentRanges = true;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
mergedOutdatedPkgs[outdatedPkg.name].currentRange = tryPickLowestRange(mergedOutdatedPkgs[outdatedPkg.name].currentRange, outdatedPkg.currentRange);
|
|
211
|
-
mergedOutdatedPkgs[outdatedPkg.name].dependentComponents.push(outdatedPkg.componentId);
|
|
212
|
-
|
|
213
|
-
if (outdatedPkg.targetField === 'dependencies') {
|
|
214
|
-
mergedOutdatedPkgs[outdatedPkg.name].targetField = outdatedPkg.targetField;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
} else {
|
|
218
|
-
outdatedPkgsNotFromComponentModel.push(outdatedPkg);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return [...Object.values(mergedOutdatedPkgs), ...outdatedPkgsNotFromComponentModel];
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function tryPickLowestRange(range1, range2) {
|
|
226
|
-
if (range1 === '*' || range2 === '*') return '*';
|
|
227
|
-
|
|
228
|
-
try {
|
|
229
|
-
return _semver().default.lt(rangeToVersion(range1), rangeToVersion(range2)) ? range1 : range2;
|
|
230
|
-
} catch (_unused) {
|
|
231
|
-
return '*';
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function rangeToVersion(range) {
|
|
236
|
-
if (range.startsWith('~') || range.startsWith('^')) {
|
|
237
|
-
return range.substring(1);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return range;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function renderContext(outdatedPkg) {
|
|
244
|
-
if (outdatedPkg.variantPattern) {
|
|
245
|
-
return `${outdatedPkg.variantPattern} (variant)`;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
if (outdatedPkg.componentId) {
|
|
249
|
-
return `${outdatedPkg.componentId} (component)`;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return 'Root policies';
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
const TARGET_FIELD_TO_DEP_TYPE = {
|
|
256
|
-
devDependencies: 'dev',
|
|
257
|
-
dependencies: 'runtime',
|
|
258
|
-
peerDependencies: 'peer'
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
function outdatedPkgsRows(outdatedPkgs) {
|
|
262
|
-
return outdatedPkgs.map(outdatedPkg => {
|
|
263
|
-
const {
|
|
264
|
-
change,
|
|
265
|
-
diff
|
|
266
|
-
} = (0, _semverDiff().default)(outdatedPkg.currentRange, outdatedPkg.latestRange);
|
|
267
|
-
let colorizeChange = change !== null && change !== void 0 ? change : 'breaking';
|
|
268
|
-
|
|
269
|
-
if (change === 'feature') {
|
|
270
|
-
colorizeChange = 'fix';
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const latest = (0, _colorizeSemverDiff().default)({
|
|
274
|
-
change: colorizeChange,
|
|
275
|
-
diff
|
|
276
|
-
});
|
|
277
|
-
return [outdatedPkg.name, _chalk().default.grey(`(${TARGET_FIELD_TO_DEP_TYPE[outdatedPkg.targetField]})`), outdatedPkg.hasDifferentRanges ? '*' : outdatedPkg.currentRange, '❯', latest, outdatedPkg.dependentComponents ? renderDependents(outdatedPkg.dependentComponents) : ' '];
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function renderDependents(dependentComponents) {
|
|
282
|
-
let result = `because of ${dependentComponents[0]}`;
|
|
283
|
-
|
|
284
|
-
if (dependentComponents.length > 1) {
|
|
285
|
-
result += ` and ${dependentComponents.length - 1} other components`;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return result;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function alignColumns(rows) {
|
|
292
|
-
return (0, _table().table)(rows, {
|
|
293
|
-
border: (0, _table().getBorderCharacters)('void'),
|
|
294
|
-
columnDefault: {
|
|
295
|
-
paddingLeft: 0,
|
|
296
|
-
paddingRight: 1
|
|
297
|
-
},
|
|
298
|
-
columns: {
|
|
299
|
-
// This is the current range column
|
|
300
|
-
2: {
|
|
301
|
-
alignment: 'right'
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
drawHorizontalLine: () => false
|
|
305
|
-
}).split('\n');
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
//# sourceMappingURL=pick-outdated-pkgs.js.map
|