@teambit/workspace 0.0.554 → 0.0.558

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.
Files changed (89) hide show
  1. package/dist/build-graph-from-fs.d.ts +30 -0
  2. package/dist/build-graph-from-fs.js +4 -1
  3. package/dist/build-graph-from-fs.js.map +1 -1
  4. package/dist/install.cmd.d.ts +17 -3
  5. package/dist/install.cmd.js.map +1 -1
  6. package/dist/link/link.cmd.d.ts +15 -1
  7. package/dist/types.d.ts +21 -0
  8. package/dist/ui/workspace/workspace-model.d.ts +32 -1
  9. package/dist/ui/workspace/workspace-provider.d.ts +9 -0
  10. package/dist/ui/workspace/workspace.d.ts +3 -0
  11. package/dist/watch/output-formatter.d.ts +6 -0
  12. package/dist/watch/watch.cmd.d.ts +22 -1
  13. package/dist/watch/watcher.d.ts +9 -0
  14. package/dist/workspace-component/component-status.d.ts +57 -1
  15. package/dist/workspace-component/workspace-component-loader.d.ts +7 -0
  16. package/dist/workspace-component/workspace-component.d.ts +36 -1
  17. package/dist/workspace.d.ts +236 -3
  18. package/dist/workspace.js +6 -0
  19. package/dist/workspace.js.map +1 -1
  20. package/dist/workspace.ui-root.d.ts +18 -1
  21. package/dist/workspace.ui.runtime.d.ts +32 -1
  22. package/package.json +61 -53
  23. package/tsconfig.json +1 -2
  24. package/build-graph-from-fs.ts +0 -160
  25. package/capsule.cmd.ts +0 -136
  26. package/component-config-file/component-config-file.ts +0 -98
  27. package/component-config-file/exceptions/already-exists.ts +0 -7
  28. package/component-config-file/exceptions/index.ts +0 -1
  29. package/component-config-file/index.ts +0 -2
  30. package/component-tree.widget.tsx +0 -16
  31. package/constants.ts +0 -1
  32. package/eject-conf.cmd.tsx +0 -62
  33. package/events/index.ts +0 -3
  34. package/events/on-component-add-event.ts +0 -14
  35. package/events/on-component-change-event.ts +0 -14
  36. package/events/on-component-removed-event.ts +0 -14
  37. package/exceptions/dependency-type-not-supported-in-policy.ts +0 -7
  38. package/exceptions/incorrect-env-aspect.ts +0 -8
  39. package/exceptions/index.ts +0 -1
  40. package/index.ts +0 -19
  41. package/install.cmd.tsx +0 -67
  42. package/link/component-list-links.ts +0 -50
  43. package/link/core-aspects-links.ts +0 -50
  44. package/link/get-package-name-from-target.ts +0 -5
  45. package/link/index.ts +0 -1
  46. package/link/link-row.ts +0 -20
  47. package/link/link-to-dir.ts +0 -13
  48. package/link/link.cmd.ts +0 -96
  49. package/link/nested-deps-in-nm-links.ts +0 -47
  50. package/link/rewire-row.ts +0 -17
  51. package/list.cmd.tsx +0 -30
  52. package/on-component-events.ts +0 -14
  53. package/package-tar/teambit-workspace-0.0.554.tgz +0 -0
  54. package/tag-cmd.ts +0 -247
  55. package/types/asset.d.ts +0 -29
  56. package/types/style.d.ts +0 -42
  57. package/types.ts +0 -40
  58. package/ui/index.ts +0 -1
  59. package/ui/workspace/default-component.ts +0 -7
  60. package/ui/workspace/index.ts +0 -1
  61. package/ui/workspace/use-workspace.ts +0 -193
  62. package/ui/workspace/workspace-context.tsx +0 -5
  63. package/ui/workspace/workspace-model.ts +0 -66
  64. package/ui/workspace/workspace-overview/index.ts +0 -1
  65. package/ui/workspace/workspace-overview/workspace-overview.module.scss +0 -6
  66. package/ui/workspace/workspace-overview/workspace-overview.tsx +0 -21
  67. package/ui/workspace/workspace-provider.tsx +0 -23
  68. package/ui/workspace/workspace.module.scss +0 -40
  69. package/ui/workspace/workspace.tsx +0 -99
  70. package/ui/workspace-components-drawer/index.ts +0 -1
  71. package/ui/workspace-components-drawer/workspace-components-drawer.module.scss +0 -4
  72. package/ui/workspace-components-drawer/workspace-components.drawer.tsx +0 -49
  73. package/watch/REFACTOR_GUIDE.md +0 -14
  74. package/watch/check-types.ts +0 -5
  75. package/watch/output-formatter.ts +0 -50
  76. package/watch/watch.cmd.tsx +0 -142
  77. package/watch/watcher.ts +0 -289
  78. package/workspace-component/component-status.ts +0 -67
  79. package/workspace-component/index.ts +0 -2
  80. package/workspace-component/workspace-component-loader.ts +0 -276
  81. package/workspace-component/workspace-component.ts +0 -51
  82. package/workspace-section.ts +0 -14
  83. package/workspace.aspect.ts +0 -9
  84. package/workspace.graphql.ts +0 -133
  85. package/workspace.main.runtime.ts +0 -50
  86. package/workspace.provider.ts +0 -218
  87. package/workspace.ts +0 -1534
  88. package/workspace.ui-root.ts +0 -64
  89. package/workspace.ui.runtime.tsx +0 -215
@@ -1,62 +0,0 @@
1
- import { Command, CommandOptions } from '@teambit/cli';
2
- import chalk from 'chalk';
3
- import { Text } from 'ink';
4
- import React from 'react';
5
-
6
- import { EjectConfOptions, EjectConfResult, Workspace } from './workspace';
7
-
8
- type EjectConfArgs = [string];
9
- // From the cli we might get those as string in case we run it like --propagate true (return string) as opposed to only --propagate
10
- type EjectConfOptionsCLI = {
11
- propagate: string | boolean | undefined;
12
- override: string | boolean | undefined;
13
- };
14
-
15
- export default class EjectConfCmd implements Command {
16
- name = 'eject-conf [id]';
17
- description = 'ejecting components configuration';
18
- alias = '';
19
- group = 'development';
20
- shortDescription = 'eject the target component configuration file (e.g. create a `component.json` file)';
21
- options = [
22
- ['p', 'propagate', 'mark propagate true in the config file'],
23
- ['o', 'override', 'override file if exist'],
24
- ] as CommandOptions;
25
-
26
- constructor(private workspace: Workspace) {}
27
-
28
- // TODO: remove this ts-ignore
29
- // @ts-ignore
30
- async render(args: EjectConfArgs, options: EjectConfOptionsCLI) {
31
- const ejectResult = await this.json(args, options);
32
- const [componentId] = args;
33
- return (
34
- <Text color="yellow">
35
- successfully ejected config for component {componentId} in path {ejectResult.configPath}
36
- </Text>
37
- );
38
- }
39
-
40
- async report(args: EjectConfArgs, options: EjectConfOptionsCLI): Promise<string> {
41
- const ejectResult = await this.json(args, options);
42
- const [componentId] = args;
43
- return `successfully ejected config for component ${chalk.bold(componentId)} in path ${chalk.green(
44
- ejectResult.configPath
45
- )}`;
46
- }
47
-
48
- async json([componentId]: EjectConfArgs, options: EjectConfOptionsCLI): Promise<EjectConfResult> {
49
- const ejectOptions = options;
50
- if (ejectOptions.propagate === 'true') {
51
- ejectOptions.propagate = true;
52
- }
53
- if (ejectOptions.override === 'true') {
54
- ejectOptions.override = true;
55
- }
56
-
57
- const id = await this.workspace.resolveComponentId(componentId);
58
-
59
- const results = await this.workspace.ejectConfig(id, ejectOptions as EjectConfOptions);
60
- return results;
61
- }
62
- }
package/events/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './on-component-change-event';
2
- export * from './on-component-add-event';
3
- export * from './on-component-removed-event';
@@ -1,14 +0,0 @@
1
- /* eslint-disable max-classes-per-file */
2
- import { BitBaseEvent } from '@teambit/pubsub';
3
-
4
- class OnComponentAddEventData {
5
- constructor(readonly idStr, readonly hook) {}
6
- }
7
-
8
- export class OnComponentAddEvent extends BitBaseEvent<OnComponentAddEventData> {
9
- static readonly TYPE = 'on-component-add';
10
-
11
- constructor(readonly timestamp, readonly idStr, readonly hook) {
12
- super(OnComponentAddEvent.TYPE, '0.0.1', timestamp, new OnComponentAddEventData(idStr, hook));
13
- }
14
- }
@@ -1,14 +0,0 @@
1
- /* eslint-disable max-classes-per-file */
2
- import { BitBaseEvent } from '@teambit/pubsub';
3
-
4
- class OnComponentChangeEventData {
5
- constructor(readonly idStr, readonly hook) {}
6
- }
7
-
8
- export class OnComponentChangeEvent extends BitBaseEvent<OnComponentChangeEventData> {
9
- static readonly TYPE = 'on-component-change';
10
-
11
- constructor(readonly timestamp, readonly idStr, readonly hook) {
12
- super(OnComponentChangeEvent.TYPE, '0.0.1', timestamp, new OnComponentChangeEventData(idStr, hook));
13
- }
14
- }
@@ -1,14 +0,0 @@
1
- /* eslint-disable max-classes-per-file */
2
- import { BitBaseEvent } from '@teambit/pubsub';
3
-
4
- class OnComponentRemovedEventData {
5
- constructor(readonly idStr) {}
6
- }
7
-
8
- export class OnComponentRemovedEvent extends BitBaseEvent<OnComponentRemovedEventData> {
9
- static readonly TYPE = 'on-component-removed';
10
-
11
- constructor(readonly timestamp, readonly idStr) {
12
- super(OnComponentRemovedEvent.TYPE, '0.0.1', timestamp, new OnComponentRemovedEventData(idStr));
13
- }
14
- }
@@ -1,7 +0,0 @@
1
- import { BitError } from '@teambit/bit-error';
2
-
3
- export class DependencyTypeNotSupportedInPolicy extends BitError {
4
- constructor(type: string) {
5
- super(`the workspace policy does not support ${type} dependencies`);
6
- }
7
- }
@@ -1,8 +0,0 @@
1
- import { BitError } from '@teambit/bit-error';
2
-
3
- export class IncorrectEnvAspect extends BitError {
4
- constructor(id: string, envType: string, envId: string) {
5
- super(`"${id}" is configured in workspace.json, but using the "${envId}" environment, which is type "${envType}".
6
- please make sure to either apply the aspect environment or a composition of the aspect environment for the aspect to load.`);
7
- }
8
- }
@@ -1 +0,0 @@
1
- export { DependencyTypeNotSupportedInPolicy } from './dependency-type-not-supported-in-policy';
package/index.ts DELETED
@@ -1,19 +0,0 @@
1
- import { WorkspaceAspect } from './workspace.aspect';
2
- // eslint-disable-next-line import/prefer-default-export
3
- export type { default as Workspace } from './workspace';
4
- // TODO: change to module path once track the utils folder
5
- export type { ResolvedComponent } from '@teambit/harmony.modules.resolved-component';
6
- export type { AlreadyExistsError as ComponentConfigFileAlreadyExistsError } from './component-config-file';
7
- export type { WorkspaceMain } from './workspace.main.runtime';
8
- export type { WatchOptions } from './watch/watcher';
9
- export { CheckTypes } from './watch/check-types';
10
- export * from './events';
11
- export type { WorkspaceUI } from './workspace.ui.runtime';
12
- export type { SerializableResults, OnComponentEventResult } from './on-component-events';
13
- export { ComponentStatus } from './workspace-component';
14
- export { WorkspaceModelComponent } from './ui/workspace/workspace-model';
15
- export { WorkspaceContext } from './ui/workspace/workspace-context';
16
- export type { WorkspaceComponent } from './workspace-component';
17
-
18
- export { WorkspaceAspect };
19
- export default WorkspaceAspect;
package/install.cmd.tsx DELETED
@@ -1,67 +0,0 @@
1
- import { Command, CommandOptions } from '@teambit/cli';
2
- import { DependencyLifecycleType } 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: DependencyLifecycleType;
11
- skipDedupe: boolean;
12
- skipImport: boolean;
13
- updateExisting: boolean;
14
- savePrefix: string;
15
- };
16
-
17
- export default class InstallCmd implements Command {
18
- name = 'install [packages...]';
19
- description = 'install development workspace dependencies';
20
- alias = 'in';
21
- group = 'development';
22
- shortDescription = '';
23
- options = [
24
- ['v', 'variants <variants>', 'add packages to specific variants'],
25
- ['t', 'type [lifecycleType]', 'runtime (default), dev or peer dependency'],
26
- ['u', 'update-existing [updateExisting]', 'update existing dependencies version and types'],
27
- ['', 'save-prefix [savePrefix]', 'set the prefix to use when adding dependency to workspace.jsonc'],
28
- ['', 'skip-dedupe [skipDedupe]', 'do not dedupe dependencies on installation'],
29
- ['', 'skip-import [skipImport]', 'do not import bit objects post installation'],
30
- ] as CommandOptions;
31
-
32
- constructor(
33
- /**
34
- * workspace extension.
35
- */
36
- private workspace: Workspace,
37
-
38
- /**
39
- * logger extension.
40
- */
41
- private logger: Logger
42
- ) {}
43
-
44
- async report([packages = []]: [string[]], options: InstallCmdOptions) {
45
- const startTime = Date.now();
46
- this.logger.console(`Resolving component dependencies for workspace: '${chalk.cyan(this.workspace.name)}'`);
47
- const installOpts: WorkspaceInstallOptions = {
48
- variants: options.variants,
49
- lifecycleType: options.type,
50
- dedupe: !options.skipDedupe,
51
- import: !options.skipImport,
52
- updateExisting: options.updateExisting,
53
- savePrefix: options.savePrefix,
54
- };
55
- const components = await this.workspace.install(packages, installOpts);
56
- const endTime = Date.now();
57
- const executionTime = calculateTime(startTime, endTime);
58
- return `Successfully resolved dependencies for ${chalk.cyan(
59
- components.toArray().length.toString()
60
- )} component(s) in ${chalk.cyan(executionTime.toString())} seconds`;
61
- }
62
- }
63
-
64
- function calculateTime(startTime: number, endTime: number) {
65
- const diff = endTime - startTime;
66
- return diff / 1000;
67
- }
@@ -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
- }
@@ -1,5 +0,0 @@
1
- export function getPackageNameFromTarget(targetPath: string): string {
2
- const subPath = targetPath.substring(targetPath.lastIndexOf('node_modules'));
3
- const packagePath = subPath.split('/').slice(0, 3).join('/');
4
- return `./${packagePath}`;
5
- }
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
- }
@@ -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,96 +0,0 @@
1
- import { Command, CommandOptions } from '@teambit/cli';
2
- import { LinkResults } from '@teambit/dependency-resolver';
3
- import { Logger } from '@teambit/logger';
4
- import { BASE_DOCS_DOMAIN } from '@teambit/legacy/dist/constants';
5
- import { timeFormat } from '@teambit/toolbox.time.time-format';
6
- import chalk from 'chalk';
7
- import { Workspace, WorkspaceLinkOptions } from '../workspace';
8
- import { ComponentListLinks } from './component-list-links';
9
- import { CoreAspectsLinks } from './core-aspects-links';
10
- import { NestedComponentLinksLinks } from './nested-deps-in-nm-links';
11
- import { RewireRow } from './rewire-row';
12
- import { linkToDir } from './link-to-dir';
13
-
14
- type LinkCommandOpts = {
15
- rewire: boolean;
16
- verbose: boolean;
17
- target: string;
18
- skipFetchingObjects?: boolean;
19
- };
20
- export class LinkCommand implements Command {
21
- name = 'link [ids...]';
22
- alias = '';
23
- description = `generate symlinks to resolve module paths for imported components.\n https://${BASE_DOCS_DOMAIN}/docs/dependencies#missing-links`;
24
- shortDescription = 'link components and core aspects';
25
- group = 'development';
26
- private = false;
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
-
51
- async report([ids]: [string[]], opts: LinkCommandOpts) {
52
- const startTime = Date.now();
53
- const linkResults = await this.json([ids], opts);
54
- const endTime = Date.now();
55
- const numOfComponents = linkResults.legacyLinkResults?.length;
56
- const timeDiff = timeFormat(endTime - startTime);
57
- const coreAspectsLinksWithMainAspect = linkResults.coreAspectsLinks || [];
58
- if (linkResults.teambitBitLink) {
59
- coreAspectsLinksWithMainAspect.unshift(linkResults.teambitBitLink);
60
- }
61
- const numOfCoreAspects = coreAspectsLinksWithMainAspect.length;
62
-
63
- const title = `Linked ${numOfComponents} components and ${numOfCoreAspects} core aspects to node_modules for workspace: ${this.workspace.name}`;
64
- const coreLinks = CoreAspectsLinks({
65
- coreAspectsLinks: coreAspectsLinksWithMainAspect,
66
- verbose: opts.verbose,
67
- });
68
- const compsLinks = ComponentListLinks({ componentListLinks: linkResults.legacyLinkResults, verbose: opts.verbose });
69
- const rewireRow = RewireRow({ legacyCodemodResults: linkResults.legacyLinkCodemodResults });
70
- const nestedLinks = NestedComponentLinksLinks({
71
- nestedDepsInNmLinks: linkResults.nestedDepsInNmLinks,
72
- verbose: opts.verbose,
73
- });
74
- const targetLinks = linkToDir(linkResults.linkToDirResults);
75
- const footer = `Finished. ${timeDiff}`;
76
- return `${title}\n${coreLinks}\n${compsLinks}\n${rewireRow}${nestedLinks}${targetLinks}${footer}`;
77
- }
78
-
79
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
80
- async json([ids]: [string[]], opts: LinkCommandOpts): Promise<LinkResults> {
81
- this.logger.console(
82
- `Linking components and core aspects to node_modules for workspaces: '${chalk.cyan(this.workspace.name)}'`
83
- );
84
-
85
- const linkOpts: WorkspaceLinkOptions = {
86
- legacyLink: true,
87
- rewire: opts.rewire,
88
- linkCoreAspects: true,
89
- linkTeambitBit: true,
90
- linkToDir: opts.target,
91
- fetchObject: !opts.skipFetchingObjects,
92
- };
93
- const linkResults = await this.workspace.link(linkOpts);
94
- return linkResults;
95
- }
96
- }
@@ -1,47 +0,0 @@
1
- import chalk from 'chalk';
2
- import { NestedNMDepsLinksResult } from '@teambit/dependency-resolver';
3
- import { VerboseLinkRow } from './link-row';
4
-
5
- type NestedComponentLinksLinksProps = {
6
- nestedDepsInNmLinks?: NestedNMDepsLinksResult[];
7
- verbose: boolean;
8
- };
9
-
10
- export function NestedComponentLinksLinks({ nestedDepsInNmLinks, verbose = false }: NestedComponentLinksLinksProps) {
11
- if (!verbose) return '';
12
- if (!nestedDepsInNmLinks || !nestedDepsInNmLinks.length) {
13
- return '';
14
- }
15
- const title = chalk.bold.cyan('Nested dependencies links');
16
- const links = nestedDepsInNmLinks
17
- .map((nestedComponentLinks) =>
18
- NestedComponentLinks({
19
- nestedComponentLinks,
20
- verbose,
21
- })
22
- )
23
- .join('\n');
24
- return `${title}\n${links}\n`;
25
- }
26
-
27
- type NestedComponentLinksProps = {
28
- nestedComponentLinks: NestedNMDepsLinksResult;
29
- verbose: boolean;
30
- };
31
- function NestedComponentLinks({ nestedComponentLinks, verbose = false }: NestedComponentLinksProps) {
32
- if (!nestedComponentLinks.linksDetail || nestedComponentLinks.linksDetail.length < 1) return '';
33
- if (verbose) return VerboseNestedComponentLinks({ nestedComponentLinks });
34
- return '';
35
- }
36
-
37
- type VerboseNestedComponentLinksProps = {
38
- nestedComponentLinks: NestedNMDepsLinksResult;
39
- };
40
- function VerboseNestedComponentLinks({ nestedComponentLinks }: VerboseNestedComponentLinksProps) {
41
- const id = nestedComponentLinks.componentId.toString();
42
- const title = chalk.cyan.bold(id);
43
- const links = nestedComponentLinks.linksDetail
44
- .map((link) => VerboseLinkRow({ from: link.from, to: link.to }))
45
- .join('\n');
46
- return `${title}\n${links}\n`;
47
- }
@@ -1,17 +0,0 @@
1
- import { CodemodResult } from '@teambit/legacy/dist/consumer/component-ops/codemod-components';
2
- import chalk from 'chalk';
3
-
4
- type RewireRowProps = {
5
- legacyCodemodResults?: CodemodResult[];
6
- };
7
- export function RewireRow({ legacyCodemodResults }: RewireRowProps) {
8
- if (!legacyCodemodResults || legacyCodemodResults.length < 1) return '';
9
- const totalComps = legacyCodemodResults?.length;
10
- const totalFiles = legacyCodemodResults.reduce((acc, curr) => {
11
- return acc + curr.changedFiles.length || 0;
12
- }, 0);
13
-
14
- return `rewired ${chalk.cyan(totalComps.toString())} components and total of ${chalk.cyan(
15
- totalFiles.toString()
16
- )} files\n`;
17
- }
package/list.cmd.tsx DELETED
@@ -1,30 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
- import { Command } from '@teambit/cli';
3
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
4
- import { Text } from 'ink';
5
- import React from 'react';
6
-
7
- import { Workspace } from './workspace';
8
-
9
- export class ListCmd implements Command {
10
- constructor(private workspace: Workspace) {}
11
-
12
- name = 'lister';
13
-
14
- description = 'list all components in the workspace';
15
-
16
- summery = 'a different text i dont really need';
17
-
18
- group = 'workspace';
19
-
20
- alias = '';
21
-
22
- options = [];
23
-
24
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
- async render(params: any, options: { [key: string]: any }) {
26
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
27
- const list = await this.workspace.list();
28
- return <Text color="green">hi there</Text>;
29
- }
30
- }
@@ -1,14 +0,0 @@
1
- import { Component, ComponentID, AspectData } from '@teambit/component';
2
- import { CompilationInitiator } from '@teambit/compiler';
3
-
4
- export type SerializableResults = { results: any; toString: () => string };
5
- export type OnComponentChange = (
6
- component: Component,
7
- files: string[],
8
- initiator?: CompilationInitiator
9
- ) => Promise<SerializableResults>;
10
- export type OnComponentAdd = (component: Component, files: string[]) => Promise<SerializableResults>;
11
- export type OnComponentRemove = (componentId: ComponentID) => Promise<SerializableResults>;
12
- export type OnComponentEventResult = { extensionId: string; results: SerializableResults };
13
-
14
- export type OnComponentLoad = (component: Component) => Promise<AspectData>;