@teambit/install 0.0.217 → 0.0.219

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.
@@ -5,23 +5,52 @@ Array [
5
5
  Object {
6
6
  "choices": Array [
7
7
  Object {
8
- "message": "foo (runtime) * ❯ 2.0.0 because of comp1 and 1 other components ",
8
+ "message": "foo (runtime) 1.1.0 ❯ 2.0.0 ",
9
9
  "name": "foo",
10
10
  "value": Object {
11
- "currentRange": "1.0.0",
12
- "dependentComponents": Array [
13
- "comp1",
14
- "comp2",
15
- ],
16
- "hasDifferentRanges": true,
11
+ "componentId": ComponentID {
12
+ "_scope": undefined,
13
+ "legacyComponentId": BitId {
14
+ "box": undefined,
15
+ "name": "comp2",
16
+ "scope": "scope",
17
+ "version": "latest",
18
+ },
19
+ },
20
+ "currentRange": "1.1.0",
17
21
  "latestRange": "2.0.0",
18
22
  "name": "foo",
19
- "source": "rootPolicy",
23
+ "source": "component-model",
20
24
  "targetField": "dependencies",
21
25
  },
22
26
  },
23
27
  ],
24
- "message": "Root policies",
28
+ "message": "scope/comp2 (component)",
29
+ },
30
+ Object {
31
+ "choices": Array [
32
+ Object {
33
+ "message": "foo (dev) 1.0.0 ❯ 2.0.0 ",
34
+ "name": "foo",
35
+ "value": Object {
36
+ "componentId": ComponentID {
37
+ "_scope": undefined,
38
+ "legacyComponentId": BitId {
39
+ "box": undefined,
40
+ "name": "comp1",
41
+ "scope": "scope",
42
+ "version": "latest",
43
+ },
44
+ },
45
+ "currentRange": "1.0.0",
46
+ "latestRange": "2.0.0",
47
+ "name": "foo",
48
+ "source": "component-model",
49
+ "targetField": "devDependencies",
50
+ },
51
+ },
52
+ ],
53
+ "message": "scope/comp1 (component)",
25
54
  },
26
55
  ]
27
56
  `;
@@ -31,22 +60,52 @@ Array [
31
60
  Object {
32
61
  "choices": Array [
33
62
  Object {
34
- "message": "foo (runtime) ^1.2.3 ❯ 2.0.0 because of comp1 and 1 other components ",
63
+ "message": "foo (runtime) ^1.2.3 ❯ 2.0.0 ",
35
64
  "name": "foo",
36
65
  "value": Object {
66
+ "componentId": ComponentID {
67
+ "_scope": undefined,
68
+ "legacyComponentId": BitId {
69
+ "box": undefined,
70
+ "name": "comp1",
71
+ "scope": "scope",
72
+ "version": "latest",
73
+ },
74
+ },
37
75
  "currentRange": "^1.2.3",
38
- "dependentComponents": Array [
39
- "comp1",
40
- "comp2",
41
- ],
42
76
  "latestRange": "2.0.0",
43
77
  "name": "foo",
44
- "source": "rootPolicy",
78
+ "source": "component-model",
45
79
  "targetField": "dependencies",
46
80
  },
47
81
  },
48
82
  ],
49
- "message": "Root policies",
83
+ "message": "scope/comp1 (component)",
84
+ },
85
+ Object {
86
+ "choices": Array [
87
+ Object {
88
+ "message": "foo (runtime) ^1.2.3 ❯ 2.0.0 ",
89
+ "name": "foo",
90
+ "value": Object {
91
+ "componentId": ComponentID {
92
+ "_scope": undefined,
93
+ "legacyComponentId": BitId {
94
+ "box": undefined,
95
+ "name": "comp2",
96
+ "scope": "scope",
97
+ "version": "latest",
98
+ },
99
+ },
100
+ "currentRange": "^1.2.3",
101
+ "latestRange": "2.0.0",
102
+ "name": "foo",
103
+ "source": "component-model",
104
+ "targetField": "dependencies",
105
+ },
106
+ },
107
+ ],
108
+ "message": "scope/comp2 (component)",
50
109
  },
51
110
  ]
52
111
  `;
@@ -56,23 +115,52 @@ Array [
56
115
  Object {
57
116
  "choices": Array [
58
117
  Object {
59
- "message": "foo (runtime) * ❯ 2.0.0 because of comp1 and 1 other components ",
118
+ "message": "foo (runtime) <=10.0.0 ❯ 2.0.0 ",
60
119
  "name": "foo",
61
120
  "value": Object {
62
- "currentRange": "*",
63
- "dependentComponents": Array [
64
- "comp1",
65
- "comp2",
66
- ],
67
- "hasDifferentRanges": true,
121
+ "componentId": ComponentID {
122
+ "_scope": undefined,
123
+ "legacyComponentId": BitId {
124
+ "box": undefined,
125
+ "name": "comp1",
126
+ "scope": "scope",
127
+ "version": "latest",
128
+ },
129
+ },
130
+ "currentRange": "<=10.0.0",
68
131
  "latestRange": "2.0.0",
69
132
  "name": "foo",
70
- "source": "rootPolicy",
133
+ "source": "component-model",
71
134
  "targetField": "dependencies",
72
135
  },
73
136
  },
74
137
  ],
75
- "message": "Root policies",
138
+ "message": "scope/comp1 (component)",
139
+ },
140
+ Object {
141
+ "choices": Array [
142
+ Object {
143
+ "message": "foo (runtime) 1.1.0 ❯ 2.0.0 ",
144
+ "name": "foo",
145
+ "value": Object {
146
+ "componentId": ComponentID {
147
+ "_scope": undefined,
148
+ "legacyComponentId": BitId {
149
+ "box": undefined,
150
+ "name": "comp2",
151
+ "scope": "scope",
152
+ "version": "latest",
153
+ },
154
+ },
155
+ "currentRange": "1.1.0",
156
+ "latestRange": "2.0.0",
157
+ "name": "foo",
158
+ "source": "component-model",
159
+ "targetField": "dependencies",
160
+ },
161
+ },
162
+ ],
163
+ "message": "scope/comp2 (component)",
76
164
  },
77
165
  ]
78
166
  `;
@@ -139,7 +227,15 @@ Array [
139
227
  "message": "foo (runtime) 1.0.0 ❯ 2.0.0 ",
140
228
  "name": "foo",
141
229
  "value": Object {
142
- "componentId": "comp1",
230
+ "componentId": ComponentID {
231
+ "_scope": undefined,
232
+ "legacyComponentId": BitId {
233
+ "box": undefined,
234
+ "name": "comp1",
235
+ "scope": "scope",
236
+ "version": "latest",
237
+ },
238
+ },
143
239
  "currentRange": "1.0.0",
144
240
  "latestRange": "2.0.0",
145
241
  "name": "foo",
@@ -148,7 +244,7 @@ Array [
148
244
  },
149
245
  },
150
246
  ],
151
- "message": "comp1 (component)",
247
+ "message": "scope/comp1 (component)",
152
248
  },
153
249
  Object {
154
250
  "choices": Array [
@@ -12,7 +12,7 @@ function _harmony() {
12
12
  return data;
13
13
  }
14
14
  const InstallAspect = _harmony().Aspect.create({
15
- id: 'teambit.bit/install'
15
+ id: 'teambit.workspace/install'
16
16
  });
17
17
  exports.InstallAspect = InstallAspect;
18
18
 
@@ -1 +1 @@
1
- {"version":3,"names":["_harmony","data","require","InstallAspect","Aspect","create","id","exports"],"sources":["install.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const InstallAspect = Aspect.create({\n id: 'teambit.bit/install',\n});\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,aAAa,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACzCC,EAAE,EAAE;AACN,CAAC,CAAC;AAACC,OAAA,CAAAJ,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_harmony","data","require","InstallAspect","Aspect","create","id","exports"],"sources":["install.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const InstallAspect = Aspect.create({\n id: 'teambit.workspace/install',\n});\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,aAAa,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACzCC,EAAE,EAAE;AACN,CAAC,CAAC;AAACC,OAAA,CAAAJ,aAAA,GAAAA,aAAA"}
@@ -60,16 +60,16 @@ class InstallCmd {
60
60
  }]);
61
61
  (0, _defineProperty2().default)(this, "alias", 'in');
62
62
  (0, _defineProperty2().default)(this, "group", 'development');
63
- (0, _defineProperty2().default)(this, "options", [['t', 'type [lifecycleType]', '"runtime" (default) or "peer" (dev is not a valid option)'], ['u', 'update', 'update all dependencies'], ['', 'update-existing [updateExisting]', 'DEPRECATED (not needed anymore, it is the default now). update existing dependencies version and types'], ['', 'save-prefix [savePrefix]', 'set the prefix to use when adding dependency to workspace.jsonc'], ['', 'skip-dedupe [skipDedupe]', 'do not dedupe dependencies on installation'], ['', 'skip-import [skipImport]', 'do not import bit objects post installation'], ['', 'skip-compile [skipCompile]', 'do not compile components'], ['', 'add-missing-deps [addMissingDeps]', 'install all missing dependencies'], ['', 'add-missing-peers [addMissingPeers]', 'install all missing peer dependencies'], ['', recurringInstallFlagName, 'automatically run install again if there are non loaded old envs in your workspace'], ['', 'no-optional [noOptional]', 'do not install optional dependencies (works with pnpm only)']]);
63
+ (0, _defineProperty2().default)(this, "options", [['t', 'type [lifecycleType]', '"runtime" (default) or "peer" (dev is not a valid option)'], ['u', 'update', 'update all dependencies to latest version according to their semver range'], ['', 'update-existing [updateExisting]', 'DEPRECATED (not needed anymore, it is the default now). update existing dependencies version and types'], ['', 'save-prefix [savePrefix]', 'set the prefix to use when adding dependency to workspace.jsonc'], ['', 'skip-dedupe [skipDedupe]', 'do not dedupe dependencies on installation'], ['', 'skip-import [skipImport]', 'do not import bit objects post installation'], ['', 'skip-compile [skipCompile]', 'do not compile components'], ['', 'add-missing-deps [addMissingDeps]', 'install all missing dependencies'], ['', 'add-missing-peers [addMissingPeers]', 'install all missing peer dependencies'], ['', recurringInstallFlagName, 'automatically run install again if there are non loaded old envs in your workspace'], ['', 'no-optional [noOptional]', 'do not install optional dependencies (works with pnpm only)']]);
64
64
  }
65
65
  async report([packages = []], options) {
66
66
  const startTime = Date.now();
67
67
  if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
68
68
  if (packages.length && options.addMissingDeps) {
69
- throw new (_bitError().BitError)('You can not use --add-missing-deps with a list of packages');
69
+ throw new (_bitError().BitError)('cannot use --add-missing-deps with a list of packages');
70
70
  }
71
71
  if (options.updateExisting) {
72
- this.logger.consoleWarning(`--update-existing is deprecated, please omit it. "bit install" will update existing dependency by default`);
72
+ this.logger.consoleWarning(`--update-existing is deprecated, please omit it. "bit install" will update existing dependencies by default`);
73
73
  }
74
74
  this.logger.console(`Resolving component dependencies for workspace: '${_chalk().default.cyan(this.workspace.name)}'`);
75
75
  const installOpts = {
@@ -117,7 +117,7 @@ function formatOutput({
117
117
  function getAnotherInstallRequiredOutput(recurringInstall = false, oldNonLoadedEnvs = []) {
118
118
  if (!oldNonLoadedEnvs.length) return '';
119
119
  const oldNonLoadedEnvsStr = oldNonLoadedEnvs.join(', ');
120
- const firstPart = `Bit is unable to install all dependencies. Please run "${_chalk().default.cyan('bit install')}" again `;
120
+ const firstPart = `Bit was not able to install all dependencies. Please run "${_chalk().default.cyan('bit install')}" again `;
121
121
  const flag = _chalk().default.cyan(`--${recurringInstallFlagName}`);
122
122
  const suggestRecurringInstall = recurringInstall ? '' : `(or use the "${flag}" option next time).`;
123
123
  const envsStr = `The following environments need to add support for "dependency policy" to fix the warning: ${_chalk().default.cyan(oldNonLoadedEnvsStr)}`;
@@ -1 +1 @@
1
- {"version":3,"names":["_bitError","data","require","_chalk","_interopRequireDefault","_workspace","recurringInstallFlagName","InstallCmd","constructor","install","workspace","logger","_defineProperty2","default","name","description","report","packages","options","startTime","Date","now","OutsideWorkspaceError","length","addMissingDeps","BitError","updateExisting","consoleWarning","console","chalk","cyan","installOpts","lifecycleType","addMissingPeers","type","dedupe","skipDedupe","import","skipImport","savePrefix","compile","skipCompile","includeOptionalDeps","noOptional","updateAll","update","recurringInstall","components","endTime","oldNonLoadedEnvs","getOldNonLoadedEnvs","formatOutput","numOfComps","toArray","toString","exports","calculateTime","diff","executionTime","summary","green","anotherInstallRequiredOutput","getAnotherInstallRequiredOutput","oldNonLoadedEnvsStr","join","firstPart","flag","suggestRecurringInstall","envsStr","docsLink","msg","yellow"],"sources":["install.cmd.tsx"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { WorkspaceDependencyLifecycleType } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport chalk from 'chalk';\nimport { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { InstallMain, WorkspaceInstallOptions } from './install.main.runtime';\n\ntype InstallCmdOptions = {\n type: WorkspaceDependencyLifecycleType;\n skipDedupe: boolean;\n skipImport: boolean;\n skipCompile: boolean;\n update: boolean;\n updateExisting: boolean;\n savePrefix: string;\n addMissingDeps: boolean;\n addMissingPeers: boolean;\n noOptional: boolean;\n recurringInstall: boolean;\n};\n\ntype FormatOutputArgs = {\n numOfComps: string;\n startTime: number;\n endTime: number;\n oldNonLoadedEnvs: string[];\n recurringInstall: boolean;\n};\n\nconst recurringInstallFlagName = 'recurring-install';\n\nexport default class InstallCmd implements Command {\n name = 'install [packages...]';\n description = 'installs workspace dependencies';\n extendedDescription =\n 'when no package is specified, all workspace dependencies are installed and all workspace components are imported.';\n helpUrl = 'docs/dependencies/dependency-installation';\n arguments = [{ name: 'packages...', description: 'a list of packages to install (separated by spaces)' }];\n alias = 'in';\n group = 'development';\n options = [\n ['t', 'type [lifecycleType]', '\"runtime\" (default) or \"peer\" (dev is not a valid option)'],\n ['u', 'update', 'update all dependencies'],\n [\n '',\n 'update-existing [updateExisting]',\n 'DEPRECATED (not needed anymore, it is the default now). update existing dependencies version and types',\n ],\n ['', 'save-prefix [savePrefix]', 'set the prefix to use when adding dependency to workspace.jsonc'],\n ['', 'skip-dedupe [skipDedupe]', 'do not dedupe dependencies on installation'],\n ['', 'skip-import [skipImport]', 'do not import bit objects post installation'],\n ['', 'skip-compile [skipCompile]', 'do not compile components'],\n ['', 'add-missing-deps [addMissingDeps]', 'install all missing dependencies'],\n ['', 'add-missing-peers [addMissingPeers]', 'install all missing peer dependencies'],\n [\n '',\n recurringInstallFlagName,\n 'automatically run install again if there are non loaded old envs in your workspace',\n ],\n ['', 'no-optional [noOptional]', 'do not install optional dependencies (works with pnpm only)'],\n ] as CommandOptions;\n\n constructor(\n private install: InstallMain,\n /**\n * workspace extension.\n */\n private workspace: Workspace,\n\n /**\n * logger extension.\n */\n private logger: Logger\n ) {}\n\n async report([packages = []]: [string[]], options: InstallCmdOptions) {\n const startTime = Date.now();\n if (!this.workspace) throw new OutsideWorkspaceError();\n if (packages.length && options.addMissingDeps) {\n throw new BitError('You can not use --add-missing-deps with a list of packages');\n }\n if (options.updateExisting) {\n this.logger.consoleWarning(\n `--update-existing is deprecated, please omit it. \"bit install\" will update existing dependency by default`\n );\n }\n this.logger.console(`Resolving component dependencies for workspace: '${chalk.cyan(this.workspace.name)}'`);\n const installOpts: WorkspaceInstallOptions = {\n lifecycleType: options.addMissingPeers ? 'peer' : options.type,\n dedupe: !options.skipDedupe,\n import: !options.skipImport,\n updateExisting: true,\n savePrefix: options.savePrefix,\n addMissingDeps: options.addMissingDeps,\n addMissingPeers: options.addMissingPeers,\n compile: !options.skipCompile,\n includeOptionalDeps: !options.noOptional,\n updateAll: options.update,\n recurringInstall: options.recurringInstall,\n };\n const components = await this.install.install(packages, installOpts);\n const endTime = Date.now();\n const oldNonLoadedEnvs = this.install.getOldNonLoadedEnvs();\n return formatOutput({\n startTime,\n endTime,\n numOfComps: components.toArray().length.toString(),\n recurringInstall: options[recurringInstallFlagName],\n oldNonLoadedEnvs,\n });\n }\n}\n\nfunction calculateTime(startTime: number, endTime: number) {\n const diff = endTime - startTime;\n return diff / 1000;\n}\n\nfunction formatOutput({\n numOfComps,\n endTime,\n startTime,\n recurringInstall,\n oldNonLoadedEnvs,\n}: FormatOutputArgs): string {\n const executionTime = calculateTime(startTime, endTime);\n const summary = chalk.green(\n `Successfully installed dependencies and compiled ${chalk.cyan(numOfComps)} component(s) in ${chalk.cyan(\n executionTime.toString()\n )} seconds`\n );\n const anotherInstallRequiredOutput = getAnotherInstallRequiredOutput(recurringInstall, oldNonLoadedEnvs);\n return anotherInstallRequiredOutput ? `\\n${anotherInstallRequiredOutput}\\n\\n${summary}` : `\\n${summary}`;\n}\n\nexport function getAnotherInstallRequiredOutput(recurringInstall = false, oldNonLoadedEnvs: string[] = []): string {\n if (!oldNonLoadedEnvs.length) return '';\n const oldNonLoadedEnvsStr = oldNonLoadedEnvs.join(', ');\n const firstPart = `Bit is unable to install all dependencies. Please run \"${chalk.cyan('bit install')}\" again `;\n const flag = chalk.cyan(`--${recurringInstallFlagName}`);\n const suggestRecurringInstall = recurringInstall ? '' : `(or use the \"${flag}\" option next time).`;\n const envsStr = `The following environments need to add support for \"dependency policy\" to fix the warning: ${chalk.cyan(\n oldNonLoadedEnvsStr\n )}`;\n const docsLink = `Read more about how to fix this issue in: https://bit.dev/blog/using-a-static-dependency-policy-in-a-legacy-env-lihfbt9b`;\n\n const msg = `${firstPart}${suggestRecurringInstall}\\n${envsStr}\\n${docsLink}`;\n return chalk.yellow(msg);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAyBA,MAAMK,wBAAwB,GAAG,mBAAmB;AAErC,MAAMC,UAAU,CAAoB;EA+BjDC,WAAWA,CACDC,OAAoB;EAC5B;AACJ;AACA;EACYC,SAAoB;EAE5B;AACJ;AACA;EACYC,MAAc,EACtB;IAAA,KAVQF,OAAoB,GAApBA,OAAoB;IAAA,KAIpBC,SAAoB,GAApBA,SAAoB;IAAA,KAKpBC,MAAc,GAAdA,MAAc;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBAxCjB,uBAAuB;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBAChB,iCAAiC;IAAA,IAAAD,gBAAA,GAAAC,OAAA,+BAE7C,mHAAmH;IAAA,IAAAD,gBAAA,GAAAC,OAAA,mBAC3G,2CAA2C;IAAA,IAAAD,gBAAA,GAAAC,OAAA,q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BAAwB,KAAIC,OAAQ,KAAIC,QAAS,EAAC;EAC7E,OAAOxC,gBAAK,CAAC0C,MAAM,CAACD,GAAG,CAAC;AAC1B"}
1
+ {"version":3,"names":["_bitError","data","require","_chalk","_interopRequireDefault","_workspace","recurringInstallFlagName","InstallCmd","constructor","install","workspace","logger","_defineProperty2","default","name","description","report","packages","options","startTime","Date","now","OutsideWorkspaceError","length","addMissingDeps","BitError","updateExisting","consoleWarning","console","chalk","cyan","installOpts","lifecycleType","addMissingPeers","type","dedupe","skipDedupe","import","skipImport","savePrefix","compile","skipCompile","includeOptionalDeps","noOptional","updateAll","update","recurringInstall","components","endTime","oldNonLoadedEnvs","getOldNonLoadedEnvs","formatOutput","numOfComps","toArray","toString","exports","calculateTime","diff","executionTime","summary","green","anotherInstallRequiredOutput","getAnotherInstallRequiredOutput","oldNonLoadedEnvsStr","join","firstPart","flag","suggestRecurringInstall","envsStr","docsLink","msg","yellow"],"sources":["install.cmd.tsx"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { WorkspaceDependencyLifecycleType } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport chalk from 'chalk';\nimport { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { InstallMain, WorkspaceInstallOptions } from './install.main.runtime';\n\ntype InstallCmdOptions = {\n type: WorkspaceDependencyLifecycleType;\n skipDedupe: boolean;\n skipImport: boolean;\n skipCompile: boolean;\n update: boolean;\n updateExisting: boolean;\n savePrefix: string;\n addMissingDeps: boolean;\n addMissingPeers: boolean;\n noOptional: boolean;\n recurringInstall: boolean;\n};\n\ntype FormatOutputArgs = {\n numOfComps: string;\n startTime: number;\n endTime: number;\n oldNonLoadedEnvs: string[];\n recurringInstall: boolean;\n};\n\nconst recurringInstallFlagName = 'recurring-install';\n\nexport default class InstallCmd implements Command {\n name = 'install [packages...]';\n description = 'installs workspace dependencies';\n extendedDescription =\n 'when no package is specified, all workspace dependencies are installed and all workspace components are imported.';\n helpUrl = 'docs/dependencies/dependency-installation';\n arguments = [{ name: 'packages...', description: 'a list of packages to install (separated by spaces)' }];\n alias = 'in';\n group = 'development';\n options = [\n ['t', 'type [lifecycleType]', '\"runtime\" (default) or \"peer\" (dev is not a valid option)'],\n ['u', 'update', 'update all dependencies to latest version according to their semver range'],\n [\n '',\n 'update-existing [updateExisting]',\n 'DEPRECATED (not needed anymore, it is the default now). update existing dependencies version and types',\n ],\n ['', 'save-prefix [savePrefix]', 'set the prefix to use when adding dependency to workspace.jsonc'],\n ['', 'skip-dedupe [skipDedupe]', 'do not dedupe dependencies on installation'],\n ['', 'skip-import [skipImport]', 'do not import bit objects post installation'],\n ['', 'skip-compile [skipCompile]', 'do not compile components'],\n ['', 'add-missing-deps [addMissingDeps]', 'install all missing dependencies'],\n ['', 'add-missing-peers [addMissingPeers]', 'install all missing peer dependencies'],\n [\n '',\n recurringInstallFlagName,\n 'automatically run install again if there are non loaded old envs in your workspace',\n ],\n ['', 'no-optional [noOptional]', 'do not install optional dependencies (works with pnpm only)'],\n ] as CommandOptions;\n\n constructor(\n private install: InstallMain,\n /**\n * workspace extension.\n */\n private workspace: Workspace,\n\n /**\n * logger extension.\n */\n private logger: Logger\n ) {}\n\n async report([packages = []]: [string[]], options: InstallCmdOptions) {\n const startTime = Date.now();\n if (!this.workspace) throw new OutsideWorkspaceError();\n if (packages.length && options.addMissingDeps) {\n throw new BitError('cannot use --add-missing-deps with a list of packages');\n }\n if (options.updateExisting) {\n this.logger.consoleWarning(\n `--update-existing is deprecated, please omit it. \"bit install\" will update existing dependencies by default`\n );\n }\n this.logger.console(`Resolving component dependencies for workspace: '${chalk.cyan(this.workspace.name)}'`);\n const installOpts: WorkspaceInstallOptions = {\n lifecycleType: options.addMissingPeers ? 'peer' : options.type,\n dedupe: !options.skipDedupe,\n import: !options.skipImport,\n updateExisting: true,\n savePrefix: options.savePrefix,\n addMissingDeps: options.addMissingDeps,\n addMissingPeers: options.addMissingPeers,\n compile: !options.skipCompile,\n includeOptionalDeps: !options.noOptional,\n updateAll: options.update,\n recurringInstall: options.recurringInstall,\n };\n const components = await this.install.install(packages, installOpts);\n const endTime = Date.now();\n const oldNonLoadedEnvs = this.install.getOldNonLoadedEnvs();\n return formatOutput({\n startTime,\n endTime,\n numOfComps: components.toArray().length.toString(),\n recurringInstall: options[recurringInstallFlagName],\n oldNonLoadedEnvs,\n });\n }\n}\n\nfunction calculateTime(startTime: number, endTime: number) {\n const diff = endTime - startTime;\n return diff / 1000;\n}\n\nfunction formatOutput({\n numOfComps,\n endTime,\n startTime,\n recurringInstall,\n oldNonLoadedEnvs,\n}: FormatOutputArgs): string {\n const executionTime = calculateTime(startTime, endTime);\n const summary = chalk.green(\n `Successfully installed dependencies and compiled ${chalk.cyan(numOfComps)} component(s) in ${chalk.cyan(\n executionTime.toString()\n )} seconds`\n );\n const anotherInstallRequiredOutput = getAnotherInstallRequiredOutput(recurringInstall, oldNonLoadedEnvs);\n return anotherInstallRequiredOutput ? `\\n${anotherInstallRequiredOutput}\\n\\n${summary}` : `\\n${summary}`;\n}\n\nexport function getAnotherInstallRequiredOutput(recurringInstall = false, oldNonLoadedEnvs: string[] = []): string {\n if (!oldNonLoadedEnvs.length) return '';\n const oldNonLoadedEnvsStr = oldNonLoadedEnvs.join(', ');\n const firstPart = `Bit was not able to install all dependencies. Please run \"${chalk.cyan('bit install')}\" again `;\n const flag = chalk.cyan(`--${recurringInstallFlagName}`);\n const suggestRecurringInstall = recurringInstall ? '' : `(or use the \"${flag}\" option next time).`;\n const envsStr = `The following environments need to add support for \"dependency policy\" to fix the warning: ${chalk.cyan(\n oldNonLoadedEnvsStr\n )}`;\n const docsLink = `Read more about how to fix this issue in: https://bit.dev/blog/using-a-static-dependency-policy-in-a-legacy-env-lihfbt9b`;\n\n const msg = `${firstPart}${suggestRecurringInstall}\\n${envsStr}\\n${docsLink}`;\n return chalk.yellow(msg);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA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IAAI,CAACsB,UAAU,CAAE,oBAAmBvB,gBAAK,CAACC,IAAI,CACtG4B,aAAa,CAACJ,QAAQ,CAAC,CACzB,CAAE,UACJ,CAAC;EACD,MAAMO,4BAA4B,GAAGC,+BAA+B,CAAChB,gBAAgB,EAAEG,gBAAgB,CAAC;EACxG,OAAOY,4BAA4B,GAAI,KAAIA,4BAA6B,OAAMF,OAAQ,EAAC,GAAI,KAAIA,OAAQ,EAAC;AAC1G;AAEO,SAASG,+BAA+BA,CAAChB,gBAAgB,GAAG,KAAK,EAAEG,gBAA0B,GAAG,EAAE,EAAU;EACjH,IAAI,CAACA,gBAAgB,CAAC1B,MAAM,EAAE,OAAO,EAAE;EACvC,MAAMwC,mBAAmB,GAAGd,gBAAgB,CAACe,IAAI,CAAC,IAAI,CAAC;EACvD,MAAMC,SAAS,GAAI,6DAA4DpC,gBAAK,CAACC,IAAI,CAAC,aAAa,CAAE,UAAS;EAClH,MAAMoC,IAAI,GAAGrC,gBAAK,CAACC,IAAI,CAAE,KAAIxB,wBAAyB,EAAC,CAAC;EACxD,MAAM6D,uBAAuB,GAAGrB,gBAAgB,GAAG,EAAE,GAAI,gBAAeoB,IAAK,sBAAqB;EAClG,MAAME,OAAO,GAAI,8FAA6FvC,gBAAK,CAACC,IAAI,CACtHiC,mBACF,CAAE,EAAC;EACH,MAAMM,QAAQ,GAAI,0HAAyH;EAE3I,MAAMC,GAAG,GAAI,GAAEL,SAAU,GAAEE,uBAAwB,KAAIC,OAAQ,KAAIC,QAAS,EAAC;EAC7E,OAAOxC,gBAAK,CAAC0C,MAAM,CAACD,GAAG,CAAC;AAC1B"}
@@ -109,8 +109,8 @@ export declare class InstallMain {
109
109
  addDuplicateComponentAndPackageIssue(components: Component[]): Promise<void>;
110
110
  private _getComponentsWithDependencyPolicies;
111
111
  private _variantPatternsToDepPolicesDict;
112
+ private _updateComponentsConfig;
112
113
  private _updateVariantsPolicies;
113
- private _saveManyComponentConfigFiles;
114
114
  /**
115
115
  * Uninstall the specified packages from dependencies.
116
116
  *
@@ -636,17 +636,14 @@ class InstallMain {
636
636
  * @param options.all {Boolean} updates all outdated dependencies without showing a prompt.
637
637
  */
638
638
  async updateDependencies(options) {
639
- const {
640
- componentConfigFiles,
641
- componentPoliciesById
642
- } = await this._getComponentsWithDependencyPolicies();
639
+ const componentPolicies = await this._getComponentsWithDependencyPolicies();
643
640
  const variantPatterns = this.variants.raw();
644
641
  const variantPoliciesByPatterns = this._variantPatternsToDepPolicesDict(variantPatterns);
645
642
  const components = await this.workspace.list();
646
643
  const outdatedPkgs = await this.dependencyResolver.getOutdatedPkgsFromPolicies({
647
644
  rootDir: this.workspace.path,
648
645
  variantPoliciesByPatterns,
649
- componentPoliciesById,
646
+ componentPolicies,
650
647
  components,
651
648
  patterns: options.patterns,
652
649
  forceVersionBump: options.forceVersionBump
@@ -667,12 +664,10 @@ class InstallMain {
667
664
  updatedVariants,
668
665
  updatedComponents
669
666
  } = this.dependencyResolver.applyUpdates(outdatedPkgsToUpdate, {
670
- variantPoliciesByPatterns,
671
- componentPoliciesById
667
+ variantPoliciesByPatterns
672
668
  });
673
669
  await this._updateVariantsPolicies(variantPatterns, updatedVariants);
674
- const updatedComponentConfigFiles = Object.values((0, _lodash().pick)(componentConfigFiles, updatedComponents));
675
- await this._saveManyComponentConfigFiles(updatedComponentConfigFiles);
670
+ await this._updateComponentsConfig(updatedComponents);
676
671
  await this.workspace._reloadConsumer();
677
672
  return this._installModules({
678
673
  dedupe: true
@@ -691,20 +686,18 @@ class InstallMain {
691
686
  }
692
687
  async _getComponentsWithDependencyPolicies() {
693
688
  const allComponentIds = await this.workspace.listIds();
694
- const componentConfigFiles = {};
695
- const componentPoliciesById = {};
689
+ const componentPolicies = [];
696
690
  (await Promise.all(allComponentIds.map(componentId => this.workspace.componentConfigFile(componentId)))).forEach((componentConfigFile, index) => {
697
691
  if (!componentConfigFile) return;
698
692
  const depResolverConfig = componentConfigFile.aspects.get(_dependencyResolver().DependencyResolverAspect.id);
699
693
  if (!depResolverConfig) return;
700
- const componentId = allComponentIds[index].toString();
701
- componentConfigFiles[componentId] = componentConfigFile;
702
- componentPoliciesById[componentId] = depResolverConfig.config.policy;
694
+ const componentId = allComponentIds[index];
695
+ componentPolicies.push({
696
+ componentId,
697
+ policy: depResolverConfig.config.policy
698
+ });
703
699
  });
704
- return {
705
- componentConfigFiles,
706
- componentPoliciesById
707
- };
700
+ return componentPolicies;
708
701
  }
709
702
  _variantPatternsToDepPolicesDict(variantPatterns) {
710
703
  const variantPoliciesByPatterns = {};
@@ -717,6 +710,19 @@ class InstallMain {
717
710
  }
718
711
  return variantPoliciesByPatterns;
719
712
  }
713
+ async _updateComponentsConfig(updatedComponents) {
714
+ if (updatedComponents.length === 0) return;
715
+ await Promise.all(updatedComponents.map(({
716
+ componentId,
717
+ config
718
+ }) => {
719
+ return this.workspace.addSpecificComponentConfig(componentId, _dependencyResolver().DependencyResolverAspect.id, config, {
720
+ shouldMergeWithExisting: true,
721
+ shouldMergeWithPrevious: true
722
+ });
723
+ }));
724
+ await this.workspace.bitMap.write();
725
+ }
720
726
  _updateVariantsPolicies(variantPatterns, updateVariantPolicies) {
721
727
  for (const variantPattern of updateVariantPolicies) {
722
728
  this.variants.setExtension(variantPattern, _dependencyResolver().DependencyResolverAspect.id, variantPatterns[variantPattern][_dependencyResolver().DependencyResolverAspect.id], {
@@ -725,13 +731,6 @@ class InstallMain {
725
731
  }
726
732
  return this.dependencyResolver.persistConfig(this.workspace.path);
727
733
  }
728
- async _saveManyComponentConfigFiles(componentConfigFiles) {
729
- await Promise.all(Array.from(componentConfigFiles).map(async componentConfigFile => {
730
- await componentConfigFile.write({
731
- override: true
732
- });
733
- }));
734
- }
735
734
 
736
735
  /**
737
736
  * Uninstall the specified packages from dependencies.