@teambit/dependencies 1.0.108 → 1.0.110
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/artifacts/__bit_junit.xml +42 -0
- package/artifacts/preview/teambit_dependencies_dependencies-preview.js +1 -0
- package/package.json +16 -12
- package/dependencies-cmd.ts +0 -335
- package/dependencies.aspect.ts +0 -5
- package/dependencies.main.runtime.ts +0 -387
- package/index.ts +0 -5
- /package/dist/{preview-1703647408454.js → preview-1703733956734.js} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<testsuites>
|
|
3
|
+
<testsuite name="teambit.dependencies/dependencies@1.0.110" timestamp="2023-12-28T03:49:10.905Z" tests="37" failures="0" errors="0" skipped="0">
|
|
4
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/testing-library__jest-dom" time="0.182"/>
|
|
5
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/chai" time="0.001"/>
|
|
6
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/mocha"/>
|
|
7
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/classnames"/>
|
|
8
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/cors" time="0.001"/>
|
|
9
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/cross-spawn"/>
|
|
10
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/dagre"/>
|
|
11
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/didyoumean"/>
|
|
12
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/eslint" time="0.001"/>
|
|
13
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/express"/>
|
|
14
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/find-cache-dir"/>
|
|
15
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/find-root" time="0.001"/>
|
|
16
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/history"/>
|
|
17
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/http-proxy-agent"/>
|
|
18
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/lodash"/>
|
|
19
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/lodash.compact" time="0.001"/>
|
|
20
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/lodash.flatten"/>
|
|
21
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/lodash.head"/>
|
|
22
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/lodash.pick"/>
|
|
23
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/mdx-js__react" time="0.001"/>
|
|
24
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/memoizee"/>
|
|
25
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/mime"/>
|
|
26
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/mousetrap"/>
|
|
27
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/node"/>
|
|
28
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/puppeteer"/>
|
|
29
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/react"/>
|
|
30
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/react-dom"/>
|
|
31
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/react-router-dom"/>
|
|
32
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/react-tabs" time="0.001"/>
|
|
33
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/react-tooltip"/>
|
|
34
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/socket.io-client"/>
|
|
35
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/ua-parser-js"/>
|
|
36
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/url-join"/>
|
|
37
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/url-parse"/>
|
|
38
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/webpack"/>
|
|
39
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/webpack-dev-server"/>
|
|
40
|
+
<testcase classname="package-to-definetly-typed.spec.js" name="should map to @types/webpack-merge"/>
|
|
41
|
+
</testsuite>
|
|
42
|
+
</testsuites>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["teambit.dependencies/dependencies-preview"]=o():e["teambit.dependencies/dependencies-preview"]=o()}(self,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var n in t)e.o(t,n)&&!e.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:t[n]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{compositions:()=>t,compositions_metadata:()=>i,overview:()=>n});const t=[],n=[],i={compositions:[]};return o})()));
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/dependencies",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.110",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/dependencies/dependencies",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.dependencies",
|
|
8
8
|
"name": "dependencies",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.110"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"archy": "1.0.0",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"@teambit/harmony": "0.4.6",
|
|
22
22
|
"@teambit/component-id": "1.2.0",
|
|
23
23
|
"@teambit/component-version": "1.0.3",
|
|
24
|
-
"@teambit/cli": "0.0.
|
|
25
|
-
"@teambit/aspect-loader": "1.0.
|
|
26
|
-
"@teambit/dependency-resolver": "1.0.
|
|
27
|
-
"@teambit/dev-files": "1.0.
|
|
28
|
-
"@teambit/workspace": "1.0.
|
|
24
|
+
"@teambit/cli": "0.0.842",
|
|
25
|
+
"@teambit/aspect-loader": "1.0.110",
|
|
26
|
+
"@teambit/dependency-resolver": "1.0.110",
|
|
27
|
+
"@teambit/dev-files": "1.0.110",
|
|
28
|
+
"@teambit/workspace": "1.0.110",
|
|
29
29
|
"@teambit/component-issues": "0.0.138"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@types/mocha": "9.1.0",
|
|
39
39
|
"@types/jest": "^29.2.2",
|
|
40
40
|
"@types/testing-library__jest-dom": "^5.9.5",
|
|
41
|
-
"@teambit/harmony.envs.core-aspect-env": "0.0.
|
|
41
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.15"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@teambit/legacy": "1.0.624"
|
|
@@ -47,11 +47,15 @@
|
|
|
47
47
|
"optionalDependencies": {},
|
|
48
48
|
"peerDependenciesMeta": {},
|
|
49
49
|
"exports": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
50
|
+
".": {
|
|
51
|
+
"node": {
|
|
52
|
+
"require": "./dist/index.js",
|
|
53
|
+
"import": "./dist/esm.mjs"
|
|
54
|
+
},
|
|
55
|
+
"default": "./dist/index.js"
|
|
53
56
|
},
|
|
54
|
-
"
|
|
57
|
+
"./dist/*": "./dist/*",
|
|
58
|
+
"./artifacts/*": "./artifacts/*"
|
|
55
59
|
},
|
|
56
60
|
"private": false,
|
|
57
61
|
"engines": {
|
package/dependencies-cmd.ts
DELETED
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line max-classes-per-file
|
|
2
|
-
import { Command, CommandOptions } from '@teambit/cli';
|
|
3
|
-
import Table from 'cli-table';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import archy from 'archy';
|
|
6
|
-
import { generateDependenciesInfoTable } from '@teambit/legacy/dist/cli/templates/component-template';
|
|
7
|
-
import { IdNotFoundInGraph } from '@teambit/legacy/dist/scope/exceptions/id-not-found-in-graph';
|
|
8
|
-
import DependencyGraph from '@teambit/legacy/dist/scope/graph/scope-graph';
|
|
9
|
-
import { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';
|
|
10
|
-
import { DependenciesMain } from './dependencies.main.runtime';
|
|
11
|
-
|
|
12
|
-
type GetDependenciesFlags = {
|
|
13
|
-
tree: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type SetDependenciesFlags = {
|
|
17
|
-
dev?: boolean;
|
|
18
|
-
optional?: boolean;
|
|
19
|
-
peer?: boolean;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type RemoveDependenciesFlags = SetDependenciesFlags;
|
|
23
|
-
|
|
24
|
-
export class DependenciesGetCmd implements Command {
|
|
25
|
-
name = 'get <component-name>';
|
|
26
|
-
arguments = [{ name: 'component-name', description: 'component name or component id' }];
|
|
27
|
-
group = 'info';
|
|
28
|
-
description = 'show direct and indirect dependencies of the given component';
|
|
29
|
-
alias = '';
|
|
30
|
-
options = [['t', 'tree', 'EXPERIMENTAL. render dependencies as a tree, similar to "npm ls"']] as CommandOptions;
|
|
31
|
-
|
|
32
|
-
constructor(private deps: DependenciesMain) {}
|
|
33
|
-
|
|
34
|
-
async report([id]: [string], { tree = false }: GetDependenciesFlags) {
|
|
35
|
-
const results = await this.deps.getDependencies(id);
|
|
36
|
-
|
|
37
|
-
if (tree) {
|
|
38
|
-
const idWithVersion = results.workspaceGraph._getIdWithLatestVersion(results.id);
|
|
39
|
-
const getGraphAsTree = (graph: DependencyGraph) => {
|
|
40
|
-
try {
|
|
41
|
-
const graphAsTree = graph.getDependenciesAsObjectTree(idWithVersion.toString());
|
|
42
|
-
return archy(graphAsTree);
|
|
43
|
-
} catch (err: any) {
|
|
44
|
-
if (err.constructor.name === 'RangeError') {
|
|
45
|
-
return `${chalk.red(
|
|
46
|
-
'unable to generate a tree representation, the graph is too big or has cyclic dependencies'
|
|
47
|
-
)}`;
|
|
48
|
-
}
|
|
49
|
-
throw err;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const workspaceTree = getGraphAsTree(results.workspaceGraph);
|
|
53
|
-
const scopeTree = getGraphAsTree(results.scopeGraph);
|
|
54
|
-
return `${chalk.green('workspace')}:\n${workspaceTree}\n\n${chalk.green('scope')}:\n${scopeTree}`;
|
|
55
|
-
}
|
|
56
|
-
const workspaceGraph = results.workspaceGraph.getDependenciesInfo(results.id);
|
|
57
|
-
const getScopeDependencies = () => {
|
|
58
|
-
try {
|
|
59
|
-
return results.scopeGraph.getDependenciesInfo(results.id);
|
|
60
|
-
} catch (err) {
|
|
61
|
-
if (err instanceof IdNotFoundInGraph) return []; // component might be new
|
|
62
|
-
throw err;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const scopeGraph = getScopeDependencies();
|
|
66
|
-
if (!scopeGraph.length && !workspaceGraph.length) {
|
|
67
|
-
return `no dependencies found for ${results.id.toString()}.
|
|
68
|
-
try running "bit cat-component ${results.id.toStringWithoutVersion()}" to see whether the component/version exists locally`;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const scopeTable = generateDependenciesInfoTable(scopeGraph, results.id);
|
|
72
|
-
const workspaceTable = generateDependenciesInfoTable(workspaceGraph, results.id);
|
|
73
|
-
return `${chalk.bold('Dependencies originated from workspace')}
|
|
74
|
-
${workspaceTable || '<none>'}
|
|
75
|
-
|
|
76
|
-
${chalk.bold('Dependencies originated from scope')}
|
|
77
|
-
${scopeTable || '<none>'}`;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export class DependenciesDebugCmd implements Command {
|
|
82
|
-
name = 'debug <component-name>';
|
|
83
|
-
arguments = [{ name: 'component-name', description: 'component name or component id' }];
|
|
84
|
-
group = 'info';
|
|
85
|
-
description = 'show the immediate dependencies and how their versions were determined';
|
|
86
|
-
alias = '';
|
|
87
|
-
options = [] as CommandOptions;
|
|
88
|
-
|
|
89
|
-
constructor(private deps: DependenciesMain) {}
|
|
90
|
-
|
|
91
|
-
async report([id]: [string]) {
|
|
92
|
-
const results = await this.deps.debugDependencies(id);
|
|
93
|
-
return JSON.stringify(results, undefined, 4);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export class DependenciesSetCmd implements Command {
|
|
98
|
-
name = 'set <component-pattern> <package...>';
|
|
99
|
-
arguments = [
|
|
100
|
-
{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP },
|
|
101
|
-
{
|
|
102
|
-
name: 'package...',
|
|
103
|
-
description:
|
|
104
|
-
'package name with or without a version, e.g. "lodash@1.0.0" or just "lodash" which will be resolved to the latest',
|
|
105
|
-
},
|
|
106
|
-
];
|
|
107
|
-
group = 'info';
|
|
108
|
-
description = 'set a dependency to component(s)';
|
|
109
|
-
alias = '';
|
|
110
|
-
options = [
|
|
111
|
-
['d', 'dev', 'add to the devDependencies'],
|
|
112
|
-
['o', 'optional', 'add to the optionalDependencies'],
|
|
113
|
-
['p', 'peer', 'add to the peerDependencies'],
|
|
114
|
-
] as CommandOptions;
|
|
115
|
-
|
|
116
|
-
constructor(private deps: DependenciesMain) {}
|
|
117
|
-
|
|
118
|
-
async report([pattern, packages]: [string, string[]], setDepsFlags: SetDependenciesFlags) {
|
|
119
|
-
const { changedComps, addedPackages } = await this.deps.setDependency(pattern, packages, setDepsFlags);
|
|
120
|
-
|
|
121
|
-
return `${chalk.green('successfully updated dependencies')}
|
|
122
|
-
${chalk.bold('changed components')}
|
|
123
|
-
${changedComps.join('\n')}
|
|
124
|
-
|
|
125
|
-
${chalk.bold('added packages')}
|
|
126
|
-
${JSON.stringify(addedPackages, undefined, 4)}`;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export class DependenciesRemoveCmd implements Command {
|
|
131
|
-
name = 'remove <component-pattern> <package...>';
|
|
132
|
-
arguments = [
|
|
133
|
-
{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP },
|
|
134
|
-
{
|
|
135
|
-
name: 'package...',
|
|
136
|
-
description:
|
|
137
|
-
'package name with or without a version, e.g. "lodash@1.0.0" or just "lodash" which will remove all lodash instances of any version',
|
|
138
|
-
},
|
|
139
|
-
];
|
|
140
|
-
group = 'info';
|
|
141
|
-
description = 'remove a dependency to component(s)';
|
|
142
|
-
alias = '';
|
|
143
|
-
options = [
|
|
144
|
-
['d', 'dev', 'remove from devDependencies'],
|
|
145
|
-
['p', 'peer', 'remove from peerDependencies'],
|
|
146
|
-
] as CommandOptions;
|
|
147
|
-
|
|
148
|
-
constructor(private deps: DependenciesMain) {}
|
|
149
|
-
|
|
150
|
-
async report([pattern, packages]: [string, string[]], removeDepsFlags: RemoveDependenciesFlags) {
|
|
151
|
-
const results = await this.deps.removeDependency(pattern, packages, removeDepsFlags);
|
|
152
|
-
if (!results.length) {
|
|
153
|
-
return chalk.yellow('the specified component-pattern do not use the entered packages. nothing to remove');
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const output = results
|
|
157
|
-
.map(({ id, removedPackages }) => `${chalk.underline(id.toString())}\n${removedPackages.join('\n')}`)
|
|
158
|
-
.join('\n\n');
|
|
159
|
-
|
|
160
|
-
return `${chalk.green('successfully removed dependencies')}\n${output}`;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export class DependenciesUnsetCmd implements Command {
|
|
165
|
-
name = 'unset <component-pattern> <package...>';
|
|
166
|
-
arguments = [
|
|
167
|
-
{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP },
|
|
168
|
-
{
|
|
169
|
-
name: 'package...',
|
|
170
|
-
description:
|
|
171
|
-
'package name with or without a version, e.g. "lodash@1.0.0" or just "lodash" which will remove all lodash instances of any version',
|
|
172
|
-
},
|
|
173
|
-
];
|
|
174
|
-
group = 'info';
|
|
175
|
-
description = 'unset a dependency to component(s) that was previously set by "bit deps set"';
|
|
176
|
-
alias = '';
|
|
177
|
-
options = [
|
|
178
|
-
['d', 'dev', 'unset from devDependencies'],
|
|
179
|
-
['p', 'peer', 'unset from peerDependencies'],
|
|
180
|
-
] as CommandOptions;
|
|
181
|
-
|
|
182
|
-
constructor(private deps: DependenciesMain) {}
|
|
183
|
-
|
|
184
|
-
async report([pattern, packages]: [string, string[]], removeDepsFlags: RemoveDependenciesFlags) {
|
|
185
|
-
const results = await this.deps.removeDependency(pattern, packages, removeDepsFlags, true);
|
|
186
|
-
if (!results.length) {
|
|
187
|
-
return chalk.yellow('the specified component-pattern do not use the entered packages. nothing to unset');
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const output = results
|
|
191
|
-
.map(({ id, removedPackages }) => `${chalk.underline(id.toString())}\n${removedPackages.join('\n')}`)
|
|
192
|
-
.join('\n\n');
|
|
193
|
-
|
|
194
|
-
return `${chalk.green('successfully unset dependencies')}\n${output}`;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export class DependenciesResetCmd implements Command {
|
|
199
|
-
name = 'reset <component-pattern>';
|
|
200
|
-
arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];
|
|
201
|
-
group = 'info';
|
|
202
|
-
description = 'reset dependencies to the default values (revert any previously "bit deps set")';
|
|
203
|
-
alias = '';
|
|
204
|
-
options = [] as CommandOptions;
|
|
205
|
-
|
|
206
|
-
constructor(private deps: DependenciesMain) {}
|
|
207
|
-
|
|
208
|
-
async report([pattern]: [string]) {
|
|
209
|
-
const results = await this.deps.reset(pattern);
|
|
210
|
-
const comps = results.map((id) => id.toString());
|
|
211
|
-
|
|
212
|
-
return `${chalk.green('successfully reset dependencies for the following component(s)')}\n${comps}`;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export class DependenciesEjectCmd implements Command {
|
|
217
|
-
name = 'eject <component-pattern>';
|
|
218
|
-
arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];
|
|
219
|
-
group = 'info';
|
|
220
|
-
description = 'write dependencies that were previously set via "bit deps set" into .bitmap';
|
|
221
|
-
alias = '';
|
|
222
|
-
options = [] as CommandOptions;
|
|
223
|
-
|
|
224
|
-
constructor(private deps: DependenciesMain) {}
|
|
225
|
-
|
|
226
|
-
async report([pattern]: [string]) {
|
|
227
|
-
const results = await this.deps.eject(pattern);
|
|
228
|
-
const comps = results.map((id) => id.toString());
|
|
229
|
-
|
|
230
|
-
return `${chalk.green('successfully ejected dependencies for the following component(s)')}\n${comps}`;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export class DependenciesBlameCmd implements Command {
|
|
235
|
-
name = 'blame <component-name> <dependency-name>';
|
|
236
|
-
arguments = [
|
|
237
|
-
{
|
|
238
|
-
name: 'dependency-name',
|
|
239
|
-
description: 'package-name. for components, you can use either component-id or package-name',
|
|
240
|
-
},
|
|
241
|
-
];
|
|
242
|
-
group = 'info';
|
|
243
|
-
description = 'EXPERIMENTAL. find out which snap/tag changed a dependency version';
|
|
244
|
-
alias = '';
|
|
245
|
-
options = [] as CommandOptions;
|
|
246
|
-
|
|
247
|
-
constructor(private deps: DependenciesMain) {}
|
|
248
|
-
|
|
249
|
-
async report([compName, depName]: [string, string]) {
|
|
250
|
-
const results = await this.deps.blame(compName, depName);
|
|
251
|
-
if (!results.length) {
|
|
252
|
-
return chalk.yellow(`the specified component ${compName} does not use the entered dependency ${depName}`);
|
|
253
|
-
}
|
|
254
|
-
// table with no style and no borders, just to align the columns.
|
|
255
|
-
const table = new Table({
|
|
256
|
-
chars: {
|
|
257
|
-
top: '',
|
|
258
|
-
'top-mid': '',
|
|
259
|
-
'top-left': '',
|
|
260
|
-
'top-right': '',
|
|
261
|
-
bottom: '',
|
|
262
|
-
'bottom-mid': '',
|
|
263
|
-
'bottom-left': '',
|
|
264
|
-
'bottom-right': '',
|
|
265
|
-
left: '',
|
|
266
|
-
'left-mid': '',
|
|
267
|
-
mid: '',
|
|
268
|
-
'mid-mid': '',
|
|
269
|
-
right: '',
|
|
270
|
-
'right-mid': '',
|
|
271
|
-
middle: ' ',
|
|
272
|
-
},
|
|
273
|
-
style: { 'padding-left': 0, 'padding-right': 0 },
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
results.map(({ snap, tag, author, date, message, version }) =>
|
|
277
|
-
table.push([snap, tag || '', author, date, message, version])
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
return table.toString();
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
type DependenciesUsageCmdOptions = {
|
|
285
|
-
depth?: number;
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
export class DependenciesUsageCmd implements Command {
|
|
289
|
-
name = 'usage <dependency-name>';
|
|
290
|
-
arguments = [
|
|
291
|
-
{
|
|
292
|
-
name: 'dependency-name',
|
|
293
|
-
description:
|
|
294
|
-
'package-name. for components, you can use either component-id or package-name. if version is specified, it will search for the exact version',
|
|
295
|
-
},
|
|
296
|
-
];
|
|
297
|
-
group = 'info';
|
|
298
|
-
description = 'EXPERIMENTAL. find components that use the specified dependency';
|
|
299
|
-
alias = '';
|
|
300
|
-
options = [['', 'depth <number>', 'max display depth of the dependency graph']] as CommandOptions;
|
|
301
|
-
|
|
302
|
-
constructor(private deps: DependenciesMain) {}
|
|
303
|
-
|
|
304
|
-
async report([depName]: [string], options: DependenciesUsageCmdOptions) {
|
|
305
|
-
const deepUsageResult = await this.deps.usageDeep(depName, options);
|
|
306
|
-
if (deepUsageResult != null) return deepUsageResult;
|
|
307
|
-
const results = await this.deps.usage(depName);
|
|
308
|
-
if (!Object.keys(results).length) {
|
|
309
|
-
return chalk.yellow(`the specified dependency ${depName} is not used by any component`);
|
|
310
|
-
}
|
|
311
|
-
return Object.keys(results)
|
|
312
|
-
.map((compIdStr) => `${chalk.bold(compIdStr)} (using dep in version ${results[compIdStr]})`)
|
|
313
|
-
.join('\n');
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
export class WhyCmd extends DependenciesUsageCmd {
|
|
318
|
-
name = 'why <dependency-name>';
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
export class DependenciesCmd implements Command {
|
|
322
|
-
name = 'deps <sub-command>';
|
|
323
|
-
alias = 'dependencies';
|
|
324
|
-
description = 'manage dependencies';
|
|
325
|
-
options = [];
|
|
326
|
-
group = 'info';
|
|
327
|
-
commands: Command[] = [];
|
|
328
|
-
helpUrl = 'reference/dependencies/configuring-dependencies';
|
|
329
|
-
|
|
330
|
-
async report([unrecognizedSubcommand]: [string]) {
|
|
331
|
-
return chalk.red(
|
|
332
|
-
`"${unrecognizedSubcommand}" is not a subcommand of "dependencies", please run "bit dependencies --help" to list the subcommands`
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
}
|
package/dependencies.aspect.ts
DELETED
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';
|
|
2
|
-
import moment from 'moment';
|
|
3
|
-
import { ComponentID } from '@teambit/component-id';
|
|
4
|
-
import {
|
|
5
|
-
DependencyResolverAspect,
|
|
6
|
-
DependencyResolverMain,
|
|
7
|
-
KEY_NAME_BY_LIFECYCLE_TYPE,
|
|
8
|
-
} from '@teambit/dependency-resolver';
|
|
9
|
-
import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';
|
|
10
|
-
import { cloneDeep, compact, set } from 'lodash';
|
|
11
|
-
import pMapSeries from 'p-map-series';
|
|
12
|
-
import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
|
|
13
|
-
import ComponentLoader, { DependencyLoaderOpts } from '@teambit/legacy/dist/consumer/component/component-loader';
|
|
14
|
-
import DependencyGraph from '@teambit/legacy/dist/scope/graph/scope-graph';
|
|
15
|
-
import DevFilesAspect, { DevFilesMain } from '@teambit/dev-files';
|
|
16
|
-
import AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';
|
|
17
|
-
import { DependenciesLoader } from './dependencies-loader/dependencies-loader';
|
|
18
|
-
import { DependenciesData, OverridesDependenciesData } from './dependencies-loader/dependencies-data';
|
|
19
|
-
import {
|
|
20
|
-
DependenciesBlameCmd,
|
|
21
|
-
DependenciesCmd,
|
|
22
|
-
DependenciesDebugCmd,
|
|
23
|
-
DependenciesEjectCmd,
|
|
24
|
-
DependenciesGetCmd,
|
|
25
|
-
DependenciesRemoveCmd,
|
|
26
|
-
DependenciesResetCmd,
|
|
27
|
-
DependenciesSetCmd,
|
|
28
|
-
DependenciesUnsetCmd,
|
|
29
|
-
DependenciesUsageCmd,
|
|
30
|
-
RemoveDependenciesFlags,
|
|
31
|
-
SetDependenciesFlags,
|
|
32
|
-
WhyCmd,
|
|
33
|
-
} from './dependencies-cmd';
|
|
34
|
-
import { DependenciesAspect } from './dependencies.aspect';
|
|
35
|
-
import { DebugDependencies } from './dependencies-loader/auto-detect-deps';
|
|
36
|
-
|
|
37
|
-
export type RemoveDependencyResult = { id: ComponentID; removedPackages: string[] };
|
|
38
|
-
|
|
39
|
-
export type DependenciesResultsDebug = DebugDependencies &
|
|
40
|
-
OverridesDependenciesData & { coreAspects: string[]; sources: { id: string; source: string }[] };
|
|
41
|
-
|
|
42
|
-
export type DependenciesResults = {
|
|
43
|
-
scopeGraph: DependencyGraph;
|
|
44
|
-
workspaceGraph: DependencyGraph;
|
|
45
|
-
id: ComponentID;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type BlameResult = {
|
|
49
|
-
snap: string;
|
|
50
|
-
tag?: string;
|
|
51
|
-
author: string;
|
|
52
|
-
date: string;
|
|
53
|
-
message: string;
|
|
54
|
-
version: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export class DependenciesMain {
|
|
58
|
-
constructor(
|
|
59
|
-
private workspace: Workspace,
|
|
60
|
-
private dependencyResolver: DependencyResolverMain,
|
|
61
|
-
private devFiles: DevFilesMain,
|
|
62
|
-
private aspectLoader: AspectLoaderMain
|
|
63
|
-
) {}
|
|
64
|
-
|
|
65
|
-
async setDependency(
|
|
66
|
-
componentPattern: string,
|
|
67
|
-
packages: string[],
|
|
68
|
-
options: SetDependenciesFlags
|
|
69
|
-
): Promise<{ changedComps: string[]; addedPackages: Record<string, string> }> {
|
|
70
|
-
const compIds = await this.workspace.idsByPattern(componentPattern);
|
|
71
|
-
const getDepField = () => {
|
|
72
|
-
if (options.dev) return 'devDependencies';
|
|
73
|
-
if (options.peer) return 'peerDependencies';
|
|
74
|
-
return 'dependencies';
|
|
75
|
-
};
|
|
76
|
-
const packagesObj = {};
|
|
77
|
-
await Promise.all(
|
|
78
|
-
packages.map(async (pkg) => {
|
|
79
|
-
const [name, version] = await this.getPackageNameAndVerResolved(pkg);
|
|
80
|
-
if (options.optional) {
|
|
81
|
-
packagesObj[name] = { optional: true, version };
|
|
82
|
-
} else {
|
|
83
|
-
packagesObj[name] = version;
|
|
84
|
-
}
|
|
85
|
-
})
|
|
86
|
-
);
|
|
87
|
-
const config = {
|
|
88
|
-
policy: {
|
|
89
|
-
[getDepField()]: packagesObj,
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
await Promise.all(
|
|
93
|
-
compIds.map(async (compId) => {
|
|
94
|
-
await this.workspace.addSpecificComponentConfig(compId, DependencyResolverAspect.id, config, {
|
|
95
|
-
shouldMergeWithExisting: true,
|
|
96
|
-
shouldMergeWithPrevious: true,
|
|
97
|
-
});
|
|
98
|
-
})
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
await this.workspace.bitMap.write(`deps-set (${componentPattern})`);
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
changedComps: compIds.map((compId) => compId.toStringWithoutVersion()),
|
|
105
|
-
addedPackages: packagesObj,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
async removeDependency(
|
|
110
|
-
componentPattern: string,
|
|
111
|
-
packages: string[],
|
|
112
|
-
options: RemoveDependenciesFlags = {},
|
|
113
|
-
removeOnlyIfExists = false // unset
|
|
114
|
-
): Promise<RemoveDependencyResult[]> {
|
|
115
|
-
const compIds = await this.workspace.idsByPattern(componentPattern);
|
|
116
|
-
const results = await pMapSeries(compIds, async (compId) => {
|
|
117
|
-
const component = await this.workspace.get(compId);
|
|
118
|
-
const depList = await this.dependencyResolver.getDependencies(component);
|
|
119
|
-
const getCurrentConfig = async () => {
|
|
120
|
-
const currentConfigFromWorkspace = await this.workspace.getSpecificComponentConfig(
|
|
121
|
-
compId,
|
|
122
|
-
DependencyResolverAspect.id
|
|
123
|
-
);
|
|
124
|
-
if (currentConfigFromWorkspace) return currentConfigFromWorkspace;
|
|
125
|
-
const extFromScope = await this.workspace.getExtensionsFromScopeAndSpecific(compId);
|
|
126
|
-
return extFromScope?.toConfigObject()[DependencyResolverAspect.id];
|
|
127
|
-
};
|
|
128
|
-
const currentDepResolverConfig = await getCurrentConfig();
|
|
129
|
-
const newDepResolverConfig = cloneDeep(currentDepResolverConfig || {});
|
|
130
|
-
const removedPackagesWithNulls = await pMapSeries(packages, async (pkg) => {
|
|
131
|
-
const [name, version] = this.splitPkgToNameAndVer(pkg);
|
|
132
|
-
const dependency = depList.findByPkgNameOrCompId(name, version);
|
|
133
|
-
if (!dependency) return null;
|
|
134
|
-
const depName = dependency.getPackageName?.() || dependency.id;
|
|
135
|
-
const getLifeCycle = () => {
|
|
136
|
-
if (options.dev) return 'dev';
|
|
137
|
-
if (options.peer) return 'peer';
|
|
138
|
-
return dependency.lifecycle;
|
|
139
|
-
};
|
|
140
|
-
const depField = KEY_NAME_BY_LIFECYCLE_TYPE[getLifeCycle()];
|
|
141
|
-
const existsInSpecificConfig = newDepResolverConfig.policy?.[depField]?.[depName];
|
|
142
|
-
if (existsInSpecificConfig) {
|
|
143
|
-
if (existsInSpecificConfig === '-') return null;
|
|
144
|
-
delete newDepResolverConfig.policy[depField][depName];
|
|
145
|
-
} else {
|
|
146
|
-
if (removeOnlyIfExists) return null;
|
|
147
|
-
set(newDepResolverConfig, ['policy', depField, depName], '-');
|
|
148
|
-
}
|
|
149
|
-
return `${depName}@${dependency.version}`;
|
|
150
|
-
});
|
|
151
|
-
const removedPackages = compact(removedPackagesWithNulls);
|
|
152
|
-
if (!removedPackages.length) return null;
|
|
153
|
-
await this.workspace.addSpecificComponentConfig(compId, DependencyResolverAspect.id, newDepResolverConfig);
|
|
154
|
-
return { id: compId, removedPackages };
|
|
155
|
-
});
|
|
156
|
-
await this.workspace.bitMap.write(`deps-remove (${componentPattern})`);
|
|
157
|
-
|
|
158
|
-
return compact(results);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
async reset(componentPattern: string): Promise<ComponentID[]> {
|
|
162
|
-
const compIds = await this.workspace.idsByPattern(componentPattern);
|
|
163
|
-
await pMapSeries(compIds, async (compId) => {
|
|
164
|
-
await this.workspace.addSpecificComponentConfig(compId, DependencyResolverAspect.id, { policy: {} });
|
|
165
|
-
});
|
|
166
|
-
await this.workspace.bitMap.write(`deps-reset (${componentPattern})`);
|
|
167
|
-
|
|
168
|
-
return compIds;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
async eject(componentPattern: string): Promise<ComponentID[]> {
|
|
172
|
-
const compIds = await this.workspace.idsByPattern(componentPattern);
|
|
173
|
-
await pMapSeries(compIds, async (compId) => {
|
|
174
|
-
await this.workspace.addSpecificComponentConfig(
|
|
175
|
-
compId,
|
|
176
|
-
DependencyResolverAspect.id,
|
|
177
|
-
{},
|
|
178
|
-
{
|
|
179
|
-
shouldMergeWithExisting: true,
|
|
180
|
-
shouldMergeWithPrevious: true,
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
});
|
|
184
|
-
await this.workspace.bitMap.write(`deps-eject (${componentPattern})`);
|
|
185
|
-
|
|
186
|
-
return compIds;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
async getDependencies(id: string): Promise<DependenciesResults> {
|
|
190
|
-
// @todo: supports this on bare-scope.
|
|
191
|
-
if (!this.workspace) throw new OutsideWorkspaceError();
|
|
192
|
-
const compId = await this.workspace.resolveComponentId(id);
|
|
193
|
-
const consumer = this.workspace.consumer;
|
|
194
|
-
const scopeGraph = await DependencyGraph.buildGraphFromScope(consumer.scope);
|
|
195
|
-
const scopeDependencyGraph = new DependencyGraph(scopeGraph);
|
|
196
|
-
|
|
197
|
-
const workspaceGraph = await DependencyGraph.buildGraphFromWorkspace(consumer, true);
|
|
198
|
-
const workspaceDependencyGraph = new DependencyGraph(workspaceGraph);
|
|
199
|
-
|
|
200
|
-
return { scopeGraph: scopeDependencyGraph, workspaceGraph: workspaceDependencyGraph, id: compId };
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
async loadDependencies(component: ConsumerComponent, opts: DependencyLoaderOpts) {
|
|
204
|
-
const dependenciesLoader = new DependenciesLoader(
|
|
205
|
-
component,
|
|
206
|
-
this.dependencyResolver,
|
|
207
|
-
this.devFiles,
|
|
208
|
-
this.aspectLoader
|
|
209
|
-
);
|
|
210
|
-
return dependenciesLoader.load(this.workspace, opts);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* load dependencies without the need for the workspace.
|
|
215
|
-
* the "auto-detect" are passed here as "dependenciesData". the "overrides", such as dependencies from the env,
|
|
216
|
-
* are calculated here.
|
|
217
|
-
* eventually all these dependencies are added to the ConsumerComponent object.
|
|
218
|
-
*/
|
|
219
|
-
async loadDependenciesFromScope(component: ConsumerComponent, dependenciesData: Partial<DependenciesData>) {
|
|
220
|
-
const dependenciesLoader = new DependenciesLoader(
|
|
221
|
-
component,
|
|
222
|
-
this.dependencyResolver,
|
|
223
|
-
this.devFiles,
|
|
224
|
-
this.aspectLoader
|
|
225
|
-
);
|
|
226
|
-
return dependenciesLoader.loadFromScope(dependenciesData);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
async debugDependencies(id: string): Promise<DependenciesResultsDebug> {
|
|
230
|
-
// @todo: supports this on bare-scope.
|
|
231
|
-
if (!this.workspace) throw new OutsideWorkspaceError();
|
|
232
|
-
const compId = await this.workspace.resolveComponentId(id);
|
|
233
|
-
const component = await this.workspace.get(compId);
|
|
234
|
-
const consumerComponent = component.state._consumer as ConsumerComponent;
|
|
235
|
-
|
|
236
|
-
const dependenciesData = await this.loadDependencies(consumerComponent, {
|
|
237
|
-
cacheResolvedDependencies: {},
|
|
238
|
-
useDependenciesCache: false,
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
const { missingPackageDependencies, manuallyAddedDependencies, manuallyRemovedDependencies } =
|
|
242
|
-
dependenciesData.overridesDependencies;
|
|
243
|
-
|
|
244
|
-
const results = await this.dependencyResolver.getDependencies(component);
|
|
245
|
-
const sources = results.map((dep) => ({ id: dep.id, source: dep.source }));
|
|
246
|
-
|
|
247
|
-
return {
|
|
248
|
-
...dependenciesData.debugDependenciesData,
|
|
249
|
-
manuallyRemovedDependencies,
|
|
250
|
-
manuallyAddedDependencies,
|
|
251
|
-
missingPackageDependencies,
|
|
252
|
-
coreAspects: dependenciesData.dependenciesData.coreAspects,
|
|
253
|
-
sources,
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* helps determine what snap/tag changed a specific dependency.
|
|
259
|
-
* the results are sorted from the oldest to newest.
|
|
260
|
-
*/
|
|
261
|
-
async blame(compName: string, depName: string) {
|
|
262
|
-
const id = await this.workspace.resolveComponentId(compName);
|
|
263
|
-
const log = await this.workspace.scope.getLogs(id);
|
|
264
|
-
const blameResults: BlameResult[] = [];
|
|
265
|
-
let lastVersion = '';
|
|
266
|
-
await pMapSeries(log, async (logItem) => {
|
|
267
|
-
const component = await this.workspace.get(id.changeVersion(logItem.tag || logItem.hash));
|
|
268
|
-
const depList = await this.dependencyResolver.getDependencies(component);
|
|
269
|
-
const dependency = depList.findByPkgNameOrCompId(depName);
|
|
270
|
-
if (dependency && dependency.version === lastVersion) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
let version: string;
|
|
274
|
-
if (!dependency) {
|
|
275
|
-
if (!lastVersion) return;
|
|
276
|
-
version = '<REMOVED>';
|
|
277
|
-
} else {
|
|
278
|
-
version = dependency.version;
|
|
279
|
-
}
|
|
280
|
-
if (!dependency || dependency.version === lastVersion) return;
|
|
281
|
-
lastVersion = dependency.version;
|
|
282
|
-
blameResults.push({
|
|
283
|
-
snap: logItem.hash,
|
|
284
|
-
tag: logItem.tag,
|
|
285
|
-
author: logItem.username || '<N/A>',
|
|
286
|
-
date: logItem.date ? moment(new Date(parseInt(logItem.date))).format('YYYY-MM-DD HH:mm:ss') : '<N/A>',
|
|
287
|
-
message: logItem.message,
|
|
288
|
-
version,
|
|
289
|
-
});
|
|
290
|
-
});
|
|
291
|
-
return blameResults;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
async usageDeep(depName: string, opts?: { depth?: number }): Promise<string | undefined> {
|
|
295
|
-
if (!isComponentId(depName)) {
|
|
296
|
-
return this.dependencyResolver.getPackageManager()?.findUsages?.(depName, {
|
|
297
|
-
lockfileDir: this.workspace.path,
|
|
298
|
-
depth: opts?.depth,
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
return undefined;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* @param depName either component-id-string or package-name (of the component or not component)
|
|
306
|
-
* @returns a map of component-id-string to the version of the dependency
|
|
307
|
-
*/
|
|
308
|
-
async usage(depName: string): Promise<{ [compIdStr: string]: string }> {
|
|
309
|
-
const [name, version] = this.splitPkgToNameAndVer(depName);
|
|
310
|
-
const allComps = await this.workspace.list();
|
|
311
|
-
const results = {};
|
|
312
|
-
await Promise.all(
|
|
313
|
-
allComps.map(async (comp) => {
|
|
314
|
-
const depList = await this.dependencyResolver.getDependencies(comp);
|
|
315
|
-
const dependency = depList.findByPkgNameOrCompId(name, version);
|
|
316
|
-
if (dependency) {
|
|
317
|
-
results[comp.id.toString()] = dependency.version;
|
|
318
|
-
}
|
|
319
|
-
})
|
|
320
|
-
);
|
|
321
|
-
return results;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
private async getPackageNameAndVerResolved(pkg: string): Promise<[string, string]> {
|
|
325
|
-
const resolveLatest = async (pkgName: string) => {
|
|
326
|
-
const versionResolver = await this.dependencyResolver.getVersionResolver({});
|
|
327
|
-
const resolved = await versionResolver.resolveRemoteVersion(pkgName, { rootDir: '' });
|
|
328
|
-
if (!resolved.version) throw new Error(`unable to resolve version for ${pkgName}`);
|
|
329
|
-
return resolved.version;
|
|
330
|
-
};
|
|
331
|
-
const [name, version] = this.splitPkgToNameAndVer(pkg);
|
|
332
|
-
const versionResolved = !version || version === 'latest' ? await resolveLatest(name) : version;
|
|
333
|
-
return [name, versionResolved];
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
private splitPkgToNameAndVer(pkg: string): [string, string | undefined] {
|
|
337
|
-
const packageSplit = pkg.split('@');
|
|
338
|
-
if (pkg.startsWith('@')) {
|
|
339
|
-
// scoped package
|
|
340
|
-
if (packageSplit.length > 3) throw new Error(`invalid package "${pkg}" syntax, expected "package[@version]"`);
|
|
341
|
-
return [`@${packageSplit[1]}`, packageSplit[2]];
|
|
342
|
-
}
|
|
343
|
-
if (packageSplit.length > 2) throw new Error(`invalid package "${pkg}" syntax, expected "package[@version]"`);
|
|
344
|
-
return [packageSplit[0], packageSplit[1]];
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
static slots = [];
|
|
348
|
-
static dependencies = [CLIAspect, WorkspaceAspect, DependencyResolverAspect, DevFilesAspect, AspectLoaderAspect];
|
|
349
|
-
|
|
350
|
-
static runtime = MainRuntime;
|
|
351
|
-
|
|
352
|
-
static async provider([cli, workspace, depsResolver, devFiles, aspectLoader]: [
|
|
353
|
-
CLIMain,
|
|
354
|
-
Workspace,
|
|
355
|
-
DependencyResolverMain,
|
|
356
|
-
DevFilesMain,
|
|
357
|
-
AspectLoaderMain
|
|
358
|
-
]) {
|
|
359
|
-
const depsMain = new DependenciesMain(workspace, depsResolver, devFiles, aspectLoader);
|
|
360
|
-
const depsCmd = new DependenciesCmd();
|
|
361
|
-
depsCmd.commands = [
|
|
362
|
-
new DependenciesGetCmd(depsMain),
|
|
363
|
-
new DependenciesRemoveCmd(depsMain),
|
|
364
|
-
new DependenciesUnsetCmd(depsMain),
|
|
365
|
-
new DependenciesDebugCmd(depsMain),
|
|
366
|
-
new DependenciesSetCmd(depsMain),
|
|
367
|
-
new DependenciesResetCmd(depsMain),
|
|
368
|
-
new DependenciesEjectCmd(depsMain),
|
|
369
|
-
new DependenciesBlameCmd(depsMain),
|
|
370
|
-
new DependenciesUsageCmd(depsMain),
|
|
371
|
-
];
|
|
372
|
-
const whyCmd = new WhyCmd(depsMain);
|
|
373
|
-
cli.register(depsCmd, whyCmd);
|
|
374
|
-
|
|
375
|
-
ComponentLoader.loadDeps = depsMain.loadDependencies.bind(depsMain);
|
|
376
|
-
|
|
377
|
-
return depsMain;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function isComponentId(depName: string) {
|
|
382
|
-
return depName.includes('/') && depName[0] !== '@';
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
DependenciesAspect.addRuntime(DependenciesMain);
|
|
386
|
-
|
|
387
|
-
export default DependenciesMain;
|
package/index.ts
DELETED
|
File without changes
|