@teambit/workspace 0.0.758 → 0.0.761

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.
@@ -6,7 +6,8 @@ Array [
6
6
  "choices": Array [
7
7
  Object {
8
8
  "message": "foo (runtime) 1.0.0 ❯ 2.0.0 ",
9
- "name": Object {
9
+ "name": "foo",
10
+ "value": Object {
10
11
  "currentRange": "1.0.0",
11
12
  "latestRange": "2.0.0",
12
13
  "name": "foo",
@@ -16,7 +17,8 @@ Array [
16
17
  },
17
18
  Object {
18
19
  "message": "qar (runtime) 1.0.0 ❯ 1.1.0 ",
19
- "name": Object {
20
+ "name": "qar",
21
+ "value": Object {
20
22
  "currentRange": "1.0.0",
21
23
  "latestRange": "1.1.0",
22
24
  "name": "qar",
@@ -26,7 +28,8 @@ Array [
26
28
  },
27
29
  Object {
28
30
  "message": "zoo (dev) 1.0.0 ❯ 1.1.0 ",
29
- "name": Object {
31
+ "name": "zoo",
32
+ "value": Object {
30
33
  "currentRange": "1.0.0",
31
34
  "latestRange": "1.1.0",
32
35
  "name": "zoo",
@@ -36,7 +39,8 @@ Array [
36
39
  },
37
40
  Object {
38
41
  "message": "bar (peer) 1.0.0 ❯ 1.1.0 ",
39
- "name": Object {
42
+ "name": "bar",
43
+ "value": Object {
40
44
  "currentRange": "1.0.0",
41
45
  "latestRange": "1.1.0",
42
46
  "name": "bar",
@@ -56,7 +60,8 @@ Array [
56
60
  "choices": Array [
57
61
  Object {
58
62
  "message": "foo (runtime) 1.0.0 ❯ 2.0.0 ",
59
- "name": Object {
63
+ "name": "foo",
64
+ "value": Object {
60
65
  "componentId": "comp1",
61
66
  "currentRange": "1.0.0",
62
67
  "latestRange": "2.0.0",
@@ -72,7 +77,8 @@ Array [
72
77
  "choices": Array [
73
78
  Object {
74
79
  "message": "bar (peer) 1.0.0 ❯ 1.1.0 ",
75
- "name": Object {
80
+ "name": "bar",
81
+ "value": Object {
76
82
  "currentRange": "1.0.0",
77
83
  "latestRange": "1.1.0",
78
84
  "name": "bar",
@@ -34,20 +34,20 @@ function _chalk() {
34
34
  class EnvsReplaceCmd {
35
35
  constructor(workspace) {
36
36
  this.workspace = workspace;
37
- (0, _defineProperty2().default)(this, "name", 'replace <old-env> <new-env>');
37
+ (0, _defineProperty2().default)(this, "name", 'replace <current-env> <new-env>');
38
38
  (0, _defineProperty2().default)(this, "description", 'replace an existing env with another env for all components using the old env');
39
39
  (0, _defineProperty2().default)(this, "options", []);
40
40
  (0, _defineProperty2().default)(this, "group", 'development');
41
41
  (0, _defineProperty2().default)(this, "arguments", [{
42
- name: 'old-env',
43
- description: 'current environment id'
42
+ name: 'current-env',
43
+ description: 'the component id of the current env'
44
44
  }, {
45
45
  name: 'new-env',
46
- description: 'target environment id'
46
+ description: 'the component id of the new env'
47
47
  }]);
48
48
  (0, _defineProperty2().default)(this, "examples", [{
49
49
  cmd: 'replace teambit.harmony/aspect teambit.harmony/node',
50
- description: 'all components using aspect env, will be replaced with node env'
50
+ description: "components configured to use the 'aspect' env will be configured to use the 'node' env, instead"
51
51
  }]);
52
52
  }
53
53
 
@@ -1 +1 @@
1
- {"version":3,"names":["EnvsReplaceCmd","constructor","workspace","name","description","cmd","report","oldEnv","env","envId","resolveComponentId","components","getComponentsUsingEnv","componentIds","map","comp","id","setEnvToComponents","chalk","bold","toString","compId","join"],"sources":["envs-replace.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Workspace } from '../workspace';\n\nexport class EnvsReplaceCmd implements Command {\n name = 'replace <old-env> <new-env>';\n description = 'replace an existing env with another env for all components using the old env';\n options = [];\n group = 'development';\n arguments = [\n { name: 'old-env', description: 'current environment id' },\n { name: 'new-env', description: 'target environment id' },\n ];\n examples = [\n {\n cmd: 'replace teambit.harmony/aspect teambit.harmony/node',\n description: 'all components using aspect env, will be replaced with node env',\n },\n ];\n\n constructor(private workspace: Workspace) {}\n\n async report([oldEnv, env]: [string, string]) {\n const envId = await this.workspace.resolveComponentId(env);\n const components = await this.workspace.getComponentsUsingEnv(oldEnv, true, true);\n const componentIds = components.map((comp) => comp.id);\n await this.workspace.setEnvToComponents(envId, componentIds);\n return `added ${chalk.bold(envId.toString())} env to the following component(s):\n${componentIds.map((compId) => compId.toString()).join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,cAAN,CAAwC;EAgB7CC,WAAW,CAASC,SAAT,EAA+B;IAAA,KAAtBA,SAAsB,GAAtBA,SAAsB;IAAA,8CAfnC,6BAemC;IAAA,qDAd5B,+EAc4B;IAAA,iDAbhC,EAagC;IAAA,+CAZlC,aAYkC;IAAA,mDAX9B,CACV;MAAEC,IAAI,EAAE,SAAR;MAAmBC,WAAW,EAAE;IAAhC,CADU,EAEV;MAAED,IAAI,EAAE,SAAR;MAAmBC,WAAW,EAAE;IAAhC,CAFU,CAW8B;IAAA,kDAP/B,CACT;MACEC,GAAG,EAAE,qDADP;MAEED,WAAW,EAAE;IAFf,CADS,CAO+B;EAAE;;EAEhC,MAANE,MAAM,CAAC,CAACC,MAAD,EAASC,GAAT,CAAD,EAAkC;IAC5C,MAAMC,KAAK,GAAG,MAAM,KAAKP,SAAL,CAAeQ,kBAAf,CAAkCF,GAAlC,CAApB;IACA,MAAMG,UAAU,GAAG,MAAM,KAAKT,SAAL,CAAeU,qBAAf,CAAqCL,MAArC,EAA6C,IAA7C,EAAmD,IAAnD,CAAzB;IACA,MAAMM,YAAY,GAAGF,UAAU,CAACG,GAAX,CAAgBC,IAAD,IAAUA,IAAI,CAACC,EAA9B,CAArB;IACA,MAAM,KAAKd,SAAL,CAAee,kBAAf,CAAkCR,KAAlC,EAAyCI,YAAzC,CAAN;IACA,OAAQ,SAAQK,gBAAA,CAAMC,IAAN,CAAWV,KAAK,CAACW,QAAN,EAAX,CAA6B;AACjD,EAAEP,YAAY,CAACC,GAAb,CAAkBO,MAAD,IAAYA,MAAM,CAACD,QAAP,EAA7B,EAAgDE,IAAhD,CAAqD,IAArD,CAA2D,EADzD;EAED;;AAzB4C"}
1
+ {"version":3,"names":["EnvsReplaceCmd","constructor","workspace","name","description","cmd","report","oldEnv","env","envId","resolveComponentId","components","getComponentsUsingEnv","componentIds","map","comp","id","setEnvToComponents","chalk","bold","toString","compId","join"],"sources":["envs-replace.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Workspace } from '../workspace';\n\nexport class EnvsReplaceCmd implements Command {\n name = 'replace <current-env> <new-env>';\n description = 'replace an existing env with another env for all components using the old env';\n options = [];\n group = 'development';\n arguments = [\n { name: 'current-env', description: 'the component id of the current env' },\n { name: 'new-env', description: 'the component id of the new env' },\n ];\n examples = [\n {\n cmd: 'replace teambit.harmony/aspect teambit.harmony/node',\n description: \"components configured to use the 'aspect' env will be configured to use the 'node' env, instead\",\n },\n ];\n\n constructor(private workspace: Workspace) {}\n\n async report([oldEnv, env]: [string, string]) {\n const envId = await this.workspace.resolveComponentId(env);\n const components = await this.workspace.getComponentsUsingEnv(oldEnv, true, true);\n const componentIds = components.map((comp) => comp.id);\n await this.workspace.setEnvToComponents(envId, componentIds);\n return `added ${chalk.bold(envId.toString())} env to the following component(s):\n${componentIds.map((compId) => compId.toString()).join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,cAAN,CAAwC;EAgB7CC,WAAW,CAASC,SAAT,EAA+B;IAAA,KAAtBA,SAAsB,GAAtBA,SAAsB;IAAA,8CAfnC,iCAemC;IAAA,qDAd5B,+EAc4B;IAAA,iDAbhC,EAagC;IAAA,+CAZlC,aAYkC;IAAA,mDAX9B,CACV;MAAEC,IAAI,EAAE,aAAR;MAAuBC,WAAW,EAAE;IAApC,CADU,EAEV;MAAED,IAAI,EAAE,SAAR;MAAmBC,WAAW,EAAE;IAAhC,CAFU,CAW8B;IAAA,kDAP/B,CACT;MACEC,GAAG,EAAE,qDADP;MAEED,WAAW,EAAE;IAFf,CADS,CAO+B;EAAE;;EAEhC,MAANE,MAAM,CAAC,CAACC,MAAD,EAASC,GAAT,CAAD,EAAkC;IAC5C,MAAMC,KAAK,GAAG,MAAM,KAAKP,SAAL,CAAeQ,kBAAf,CAAkCF,GAAlC,CAApB;IACA,MAAMG,UAAU,GAAG,MAAM,KAAKT,SAAL,CAAeU,qBAAf,CAAqCL,MAArC,EAA6C,IAA7C,EAAmD,IAAnD,CAAzB;IACA,MAAMM,YAAY,GAAGF,UAAU,CAACG,GAAX,CAAgBC,IAAD,IAAUA,IAAI,CAACC,EAA9B,CAArB;IACA,MAAM,KAAKd,SAAL,CAAee,kBAAf,CAAkCR,KAAlC,EAAyCI,YAAzC,CAAN;IACA,OAAQ,SAAQK,gBAAA,CAAMC,IAAN,CAAWV,KAAK,CAACW,QAAN,EAAX,CAA6B;AACjD,EAAEP,YAAY,CAACC,GAAb,CAAkBO,MAAD,IAAYA,MAAM,CAACD,QAAP,EAA7B,EAAgDE,IAAhD,CAAqD,IAArD,CAA2D,EADzD;EAED;;AAzB4C"}
@@ -4,9 +4,16 @@ export declare class EnvsSetCmd implements Command {
4
4
  private workspace;
5
5
  name: string;
6
6
  description: string;
7
+ arguments: {
8
+ name: string;
9
+ description: string;
10
+ }[];
11
+ examples: {
12
+ cmd: string;
13
+ description: string;
14
+ }[];
7
15
  options: never[];
8
16
  group: string;
9
- extendedDescription: string;
10
17
  constructor(workspace: Workspace);
11
18
  report([pattern, env]: [string, string]): Promise<string>;
12
19
  }
@@ -31,24 +31,30 @@ function _chalk() {
31
31
  return data;
32
32
  }
33
33
 
34
- function _constants() {
35
- const data = require("@teambit/legacy/dist/constants");
36
-
37
- _constants = function () {
38
- return data;
39
- };
40
-
41
- return data;
42
- }
43
-
44
34
  class EnvsSetCmd {
45
35
  constructor(workspace) {
46
36
  this.workspace = workspace;
47
- (0, _defineProperty2().default)(this, "name", 'set <pattern> <env>');
48
- (0, _defineProperty2().default)(this, "description", 'set an environment for component(s)');
37
+ (0, _defineProperty2().default)(this, "name", 'set <component-pattern> <env>');
38
+ (0, _defineProperty2().default)(this, "description", 'Sets one or more components with a development environment (env)');
39
+ (0, _defineProperty2().default)(this, "arguments", [{
40
+ name: 'component-pattern',
41
+ description: 'component name, component id, or component pattern. use component pattern to select multiple components. \nuse commas to separate patterns and "!" to exclude. e.g. "ui/**, !ui/button"\nwrap the pattern with quotes'
42
+ }, {
43
+ name: 'env',
44
+ description: "the env's component id (include version for non-core envs. e.g, `teambit.community/envs/community-react@1.95.13`)"
45
+ }]);
46
+ (0, _defineProperty2().default)(this, "examples", [{
47
+ cmd: 'set ui/button teambit.react/react',
48
+ description: "configures 'ui/button' to use the 'teambit.react/react' env"
49
+ }, {
50
+ cmd: 'set ui/button teambit.community/envs/community-mdx@1.95.16',
51
+ description: "configures 'ui/button' to use the (non-core) 'teambit.community/envs/community-mdx@1.95.16' env"
52
+ }, {
53
+ cmd: 'set "ui/**" teambit.react/react',
54
+ description: "configures all components that have the 'ui' namespace to use the teambit.react/react env"
55
+ }]);
49
56
  (0, _defineProperty2().default)(this, "options", []);
50
57
  (0, _defineProperty2().default)(this, "group", 'development');
51
- (0, _defineProperty2().default)(this, "extendedDescription", `${(0, _constants().PATTERN_HELP)('env set')}`);
52
58
  }
53
59
 
54
60
  async report([pattern, env]) {
@@ -1 +1 @@
1
- {"version":3,"names":["EnvsSetCmd","constructor","workspace","PATTERN_HELP","report","pattern","env","envId","resolveComponentId","componentIds","idsByPattern","setEnvToComponents","chalk","bold","toString","map","compId","join"],"sources":["envs-set.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { Workspace } from '../workspace';\n\nexport class EnvsSetCmd implements Command {\n name = 'set <pattern> <env>';\n description = 'set an environment for component(s)';\n options = [];\n group = 'development';\n extendedDescription = `${PATTERN_HELP('env set')}`;\n\n constructor(private workspace: Workspace) {}\n\n async report([pattern, env]: [string, string]) {\n const envId = await this.workspace.resolveComponentId(env);\n const componentIds = await this.workspace.idsByPattern(pattern);\n await this.workspace.setEnvToComponents(envId, componentIds);\n return `added ${chalk.bold(envId.toString())} env to the following component(s):\n${componentIds.map((compId) => compId.toString()).join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,UAAN,CAAoC;EAOzCC,WAAW,CAASC,SAAT,EAA+B;IAAA,KAAtBA,SAAsB,GAAtBA,SAAsB;IAAA,8CANnC,qBAMmC;IAAA,qDAL5B,qCAK4B;IAAA,iDAJhC,EAIgC;IAAA,+CAHlC,aAGkC;IAAA,6DAFnB,GAAE,IAAAC,yBAAA,EAAa,SAAb,CAAwB,EAEP;EAAE;;EAEhC,MAANC,MAAM,CAAC,CAACC,OAAD,EAAUC,GAAV,CAAD,EAAmC;IAC7C,MAAMC,KAAK,GAAG,MAAM,KAAKL,SAAL,CAAeM,kBAAf,CAAkCF,GAAlC,CAApB;IACA,MAAMG,YAAY,GAAG,MAAM,KAAKP,SAAL,CAAeQ,YAAf,CAA4BL,OAA5B,CAA3B;IACA,MAAM,KAAKH,SAAL,CAAeS,kBAAf,CAAkCJ,KAAlC,EAAyCE,YAAzC,CAAN;IACA,OAAQ,SAAQG,gBAAA,CAAMC,IAAN,CAAWN,KAAK,CAACO,QAAN,EAAX,CAA6B;AACjD,EAAEL,YAAY,CAACM,GAAb,CAAkBC,MAAD,IAAYA,MAAM,CAACF,QAAP,EAA7B,EAAgDG,IAAhD,CAAqD,IAArD,CAA2D,EADzD;EAED;;AAfwC"}
1
+ {"version":3,"names":["EnvsSetCmd","constructor","workspace","name","description","cmd","report","pattern","env","envId","resolveComponentId","componentIds","idsByPattern","setEnvToComponents","chalk","bold","toString","map","compId","join"],"sources":["envs-set.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Workspace } from '../workspace';\n\nexport class EnvsSetCmd implements Command {\n name = 'set <component-pattern> <env>';\n description = 'Sets one or more components with a development environment (env)';\n arguments = [\n {\n name: 'component-pattern',\n description:\n 'component name, component id, or component pattern. use component pattern to select multiple components. \\nuse commas to separate patterns and \"!\" to exclude. e.g. \"ui/**, !ui/button\"\\nwrap the pattern with quotes',\n },\n {\n name: 'env',\n description:\n \"the env's component id (include version for non-core envs. e.g, `teambit.community/envs/community-react@1.95.13`)\",\n },\n ];\n examples = [\n {\n cmd: 'set ui/button teambit.react/react',\n description: \"configures 'ui/button' to use the 'teambit.react/react' env\",\n },\n {\n cmd: 'set ui/button teambit.community/envs/community-mdx@1.95.16',\n description: \"configures 'ui/button' to use the (non-core) 'teambit.community/envs/community-mdx@1.95.16' env\",\n },\n {\n cmd: 'set \"ui/**\" teambit.react/react',\n description: \"configures all components that have the 'ui' namespace to use the teambit.react/react env\",\n },\n ];\n options = [];\n group = 'development';\n\n constructor(private workspace: Workspace) {}\n\n async report([pattern, env]: [string, string]) {\n const envId = await this.workspace.resolveComponentId(env);\n const componentIds = await this.workspace.idsByPattern(pattern);\n await this.workspace.setEnvToComponents(envId, componentIds);\n return `added ${chalk.bold(envId.toString())} env to the following component(s):\n${componentIds.map((compId) => compId.toString()).join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,UAAN,CAAoC;EAgCzCC,WAAW,CAASC,SAAT,EAA+B;IAAA,KAAtBA,SAAsB,GAAtBA,SAAsB;IAAA,8CA/BnC,+BA+BmC;IAAA,qDA9B5B,kEA8B4B;IAAA,mDA7B9B,CACV;MACEC,IAAI,EAAE,mBADR;MAEEC,WAAW,EACT;IAHJ,CADU,EAMV;MACED,IAAI,EAAE,KADR;MAEEC,WAAW,EACT;IAHJ,CANU,CA6B8B;IAAA,kDAjB/B,CACT;MACEC,GAAG,EAAE,mCADP;MAEED,WAAW,EAAE;IAFf,CADS,EAKT;MACEC,GAAG,EAAE,4DADP;MAEED,WAAW,EAAE;IAFf,CALS,EAST;MACEC,GAAG,EAAE,iCADP;MAEED,WAAW,EAAE;IAFf,CATS,CAiB+B;IAAA,iDAHhC,EAGgC;IAAA,+CAFlC,aAEkC;EAAE;;EAEhC,MAANE,MAAM,CAAC,CAACC,OAAD,EAAUC,GAAV,CAAD,EAAmC;IAC7C,MAAMC,KAAK,GAAG,MAAM,KAAKP,SAAL,CAAeQ,kBAAf,CAAkCF,GAAlC,CAApB;IACA,MAAMG,YAAY,GAAG,MAAM,KAAKT,SAAL,CAAeU,YAAf,CAA4BL,OAA5B,CAA3B;IACA,MAAM,KAAKL,SAAL,CAAeW,kBAAf,CAAkCJ,KAAlC,EAAyCE,YAAzC,CAAN;IACA,OAAQ,SAAQG,gBAAA,CAAMC,IAAN,CAAWN,KAAK,CAACO,QAAN,EAAX,CAA6B;AACjD,EAAEL,YAAY,CAACM,GAAb,CAAkBC,MAAD,IAAYA,MAAM,CAACF,QAAP,EAA7B,EAAgDG,IAAhD,CAAqD,IAArD,CAA2D,EADzD;EAED;;AAxCwC"}
@@ -4,6 +4,10 @@ export declare class EnvsUnsetCmd implements Command {
4
4
  private workspace;
5
5
  name: string;
6
6
  description: string;
7
+ arguments: {
8
+ name: string;
9
+ description: string;
10
+ }[];
7
11
  options: never[];
8
12
  group: string;
9
13
  extendedDescription: string;
@@ -44,8 +44,12 @@ function _chalk() {
44
44
  class EnvsUnsetCmd {
45
45
  constructor(workspace) {
46
46
  this.workspace = workspace;
47
- (0, _defineProperty2().default)(this, "name", 'unset <pattern>');
48
- (0, _defineProperty2().default)(this, "description", 'unset an environment from component(s) that was set by "bit env set"');
47
+ (0, _defineProperty2().default)(this, "name", 'unset <component-pattern>');
48
+ (0, _defineProperty2().default)(this, "description", 'un-sets an env from components that were previously set by "bit env set" or by a component template');
49
+ (0, _defineProperty2().default)(this, "arguments", [{
50
+ name: 'component-pattern',
51
+ description: 'component name, component id, or component pattern. use component pattern to select multiple components. \nuse comma to separate patterns and "!" to exclude. e.g. "ui/**, !ui/button"\nwrap the pattern with quotes'
52
+ }]);
49
53
  (0, _defineProperty2().default)(this, "options", []);
50
54
  (0, _defineProperty2().default)(this, "group", 'development');
51
55
  (0, _defineProperty2().default)(this, "extendedDescription", `keep in mind that this doesn't remove envs that are set in the variants.
@@ -1 +1 @@
1
- {"version":3,"names":["EnvsUnsetCmd","constructor","workspace","PATTERN_HELP","report","pattern","componentIds","idsByPattern","changed","unsetEnvFromComponents","length","chalk","yellow","map","id","toString","join"],"sources":["envs-unset.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport { PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport chalk from 'chalk';\nimport { Workspace } from '../workspace';\n\nexport class EnvsUnsetCmd implements Command {\n name = 'unset <pattern>';\n description = 'unset an environment from component(s) that was set by \"bit env set\"';\n options = [];\n group = 'development';\n extendedDescription = `keep in mind that this doesn't remove envs that are set in the variants.\nin only removes envs that appear in the .bitmap file, which were previously configured via \"bit env set\".\nthe purpose of this command is to remove the specific settings and let the the variants in workspace.jsonc to control the env.\n${PATTERN_HELP('env unset')}`;\n\n constructor(private workspace: Workspace) {}\n\n async report([pattern]: [string]) {\n const componentIds = await this.workspace.idsByPattern(pattern);\n const { changed } = await this.workspace.unsetEnvFromComponents(componentIds);\n if (!changed.length) {\n return chalk.yellow(`unable to find any component matching the pattern with env configured in the .bitmap file`);\n }\n return `successfully removed env from the following component(s):\n${changed.map((id) => id.toString()).join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,YAAN,CAAsC;EAU3CC,WAAW,CAASC,SAAT,EAA+B;IAAA,KAAtBA,SAAsB,GAAtBA,SAAsB;IAAA,8CATnC,iBASmC;IAAA,qDAR5B,sEAQ4B;IAAA,iDAPhC,EAOgC;IAAA,+CANlC,aAMkC;IAAA,6DALnB;AACzB;AACA;AACA,EAAE,IAAAC,yBAAA,EAAa,WAAb,CAA0B,EAEgB;EAAE;;EAEhC,MAANC,MAAM,CAAC,CAACC,OAAD,CAAD,EAAsB;IAChC,MAAMC,YAAY,GAAG,MAAM,KAAKJ,SAAL,CAAeK,YAAf,CAA4BF,OAA5B,CAA3B;IACA,MAAM;MAAEG;IAAF,IAAc,MAAM,KAAKN,SAAL,CAAeO,sBAAf,CAAsCH,YAAtC,CAA1B;;IACA,IAAI,CAACE,OAAO,CAACE,MAAb,EAAqB;MACnB,OAAOC,gBAAA,CAAMC,MAAN,CAAc,2FAAd,CAAP;IACD;;IACD,OAAQ;AACZ,EAAEJ,OAAO,CAACK,GAAR,CAAaC,EAAD,IAAQA,EAAE,CAACC,QAAH,EAApB,EAAmCC,IAAnC,CAAwC,IAAxC,CAA8C,EAD5C;EAED;;AApB0C"}
1
+ {"version":3,"names":["EnvsUnsetCmd","constructor","workspace","name","description","PATTERN_HELP","report","pattern","componentIds","idsByPattern","changed","unsetEnvFromComponents","length","chalk","yellow","map","id","toString","join"],"sources":["envs-unset.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport { PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport chalk from 'chalk';\nimport { Workspace } from '../workspace';\n\nexport class EnvsUnsetCmd implements Command {\n name = 'unset <component-pattern>';\n description = 'un-sets an env from components that were previously set by \"bit env set\" or by a component template';\n arguments = [\n {\n name: 'component-pattern',\n description:\n 'component name, component id, or component pattern. use component pattern to select multiple components. \\nuse comma to separate patterns and \"!\" to exclude. e.g. \"ui/**, !ui/button\"\\nwrap the pattern with quotes',\n },\n ];\n options = [];\n group = 'development';\n extendedDescription = `keep in mind that this doesn't remove envs that are set in the variants.\nin only removes envs that appear in the .bitmap file, which were previously configured via \"bit env set\".\nthe purpose of this command is to remove the specific settings and let the the variants in workspace.jsonc to control the env.\n${PATTERN_HELP('env unset')}`;\n\n constructor(private workspace: Workspace) {}\n\n async report([pattern]: [string]) {\n const componentIds = await this.workspace.idsByPattern(pattern);\n const { changed } = await this.workspace.unsetEnvFromComponents(componentIds);\n if (!changed.length) {\n return chalk.yellow(`unable to find any component matching the pattern with env configured in the .bitmap file`);\n }\n return `successfully removed env from the following component(s):\n${changed.map((id) => id.toString()).join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,YAAN,CAAsC;EAiB3CC,WAAW,CAASC,SAAT,EAA+B;IAAA,KAAtBA,SAAsB,GAAtBA,SAAsB;IAAA,8CAhBnC,2BAgBmC;IAAA,qDAf5B,qGAe4B;IAAA,mDAd9B,CACV;MACEC,IAAI,EAAE,mBADR;MAEEC,WAAW,EACT;IAHJ,CADU,CAc8B;IAAA,iDAPhC,EAOgC;IAAA,+CANlC,aAMkC;IAAA,6DALnB;AACzB;AACA;AACA,EAAE,IAAAC,yBAAA,EAAa,WAAb,CAA0B,EAEgB;EAAE;;EAEhC,MAANC,MAAM,CAAC,CAACC,OAAD,CAAD,EAAsB;IAChC,MAAMC,YAAY,GAAG,MAAM,KAAKN,SAAL,CAAeO,YAAf,CAA4BF,OAA5B,CAA3B;IACA,MAAM;MAAEG;IAAF,IAAc,MAAM,KAAKR,SAAL,CAAeS,sBAAf,CAAsCH,YAAtC,CAA1B;;IACA,IAAI,CAACE,OAAO,CAACE,MAAb,EAAqB;MACnB,OAAOC,gBAAA,CAAMC,MAAN,CAAc,2FAAd,CAAP;IACD;;IACD,OAAQ;AACZ,EAAEJ,OAAO,CAACK,GAAR,CAAaC,EAAD,IAAQA,EAAE,CAACC,QAAH,EAApB,EAAmCC,IAAnC,CAAwC,IAAxC,CAA8C,EAD5C;EAED;;AA3B0C"}
@@ -22,6 +22,11 @@ export default class InstallCmd implements Command {
22
22
  private logger;
23
23
  name: string;
24
24
  description: string;
25
+ extendedDescription: string;
26
+ arguments: [{
27
+ name: 'packages...';
28
+ description: 'a list of packages to install (separated by spaces)';
29
+ }];
25
30
  alias: string;
26
31
  group: string;
27
32
  options: CommandOptions;
@@ -44,7 +44,9 @@ class InstallCmd {
44
44
  this.workspace = workspace;
45
45
  this.logger = logger;
46
46
  (0, _defineProperty2().default)(this, "name", 'install [packages...]');
47
- (0, _defineProperty2().default)(this, "description", 'install development workspace dependencies');
47
+ (0, _defineProperty2().default)(this, "description", 'installs workspace dependencies');
48
+ (0, _defineProperty2().default)(this, "extendedDescription", 'when no package is specified, all workspace dependencies are installed and all workspace components are imported.');
49
+ (0, _defineProperty2().default)(this, "arguments", void 0);
48
50
  (0, _defineProperty2().default)(this, "alias", 'in');
49
51
  (0, _defineProperty2().default)(this, "group", 'development');
50
52
  (0, _defineProperty2().default)(this, "options", [['v', 'variants <variants>', 'add packages to specific variants'], ['t', 'type [lifecycleType]', '"runtime" (default) or "peer" (dev is not a valid option)'], ['u', 'update-existing [updateExisting]', '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'], ['', 'add-missing-peers [addMissingPeers]', 'install all missing peer dependencies']]);
@@ -1 +1 @@
1
- {"version":3,"names":["InstallCmd","constructor","workspace","logger","report","packages","options","startTime","Date","now","console","chalk","cyan","name","installOpts","variants","lifecycleType","addMissingPeers","type","dedupe","skipDedupe","import","skipImport","updateExisting","savePrefix","components","install","endTime","executionTime","calculateTime","toArray","length","toString","diff"],"sources":["install.cmd.tsx"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { WorkspaceDependencyLifecycleType } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport chalk from 'chalk';\n\nimport { Workspace, WorkspaceInstallOptions } from './workspace';\n\ntype InstallCmdOptions = {\n variants: string;\n type: WorkspaceDependencyLifecycleType;\n skipDedupe: boolean;\n skipImport: boolean;\n updateExisting: boolean;\n savePrefix: string;\n addMissingPeers: boolean;\n};\n\nexport default class InstallCmd implements Command {\n name = 'install [packages...]';\n description = 'install development workspace dependencies';\n alias = 'in';\n group = 'development';\n options = [\n ['v', 'variants <variants>', 'add packages to specific variants'],\n ['t', 'type [lifecycleType]', '\"runtime\" (default) or \"peer\" (dev is not a valid option)'],\n ['u', 'update-existing [updateExisting]', 'update existing dependencies version and types'],\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 ['', 'add-missing-peers [addMissingPeers]', 'install all missing peer dependencies'],\n ] as CommandOptions;\n\n constructor(\n /**\n * workspace extension.\n */\n private workspace: Workspace,\n\n /**\n * logger extension.\n */\n private logger: Logger\n ) {}\n\n async report([packages = []]: [string[]], options: InstallCmdOptions) {\n const startTime = Date.now();\n this.logger.console(`Resolving component dependencies for workspace: '${chalk.cyan(this.workspace.name)}'`);\n const installOpts: WorkspaceInstallOptions = {\n variants: options.variants,\n lifecycleType: options.addMissingPeers ? 'peer' : options.type,\n dedupe: !options.skipDedupe,\n import: !options.skipImport,\n updateExisting: options.updateExisting,\n savePrefix: options.savePrefix,\n addMissingPeers: options.addMissingPeers,\n };\n const components = await this.workspace.install(packages, installOpts);\n const endTime = Date.now();\n const executionTime = calculateTime(startTime, endTime);\n return `Successfully resolved dependencies for ${chalk.cyan(\n components.toArray().length.toString()\n )} component(s) in ${chalk.cyan(executionTime.toString())} seconds`;\n }\n}\n\nfunction calculateTime(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AAM,EAAE,CAACf,OAAO,CAACgB,UAJ0B;MAK3CC,cAAc,EAAEjB,OAAO,CAACiB,cALmB;MAM3CC,UAAU,EAAElB,OAAO,CAACkB,UANuB;MAO3CP,eAAe,EAAEX,OAAO,CAACW;IAPkB,CAA7C;IASA,MAAMQ,UAAU,GAAG,MAAM,KAAKvB,SAAL,CAAewB,OAAf,CAAuBrB,QAAvB,EAAiCS,WAAjC,CAAzB;IACA,MAAMa,OAAO,GAAGnB,IAAI,CAACC,GAAL,EAAhB;IACA,MAAMmB,aAAa,GAAGC,aAAa,CAACtB,SAAD,EAAYoB,OAAZ,CAAnC;IACA,OAAQ,0CAAyChB,gBAAA,CAAMC,IAAN,CAC/Ca,UAAU,CAACK,OAAX,GAAqBC,MAArB,CAA4BC,QAA5B,EAD+C,CAE/C,oBAAmBrB,gBAAA,CAAMC,IAAN,CAAWgB,aAAa,CAACI,QAAd,EAAX,CAAqC,UAF1D;EAGD;;AA7CgD;;;;AAgDnD,SAASH,aAAT,CAAuBtB,SAAvB,EAA0CoB,OAA1C,EAA2D;EACzD,MAAMM,IAAI,GAAGN,OAAO,GAAGpB,SAAvB;EACA,OAAO0B,IAAI,GAAG,IAAd;AACD"}
1
+ {"version":3,"names":["InstallCmd","constructor","workspace","logger","report","packages","options","startTime","Date","now","console","chalk","cyan","name","installOpts","variants","lifecycleType","addMissingPeers","type","dedupe","skipDedupe","import","skipImport","updateExisting","savePrefix","components","install","endTime","executionTime","calculateTime","toArray","length","toString","diff"],"sources":["install.cmd.tsx"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { WorkspaceDependencyLifecycleType } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport chalk from 'chalk';\n\nimport { Workspace, WorkspaceInstallOptions } from './workspace';\n\ntype InstallCmdOptions = {\n variants: string;\n type: WorkspaceDependencyLifecycleType;\n skipDedupe: boolean;\n skipImport: boolean;\n updateExisting: boolean;\n savePrefix: string;\n addMissingPeers: boolean;\n};\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 arguments: [{ name: 'packages...'; description: 'a list of packages to install (separated by spaces)' }];\n alias = 'in';\n group = 'development';\n options = [\n ['v', 'variants <variants>', 'add packages to specific variants'],\n ['t', 'type [lifecycleType]', '\"runtime\" (default) or \"peer\" (dev is not a valid option)'],\n ['u', 'update-existing [updateExisting]', 'update existing dependencies version and types'],\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 ['', 'add-missing-peers [addMissingPeers]', 'install all missing peer dependencies'],\n ] as CommandOptions;\n\n constructor(\n /**\n * workspace extension.\n */\n private workspace: Workspace,\n\n /**\n * logger extension.\n */\n private logger: Logger\n ) {}\n\n async report([packages = []]: [string[]], options: InstallCmdOptions) {\n const startTime = Date.now();\n this.logger.console(`Resolving component dependencies for workspace: '${chalk.cyan(this.workspace.name)}'`);\n const installOpts: WorkspaceInstallOptions = {\n variants: options.variants,\n lifecycleType: options.addMissingPeers ? 'peer' : options.type,\n dedupe: !options.skipDedupe,\n import: !options.skipImport,\n updateExisting: options.updateExisting,\n savePrefix: options.savePrefix,\n addMissingPeers: options.addMissingPeers,\n };\n const components = await this.workspace.install(packages, installOpts);\n const endTime = Date.now();\n const executionTime = calculateTime(startTime, endTime);\n return `Successfully resolved dependencies for ${chalk.cyan(\n components.toArray().length.toString()\n )} component(s) in ${chalk.cyan(executionTime.toString())} seconds`;\n }\n}\n\nfunction calculateTime(startTime: number, endTime: number) {\n const diff = endTime - startTime;\n return diff / 1000;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAce,MAAMA,UAAN,CAAoC;EAkBjDC,WAAW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X,OAAO,CAACW;IAPkB,CAA7C;IASA,MAAMQ,UAAU,GAAG,MAAM,KAAKvB,SAAL,CAAewB,OAAf,CAAuBrB,QAAvB,EAAiCS,WAAjC,CAAzB;IACA,MAAMa,OAAO,GAAGnB,IAAI,CAACC,GAAL,EAAhB;IACA,MAAMmB,aAAa,GAAGC,aAAa,CAACtB,SAAD,EAAYoB,OAAZ,CAAnC;IACA,OAAQ,0CAAyChB,gBAAA,CAAMC,IAAN,CAC/Ca,UAAU,CAACK,OAAX,GAAqBC,MAArB,CAA4BC,QAA5B,EAD+C,CAE/C,oBAAmBrB,gBAAA,CAAMC,IAAN,CAAWgB,aAAa,CAACI,QAAd,EAAX,CAAqC,UAF1D;EAGD;;AAhDgD;;;;AAmDnD,SAASH,aAAT,CAAuBtB,SAAvB,EAA0CoB,OAA1C,EAA2D;EACzD,MAAMM,IAAI,GAAGN,OAAO,GAAGpB,SAAvB;EACA,OAAO0B,IAAI,GAAG,IAAd;AACD"}
@@ -102,10 +102,16 @@ ${_chalk().default.red('Red')} - indicates a semantically breaking change`,
102
102
 
103
103
  k() {
104
104
  return this.up();
105
+ },
106
+
107
+ result(names) {
108
+ // This is needed in order to have the values of the choices in the answer object.
109
+ // Otherwise, only the names of the selected choices would've been included.
110
+ return this.map(names);
105
111
  }
106
112
 
107
113
  });
108
- return updateDependencies.filter(updateDependency => typeof updateDependency !== 'string');
114
+ return Object.values(updateDependencies !== null && updateDependencies !== void 0 ? updateDependencies : {}).filter(updateDependency => typeof updateDependency !== 'string');
109
115
  }
110
116
 
111
117
  const DEP_TYPE_PRIORITY = {
@@ -133,7 +139,8 @@ function makeOutdatedPkgChoices(outdatedPkgs) {
133
139
 
134
140
  groupedChoices[context].push({
135
141
  message: renderedTable[index],
136
- name: outdatedPkg
142
+ name: outdatedPkg.name,
143
+ value: outdatedPkg
137
144
  });
138
145
  });
139
146
  const choices = Object.entries(groupedChoices).map(([context, subChoices]) => ({
@@ -1 +1 @@
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","filter","updateDependency","DEP_TYPE_PRIORITY","dependencies","devDependencies","peerDependencies","sort","pkg1","pkg2","targetField","localeCompare","renderedTable","alignColumns","outdatedPkgsRows","groupedChoices","forEach","outdatedPkg","index","context","renderContext","push","Object","entries","map","subChoices","variantPattern","componentId","TARGET_FIELD_TO_DEP_TYPE","change","diff","semverDiff","currentRange","latestRange","colorizeChange","latest","colorizeSemverDiff","grey","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 { getBorderCharacters, table } from 'table';\nimport chalk from 'chalk';\nimport { prompt } from 'enquirer';\n\n/**\n * Lets the user pick the packages that should be updated.\n */\nexport async function pickOutdatedPkgs(outdatedPkgs: OutdatedPkg[]): Promise<OutdatedPkg[]> {\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 } as any)) as { updateDependencies: Array<string | OutdatedPkg> };\n return updateDependencies.filter((updateDependency) => typeof updateDependency !== 'string') 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 outdatedPkgs.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(outdatedPkgs));\n const groupedChoices = {};\n outdatedPkgs.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,\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\nfunction renderContext(outdatedPkg: OutdatedPkg) {\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: OutdatedPkg[]) {\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.currentRange,\n '❯',\n latest,\n ];\n });\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;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;AACA;AACA;AACO,eAAeA,gBAAf,CAAgCC,YAAhC,EAAqF;EAC1F,MAAM;IAAEC;EAAF,IAA0B,MAAM,IAAAC,kBAAA,EAAO;IAC3CC,OAAO,EAAEC,sBAAsB,CAACJ,YAAD,CADY;IAE3CK,MAAM,EAAE,8CAFmC;IAG3CC,SAAS,EAAE,CAACC,KAAD,EAAaC,MAAb,KAA8B,IAAGA,MAAM,CAACC,OAAP,GAAiB,GAAjB,GAAuB,GAAI,EAH5B;IAI3CC,OAAO,EACL,qCACC,UAASC,gBAAA,CAAMC,IAAN,CAAW,SAAX,CAAsB,cADhC,GAEC,GAAED,gBAAA,CAAMC,IAAN,CAAW,KAAX,CAAkB,kBAFrB,GAGC,GAAED,gBAAA,CAAMC,IAAN,CAAW,KAAX,CAAkB;AAC3B,EAAED,gBAAA,CAAME,KAAN,CAAY,OAAZ,CAAqB;AACvB,EAAEF,gBAAA,CAAMG,GAAN,CAAU,KAAV,CAAiB,6CAV4B;IAW3CC,IAAI,EAAE,oBAXqC;IAY3CC,OAAO,EAAE,GAZkC;IAa3CC,MAAM,EAAE;MACNC,IAAI,E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AAIA,MAAM,KAAK,SAAf,EAA0B;MACxBK,cAAc,GAAG,KAAjB;IACD;;IACD,MAAMC,MAAM,GAAG,IAAAC,6BAAA,EAAmB;MAChCP,MAAM,EAAEK,cADwB;MAEhCJ;IAFgC,CAAnB,CAAf;IAIA,OAAO,CACLb,WAAW,CAACjC,IADP,EAELJ,gBAAA,CAAMyD,IAAN,CAAY,IAAGT,wBAAwB,CAACX,WAAW,CAACP,WAAb,CAA0B,GAAjE,CAFK,EAGLO,WAAW,CAACe,YAHP,EAIL,GAJK,EAKLG,MALK,CAAP;EAOD,CAjBM,CAAP;AAkBD;;AAED,SAAStB,YAAT,CAAsByB,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
+ {"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","Object","values","filter","updateDependency","DEP_TYPE_PRIORITY","dependencies","devDependencies","peerDependencies","sort","pkg1","pkg2","targetField","localeCompare","renderedTable","alignColumns","outdatedPkgsRows","groupedChoices","forEach","outdatedPkg","index","context","renderContext","push","entries","subChoices","variantPattern","componentId","TARGET_FIELD_TO_DEP_TYPE","change","diff","semverDiff","currentRange","latestRange","colorizeChange","latest","colorizeSemverDiff","grey","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 { getBorderCharacters, table } from 'table';\nimport chalk from 'chalk';\nimport { prompt } from 'enquirer';\n\n/**\n * Lets the user pick the packages that should be updated.\n */\nexport async function pickOutdatedPkgs(outdatedPkgs: OutdatedPkg[]): Promise<OutdatedPkg[]> {\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 } as any)) as { updateDependencies: Record<string, string | OutdatedPkg> };\n return Object.values(updateDependencies ?? {})\n .filter((updateDependency) => typeof updateDependency !== 'string') 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 outdatedPkgs.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(outdatedPkgs));\n const groupedChoices = {};\n outdatedPkgs.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\nfunction renderContext(outdatedPkg: OutdatedPkg) {\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: OutdatedPkg[]) {\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.currentRange,\n '❯',\n latest,\n ];\n });\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;;EAA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EK,cADwB;MAEhCJ;IAFgC,CAAnB,CAAf;IAIA,OAAO,CACLX,WAAW,CAACtC,IADP,EAELJ,gBAAA,CAAM4D,IAAN,CAAY,IAAGT,wBAAwB,CAACT,WAAW,CAACP,WAAb,CAA0B,GAAjE,CAFK,EAGLO,WAAW,CAACa,YAHP,EAIL,GAJK,EAKLG,MALK,CAAP;EAOD,CAjBM,CAAP;AAkBD;;AAED,SAASpB,YAAT,CAAsBuB,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"}
@@ -4,6 +4,10 @@ export declare class ScopeSetCmd implements Command {
4
4
  private workspace;
5
5
  name: string;
6
6
  description: string;
7
+ arguments: {
8
+ name: string;
9
+ description: string;
10
+ }[];
7
11
  options: never[];
8
12
  group: string;
9
13
  extendedDescription: string;
@@ -44,12 +44,18 @@ function _chalk() {
44
44
  class ScopeSetCmd {
45
45
  constructor(workspace) {
46
46
  this.workspace = workspace;
47
- (0, _defineProperty2().default)(this, "name", 'set <scope-name> [pattern]');
48
- (0, _defineProperty2().default)(this, "description", 'set the default-scope');
47
+ (0, _defineProperty2().default)(this, "name", 'set <scope-name> [component-pattern]');
48
+ (0, _defineProperty2().default)(this, "description", 'Sets components with a default-scope. If no component is specified, sets the workspace with a default scope');
49
+ (0, _defineProperty2().default)(this, "arguments", [{
50
+ name: 'scope-name',
51
+ description: 'the scope name to use as the default scope'
52
+ }, {
53
+ name: 'component-pattern',
54
+ description: 'component name, component id, or component pattern. use component pattern to select multiple components. \nuse comma to separate patterns and "!" to exclude. e.g. "ui/**, !ui/button"\nwrap the pattern with quotes'
55
+ }]);
49
56
  (0, _defineProperty2().default)(this, "options", []);
50
57
  (0, _defineProperty2().default)(this, "group", 'development');
51
- (0, _defineProperty2().default)(this, "extendedDescription", `set a new scope in the workspace.jsonc.
52
- if "pattern" is provided, the default-scope will be set to the new components matching the criteria.
58
+ (0, _defineProperty2().default)(this, "extendedDescription", `default scopes for components are set in the bitmap file. the default scope for a workspace is set in the workspace.jsonc. a component is set with a scope (as oppose to default scope) only once it is versioned.'
53
59
 
54
60
  ${(0, _constants().PATTERN_HELP)('scope set scope-name')}`);
55
61
  }
@@ -1 +1 @@
1
- {"version":3,"names":["ScopeSetCmd","constructor","workspace","PATTERN_HELP","report","scopeName","pattern","componentsIds","idsByPattern","changedIds","setDefaultScopeToComponents","chalk","green","bold","reset","map","id","toString","join","oldScope","defaultScope","setDefaultScope"],"sources":["scope-set.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport { PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport chalk from 'chalk';\nimport { Workspace } from '../workspace';\n\nexport class ScopeSetCmd implements Command {\n name = 'set <scope-name> [pattern]';\n description = 'set the default-scope';\n options = [];\n group = 'development';\n extendedDescription = `set a new scope in the workspace.jsonc.\nif \"pattern\" is provided, the default-scope will be set to the new components matching the criteria.\n\n${PATTERN_HELP('scope set scope-name')}`;\n\n constructor(private workspace: Workspace) {}\n\n async report([scopeName, pattern]: [string, string]) {\n if (pattern) {\n const componentsIds = await this.workspace.idsByPattern(pattern);\n const changedIds = await this.workspace.setDefaultScopeToComponents(componentsIds, scopeName);\n return chalk.green(`successfully set ${chalk.bold(scopeName)} as the default-scope for the following component(s):\n ${chalk.reset(changedIds.map((id) => id.toString()).join('\\n'))}`);\n }\n const oldScope = this.workspace.defaultScope;\n await this.workspace.setDefaultScope(scopeName);\n return chalk.green(\n `successfully set the default-scope to ${chalk.bold(scopeName)}. (previous scope was \"${oldScope}\")`\n );\n }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eName","pattern","componentsIds","idsByPattern","changedIds","setDefaultScopeToComponents","chalk","green","bold","reset","map","id","toString","join","oldScope","defaultScope","setDefaultScope"],"sources":["scope-set.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport { PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport chalk from 'chalk';\nimport { Workspace } from '../workspace';\n\nexport class ScopeSetCmd implements Command {\n name = 'set <scope-name> [component-pattern]';\n description =\n 'Sets components with a default-scope. If no component is specified, sets the workspace with a default scope';\n arguments = [\n { name: 'scope-name', description: 'the scope name to use as the default scope' },\n {\n name: 'component-pattern',\n description:\n 'component name, component id, or component pattern. use component pattern to select multiple components. \\nuse comma to separate patterns and \"!\" to exclude. e.g. \"ui/**, !ui/button\"\\nwrap the pattern with quotes',\n },\n ];\n options = [];\n group = 'development';\n extendedDescription = `default scopes for components are set in the bitmap file. the default scope for a workspace is set in the workspace.jsonc. a component is set with a scope (as oppose to default scope) only once it is versioned.'\n\n${PATTERN_HELP('scope set scope-name')}`;\n\n constructor(private workspace: Workspace) {}\n\n async report([scopeName, pattern]: [string, string]) {\n if (pattern) {\n const componentsIds = await this.workspace.idsByPattern(pattern);\n const changedIds = await this.workspace.setDefaultScopeToComponents(componentsIds, scopeName);\n return chalk.green(`successfully set ${chalk.bold(scopeName)} as the default-scope for the following component(s):\n ${chalk.reset(changedIds.map((id) => id.toString()).join('\\n'))}`);\n }\n const oldScope = this.workspace.defaultScope;\n await this.workspace.setDefaultScope(scopeName);\n return chalk.green(\n `successfully set the default-scope to ${chalk.bold(scopeName)}. (previous scope was \"${oldScope}\")`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,WAAN,CAAqC;EAkB1CC,WAAW,CAASC,SAAT,EAA+B;IAAA,KAAtBA,SAAsB,GAAtBA,SAAsB;IAAA,8CAjBnC,sCAiBmC;IAAA,qDAfxC,6GAewC;IAAA,mDAd9B,CACV;MAAEC,IAAI,EAAE,YAAR;MAAsBC,WAAW,EAAE;IAAnC,CADU,EAEV;MACED,IAAI,EAAE,mBADR;MAEEC,WAAW,EACT;IAHJ,CAFU,CAc8B;IAAA,iDANhC,EAMgC;IAAA,+CALlC,aAKkC;IAAA,6DAJnB;AACzB;AACA,EAAE,IAAAC,yBAAA,EAAa,sBAAb,CAAqC,EAEK;EAAE;;EAEhC,MAANC,MAAM,CAAC,CAACC,SAAD,EAAYC,OAAZ,CAAD,EAAyC;IACnD,IAAIA,OAAJ,EAAa;MACX,MAAMC,aAAa,GAAG,MAAM,KAAKP,SAAL,CAAeQ,YAAf,CAA4BF,OAA5B,CAA5B;MACA,MAAMG,UAAU,GAAG,MAAM,KAAKT,SAAL,CAAeU,2BAAf,CAA2CH,aAA3C,EAA0DF,SAA1D,CAAzB;MACA,OAAOM,gBAAA,CAAMC,KAAN,CAAa,oBAAmBD,gBAAA,CAAME,IAAN,CAAWR,SAAX,CAAsB;AACnE,IAAIM,gBAAA,CAAMG,KAAN,CAAYL,UAAU,CAACM,GAAX,CAAgBC,EAAD,IAAQA,EAAE,CAACC,QAAH,EAAvB,EAAsCC,IAAtC,CAA2C,IAA3C,CAAZ,CAA8D,EADrD,CAAP;IAED;;IACD,MAAMC,QAAQ,GAAG,KAAKnB,SAAL,CAAeoB,YAAhC;IACA,MAAM,KAAKpB,SAAL,CAAeqB,eAAf,CAA+BhB,SAA/B,CAAN;IACA,OAAOM,gBAAA,CAAMC,KAAN,CACJ,yCAAwCD,gBAAA,CAAME,IAAN,CAAWR,SAAX,CAAsB,0BAAyBc,QAAS,IAD5F,CAAP;EAGD;;AAhCyC"}
@@ -3,18 +3,18 @@ import chalk from 'chalk';
3
3
  import { Workspace } from '../workspace';
4
4
 
5
5
  export class EnvsReplaceCmd implements Command {
6
- name = 'replace <old-env> <new-env>';
6
+ name = 'replace <current-env> <new-env>';
7
7
  description = 'replace an existing env with another env for all components using the old env';
8
8
  options = [];
9
9
  group = 'development';
10
10
  arguments = [
11
- { name: 'old-env', description: 'current environment id' },
12
- { name: 'new-env', description: 'target environment id' },
11
+ { name: 'current-env', description: 'the component id of the current env' },
12
+ { name: 'new-env', description: 'the component id of the new env' },
13
13
  ];
14
14
  examples = [
15
15
  {
16
16
  cmd: 'replace teambit.harmony/aspect teambit.harmony/node',
17
- description: 'all components using aspect env, will be replaced with node env',
17
+ description: "components configured to use the 'aspect' env will be configured to use the 'node' env, instead",
18
18
  },
19
19
  ];
20
20
 
@@ -1,14 +1,38 @@
1
1
  import { Command } from '@teambit/cli';
2
2
  import chalk from 'chalk';
3
- import { PATTERN_HELP } from '@teambit/legacy/dist/constants';
4
3
  import { Workspace } from '../workspace';
5
4
 
6
5
  export class EnvsSetCmd implements Command {
7
- name = 'set <pattern> <env>';
8
- description = 'set an environment for component(s)';
6
+ name = 'set <component-pattern> <env>';
7
+ description = 'Sets one or more components with a development environment (env)';
8
+ arguments = [
9
+ {
10
+ name: 'component-pattern',
11
+ description:
12
+ 'component name, component id, or component pattern. use component pattern to select multiple components. \nuse commas to separate patterns and "!" to exclude. e.g. "ui/**, !ui/button"\nwrap the pattern with quotes',
13
+ },
14
+ {
15
+ name: 'env',
16
+ description:
17
+ "the env's component id (include version for non-core envs. e.g, `teambit.community/envs/community-react@1.95.13`)",
18
+ },
19
+ ];
20
+ examples = [
21
+ {
22
+ cmd: 'set ui/button teambit.react/react',
23
+ description: "configures 'ui/button' to use the 'teambit.react/react' env",
24
+ },
25
+ {
26
+ cmd: 'set ui/button teambit.community/envs/community-mdx@1.95.16',
27
+ description: "configures 'ui/button' to use the (non-core) 'teambit.community/envs/community-mdx@1.95.16' env",
28
+ },
29
+ {
30
+ cmd: 'set "ui/**" teambit.react/react',
31
+ description: "configures all components that have the 'ui' namespace to use the teambit.react/react env",
32
+ },
33
+ ];
9
34
  options = [];
10
35
  group = 'development';
11
- extendedDescription = `${PATTERN_HELP('env set')}`;
12
36
 
13
37
  constructor(private workspace: Workspace) {}
14
38
 
@@ -4,8 +4,15 @@ import chalk from 'chalk';
4
4
  import { Workspace } from '../workspace';
5
5
 
6
6
  export class EnvsUnsetCmd implements Command {
7
- name = 'unset <pattern>';
8
- description = 'unset an environment from component(s) that was set by "bit env set"';
7
+ name = 'unset <component-pattern>';
8
+ description = 'un-sets an env from components that were previously set by "bit env set" or by a component template';
9
+ arguments = [
10
+ {
11
+ name: 'component-pattern',
12
+ description:
13
+ 'component name, component id, or component pattern. use component pattern to select multiple components. \nuse comma to separate patterns and "!" to exclude. e.g. "ui/**, !ui/button"\nwrap the pattern with quotes',
14
+ },
15
+ ];
9
16
  options = [];
10
17
  group = 'development';
11
18
  extendedDescription = `keep in mind that this doesn't remove envs that are set in the variants.
package/install.cmd.tsx CHANGED
@@ -17,7 +17,10 @@ type InstallCmdOptions = {
17
17
 
18
18
  export default class InstallCmd implements Command {
19
19
  name = 'install [packages...]';
20
- description = 'install development workspace dependencies';
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)' }];
21
24
  alias = 'in';
22
25
  group = 'development';
23
26
  options = [
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace",
3
- "version": "0.0.758",
3
+ "version": "0.0.761",
4
4
  "homepage": "https://bit.dev/teambit/workspace/workspace",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.workspace",
8
8
  "name": "workspace",
9
- "version": "0.0.758"
9
+ "version": "0.0.761"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -40,46 +40,46 @@
40
40
  "@teambit/bit-error": "0.0.394",
41
41
  "@teambit/component-id": "0.0.402",
42
42
  "@teambit/legacy-bit-id": "0.0.399",
43
- "@teambit/logger": "0.0.594",
44
- "@teambit/scope": "0.0.758",
45
- "@teambit/cli": "0.0.501",
46
- "@teambit/isolator": "0.0.758",
47
- "@teambit/component-tree": "0.0.546",
43
+ "@teambit/logger": "0.0.596",
44
+ "@teambit/scope": "0.0.761",
45
+ "@teambit/cli": "0.0.503",
46
+ "@teambit/isolator": "0.0.761",
47
+ "@teambit/component-tree": "0.0.549",
48
48
  "@teambit/component.ui.component-status-resolver": "0.0.492",
49
- "@teambit/lanes.ui.lanes": "0.0.68",
49
+ "@teambit/lanes.ui.lanes": "0.0.70",
50
50
  "@teambit/harmony.modules.resolved-component": "0.0.484",
51
- "@teambit/dependency-resolver": "0.0.758",
52
- "@teambit/compiler": "0.0.758",
53
- "@teambit/component": "0.0.758",
54
- "@teambit/graphql": "0.0.758",
55
- "@teambit/aspect-loader": "0.0.758",
56
- "@teambit/bundler": "0.0.758",
57
- "@teambit/community": "0.0.49",
58
- "@teambit/envs": "0.0.758",
59
- "@teambit/pubsub": "0.0.758",
60
- "@teambit/ui": "0.0.758",
61
- "@teambit/variants": "0.0.597",
51
+ "@teambit/dependency-resolver": "0.0.761",
52
+ "@teambit/compiler": "0.0.761",
53
+ "@teambit/component": "0.0.761",
54
+ "@teambit/graphql": "0.0.761",
55
+ "@teambit/aspect-loader": "0.0.761",
56
+ "@teambit/bundler": "0.0.761",
57
+ "@teambit/community": "0.0.51",
58
+ "@teambit/envs": "0.0.761",
59
+ "@teambit/pubsub": "0.0.761",
60
+ "@teambit/ui": "0.0.761",
61
+ "@teambit/variants": "0.0.599",
62
62
  "@teambit/component-issues": "0.0.54",
63
- "@teambit/config": "0.0.514",
63
+ "@teambit/config": "0.0.516",
64
64
  "@teambit/harmony.modules.requireable-component": "0.0.484",
65
- "@teambit/importer": "0.0.187",
66
- "@teambit/lane-id": "0.0.20",
65
+ "@teambit/importer": "0.0.190",
66
+ "@teambit/lane-id": "0.0.22",
67
67
  "@teambit/workspace.modules.match-pattern": "0.0.489",
68
- "@teambit/component.ui.component-drawer": "0.0.47",
68
+ "@teambit/component.ui.component-drawer": "0.0.49",
69
69
  "@teambit/design.ui.tree": "0.0.5",
70
- "@teambit/ui-foundation.ui.side-bar": "0.0.565",
71
- "@teambit/command-bar": "0.0.758",
70
+ "@teambit/ui-foundation.ui.side-bar": "0.0.567",
71
+ "@teambit/command-bar": "0.0.761",
72
72
  "@teambit/component.ui.component-filters": "0.0.5",
73
- "@teambit/graph": "0.0.758",
74
- "@teambit/sidebar": "0.0.758",
73
+ "@teambit/graph": "0.0.761",
74
+ "@teambit/sidebar": "0.0.761",
75
75
  "@teambit/ui-foundation.ui.main-dropdown": "0.0.487",
76
76
  "@teambit/ui-foundation.ui.menu": "0.0.487",
77
77
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.490",
78
78
  "@teambit/ui-foundation.ui.tree.drawer": "0.0.499",
79
79
  "@teambit/toolbox.time.time-format": "0.0.483",
80
80
  "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.487",
81
- "@teambit/component-descriptor": "0.0.63",
82
- "@teambit/deprecation": "0.0.758",
81
+ "@teambit/component-descriptor": "0.0.65",
82
+ "@teambit/deprecation": "0.0.761",
83
83
  "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.487",
84
84
  "@teambit/ui-foundation.ui.buttons.collapser": "0.0.194",
85
85
  "@teambit/ui-foundation.ui.corner": "0.0.498",
@@ -106,7 +106,7 @@
106
106
  "peerDependencies": {
107
107
  "react-router-dom": "^6.0.0",
108
108
  "@apollo/client": "^3.0.0",
109
- "@teambit/legacy": "1.0.281",
109
+ "@teambit/legacy": "1.0.283",
110
110
  "react-dom": "^16.8.0 || ^17.0.0",
111
111
  "react": "^16.8.0 || ^17.0.0"
112
112
  },
@@ -134,7 +134,7 @@
134
134
  "react": "-"
135
135
  },
136
136
  "peerDependencies": {
137
- "@teambit/legacy": "1.0.281",
137
+ "@teambit/legacy": "1.0.283",
138
138
  "react-dom": "^16.8.0 || ^17.0.0",
139
139
  "react": "^16.8.0 || ^17.0.0"
140
140
  }
@@ -1,2 +1,2 @@
1
- export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.758/dist/workspace.composition.js')]
2
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.758/dist/workspace.docs.mdx')]
1
+ export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.761/dist/workspace.composition.js')]
2
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.761/dist/workspace.docs.mdx')]
@@ -4,12 +4,20 @@ import chalk from 'chalk';
4
4
  import { Workspace } from '../workspace';
5
5
 
6
6
  export class ScopeSetCmd implements Command {
7
- name = 'set <scope-name> [pattern]';
8
- description = 'set the default-scope';
7
+ name = 'set <scope-name> [component-pattern]';
8
+ description =
9
+ 'Sets components with a default-scope. If no component is specified, sets the workspace with a default scope';
10
+ arguments = [
11
+ { name: 'scope-name', description: 'the scope name to use as the default scope' },
12
+ {
13
+ name: 'component-pattern',
14
+ description:
15
+ 'component name, component id, or component pattern. use component pattern to select multiple components. \nuse comma to separate patterns and "!" to exclude. e.g. "ui/**, !ui/button"\nwrap the pattern with quotes',
16
+ },
17
+ ];
9
18
  options = [];
10
19
  group = 'development';
11
- extendedDescription = `set a new scope in the workspace.jsonc.
12
- if "pattern" is provided, the default-scope will be set to the new components matching the criteria.
20
+ extendedDescription = `default scopes for components are set in the bitmap file. the default scope for a workspace is set in the workspace.jsonc. a component is set with a scope (as oppose to default scope) only once it is versioned.'
13
21
 
14
22
  ${PATTERN_HELP('scope set scope-name')}`;
15
23