@teambit/workspace 0.0.843 → 0.0.846
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.d.ts +9 -60
- package/dist/workspace.js +37 -409
- 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.846.tgz +0 -0
- package/package.json +33 -42
- package/{preview-1662089982043.js → preview-1662608124038.js} +2 -2
- package/ui/workspace/use-workspace.ts +3 -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.843.tgz +0 -0
- package/uninstall.cmd.tsx +0 -23
- package/update.cmd.tsx +0 -29
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["pickOutdatedPkgs","outdatedPkgs","updateDependencies","prompt","choices","makeOutdatedPkgChoices","footer","indicator","state","choice","enabled","message","chalk","cyan","green","red","name","pointer","styles","dark","white","em","bgBlack","whiteBright","success","type","validate","value","length","j","down","k","up","result","names","map","cancel","Object","values","filter","updateDependency","DEP_TYPE_PRIORITY","dependencies","devDependencies","peerDependencies","mergedOutdatedPkgs","mergeOutdatedPkgs","sort","pkg1","pkg2","targetField","localeCompare","renderedTable","alignColumns","outdatedPkgsRows","groupedChoices","forEach","outdatedPkg","index","context","renderContext","push","entries","subChoices","outdatedPkgsNotFromComponentModel","source","componentId","omit","dependentComponents","currentRange","hasDifferentRanges","tryPickLowestRange","range1","range2","semver","lt","rangeToVersion","range","startsWith","substring","variantPattern","TARGET_FIELD_TO_DEP_TYPE","change","diff","semverDiff","latestRange","colorizeChange","latest","colorizeSemverDiff","grey","renderDependents","rows","table","border","getBorderCharacters","columnDefault","paddingLeft","paddingRight","columns","alignment","drawHorizontalLine","split"],"sources":["pick-outdated-pkgs.ts"],"sourcesContent":["import colorizeSemverDiff from '@pnpm/colorize-semver-diff';\nimport semverDiff from '@pnpm/semver-diff';\nimport { OutdatedPkg } from '@teambit/dependency-resolver';\nimport { omit } from 'lodash';\nimport { getBorderCharacters, table } from 'table';\nimport chalk from 'chalk';\nimport { prompt } from 'enquirer';\nimport semver from 'semver';\n\n/**\n * Lets the user pick the packages that should be updated.\n */\nexport async function pickOutdatedPkgs(outdatedPkgs: OutdatedPkg[]): Promise<MergedOutdatedPkg[]> {\n const { updateDependencies } = (await prompt({\n choices: makeOutdatedPkgChoices(outdatedPkgs),\n footer: '\\nEnter to start updating. Ctrl-c to cancel.',\n indicator: (state: any, choice: any) => ` ${choice.enabled ? '●' : '○'}`,\n message:\n 'Choose which packages to update ' +\n `(Press ${chalk.cyan('<space>')} to select, ` +\n `${chalk.cyan('<a>')} to toggle all, ` +\n `${chalk.cyan('<i>')} to invert selection)\n${chalk.green('Green')} - indicates a semantically safe update\n${chalk.red('Red')} - indicates a semantically breaking change`,\n name: 'updateDependencies',\n pointer: '❯',\n styles: {\n dark: chalk.white,\n em: chalk.bgBlack.whiteBright,\n success: chalk.white,\n },\n type: 'multiselect',\n validate(value: string[]) {\n if (value.length === 0) {\n return 'You must choose at least one package.';\n }\n return true;\n },\n j() {\n return this.down();\n },\n k() {\n return this.up();\n },\n result(names: string[]) {\n // This is needed in order to have the values of the choices in the answer object.\n // Otherwise, only the names of the selected choices would've been included.\n return this.map(names);\n },\n cancel() {\n // By default, canceling the prompt via Ctrl+c throws an empty string.\n // The custom cancel function prevents that behavior.\n // Otherwise, Bit CLI would print an error and confuse users.\n // See related issue: https://github.com/enquirer/enquirer/issues/225\n },\n } as any)) as { updateDependencies: Record<string, string | MergedOutdatedPkg> };\n return Object.values(updateDependencies ?? {}).filter(\n (updateDependency) => typeof updateDependency !== 'string'\n ) as OutdatedPkg[];\n}\n\nconst DEP_TYPE_PRIORITY = {\n dependencies: 0,\n devDependencies: 1,\n peerDependencies: 2,\n};\n\n/**\n * Groups the outdated packages and makes choices for enquirer's prompt.\n */\nexport function makeOutdatedPkgChoices(outdatedPkgs: OutdatedPkg[]) {\n const mergedOutdatedPkgs = mergeOutdatedPkgs(outdatedPkgs);\n mergedOutdatedPkgs.sort((pkg1, pkg2) => {\n if (pkg1.targetField === pkg2.targetField) return pkg1.name.localeCompare(pkg2.name);\n return DEP_TYPE_PRIORITY[pkg1.targetField] - DEP_TYPE_PRIORITY[pkg2.targetField];\n });\n const renderedTable = alignColumns(outdatedPkgsRows(mergedOutdatedPkgs));\n const groupedChoices = {};\n mergedOutdatedPkgs.forEach((outdatedPkg, index) => {\n const context = renderContext(outdatedPkg);\n if (!groupedChoices[context]) {\n groupedChoices[context] = [];\n }\n groupedChoices[context].push({\n message: renderedTable[index],\n name: outdatedPkg.name,\n value: outdatedPkg,\n });\n });\n const choices = Object.entries(groupedChoices).map(([context, subChoices]) => ({\n message: chalk.cyan(context),\n choices: subChoices,\n }));\n return choices;\n}\n\nexport interface MergedOutdatedPkg extends OutdatedPkg {\n dependentComponents?: string[];\n hasDifferentRanges?: boolean;\n}\n\nfunction mergeOutdatedPkgs(outdatedPkgs: OutdatedPkg[]): MergedOutdatedPkg[] {\n const mergedOutdatedPkgs: Record<\n string,\n MergedOutdatedPkg & Required<Pick<MergedOutdatedPkg, 'dependentComponents'>>\n > = {};\n const outdatedPkgsNotFromComponentModel: OutdatedPkg[] = [];\n for (const outdatedPkg of outdatedPkgs) {\n if (outdatedPkg.source === 'component-model' && outdatedPkg.componentId) {\n if (!mergedOutdatedPkgs[outdatedPkg.name]) {\n mergedOutdatedPkgs[outdatedPkg.name] = {\n ...omit(outdatedPkg, ['componentId']),\n source: 'rootPolicy',\n dependentComponents: [outdatedPkg.componentId],\n };\n } else {\n if (mergedOutdatedPkgs[outdatedPkg.name].currentRange !== outdatedPkg.currentRange) {\n mergedOutdatedPkgs[outdatedPkg.name].hasDifferentRanges = true;\n }\n mergedOutdatedPkgs[outdatedPkg.name].currentRange = tryPickLowestRange(\n mergedOutdatedPkgs[outdatedPkg.name].currentRange,\n outdatedPkg.currentRange\n );\n mergedOutdatedPkgs[outdatedPkg.name].dependentComponents.push(outdatedPkg.componentId);\n if (outdatedPkg.targetField === 'dependencies') {\n mergedOutdatedPkgs[outdatedPkg.name].targetField = outdatedPkg.targetField;\n }\n }\n } else {\n outdatedPkgsNotFromComponentModel.push(outdatedPkg);\n }\n }\n return [...Object.values(mergedOutdatedPkgs), ...outdatedPkgsNotFromComponentModel];\n}\n\nfunction tryPickLowestRange(range1: string, range2: string) {\n if (range1 === '*' || range2 === '*') return '*';\n try {\n return semver.lt(rangeToVersion(range1), rangeToVersion(range2)) ? range1 : range2;\n } catch {\n return '*';\n }\n}\n\nfunction rangeToVersion(range: string) {\n if (range.startsWith('~') || range.startsWith('^')) {\n return range.substring(1);\n }\n return range;\n}\n\nfunction renderContext(outdatedPkg: MergedOutdatedPkg) {\n if (outdatedPkg.variantPattern) {\n return `${outdatedPkg.variantPattern} (variant)`;\n }\n if (outdatedPkg.componentId) {\n return `${outdatedPkg.componentId} (component)`;\n }\n return 'Root policies';\n}\n\nconst TARGET_FIELD_TO_DEP_TYPE = {\n devDependencies: 'dev',\n dependencies: 'runtime',\n peerDependencies: 'peer',\n};\n\nfunction outdatedPkgsRows(outdatedPkgs: MergedOutdatedPkg[]) {\n return outdatedPkgs.map((outdatedPkg) => {\n const { change, diff } = semverDiff(outdatedPkg.currentRange, outdatedPkg.latestRange);\n let colorizeChange = change ?? 'breaking';\n if (change === 'feature') {\n colorizeChange = 'fix';\n }\n const latest = colorizeSemverDiff({\n change: colorizeChange,\n diff,\n });\n return [\n outdatedPkg.name,\n chalk.grey(`(${TARGET_FIELD_TO_DEP_TYPE[outdatedPkg.targetField]})`),\n outdatedPkg.hasDifferentRanges ? '*' : outdatedPkg.currentRange,\n '❯',\n latest,\n outdatedPkg.dependentComponents ? renderDependents(outdatedPkg.dependentComponents) : ' ',\n ];\n });\n}\n\nfunction renderDependents(dependentComponents: string[]): string {\n let result = `because of ${dependentComponents[0]}`;\n if (dependentComponents.length > 1) {\n result += ` and ${dependentComponents.length - 1} other components`;\n }\n return result;\n}\n\nfunction alignColumns(rows: string[][]) {\n return table(rows, {\n border: getBorderCharacters('void'),\n columnDefault: {\n paddingLeft: 0,\n paddingRight: 1,\n },\n columns: {\n // This is the current range column\n 2: { alignment: 'right' },\n },\n drawHorizontalLine: () => false,\n }).split('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA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A0BtB,mBAA1B,EAAiE;EAC/D,IAAInC,MAAM,GAAI,cAAamC,mBAAmB,CAAC,CAAD,CAAI,EAAlD;;EACA,IAAIA,mBAAmB,CAACxC,MAApB,GAA6B,CAAjC,EAAoC;IAClCK,MAAM,IAAK,QAAOmC,mBAAmB,CAACxC,MAApB,GAA6B,CAAE,mBAAjD;EACD;;EACD,OAAOK,MAAP;AACD;;AAED,SAASoB,YAAT,CAAsBsC,IAAtB,EAAwC;EACtC,OAAO,IAAAC,cAAA,EAAMD,IAAN,EAAY;IACjBE,MAAM,EAAE,IAAAC,4BAAA,EAAoB,MAApB,CADS;IAEjBC,aAAa,EAAE;MACbC,WAAW,EAAE,CADA;MAEbC,YAAY,EAAE;IAFD,CAFE;IAMjBC,OAAO,EAAE;MACP;MACA,GAAG;QAAEC,SAAS,EAAE;MAAb;IAFI,CANQ;IAUjBC,kBAAkB,EAAE,MAAM;EAVT,CAAZ,EAWJC,KAXI,CAWE,IAXF,CAAP;AAYD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _pickOutdatedPkgs() {
|
|
4
|
-
const data = require("./pick-outdated-pkgs");
|
|
5
|
-
|
|
6
|
-
_pickOutdatedPkgs = function () {
|
|
7
|
-
return data;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
return data;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
describe('makeOutdatedPkgChoices', () => {
|
|
14
|
-
it('should render choices in correct order', () => {
|
|
15
|
-
const choices = (0, _pickOutdatedPkgs().makeOutdatedPkgChoices)([{
|
|
16
|
-
name: 'zoo',
|
|
17
|
-
currentRange: '1.0.0',
|
|
18
|
-
latestRange: '1.1.0',
|
|
19
|
-
source: 'rootPolicy',
|
|
20
|
-
targetField: 'devDependencies'
|
|
21
|
-
}, {
|
|
22
|
-
name: 'qar',
|
|
23
|
-
currentRange: '1.0.0',
|
|
24
|
-
latestRange: '1.1.0',
|
|
25
|
-
source: 'rootPolicy',
|
|
26
|
-
targetField: 'dependencies'
|
|
27
|
-
}, {
|
|
28
|
-
name: 'foo',
|
|
29
|
-
currentRange: '1.0.0',
|
|
30
|
-
latestRange: '2.0.0',
|
|
31
|
-
source: 'rootPolicy',
|
|
32
|
-
targetField: 'dependencies'
|
|
33
|
-
}, {
|
|
34
|
-
name: 'bar',
|
|
35
|
-
currentRange: '1.0.0',
|
|
36
|
-
latestRange: '1.1.0',
|
|
37
|
-
source: 'rootPolicy',
|
|
38
|
-
targetField: 'peerDependencies'
|
|
39
|
-
}]); // @ts-ignore
|
|
40
|
-
|
|
41
|
-
expect(choices).toMatchSnapshot();
|
|
42
|
-
});
|
|
43
|
-
it('should render choices with context information', () => {
|
|
44
|
-
const choices = (0, _pickOutdatedPkgs().makeOutdatedPkgChoices)([{
|
|
45
|
-
name: 'foo',
|
|
46
|
-
currentRange: '1.0.0',
|
|
47
|
-
latestRange: '2.0.0',
|
|
48
|
-
source: 'component',
|
|
49
|
-
componentId: 'comp1',
|
|
50
|
-
targetField: 'dependencies'
|
|
51
|
-
}, {
|
|
52
|
-
name: 'bar',
|
|
53
|
-
currentRange: '1.0.0',
|
|
54
|
-
latestRange: '1.1.0',
|
|
55
|
-
source: 'variants',
|
|
56
|
-
variantPattern: '{comp2}',
|
|
57
|
-
targetField: 'peerDependencies'
|
|
58
|
-
}]); // @ts-ignore
|
|
59
|
-
|
|
60
|
-
expect(choices).toMatchSnapshot();
|
|
61
|
-
});
|
|
62
|
-
it('should group component model updates of the same dependency', () => {
|
|
63
|
-
const choices = (0, _pickOutdatedPkgs().makeOutdatedPkgChoices)([{
|
|
64
|
-
name: 'foo',
|
|
65
|
-
currentRange: '1.0.0',
|
|
66
|
-
latestRange: '2.0.0',
|
|
67
|
-
source: 'component-model',
|
|
68
|
-
componentId: 'comp1',
|
|
69
|
-
targetField: 'devDependencies'
|
|
70
|
-
}, {
|
|
71
|
-
name: 'foo',
|
|
72
|
-
currentRange: '1.1.0',
|
|
73
|
-
latestRange: '2.0.0',
|
|
74
|
-
source: 'component-model',
|
|
75
|
-
componentId: 'comp2',
|
|
76
|
-
targetField: 'dependencies'
|
|
77
|
-
}]); // @ts-ignore
|
|
78
|
-
|
|
79
|
-
expect(choices).toMatchSnapshot();
|
|
80
|
-
});
|
|
81
|
-
it("should group component model updates of the same dependency and use * as current range when can't compare ranges", () => {
|
|
82
|
-
const choices = (0, _pickOutdatedPkgs().makeOutdatedPkgChoices)([{
|
|
83
|
-
name: 'foo',
|
|
84
|
-
currentRange: '<=10.0.0',
|
|
85
|
-
latestRange: '2.0.0',
|
|
86
|
-
source: 'component-model',
|
|
87
|
-
componentId: 'comp1',
|
|
88
|
-
targetField: 'dependencies'
|
|
89
|
-
}, {
|
|
90
|
-
name: 'foo',
|
|
91
|
-
currentRange: '1.1.0',
|
|
92
|
-
latestRange: '2.0.0',
|
|
93
|
-
source: 'component-model',
|
|
94
|
-
componentId: 'comp2',
|
|
95
|
-
targetField: 'dependencies'
|
|
96
|
-
}]); // @ts-ignore
|
|
97
|
-
|
|
98
|
-
expect(choices).toMatchSnapshot();
|
|
99
|
-
});
|
|
100
|
-
it('should group component model updates of the same dependency and display the current range when all components use the same range', () => {
|
|
101
|
-
const choices = (0, _pickOutdatedPkgs().makeOutdatedPkgChoices)([{
|
|
102
|
-
name: 'foo',
|
|
103
|
-
currentRange: '^1.2.3',
|
|
104
|
-
latestRange: '2.0.0',
|
|
105
|
-
source: 'component-model',
|
|
106
|
-
componentId: 'comp1',
|
|
107
|
-
targetField: 'dependencies'
|
|
108
|
-
}, {
|
|
109
|
-
name: 'foo',
|
|
110
|
-
currentRange: '^1.2.3',
|
|
111
|
-
latestRange: '2.0.0',
|
|
112
|
-
source: 'component-model',
|
|
113
|
-
componentId: 'comp2',
|
|
114
|
-
targetField: 'dependencies'
|
|
115
|
-
}]); // @ts-ignore
|
|
116
|
-
|
|
117
|
-
expect(choices).toMatchSnapshot();
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
//# sourceMappingURL=pick-outdated-pkgs.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["describe","it","choices","makeOutdatedPkgChoices","name","currentRange","latestRange","source","targetField","expect","toMatchSnapshot","componentId","variantPattern"],"sources":["pick-outdated-pkgs.spec.ts"],"sourcesContent":["import { makeOutdatedPkgChoices } from './pick-outdated-pkgs';\n\ndescribe('makeOutdatedPkgChoices', () => {\n it('should render choices in correct order', () => {\n const choices = makeOutdatedPkgChoices([\n {\n name: 'zoo',\n currentRange: '1.0.0',\n latestRange: '1.1.0',\n source: 'rootPolicy',\n targetField: 'devDependencies',\n },\n {\n name: 'qar',\n currentRange: '1.0.0',\n latestRange: '1.1.0',\n source: 'rootPolicy',\n targetField: 'dependencies',\n },\n {\n name: 'foo',\n currentRange: '1.0.0',\n latestRange: '2.0.0',\n source: 'rootPolicy',\n targetField: 'dependencies',\n },\n {\n name: 'bar',\n currentRange: '1.0.0',\n latestRange: '1.1.0',\n source: 'rootPolicy',\n targetField: 'peerDependencies',\n },\n ]);\n // @ts-ignore\n expect(choices).toMatchSnapshot();\n });\n it('should render choices with context information', () => {\n const choices = makeOutdatedPkgChoices([\n {\n name: 'foo',\n currentRange: '1.0.0',\n latestRange: '2.0.0',\n source: 'component',\n componentId: 'comp1',\n targetField: 'dependencies',\n },\n {\n name: 'bar',\n currentRange: '1.0.0',\n latestRange: '1.1.0',\n source: 'variants',\n variantPattern: '{comp2}',\n targetField: 'peerDependencies',\n },\n ]);\n // @ts-ignore\n expect(choices).toMatchSnapshot();\n });\n it('should group component model updates of the same dependency', () => {\n const choices = makeOutdatedPkgChoices([\n {\n name: 'foo',\n currentRange: '1.0.0',\n latestRange: '2.0.0',\n source: 'component-model',\n componentId: 'comp1',\n targetField: 'devDependencies',\n },\n {\n name: 'foo',\n currentRange: '1.1.0',\n latestRange: '2.0.0',\n source: 'component-model',\n componentId: 'comp2',\n targetField: 'dependencies',\n },\n ]);\n // @ts-ignore\n expect(choices).toMatchSnapshot();\n });\n it(\"should group component model updates of the same dependency and use * as current range when can't compare ranges\", () => {\n const choices = makeOutdatedPkgChoices([\n {\n name: 'foo',\n currentRange: '<=10.0.0',\n latestRange: '2.0.0',\n source: 'component-model',\n componentId: 'comp1',\n targetField: 'dependencies',\n },\n {\n name: 'foo',\n currentRange: '1.1.0',\n latestRange: '2.0.0',\n source: 'component-model',\n componentId: 'comp2',\n targetField: 'dependencies',\n },\n ]);\n // @ts-ignore\n expect(choices).toMatchSnapshot();\n });\n it('should group component model updates of the same dependency and display the current range when all components use the same range', () => {\n const choices = makeOutdatedPkgChoices([\n {\n name: 'foo',\n currentRange: '^1.2.3',\n latestRange: '2.0.0',\n source: 'component-model',\n componentId: 'comp1',\n targetField: 'dependencies',\n },\n {\n name: 'foo',\n currentRange: '^1.2.3',\n latestRange: '2.0.0',\n source: 'component-model',\n componentId: 'comp2',\n targetField: 'dependencies',\n },\n ]);\n // @ts-ignore\n expect(choices).toMatchSnapshot();\n });\n});\n"],"mappings":";;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEAA,QAAQ,CAAC,wBAAD,EAA2B,MAAM;EACvCC,EAAE,CAAC,wCAAD,EAA2C,MAAM;IACjD,MAAMC,OAAO,GAAG,IAAAC,0CAAA,EAAuB,CACrC;MACEC,IAAI,EAAE,KADR;MAEEC,YAAY,EAAE,OAFhB;MAGEC,WAAW,EAAE,OAHf;MAIEC,MAAM,EAAE,YAJV;MAKEC,WAAW,EAAE;IALf,CADqC,EAQrC;MACEJ,IAAI,EAAE,KADR;MAEEC,YAAY,EAAE,OAFhB;MAGEC,WAAW,EAAE,OAHf;MAIEC,MAAM,EAAE,YAJV;MAKEC,WAAW,EAAE;IALf,CARqC,EAerC;MACEJ,IAAI,EAAE,KADR;MAEEC,YAAY,EAAE,OAFhB;MAGEC,WAAW,EAAE,OAHf;MAIEC,MAAM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C,MAAM,CAACP,OAAD,CAAN,CAAgBQ,eAAhB;EACD,CArBC,CAAF;EAsBAT,EAAE,CAAC,kHAAD,EAAqH,MAAM;IAC3H,MAAMC,OAAO,GAAG,IAAAC,0CAAA,EAAuB,CACrC;MACEC,IAAI,EAAE,KADR;MAEEC,YAAY,EAAE,UAFhB;MAGEC,WAAW,EAAE,OAHf;MAIEC,MAAM,EAAE,iBAJV;MAKEI,WAAW,EAAE,OALf;MAMEH,WAAW,EAAE;IANf,CADqC,EASrC;MACEJ,IAAI,EAAE,KADR;MAEEC,YAAY,EAAE,OAFhB;MAGEC,WAAW,EAAE,OAHf;MAIEC,MAAM,EAAE,iBAJV;MAKEI,WAAW,EAAE,OALf;MAMEH,WAAW,EAAE;IANf,CATqC,CAAvB,CAAhB,CAD2H,CAmB3H;;IACAC,MAAM,CAACP,OAAD,CAAN,CAAgBQ,eAAhB;EACD,CArBC,CAAF;EAsBAT,EAAE,CAAC,kIAAD,EAAqI,MAAM;IAC3I,MAAMC,OAAO,GAAG,IAAAC,0CAAA,EAAuB,CACrC;MACEC,IAAI,EAAE,KADR;MAEEC,YAAY,EAAE,QAFhB;MAGEC,WAAW,EAAE,OAHf;MAIEC,MAAM,EAAE,iBAJV;MAKEI,WAAW,EAAE,OALf;MAMEH,WAAW,EAAE;IANf,CADqC,EASrC;MACEJ,IAAI,EAAE,KADR;MAEEC,YAAY,EAAE,QAFhB;MAGEC,WAAW,EAAE,OAHf;MAIEC,MAAM,EAAE,iBAJV;MAKEI,WAAW,EAAE,OALf;MAMEH,WAAW,EAAE;IANf,CATqC,CAAvB,CAAhB,CAD2I,CAmB3I;;IACAC,MAAM,CAACP,OAAD,CAAN,CAAgBQ,eAAhB;EACD,CArBC,CAAF;AAsBD,CA3HO,CAAR"}
|
package/dist/uninstall.cmd.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
-
import { Workspace } from './workspace';
|
|
3
|
-
export default class UninstallCmd implements Command {
|
|
4
|
-
/**
|
|
5
|
-
* workspace extension.
|
|
6
|
-
*/
|
|
7
|
-
private workspace;
|
|
8
|
-
name: string;
|
|
9
|
-
description: string;
|
|
10
|
-
alias: string;
|
|
11
|
-
group: string;
|
|
12
|
-
options: CommandOptions;
|
|
13
|
-
constructor(
|
|
14
|
-
/**
|
|
15
|
-
* workspace extension.
|
|
16
|
-
*/
|
|
17
|
-
workspace: Workspace);
|
|
18
|
-
report([packages]: [string[]]): Promise<string>;
|
|
19
|
-
}
|
package/dist/uninstall.cmd.js
DELETED
|
@@ -1,47 +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.default = 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
|
-
class UninstallCmd {
|
|
25
|
-
constructor(
|
|
26
|
-
/**
|
|
27
|
-
* workspace extension.
|
|
28
|
-
*/
|
|
29
|
-
workspace) {
|
|
30
|
-
this.workspace = workspace;
|
|
31
|
-
(0, _defineProperty2().default)(this, "name", 'uninstall [packages...]');
|
|
32
|
-
(0, _defineProperty2().default)(this, "description", 'uninstall dependencies');
|
|
33
|
-
(0, _defineProperty2().default)(this, "alias", 'un');
|
|
34
|
-
(0, _defineProperty2().default)(this, "group", 'development');
|
|
35
|
-
(0, _defineProperty2().default)(this, "options", []);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async report([packages = []]) {
|
|
39
|
-
await this.workspace.uninstallDependencies(packages);
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
exports.default = UninstallCmd;
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=uninstall.cmd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["UninstallCmd","constructor","workspace","report","packages","uninstallDependencies"],"sources":["uninstall.cmd.tsx"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\n\nimport { Workspace } from './workspace';\n\nexport default class UninstallCmd implements Command {\n name = 'uninstall [packages...]';\n description = 'uninstall dependencies';\n alias = 'un';\n group = 'development';\n options = [] as CommandOptions;\n\n constructor(\n /**\n * workspace extension.\n */\n private workspace: Workspace\n ) {}\n\n async report([packages = []]: [string[]]) {\n await this.workspace.uninstallDependencies(packages);\n return '';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAIe,MAAMA,YAAN,CAAsC;EAOnDC,WAAW;EACT;AACJ;AACA;EACYC,SAJC,EAKT;IAAA,KADQA,SACR,GADQA,SACR;IAAA,8CAXK,yBAWL;IAAA,qDAVY,wBAUZ;IAAA,+CATM,IASN;IAAA,+CARM,aAQN;IAAA,iDAPQ,EAOR;EAAE;;EAEQ,MAANC,MAAM,CAAC,CAACC,QAAQ,GAAG,EAAZ,CAAD,EAA8B;IACxC,MAAM,KAAKF,SAAL,CAAeG,qBAAf,CAAqCD,QAArC,CAAN;IACA,OAAO,EAAP;EACD;;AAjBkD"}
|
package/dist/update.cmd.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
-
import { Workspace } from './workspace';
|
|
3
|
-
declare type UpdateCmdOptions = {
|
|
4
|
-
yes?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export default class UpdateCmd implements Command {
|
|
7
|
-
/**
|
|
8
|
-
* workspace extension.
|
|
9
|
-
*/
|
|
10
|
-
private workspace;
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
alias: string;
|
|
14
|
-
group: string;
|
|
15
|
-
options: CommandOptions;
|
|
16
|
-
constructor(
|
|
17
|
-
/**
|
|
18
|
-
* workspace extension.
|
|
19
|
-
*/
|
|
20
|
-
workspace: Workspace);
|
|
21
|
-
report(args: [string[]], options: UpdateCmdOptions): Promise<string>;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
package/dist/update.cmd.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.promise.js");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.default = void 0;
|
|
11
|
-
|
|
12
|
-
function _defineProperty2() {
|
|
13
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
|
|
15
|
-
_defineProperty2 = function () {
|
|
16
|
-
return data;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
class UpdateCmd {
|
|
23
|
-
constructor(
|
|
24
|
-
/**
|
|
25
|
-
* workspace extension.
|
|
26
|
-
*/
|
|
27
|
-
workspace) {
|
|
28
|
-
this.workspace = workspace;
|
|
29
|
-
(0, _defineProperty2().default)(this, "name", 'update');
|
|
30
|
-
(0, _defineProperty2().default)(this, "description", 'update dependencies');
|
|
31
|
-
(0, _defineProperty2().default)(this, "alias", 'up');
|
|
32
|
-
(0, _defineProperty2().default)(this, "group", 'development');
|
|
33
|
-
(0, _defineProperty2().default)(this, "options", [['y', 'yes', 'automatically update all outdated packages']]);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async report(args, options) {
|
|
37
|
-
await this.workspace.updateDependencies({
|
|
38
|
-
all: options.yes === true
|
|
39
|
-
});
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
exports.default = UpdateCmd;
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=update.cmd.js.map
|
package/dist/update.cmd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["UpdateCmd","constructor","workspace","report","args","options","updateDependencies","all","yes"],"sources":["update.cmd.tsx"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\n\nimport { Workspace } from './workspace';\n\ntype UpdateCmdOptions = {\n yes?: boolean;\n};\n\nexport default class UpdateCmd implements Command {\n name = 'update';\n description = 'update dependencies';\n alias = 'up';\n group = 'development';\n options = [['y', 'yes', 'automatically update all outdated packages']] as CommandOptions;\n\n constructor(\n /**\n * workspace extension.\n */\n private workspace: Workspace\n ) {}\n\n async report(args: [string[]], options: UpdateCmdOptions) {\n await this.workspace.updateDependencies({\n all: options.yes === true,\n });\n return '';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQe,MAAMA,SAAN,CAAmC;EAOhDC,WAAW;EACT;AACJ;AACA;EACYC,SAJC,EAKT;IAAA,KADQA,SACR,GADQA,SACR;IAAA,8CAXK,QAWL;IAAA,qDAVY,qBAUZ;IAAA,+CATM,IASN;IAAA,+CARM,aAQN;IAAA,iDAPQ,CAAC,CAAC,GAAD,EAAM,KAAN,EAAa,4CAAb,CAAD,CAOR;EAAE;;EAEQ,MAANC,MAAM,CAACC,IAAD,EAAmBC,OAAnB,EAA8C;IACxD,MAAM,KAAKH,SAAL,CAAeI,kBAAf,CAAkC;MACtCC,GAAG,EAAEF,OAAO,CAACG,GAAR,KAAgB;IADiB,CAAlC,CAAN;IAGA,OAAO,EAAP;EACD;;AAnB+C"}
|
package/exceptions/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DependencyTypeNotSupportedInPolicy } from './dependency-type-not-supported-in-policy';
|
package/install.cmd.tsx
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
-
import { WorkspaceDependencyLifecycleType } from '@teambit/dependency-resolver';
|
|
3
|
-
import { Logger } from '@teambit/logger';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
|
|
6
|
-
import { Workspace, WorkspaceInstallOptions } from './workspace';
|
|
7
|
-
|
|
8
|
-
type InstallCmdOptions = {
|
|
9
|
-
variants: string;
|
|
10
|
-
type: WorkspaceDependencyLifecycleType;
|
|
11
|
-
skipDedupe: boolean;
|
|
12
|
-
skipImport: boolean;
|
|
13
|
-
updateExisting: boolean;
|
|
14
|
-
savePrefix: string;
|
|
15
|
-
addMissingPeers: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default class InstallCmd implements Command {
|
|
19
|
-
name = 'install [packages...]';
|
|
20
|
-
description = 'installs workspace dependencies';
|
|
21
|
-
extendedDescription =
|
|
22
|
-
'when no package is specified, all workspace dependencies are installed and all workspace components are imported.';
|
|
23
|
-
arguments = [{ name: 'packages...', description: 'a list of packages to install (separated by spaces)' }];
|
|
24
|
-
alias = 'in';
|
|
25
|
-
group = 'development';
|
|
26
|
-
options = [
|
|
27
|
-
['v', 'variants <variants>', 'add packages to specific variants'],
|
|
28
|
-
['t', 'type [lifecycleType]', '"runtime" (default) or "peer" (dev is not a valid option)'],
|
|
29
|
-
['u', 'update-existing [updateExisting]', 'update existing dependencies version and types'],
|
|
30
|
-
['', 'save-prefix [savePrefix]', 'set the prefix to use when adding dependency to workspace.jsonc'],
|
|
31
|
-
['', 'skip-dedupe [skipDedupe]', 'do not dedupe dependencies on installation'],
|
|
32
|
-
['', 'skip-import [skipImport]', 'do not import bit objects post installation'],
|
|
33
|
-
['', 'add-missing-peers [addMissingPeers]', 'install all missing peer dependencies'],
|
|
34
|
-
] as CommandOptions;
|
|
35
|
-
|
|
36
|
-
constructor(
|
|
37
|
-
/**
|
|
38
|
-
* workspace extension.
|
|
39
|
-
*/
|
|
40
|
-
private workspace: Workspace,
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* logger extension.
|
|
44
|
-
*/
|
|
45
|
-
private logger: Logger
|
|
46
|
-
) {}
|
|
47
|
-
|
|
48
|
-
async report([packages = []]: [string[]], options: InstallCmdOptions) {
|
|
49
|
-
const startTime = Date.now();
|
|
50
|
-
this.logger.console(`Resolving component dependencies for workspace: '${chalk.cyan(this.workspace.name)}'`);
|
|
51
|
-
const installOpts: WorkspaceInstallOptions = {
|
|
52
|
-
variants: options.variants,
|
|
53
|
-
lifecycleType: options.addMissingPeers ? 'peer' : options.type,
|
|
54
|
-
dedupe: !options.skipDedupe,
|
|
55
|
-
import: !options.skipImport,
|
|
56
|
-
updateExisting: options.updateExisting,
|
|
57
|
-
savePrefix: options.savePrefix,
|
|
58
|
-
addMissingPeers: options.addMissingPeers,
|
|
59
|
-
};
|
|
60
|
-
const components = await this.workspace.install(packages, installOpts);
|
|
61
|
-
const endTime = Date.now();
|
|
62
|
-
const executionTime = calculateTime(startTime, endTime);
|
|
63
|
-
return `Successfully resolved dependencies for ${chalk.cyan(
|
|
64
|
-
components.toArray().length.toString()
|
|
65
|
-
)} component(s) in ${chalk.cyan(executionTime.toString())} seconds`;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function calculateTime(startTime: number, endTime: number) {
|
|
70
|
-
const diff = endTime - startTime;
|
|
71
|
-
return diff / 1000;
|
|
72
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { LinksResult as LegacyLinksResult } from '@teambit/legacy/dist/links/node-modules-linker';
|
|
3
|
-
import { getPackageNameFromTarget } from './get-package-name-from-target';
|
|
4
|
-
import { LinkRow, VerboseLinkRow } from './link-row';
|
|
5
|
-
|
|
6
|
-
type ComponentListLinksProps = {
|
|
7
|
-
componentListLinks?: LegacyLinksResult[];
|
|
8
|
-
verbose: boolean;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export function ComponentListLinks({ componentListLinks, verbose = false }: ComponentListLinksProps) {
|
|
12
|
-
if (!componentListLinks || !componentListLinks.length) {
|
|
13
|
-
return chalk.cyan('No components link were generated');
|
|
14
|
-
}
|
|
15
|
-
const title = chalk.bold.cyan('Components links');
|
|
16
|
-
const links = componentListLinks.map((componentLinks) => ComponentLinks({ componentLinks, verbose })).join('\n');
|
|
17
|
-
|
|
18
|
-
return `${title}\n${links}`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type ComponentLinksProps = {
|
|
22
|
-
componentLinks: LegacyLinksResult;
|
|
23
|
-
verbose: boolean;
|
|
24
|
-
};
|
|
25
|
-
function ComponentLinks({ componentLinks, verbose = false }: ComponentLinksProps) {
|
|
26
|
-
if (!componentLinks.bound || componentLinks.bound.length < 1) return '';
|
|
27
|
-
if (verbose) return VerboseComponentLinks({ componentLinks });
|
|
28
|
-
return RegularComponentLinks({ componentLinks });
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type RegularComponentLinksProps = {
|
|
32
|
-
componentLinks: LegacyLinksResult;
|
|
33
|
-
};
|
|
34
|
-
function RegularComponentLinks({ componentLinks }: RegularComponentLinksProps) {
|
|
35
|
-
const id = componentLinks.id.toString();
|
|
36
|
-
if (!componentLinks.bound || componentLinks.bound.length < 1) return '';
|
|
37
|
-
const packagePath = getPackageNameFromTarget(componentLinks.bound[0].to);
|
|
38
|
-
return LinkRow({ title: id, target: packagePath, padding: 50 });
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
type VerboseComponentLinksProps = {
|
|
42
|
-
componentLinks: LegacyLinksResult;
|
|
43
|
-
};
|
|
44
|
-
function VerboseComponentLinks({ componentLinks }: VerboseComponentLinksProps) {
|
|
45
|
-
const id = componentLinks.id.toString();
|
|
46
|
-
if (!componentLinks.bound || componentLinks.bound.length < 1) return '';
|
|
47
|
-
const title = chalk.bold.cyan(id);
|
|
48
|
-
const links = componentLinks.bound.map((link) => VerboseLinkRow({ from: link.from, to: link.to })).join('\n');
|
|
49
|
-
return `${title}\n${links}\n`;
|
|
50
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { CoreAspectLinkResult } from '@teambit/dependency-resolver';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
|
|
4
|
-
import { getPackageNameFromTarget } from './get-package-name-from-target';
|
|
5
|
-
import { LinkRow, VerboseLinkRow } from './link-row';
|
|
6
|
-
|
|
7
|
-
type CoreAspectsLinksProps = {
|
|
8
|
-
coreAspectsLinks?: CoreAspectLinkResult[];
|
|
9
|
-
verbose: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export function CoreAspectsLinks({ coreAspectsLinks, verbose = false }: CoreAspectsLinksProps) {
|
|
13
|
-
if (!coreAspectsLinks || !coreAspectsLinks.length) {
|
|
14
|
-
return chalk.cyan('No core aspects were linked');
|
|
15
|
-
}
|
|
16
|
-
const title = chalk.cyan('Core aspects links');
|
|
17
|
-
const links = coreAspectsLinks.map((link) => CoreAspectLinkRow({ coreAspectLink: link, verbose })).join('\n');
|
|
18
|
-
return `${title}\n${links}`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type CoreAspectLinkProps = {
|
|
22
|
-
coreAspectLink: CoreAspectLinkResult;
|
|
23
|
-
verbose: boolean;
|
|
24
|
-
};
|
|
25
|
-
function CoreAspectLinkRow({ coreAspectLink, verbose = false }: CoreAspectLinkProps) {
|
|
26
|
-
if (verbose) return VerboseCoreAspectLink({ coreAspectLink });
|
|
27
|
-
return RegularCoreAspectLink({ coreAspectLink });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type RegularCoreAspectLinkProps = {
|
|
31
|
-
coreAspectLink: CoreAspectLinkResult;
|
|
32
|
-
};
|
|
33
|
-
function RegularCoreAspectLink({ coreAspectLink }: RegularCoreAspectLinkProps) {
|
|
34
|
-
const id = coreAspectLink.aspectId.toString();
|
|
35
|
-
const packagePath = getPackageNameFromTarget(coreAspectLink.linkDetail.to);
|
|
36
|
-
return LinkRow({ title: id, target: packagePath, padding: 50 });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
type VerboseCoreAspectLinkProps = {
|
|
40
|
-
coreAspectLink: CoreAspectLinkResult;
|
|
41
|
-
};
|
|
42
|
-
function VerboseCoreAspectLink({ coreAspectLink }: VerboseCoreAspectLinkProps) {
|
|
43
|
-
const id = coreAspectLink.aspectId.toString();
|
|
44
|
-
const title = chalk.bold.cyan(id);
|
|
45
|
-
const link = VerboseLinkRow({
|
|
46
|
-
from: coreAspectLink.linkDetail.from,
|
|
47
|
-
to: coreAspectLink.linkDetail.to,
|
|
48
|
-
});
|
|
49
|
-
return `${title}\n${link}`;
|
|
50
|
-
}
|
package/link/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { LinkCommand } from './link.cmd';
|
package/link/link-row.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
type LinkRowProps = {
|
|
4
|
-
title: string;
|
|
5
|
-
target: string;
|
|
6
|
-
padding?: number;
|
|
7
|
-
};
|
|
8
|
-
export function LinkRow({ title, target, padding = 50 }: LinkRowProps) {
|
|
9
|
-
return chalk.bold(`${title.padEnd(padding)} ${'>'} ${target}`);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type VerboseLinkRowProps = {
|
|
13
|
-
from: string;
|
|
14
|
-
to: string;
|
|
15
|
-
};
|
|
16
|
-
export function VerboseLinkRow({ from, to }: VerboseLinkRowProps) {
|
|
17
|
-
return `${chalk.bold('from')}: ${from}
|
|
18
|
-
${chalk.bold('to')}: ${to}
|
|
19
|
-
`;
|
|
20
|
-
}
|
package/link/link-to-dir.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { LinkToDirResult } from '@teambit/dependency-resolver';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { LinkRow } from './link-row';
|
|
4
|
-
|
|
5
|
-
export function linkToDir(links?: LinkToDirResult[]) {
|
|
6
|
-
if (!links || !links.length) return '';
|
|
7
|
-
const title = chalk.bold.cyan('Target Links');
|
|
8
|
-
const linksOutput = links
|
|
9
|
-
.map(({ componentId, linksDetail }) => LinkRow({ title: componentId, target: linksDetail.to }))
|
|
10
|
-
.join('\n');
|
|
11
|
-
|
|
12
|
-
return `${title}\n${linksOutput}\n`;
|
|
13
|
-
}
|
package/link/link.cmd.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
-
import { LinkResults } from '@teambit/dependency-resolver';
|
|
3
|
-
import { Logger } from '@teambit/logger';
|
|
4
|
-
import { timeFormat } from '@teambit/toolbox.time.time-format';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
import { Workspace, WorkspaceLinkOptions } from '../workspace';
|
|
7
|
-
import { ComponentListLinks } from './component-list-links';
|
|
8
|
-
import { CoreAspectsLinks } from './core-aspects-links';
|
|
9
|
-
import { NestedComponentLinksLinks } from './nested-deps-in-nm-links';
|
|
10
|
-
import { RewireRow } from './rewire-row';
|
|
11
|
-
import { linkToDir } from './link-to-dir';
|
|
12
|
-
|
|
13
|
-
type LinkCommandOpts = {
|
|
14
|
-
rewire: boolean;
|
|
15
|
-
verbose: boolean;
|
|
16
|
-
target: string;
|
|
17
|
-
skipFetchingObjects?: boolean;
|
|
18
|
-
};
|
|
19
|
-
export class LinkCommand implements Command {
|
|
20
|
-
name = 'link [component-names...]';
|
|
21
|
-
alias = '';
|
|
22
|
-
description = 'create links in the node_modules directory, to core aspects and to components in the workspace';
|
|
23
|
-
extendedDescription: string;
|
|
24
|
-
group = 'development';
|
|
25
|
-
private = false;
|
|
26
|
-
arguments = [{ name: 'component-names...', description: 'names or IDs of the components to link' }];
|
|
27
|
-
options = [
|
|
28
|
-
['j', 'json', 'return the output as JSON'],
|
|
29
|
-
['', 'verbose', 'verbose output'],
|
|
30
|
-
['r', 'rewire', 'Replace relative paths with module paths in code (e.g. "../foo" => "@bit/foo")'],
|
|
31
|
-
[
|
|
32
|
-
'',
|
|
33
|
-
'target <dir>',
|
|
34
|
-
'EXPERIMENTAL. link to an external directory (similar to npm-link) so other projects could use these components',
|
|
35
|
-
],
|
|
36
|
-
['', 'skip-fetching-objects', 'skip fetch missing objects from remotes before linking'],
|
|
37
|
-
] as CommandOptions;
|
|
38
|
-
|
|
39
|
-
constructor(
|
|
40
|
-
/**
|
|
41
|
-
* workspace extension.
|
|
42
|
-
*/
|
|
43
|
-
private workspace: Workspace,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* logger extension.
|
|
47
|
-
*/
|
|
48
|
-
private logger: Logger,
|
|
49
|
-
|
|
50
|
-
private docsDomain: string
|
|
51
|
-
) {
|
|
52
|
-
this.extendedDescription = `https://${this.docsDomain}/workspace/component-links`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async report([ids]: [string[]], opts: LinkCommandOpts) {
|
|
56
|
-
const startTime = Date.now();
|
|
57
|
-
const linkResults = await this.json([ids], opts);
|
|
58
|
-
const endTime = Date.now();
|
|
59
|
-
const numOfComponents = linkResults.legacyLinkResults?.length;
|
|
60
|
-
const timeDiff = timeFormat(endTime - startTime);
|
|
61
|
-
const coreAspectsLinksWithMainAspect = linkResults.coreAspectsLinks || [];
|
|
62
|
-
if (linkResults.teambitBitLink) {
|
|
63
|
-
coreAspectsLinksWithMainAspect.unshift(linkResults.teambitBitLink);
|
|
64
|
-
}
|
|
65
|
-
const numOfCoreAspects = coreAspectsLinksWithMainAspect.length;
|
|
66
|
-
|
|
67
|
-
const title = `Linked ${numOfComponents} components and ${numOfCoreAspects} core aspects to node_modules for workspace: ${this.workspace.name}`;
|
|
68
|
-
const coreLinks = CoreAspectsLinks({
|
|
69
|
-
coreAspectsLinks: coreAspectsLinksWithMainAspect,
|
|
70
|
-
verbose: opts.verbose,
|
|
71
|
-
});
|
|
72
|
-
const compsLinks = ComponentListLinks({ componentListLinks: linkResults.legacyLinkResults, verbose: opts.verbose });
|
|
73
|
-
const rewireRow = RewireRow({ legacyCodemodResults: linkResults.legacyLinkCodemodResults });
|
|
74
|
-
const nestedLinks = NestedComponentLinksLinks({
|
|
75
|
-
nestedDepsInNmLinks: linkResults.nestedDepsInNmLinks,
|
|
76
|
-
verbose: opts.verbose,
|
|
77
|
-
});
|
|
78
|
-
const targetLinks = linkToDir(linkResults.linkToDirResults);
|
|
79
|
-
const footer = `Finished. ${timeDiff}`;
|
|
80
|
-
return `${title}\n${coreLinks}\n${compsLinks}\n${rewireRow}${nestedLinks}${targetLinks}${footer}`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
84
|
-
async json([ids]: [string[]], opts: LinkCommandOpts): Promise<LinkResults> {
|
|
85
|
-
this.logger.console(
|
|
86
|
-
`Linking components and core aspects to node_modules for workspaces: '${chalk.cyan(this.workspace.name)}'`
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const linkOpts: WorkspaceLinkOptions = {
|
|
90
|
-
legacyLink: true,
|
|
91
|
-
rewire: opts.rewire,
|
|
92
|
-
linkCoreAspects: true,
|
|
93
|
-
linkTeambitBit: true,
|
|
94
|
-
linkToDir: opts.target,
|
|
95
|
-
fetchObject: !opts.skipFetchingObjects,
|
|
96
|
-
};
|
|
97
|
-
const linkResults = await this.workspace.link(linkOpts);
|
|
98
|
-
return linkResults;
|
|
99
|
-
}
|
|
100
|
-
}
|