@teambit/workspace 0.0.1133 → 0.0.1134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eject-conf.cmd.js +3 -3
- package/dist/eject-conf.cmd.js.map +1 -1
- package/dist/envs-subcommands/envs-replace.cmd.js +1 -1
- package/dist/envs-subcommands/envs-replace.cmd.js.map +1 -1
- package/dist/envs-subcommands/envs-set.cmd.js +8 -8
- package/dist/envs-subcommands/envs-set.cmd.js.map +1 -1
- package/dist/envs-subcommands/envs-unset.cmd.js +5 -5
- package/dist/envs-subcommands/envs-unset.cmd.js.map +1 -1
- package/dist/envs-subcommands/envs-update.cmd.js +13 -6
- package/dist/envs-subcommands/envs-update.cmd.js.map +1 -1
- package/dist/pattern.cmd.js +3 -3
- package/dist/pattern.cmd.js.map +1 -1
- package/dist/{preview-1692155876143.js → preview-1692297727886.js} +2 -2
- package/dist/scope-subcommands/scope-set.cmd.js +5 -5
- package/dist/scope-subcommands/scope-set.cmd.js.map +1 -1
- package/dist/workspace.d.ts +8 -6
- package/dist/workspace.js +10 -7
- package/dist/workspace.js.map +1 -1
- package/envs-subcommands/envs-replace.cmd.ts +1 -1
- package/envs-subcommands/envs-set.cmd.ts +9 -8
- package/envs-subcommands/envs-unset.cmd.ts +6 -7
- package/envs-subcommands/envs-update.cmd.ts +7 -7
- package/package-tar/teambit-workspace-0.0.1134.tgz +0 -0
- package/package.json +36 -36
- package/scope-subcommands/scope-set.cmd.ts +6 -7
- package/package-tar/teambit-workspace-0.0.1133.tgz +0 -0
package/dist/eject-conf.cmd.js
CHANGED
|
@@ -42,15 +42,15 @@ class EjectConfCmd {
|
|
|
42
42
|
this.workspace = workspace;
|
|
43
43
|
(0, _defineProperty2().default)(this, "name", 'eject-conf <pattern>');
|
|
44
44
|
(0, _defineProperty2().default)(this, "description", 'eject components configuration (create a `component.json` file)');
|
|
45
|
-
(0, _defineProperty2().default)(this, "extendedDescription",
|
|
45
|
+
(0, _defineProperty2().default)(this, "extendedDescription", `note this can be reversed at any time by snapping/tagging changes and deleting the component.json file \n${(0, _constants().PATTERN_HELP)('eject-conf')}`);
|
|
46
46
|
(0, _defineProperty2().default)(this, "alias", '');
|
|
47
47
|
(0, _defineProperty2().default)(this, "group", 'development');
|
|
48
|
-
(0, _defineProperty2().default)(this, "options", [['p', 'propagate', 'mark propagate true in the config file'], ['o', 'override', 'override file if exist']]);
|
|
48
|
+
(0, _defineProperty2().default)(this, "options", [['p', 'propagate', 'mark propagate true in the config file, so that component.json configs will be merge with workspace configs'], ['o', 'override', 'override file if exist']]);
|
|
49
49
|
}
|
|
50
50
|
async report(args, options) {
|
|
51
51
|
const ejectResult = await this.json(args, options);
|
|
52
52
|
const paths = ejectResult.map(result => result.configPath).map(p => _path().default.relative(this.workspace.path, p)).join('\n');
|
|
53
|
-
return _chalk().default.green(`successfully ejected config
|
|
53
|
+
return _chalk().default.green(`successfully ejected config to the following path(s)
|
|
54
54
|
${_chalk().default.bold(paths)}`);
|
|
55
55
|
}
|
|
56
56
|
async json([pattern], options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_path","data","_interopRequireDefault","require","_chalk","_constants","EjectConfCmd","constructor","workspace","_defineProperty2","default","PATTERN_HELP","report","args","options","ejectResult","json","paths","map","result","configPath","p","path","relative","join","chalk","green","bold","pattern","ejectOptions","propagate","override","componentIds","idsByPattern","results","ejectMultipleConfigs","exports"],"sources":["eject-conf.cmd.ts"],"sourcesContent":["import path from 'path';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { PATTERN_HELP } from '@teambit/legacy/dist/constants';\n\nimport { EjectConfOptions, EjectConfResult, Workspace } from './workspace';\n\ntype EjectConfArgs = [string];\n// From the cli we might get those as string in case we run it like --propagate true (return string) as opposed to only --propagate\ntype EjectConfOptionsCLI = {\n propagate: string | boolean | undefined;\n override: string | boolean | undefined;\n};\n\nexport default class EjectConfCmd implements Command {\n name = 'eject-conf <pattern>';\n description = 'eject components configuration (create a `component.json` file)';\n extendedDescription =
|
|
1
|
+
{"version":3,"names":["_path","data","_interopRequireDefault","require","_chalk","_constants","EjectConfCmd","constructor","workspace","_defineProperty2","default","PATTERN_HELP","report","args","options","ejectResult","json","paths","map","result","configPath","p","path","relative","join","chalk","green","bold","pattern","ejectOptions","propagate","override","componentIds","idsByPattern","results","ejectMultipleConfigs","exports"],"sources":["eject-conf.cmd.ts"],"sourcesContent":["import path from 'path';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { PATTERN_HELP } from '@teambit/legacy/dist/constants';\n\nimport { EjectConfOptions, EjectConfResult, Workspace } from './workspace';\n\ntype EjectConfArgs = [string];\n// From the cli we might get those as string in case we run it like --propagate true (return string) as opposed to only --propagate\ntype EjectConfOptionsCLI = {\n propagate: string | boolean | undefined;\n override: string | boolean | undefined;\n};\n\nexport default class EjectConfCmd implements Command {\n name = 'eject-conf <pattern>';\n description = 'eject components configuration (create a `component.json` file)';\n extendedDescription = `note this can be reversed at any time by snapping/tagging changes and deleting the component.json file \\n${PATTERN_HELP(\n 'eject-conf'\n )}`;\n alias = '';\n group = 'development';\n options = [\n [\n 'p',\n 'propagate',\n 'mark propagate true in the config file, so that component.json configs will be merge with workspace configs',\n ],\n ['o', 'override', 'override file if exist'],\n ] as CommandOptions;\n\n constructor(private workspace: Workspace) {}\n\n async report(args: EjectConfArgs, options: EjectConfOptionsCLI): Promise<string> {\n const ejectResult = await this.json(args, options);\n const paths = ejectResult\n .map((result) => result.configPath)\n .map((p) => path.relative(this.workspace.path, p))\n .join('\\n');\n return chalk.green(`successfully ejected config to the following path(s)\n${chalk.bold(paths)}`);\n }\n\n async json([pattern]: EjectConfArgs, options: EjectConfOptionsCLI): Promise<EjectConfResult[]> {\n const ejectOptions = options;\n if (ejectOptions.propagate === 'true') {\n ejectOptions.propagate = true;\n }\n if (ejectOptions.override === 'true') {\n ejectOptions.override = true;\n }\n\n const componentIds = await this.workspace.idsByPattern(pattern);\n const results = await this.workspace.ejectMultipleConfigs(componentIds, ejectOptions as EjectConfOptions);\n return results;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA;;AAMe,MAAMK,YAAY,CAAoB;EAiBnDC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBAhBjC,sBAAsB;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBACf,iEAAiE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,+BACxD,4GAA2G,IAAAC,yBAAY,EAC5I,YACF,CAAE,EAAC;IAAA,IAAAF,gBAAA,GAAAC,OAAA,iBACK,EAAE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBACF,aAAa;IAAA,IAAAD,gBAAA,GAAAC,OAAA,mBACX,CACR,CACE,GAAG,EACH,WAAW,EACX,6GAA6G,CAC9G,EACD,CAAC,GAAG,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAC5C;EAE0C;EAE3C,MAAME,MAAMA,CAACC,IAAmB,EAAEC,OAA4B,EAAmB;IAC/E,MAAMC,WAAW,GAAG,MAAM,IAAI,CAACC,IAAI,CAACH,IAAI,EAAEC,OAAO,CAAC;IAClD,MAAMG,KAAK,GAAGF,WAAW,CACtBG,GAAG,CAAEC,MAAM,IAAKA,MAAM,CAACC,UAAU,CAAC,CAClCF,GAAG,CAAEG,CAAC,IAAKC,eAAI,CAACC,QAAQ,CAAC,IAAI,CAACf,SAAS,CAACc,IAAI,EAAED,CAAC,CAAC,CAAC,CACjDG,IAAI,CAAC,IAAI,CAAC;IACb,OAAOC,gBAAK,CAACC,KAAK,CAAE;AACxB,EAAED,gBAAK,CAACE,IAAI,CAACV,KAAK,CAAE,EAAC,CAAC;EACpB;EAEA,MAAMD,IAAIA,CAAC,CAACY,OAAO,CAAgB,EAAEd,OAA4B,EAA8B;IAC7F,MAAMe,YAAY,GAAGf,OAAO;IAC5B,IAAIe,YAAY,CAACC,SAAS,KAAK,MAAM,EAAE;MACrCD,YAAY,CAACC,SAAS,GAAG,IAAI;IAC/B;IACA,IAAID,YAAY,CAACE,QAAQ,KAAK,MAAM,EAAE;MACpCF,YAAY,CAACE,QAAQ,GAAG,IAAI;IAC9B;IAEA,MAAMC,YAAY,GAAG,MAAM,IAAI,CAACxB,SAAS,CAACyB,YAAY,CAACL,OAAO,CAAC;IAC/D,MAAMM,OAAO,GAAG,MAAM,IAAI,CAAC1B,SAAS,CAAC2B,oBAAoB,CAACH,YAAY,EAAEH,YAAgC,CAAC;IACzG,OAAOK,OAAO;EAChB;AACF;AAACE,OAAA,CAAA1B,OAAA,GAAAJ,YAAA"}
|
|
@@ -30,7 +30,7 @@ class EnvsReplaceCmd {
|
|
|
30
30
|
(0, _defineProperty2().default)(this, "group", 'development');
|
|
31
31
|
(0, _defineProperty2().default)(this, "arguments", [{
|
|
32
32
|
name: 'current-env',
|
|
33
|
-
description: 'the component id of the
|
|
33
|
+
description: 'the component id of the env to be replaced'
|
|
34
34
|
}, {
|
|
35
35
|
name: 'new-env',
|
|
36
36
|
description: 'the component id of the new env'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","EnvsReplaceCmd","constructor","workspace","_defineProperty2","default","name","description","cmd","report","oldEnv","env","envId","resolveComponentId","components","getComponentsUsingEnv","componentIds","map","comp","id","setEnvToComponents","chalk","bold","toString","compId","join","exports"],"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
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","EnvsReplaceCmd","constructor","workspace","_defineProperty2","default","name","description","cmd","report","oldEnv","env","envId","resolveComponentId","components","getComponentsUsingEnv","componentIds","map","comp","id","setEnvToComponents","chalk","bold","toString","compId","join","exports"],"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 env to be replaced' },\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,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAMG,cAAc,CAAoB;EAgB7CC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBAfjC,iCAAiC;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBAC1B,+EAA+E;IAAA,IAAAD,gBAAA,GAAAC,OAAA,mBACnF,EAAE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBACJ,aAAa;IAAA,IAAAD,gBAAA,GAAAC,OAAA,qBACT,CACV;MAAEC,IAAI,EAAE,aAAa;MAAEC,WAAW,EAAE;IAA6C,CAAC,EAClF;MAAED,IAAI,EAAE,SAAS;MAAEC,WAAW,EAAE;IAAkC,CAAC,CACpE;IAAA,IAAAH,gBAAA,GAAAC,OAAA,oBACU,CACT;MACEG,GAAG,EAAE,qDAAqD;MAC1DD,WAAW,EAAE;IACf,CAAC,CACF;EAE0C;EAE3C,MAAME,MAAMA,CAAC,CAACC,MAAM,EAAEC,GAAG,CAAmB,EAAE;IAC5C,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACT,SAAS,CAACU,kBAAkB,CAACF,GAAG,CAAC;IAC1D,MAAMG,UAAU,GAAG,MAAM,IAAI,CAACX,SAAS,CAACY,qBAAqB,CAACL,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;IACjF,MAAMM,YAAY,GAAGF,UAAU,CAACG,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACC,EAAE,CAAC;IACtD,MAAM,IAAI,CAAChB,SAAS,CAACiB,kBAAkB,CAACR,KAAK,EAAEI,YAAY,CAAC;IAC5D,OAAQ,SAAQK,gBAAK,CAACC,IAAI,CAACV,KAAK,CAACW,QAAQ,CAAC,CAAC,CAAE;AACjD,EAAEP,YAAY,CAACC,GAAG,CAAEO,MAAM,IAAKA,MAAM,CAACD,QAAQ,CAAC,CAAC,CAAC,CAACE,IAAI,CAAC,IAAI,CAAE,EAAC;EAC5D;AACF;AAACC,OAAA,CAAAzB,cAAA,GAAAA,cAAA"}
|
|
@@ -32,23 +32,23 @@ class EnvsSetCmd {
|
|
|
32
32
|
constructor(workspace) {
|
|
33
33
|
this.workspace = workspace;
|
|
34
34
|
(0, _defineProperty2().default)(this, "name", 'set <component-pattern> <env>');
|
|
35
|
-
(0, _defineProperty2().default)(this, "description", '
|
|
35
|
+
(0, _defineProperty2().default)(this, "description", 'Assigns one or more components a development environment (env)');
|
|
36
36
|
(0, _defineProperty2().default)(this, "arguments", [{
|
|
37
37
|
name: 'component-pattern',
|
|
38
38
|
description: _constants().COMPONENT_PATTERN_HELP
|
|
39
39
|
}, {
|
|
40
40
|
name: 'env',
|
|
41
|
-
description: "the env's component id (include version
|
|
41
|
+
description: "the env's component id (include version if not latest, e.g `teambit.community/envs/community-react@1.95.13`)"
|
|
42
42
|
}]);
|
|
43
43
|
(0, _defineProperty2().default)(this, "examples", [{
|
|
44
|
-
cmd: 'set ui/button teambit.react/react',
|
|
45
|
-
description: "configures 'ui/button' to use the 'teambit.react/react' env"
|
|
44
|
+
cmd: 'set ui/button teambit.react/react-env',
|
|
45
|
+
description: "configures 'ui/button' to use the latest version of the 'teambit.react/react-env' env"
|
|
46
46
|
}, {
|
|
47
47
|
cmd: 'set ui/button teambit.community/envs/community-mdx@1.95.16',
|
|
48
|
-
description: "configures 'ui/button' to use the
|
|
48
|
+
description: "configures 'ui/button' to use the 'teambit.community/envs/community-mdx@1.95.16' env"
|
|
49
49
|
}, {
|
|
50
|
-
cmd: 'set "ui/**" teambit.react/react',
|
|
51
|
-
description: "configures all components that have the 'ui' namespace to use the teambit.react/react env"
|
|
50
|
+
cmd: 'set "ui/**" teambit.react/react-env',
|
|
51
|
+
description: "configures all components that have the 'ui' namespace to use the latest version of the teambit.react/react-env env"
|
|
52
52
|
}]);
|
|
53
53
|
(0, _defineProperty2().default)(this, "options", []);
|
|
54
54
|
(0, _defineProperty2().default)(this, "group", 'development');
|
|
@@ -57,7 +57,7 @@ class EnvsSetCmd {
|
|
|
57
57
|
const envId = await this.workspace.resolveComponentId(env);
|
|
58
58
|
const componentIds = await this.workspace.idsByPattern(pattern);
|
|
59
59
|
await this.workspace.setEnvToComponents(envId, componentIds);
|
|
60
|
-
return `
|
|
60
|
+
return `assigned ${_chalk().default.bold(envId.toString())} env to the following component(s):
|
|
61
61
|
${componentIds.map(compId => compId.toString()).join('\n')}`;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_constants","EnvsSetCmd","constructor","workspace","_defineProperty2","default","name","description","COMPONENT_PATTERN_HELP","cmd","report","pattern","env","envId","resolveComponentId","componentIds","idsByPattern","setEnvToComponents","chalk","bold","toString","map","compId","join","exports"],"sources":["envs-set.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { Workspace } from '../workspace';\n\nexport class EnvsSetCmd implements Command {\n name = 'set <component-pattern> <env>';\n description = '
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_constants","EnvsSetCmd","constructor","workspace","_defineProperty2","default","name","description","COMPONENT_PATTERN_HELP","cmd","report","pattern","env","envId","resolveComponentId","componentIds","idsByPattern","setEnvToComponents","chalk","bold","toString","map","compId","join","exports"],"sources":["envs-set.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { Workspace } from '../workspace';\n\nexport class EnvsSetCmd implements Command {\n name = 'set <component-pattern> <env>';\n description = 'Assigns one or more components a development environment (env)';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'env',\n description:\n \"the env's component id (include version if not latest, e.g `teambit.community/envs/community-react@1.95.13`)\",\n },\n ];\n examples = [\n {\n cmd: 'set ui/button teambit.react/react-env',\n description: \"configures 'ui/button' to use the latest version of the 'teambit.react/react-env' env\",\n },\n {\n cmd: 'set ui/button teambit.community/envs/community-mdx@1.95.16',\n description: \"configures 'ui/button' to use the 'teambit.community/envs/community-mdx@1.95.16' env\",\n },\n {\n cmd: 'set \"ui/**\" teambit.react/react-env',\n description:\n \"configures all components that have the 'ui' namespace to use the latest version of the teambit.react/react-env 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 `assigned ${chalk.bold(envId.toString())} env to the following component(s):\n${componentIds.map((compId) => compId.toString()).join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAMI,UAAU,CAAoB;EAgCzCC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBA/BjC,+BAA+B;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBACxB,gEAAgE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,qBAClE,CACV;MACEC,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EAAEC;IACf,CAAC,EACD;MACEF,IAAI,EAAE,KAAK;MACXC,WAAW,EACT;IACJ,CAAC,CACF;IAAA,IAAAH,gBAAA,GAAAC,OAAA,oBACU,CACT;MACEI,GAAG,EAAE,uCAAuC;MAC5CF,WAAW,EAAE;IACf,CAAC,EACD;MACEE,GAAG,EAAE,4DAA4D;MACjEF,WAAW,EAAE;IACf,CAAC,EACD;MACEE,GAAG,EAAE,qCAAqC;MAC1CF,WAAW,EACT;IACJ,CAAC,CACF;IAAA,IAAAH,gBAAA,GAAAC,OAAA,mBACS,EAAE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBACJ,aAAa;EAEsB;EAE3C,MAAMK,MAAMA,CAAC,CAACC,OAAO,EAAEC,GAAG,CAAmB,EAAE;IAC7C,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACV,SAAS,CAACW,kBAAkB,CAACF,GAAG,CAAC;IAC1D,MAAMG,YAAY,GAAG,MAAM,IAAI,CAACZ,SAAS,CAACa,YAAY,CAACL,OAAO,CAAC;IAC/D,MAAM,IAAI,CAACR,SAAS,CAACc,kBAAkB,CAACJ,KAAK,EAAEE,YAAY,CAAC;IAC5D,OAAQ,YAAWG,gBAAK,CAACC,IAAI,CAACN,KAAK,CAACO,QAAQ,CAAC,CAAC,CAAE;AACpD,EAAEL,YAAY,CAACM,GAAG,CAAEC,MAAM,IAAKA,MAAM,CAACF,QAAQ,CAAC,CAAC,CAAC,CAACG,IAAI,CAAC,IAAI,CAAE,EAAC;EAC5D;AACF;AAACC,OAAA,CAAAvB,UAAA,GAAAA,UAAA"}
|
|
@@ -35,13 +35,13 @@ class EnvsUnsetCmd {
|
|
|
35
35
|
(0, _defineProperty2().default)(this, "description", 'un-sets an env from components that were previously set by "bit env set" or by a component template');
|
|
36
36
|
(0, _defineProperty2().default)(this, "arguments", [{
|
|
37
37
|
name: 'component-pattern',
|
|
38
|
-
description:
|
|
38
|
+
description: _constants().COMPONENT_PATTERN_HELP
|
|
39
39
|
}]);
|
|
40
40
|
(0, _defineProperty2().default)(this, "options", []);
|
|
41
41
|
(0, _defineProperty2().default)(this, "group", 'development');
|
|
42
|
-
(0, _defineProperty2().default)(this, "extendedDescription", `keep in mind that this doesn't remove envs that are set
|
|
42
|
+
(0, _defineProperty2().default)(this, "extendedDescription", `keep in mind that this doesn't remove envs that are set via variants.
|
|
43
43
|
in only removes envs that appear in the .bitmap file, which were previously configured via "bit env set".
|
|
44
|
-
the purpose of this command is to
|
|
44
|
+
the purpose of this command is to reset previously assigned envs to either allow variants configure the env or use the base node env.
|
|
45
45
|
${(0, _constants().PATTERN_HELP)('env unset')}`);
|
|
46
46
|
}
|
|
47
47
|
async report([pattern]) {
|
|
@@ -50,9 +50,9 @@ ${(0, _constants().PATTERN_HELP)('env unset')}`);
|
|
|
50
50
|
changed
|
|
51
51
|
} = await this.workspace.unsetEnvFromComponents(componentIds);
|
|
52
52
|
if (!changed.length) {
|
|
53
|
-
return _chalk().default.yellow(`unable to find
|
|
53
|
+
return _chalk().default.yellow(`unable to find components matching the pattern with env configured in the .bitmap file`);
|
|
54
54
|
}
|
|
55
|
-
return `successfully removed env from the following component(s):
|
|
55
|
+
return `successfully removed .bitmap env configuration from the following component(s):
|
|
56
56
|
${changed.map(id => id.toString()).join('\n')}`;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_constants","data","require","_chalk","_interopRequireDefault","EnvsUnsetCmd","constructor","workspace","_defineProperty2","default","name","description","PATTERN_HELP","report","pattern","componentIds","idsByPattern","changed","unsetEnvFromComponents","length","chalk","yellow","map","id","toString","join","exports"],"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
|
|
1
|
+
{"version":3,"names":["_constants","data","require","_chalk","_interopRequireDefault","EnvsUnsetCmd","constructor","workspace","_defineProperty2","default","name","description","COMPONENT_PATTERN_HELP","PATTERN_HELP","report","pattern","componentIds","idsByPattern","changed","unsetEnvFromComponents","length","chalk","yellow","map","id","toString","join","exports"],"sources":["envs-unset.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport { PATTERN_HELP, COMPONENT_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: COMPONENT_PATTERN_HELP,\n },\n ];\n options = [];\n group = 'development';\n extendedDescription = `keep in mind that this doesn't remove envs that are set via 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 reset previously assigned envs to either allow variants configure the env or use the base node 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 components matching the pattern with env configured in the .bitmap file`);\n }\n return `successfully removed .bitmap env configuration from the following component(s):\n${changed.map((id) => id.toString()).join('\\n')}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAMI,YAAY,CAAoB;EAgB3CC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBAfjC,2BAA2B;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBACpB,qGAAqG;IAAA,IAAAD,gBAAA,GAAAC,OAAA,qBACvG,CACV;MACEC,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EAAEC;IACf,CAAC,CACF;IAAA,IAAAJ,gBAAA,GAAAC,OAAA,mBACS,EAAE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBACJ,aAAa;IAAA,IAAAD,gBAAA,GAAAC,OAAA,+BACE;AACzB;AACA;AACA,EAAE,IAAAI,yBAAY,EAAC,WAAW,CAAE,EAAC;EAEgB;EAE3C,MAAMC,MAAMA,CAAC,CAACC,OAAO,CAAW,EAAE;IAChC,MAAMC,YAAY,GAAG,MAAM,IAAI,CAACT,SAAS,CAACU,YAAY,CAACF,OAAO,CAAC;IAC/D,MAAM;MAAEG;IAAQ,CAAC,GAAG,MAAM,IAAI,CAACX,SAAS,CAACY,sBAAsB,CAACH,YAAY,CAAC;IAC7E,IAAI,CAACE,OAAO,CAACE,MAAM,EAAE;MACnB,OAAOC,gBAAK,CAACC,MAAM,CAAE,wFAAuF,CAAC;IAC/G;IACA,OAAQ;AACZ,EAAEJ,OAAO,CAACK,GAAG,CAAEC,EAAE,IAAKA,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAE,EAAC;EAC/C;AACF;AAACC,OAAA,CAAAtB,YAAA,GAAAA,YAAA"}
|
|
@@ -21,6 +21,13 @@ function _chalk() {
|
|
|
21
21
|
};
|
|
22
22
|
return data;
|
|
23
23
|
}
|
|
24
|
+
function _constants() {
|
|
25
|
+
const data = require("@teambit/legacy/dist/constants");
|
|
26
|
+
_constants = function () {
|
|
27
|
+
return data;
|
|
28
|
+
};
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
24
31
|
class EnvsUpdateCmd {
|
|
25
32
|
constructor(workspace) {
|
|
26
33
|
this.workspace = workspace;
|
|
@@ -28,17 +35,17 @@ class EnvsUpdateCmd {
|
|
|
28
35
|
(0, _defineProperty2().default)(this, "description", 'update a version of an env for all components using that env');
|
|
29
36
|
(0, _defineProperty2().default)(this, "arguments", [{
|
|
30
37
|
name: 'env-id',
|
|
31
|
-
description: 'the environment id (defaults to all envs). optionally, add a version (id@version),
|
|
38
|
+
description: 'the environment id (defaults to all envs). optionally, add a version (id@version), if no version is supplied will use the latest version on the remote.'
|
|
32
39
|
}, {
|
|
33
40
|
name: 'pattern',
|
|
34
|
-
description:
|
|
41
|
+
description: `the components to update (defaults to all components). ${_constants().COMPONENT_PATTERN_HELP}`
|
|
35
42
|
}]);
|
|
36
43
|
(0, _defineProperty2().default)(this, "examples", [{
|
|
37
44
|
cmd: 'envs update',
|
|
38
|
-
description: 'update all envs in the workspace to their latest version'
|
|
45
|
+
description: 'update all envs for all components in the workspace, to their latest version'
|
|
39
46
|
}, {
|
|
40
47
|
cmd: "envs update scope.org/env '**/ui/**'",
|
|
41
|
-
description: 'update "ui"
|
|
48
|
+
description: 'update components in the "ui" namespace that use scope.org/env to use its latest version'
|
|
42
49
|
}, {
|
|
43
50
|
cmd: 'envs update scope.org/env@2.0.0',
|
|
44
51
|
description: 'update all components that use scope.org/env to version 2.0.0 (of this env).'
|
|
@@ -55,13 +62,13 @@ class EnvsUpdateCmd {
|
|
|
55
62
|
const body = Object.keys(updated).map(envId => {
|
|
56
63
|
return `${_chalk().default.bold(envId)}:\n${updated[envId].map(compId => compId.toString()).join('\n')}`;
|
|
57
64
|
}).join('\n\n');
|
|
58
|
-
const title = _chalk().default.green(`the following component(s)
|
|
65
|
+
const title = _chalk().default.green(`the following component(s) env has been successfully updated:\n`);
|
|
59
66
|
return title + body;
|
|
60
67
|
}
|
|
61
68
|
if (alreadyUpToDate.length) {
|
|
62
69
|
return _chalk().default.green(`all ${alreadyUpToDate.length} component(s) that use this env are already up to date. nothing to update`);
|
|
63
70
|
}
|
|
64
|
-
return _chalk().default.yellow(`unable to find any
|
|
71
|
+
return _chalk().default.yellow(`unable to find any components using env ${_chalk().default.bold(aspectId)}`);
|
|
65
72
|
}
|
|
66
73
|
}
|
|
67
74
|
exports.EnvsUpdateCmd = EnvsUpdateCmd;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","EnvsUpdateCmd","constructor","workspace","_defineProperty2","default","name","description","cmd","report","aspectId","pattern","updated","alreadyUpToDate","updateEnvForComponents","Object","keys","length","body","map","envId","chalk","bold","compId","toString","join","title","green","yellow","exports"],"sources":["envs-update.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Workspace } from '../workspace';\n\nexport class EnvsUpdateCmd implements Command {\n name = 'update [env-id] [pattern]';\n description = 'update a version of an env for all components using that env';\n arguments = [\n {\n name: 'env-id',\n description:\n 'the environment id (defaults to all envs). optionally, add a version (id@version),
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_constants","EnvsUpdateCmd","constructor","workspace","_defineProperty2","default","name","description","COMPONENT_PATTERN_HELP","cmd","report","aspectId","pattern","updated","alreadyUpToDate","updateEnvForComponents","Object","keys","length","body","map","envId","chalk","bold","compId","toString","join","title","green","yellow","exports"],"sources":["envs-update.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { Workspace } from '../workspace';\n\nexport class EnvsUpdateCmd implements Command {\n name = 'update [env-id] [pattern]';\n description = 'update a version of an env for all components using that env';\n arguments = [\n {\n name: 'env-id',\n description:\n 'the environment id (defaults to all envs). optionally, add a version (id@version), if no version is supplied will use the latest version on the remote.',\n },\n {\n name: 'pattern',\n description: `the components to update (defaults to all components). ${COMPONENT_PATTERN_HELP}`,\n },\n ];\n examples = [\n {\n cmd: 'envs update',\n description: 'update all envs for all components in the workspace, to their latest version',\n },\n {\n cmd: \"envs update scope.org/env '**/ui/**'\",\n description: 'update components in the \"ui\" namespace that use scope.org/env to use its latest version',\n },\n {\n cmd: 'envs update scope.org/env@2.0.0',\n description: 'update all components that use scope.org/env to version 2.0.0 (of this env).',\n },\n ];\n options = [];\n group = 'development';\n\n constructor(private workspace: Workspace) {}\n\n async report([aspectId, pattern]: [string, string]) {\n const { updated, alreadyUpToDate } = await this.workspace.updateEnvForComponents(aspectId, pattern);\n if (Object.keys(updated).length) {\n const body = Object.keys(updated)\n .map((envId) => {\n return `${chalk.bold(envId)}:\\n${updated[envId].map((compId) => compId.toString()).join('\\n')}`;\n })\n .join('\\n\\n');\n const title = chalk.green(`the following component(s) env has been successfully updated:\\n`);\n return title + body;\n }\n if (alreadyUpToDate.length) {\n return chalk.green(\n `all ${alreadyUpToDate.length} component(s) that use this env are already up to date. nothing to update`\n );\n }\n return chalk.yellow(`unable to find any components using env ${chalk.bold(aspectId)}`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAMI,aAAa,CAAoB;EA+B5CC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBA9BjC,2BAA2B;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBACpB,8DAA8D;IAAA,IAAAD,gBAAA,GAAAC,OAAA,qBAChE,CACV;MACEC,IAAI,EAAE,QAAQ;MACdC,WAAW,EACT;IACJ,CAAC,EACD;MACED,IAAI,EAAE,SAAS;MACfC,WAAW,EAAG,0DAAyDC,mCAAuB;IAChG,CAAC,CACF;IAAA,IAAAJ,gBAAA,GAAAC,OAAA,oBACU,CACT;MACEI,GAAG,EAAE,aAAa;MAClBF,WAAW,EAAE;IACf,CAAC,EACD;MACEE,GAAG,EAAE,sCAAsC;MAC3CF,WAAW,EAAE;IACf,CAAC,EACD;MACEE,GAAG,EAAE,iCAAiC;MACtCF,WAAW,EAAE;IACf,CAAC,CACF;IAAA,IAAAH,gBAAA,GAAAC,OAAA,mBACS,EAAE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBACJ,aAAa;EAEsB;EAE3C,MAAMK,MAAMA,CAAC,CAACC,QAAQ,EAAEC,OAAO,CAAmB,EAAE;IAClD,MAAM;MAAEC,OAAO;MAAEC;IAAgB,CAAC,GAAG,MAAM,IAAI,CAACX,SAAS,CAACY,sBAAsB,CAACJ,QAAQ,EAAEC,OAAO,CAAC;IACnG,IAAII,MAAM,CAACC,IAAI,CAACJ,OAAO,CAAC,CAACK,MAAM,EAAE;MAC/B,MAAMC,IAAI,GAAGH,MAAM,CAACC,IAAI,CAACJ,OAAO,CAAC,CAC9BO,GAAG,CAAEC,KAAK,IAAK;QACd,OAAQ,GAAEC,gBAAK,CAACC,IAAI,CAACF,KAAK,CAAE,MAAKR,OAAO,CAACQ,KAAK,CAAC,CAACD,GAAG,CAAEI,MAAM,IAAKA,MAAM,CAACC,QAAQ,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAE,EAAC;MACjG,CAAC,CAAC,CACDA,IAAI,CAAC,MAAM,CAAC;MACf,MAAMC,KAAK,GAAGL,gBAAK,CAACM,KAAK,CAAE,iEAAgE,CAAC;MAC5F,OAAOD,KAAK,GAAGR,IAAI;IACrB;IACA,IAAIL,eAAe,CAACI,MAAM,EAAE;MAC1B,OAAOI,gBAAK,CAACM,KAAK,CACf,OAAMd,eAAe,CAACI,MAAO,2EAChC,CAAC;IACH;IACA,OAAOI,gBAAK,CAACO,MAAM,CAAE,2CAA0CP,gBAAK,CAACC,IAAI,CAACZ,QAAQ,CAAE,EAAC,CAAC;EACxF;AACF;AAACmB,OAAA,CAAA7B,aAAA,GAAAA,aAAA"}
|
package/dist/pattern.cmd.js
CHANGED
|
@@ -29,11 +29,11 @@ class PatternCommand {
|
|
|
29
29
|
(0, _defineProperty2().default)(this, "description", 'list the component ids matching the given pattern');
|
|
30
30
|
(0, _defineProperty2().default)(this, "extendedDescription", `this command helps validating a pattern before using it in other commands.
|
|
31
31
|
a pattern can be a simple component-id or component-name. e.g. "ui/button".
|
|
32
|
-
a pattern can be used with wildcards for multiple component ids, e.g. "org.scope/utils/**".
|
|
32
|
+
a pattern can be used with wildcards for multiple component ids, e.g. "org.scope/utils/**" or "**/utils/**" to capture all org/scopes.
|
|
33
33
|
to enter multiple patterns, separate them by a comma, e.g. "ui/*, lib/*"
|
|
34
34
|
to exclude, use "!". e.g. "ui/**, !ui/button"
|
|
35
35
|
always wrap the pattern with quotes to avoid collision with shell commands.
|
|
36
|
-
the matching algorithm is
|
|
36
|
+
the matching algorithm is from multimatch (@see https://github.com/sindresorhus/multimatch)
|
|
37
37
|
`);
|
|
38
38
|
(0, _defineProperty2().default)(this, "examples", [{
|
|
39
39
|
cmd: 'bit pattern "**"',
|
|
@@ -43,7 +43,7 @@ the matching algorithm is done by multimatch (@see https://github.com/sindresorh
|
|
|
43
43
|
description: 'matches components with any scope-name and the "ui" namespace. e.g. "ui/button" but not "ui/elements/button"'
|
|
44
44
|
}, {
|
|
45
45
|
cmd: 'bit pattern "*/ui/**"',
|
|
46
|
-
description: 'matches components
|
|
46
|
+
description: 'matches components whose namespace starts with "ui/" e.g. "ui/button", "ui/elements/button"'
|
|
47
47
|
}, {
|
|
48
48
|
cmd: 'bit pattern "bar, foo"',
|
|
49
49
|
description: 'matches two components: bar and foo'
|
package/dist/pattern.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","PatternCommand","constructor","workspace","_defineProperty2","default","cmd","description","report","pattern","ids","json","title","chalk","green","bold","length","toString","join","idsByPattern","exports"],"sources":["pattern.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Workspace } from './workspace';\n\nexport class PatternCommand implements Command {\n name = 'pattern <pattern>';\n alias = '';\n description = 'list the component ids matching the given pattern';\n extendedDescription = `this command helps validating a pattern before using it in other commands.\na pattern can be a simple component-id or component-name. e.g. \"ui/button\".\na pattern can be used with wildcards for multiple component ids, e.g. \"org.scope/utils/**\".\nto enter multiple patterns, separate them by a comma, e.g. \"ui/*, lib/*\"\nto exclude, use \"!\". e.g. \"ui/**, !ui/button\"\nalways wrap the pattern with quotes to avoid collision with shell commands.\nthe matching algorithm is
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","PatternCommand","constructor","workspace","_defineProperty2","default","cmd","description","report","pattern","ids","json","title","chalk","green","bold","length","toString","join","idsByPattern","exports"],"sources":["pattern.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Workspace } from './workspace';\n\nexport class PatternCommand implements Command {\n name = 'pattern <pattern>';\n alias = '';\n description = 'list the component ids matching the given pattern';\n extendedDescription = `this command helps validating a pattern before using it in other commands.\na pattern can be a simple component-id or component-name. e.g. \"ui/button\".\na pattern can be used with wildcards for multiple component ids, e.g. \"org.scope/utils/**\" or \"**/utils/**\" to capture all org/scopes.\nto enter multiple patterns, separate them by a comma, e.g. \"ui/*, lib/*\"\nto exclude, use \"!\". e.g. \"ui/**, !ui/button\"\nalways wrap the pattern with quotes to avoid collision with shell commands.\nthe matching algorithm is from multimatch (@see https://github.com/sindresorhus/multimatch)\n`;\n examples = [\n { cmd: 'bit pattern \"**\"', description: 'matches all components' },\n {\n cmd: 'bit pattern \"*/ui/*\"',\n description:\n 'matches components with any scope-name and the \"ui\" namespace. e.g. \"ui/button\" but not \"ui/elements/button\"',\n },\n {\n cmd: 'bit pattern \"*/ui/**\"',\n description: 'matches components whose namespace starts with \"ui/\" e.g. \"ui/button\", \"ui/elements/button\"',\n },\n { cmd: 'bit pattern \"bar, foo\"', description: 'matches two components: bar and foo' },\n { cmd: 'bit pattern \"my-scope.org/**\"', description: 'matches all components of the scope \"my-scope.org\"' },\n ];\n group = 'development';\n private = false;\n options = [['j', 'json', 'return the output as JSON']] as CommandOptions;\n\n constructor(private workspace: Workspace) {}\n\n async report([pattern]: [string]) {\n const ids = await this.json([pattern]);\n const title = chalk.green(`found ${chalk.bold(ids.length.toString())} components matching the pattern`);\n return `${title}\\n${ids.join('\\n')}`;\n }\n\n async json([pattern]: [string]) {\n return this.workspace.idsByPattern(pattern, false);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAMG,cAAc,CAAoB;EA8B7CC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBA7BjC,mBAAmB;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBAClB,EAAE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBACI,mDAAmD;IAAA,IAAAD,gBAAA,GAAAC,OAAA,+BAC1C;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;IAAA,IAAAD,gBAAA,GAAAC,OAAA,oBACY,CACT;MAAEC,GAAG,EAAE,kBAAkB;MAAEC,WAAW,EAAE;IAAyB,CAAC,EAClE;MACED,GAAG,EAAE,sBAAsB;MAC3BC,WAAW,EACT;IACJ,CAAC,EACD;MACED,GAAG,EAAE,uBAAuB;MAC5BC,WAAW,EAAE;IACf,CAAC,EACD;MAAED,GAAG,EAAE,wBAAwB;MAAEC,WAAW,EAAE;IAAsC,CAAC,EACrF;MAAED,GAAG,EAAE,+BAA+B;MAAEC,WAAW,EAAE;IAAqD,CAAC,CAC5G;IAAA,IAAAH,gBAAA,GAAAC,OAAA,iBACO,aAAa;IAAA,IAAAD,gBAAA,GAAAC,OAAA,mBACX,KAAK;IAAA,IAAAD,gBAAA,GAAAC,OAAA,mBACL,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,2BAA2B,CAAC,CAAC;EAEX;EAE3C,MAAMG,MAAMA,CAAC,CAACC,OAAO,CAAW,EAAE;IAChC,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACC,IAAI,CAAC,CAACF,OAAO,CAAC,CAAC;IACtC,MAAMG,KAAK,GAAGC,gBAAK,CAACC,KAAK,CAAE,SAAQD,gBAAK,CAACE,IAAI,CAACL,GAAG,CAACM,MAAM,CAACC,QAAQ,CAAC,CAAC,CAAE,kCAAiC,CAAC;IACvG,OAAQ,GAAEL,KAAM,KAAIF,GAAG,CAACQ,IAAI,CAAC,IAAI,CAAE,EAAC;EACtC;EAEA,MAAMP,IAAIA,CAAC,CAACF,OAAO,CAAW,EAAE;IAC9B,OAAO,IAAI,CAACN,SAAS,CAACgB,YAAY,CAACV,OAAO,EAAE,KAAK,CAAC;EACpD;AACF;AAACW,OAAA,CAAAnB,cAAA,GAAAA,cAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.1134/dist/workspace.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.1134/dist/workspace.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -32,17 +32,17 @@ class ScopeSetCmd {
|
|
|
32
32
|
constructor(workspace) {
|
|
33
33
|
this.workspace = workspace;
|
|
34
34
|
(0, _defineProperty2().default)(this, "name", 'set <scope-name> [component-pattern]');
|
|
35
|
-
(0, _defineProperty2().default)(this, "description", 'Sets
|
|
35
|
+
(0, _defineProperty2().default)(this, "description", 'Sets the scope for specified component/s. If no component is specified, sets the default scope of the workspace');
|
|
36
36
|
(0, _defineProperty2().default)(this, "arguments", [{
|
|
37
37
|
name: 'scope-name',
|
|
38
|
-
description: 'the scope
|
|
38
|
+
description: 'name of the scope to set'
|
|
39
39
|
}, {
|
|
40
40
|
name: 'component-pattern',
|
|
41
|
-
description:
|
|
41
|
+
description: _constants().COMPONENT_PATTERN_HELP
|
|
42
42
|
}]);
|
|
43
43
|
(0, _defineProperty2().default)(this, "options", []);
|
|
44
44
|
(0, _defineProperty2().default)(this, "group", 'development');
|
|
45
|
-
(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
|
|
45
|
+
(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.\na component is set with a scope (as oppose to default scope) only once it is versioned.'
|
|
46
46
|
|
|
47
47
|
${(0, _constants().PATTERN_HELP)('scope set scope-name')}`);
|
|
48
48
|
}
|
|
@@ -55,7 +55,7 @@ ${(0, _constants().PATTERN_HELP)('scope set scope-name')}`);
|
|
|
55
55
|
}
|
|
56
56
|
const oldScope = this.workspace.defaultScope;
|
|
57
57
|
await this.workspace.setDefaultScope(scopeName);
|
|
58
|
-
return _chalk().default.green(`successfully set the default-scope to ${_chalk().default.bold(scopeName)}. (previous scope was "${oldScope}")`);
|
|
58
|
+
return _chalk().default.green(`successfully set the workspace's default-scope to ${_chalk().default.bold(scopeName)}. (previous scope was "${oldScope}")`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
exports.ScopeSetCmd = ScopeSetCmd;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_constants","data","require","_chalk","_interopRequireDefault","ScopeSetCmd","constructor","workspace","_defineProperty2","default","name","description","PATTERN_HELP","report","scopeName","pattern","componentsIds","idsByPattern","changedIds","setDefaultScopeToComponents","chalk","green","bold","reset","map","id","toString","join","oldScope","defaultScope","setDefaultScope","exports"],"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
|
|
1
|
+
{"version":3,"names":["_constants","data","require","_chalk","_interopRequireDefault","ScopeSetCmd","constructor","workspace","_defineProperty2","default","name","description","COMPONENT_PATTERN_HELP","PATTERN_HELP","report","scopeName","pattern","componentsIds","idsByPattern","changedIds","setDefaultScopeToComponents","chalk","green","bold","reset","map","id","toString","join","oldScope","defaultScope","setDefaultScope","exports"],"sources":["scope-set.cmd.ts"],"sourcesContent":["import { Command } from '@teambit/cli';\nimport { PATTERN_HELP, COMPONENT_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 the scope for specified component/s. If no component is specified, sets the default scope of the workspace';\n arguments = [\n { name: 'scope-name', description: 'name of the scope to set' },\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\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.\\na 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 workspace's default-scope to ${chalk.bold(scopeName)}. (previous scope was \"${oldScope}\")`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAMI,WAAW,CAAoB;EAiB1CC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBAhBjC,sCAAsC;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBAE3C,iHAAiH;IAAA,IAAAD,gBAAA,GAAAC,OAAA,qBACvG,CACV;MAAEC,IAAI,EAAE,YAAY;MAAEC,WAAW,EAAE;IAA2B,CAAC,EAC/D;MACED,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EAAEC;IACf,CAAC,CACF;IAAA,IAAAJ,gBAAA,GAAAC,OAAA,mBACS,EAAE;IAAA,IAAAD,gBAAA,GAAAC,OAAA,iBACJ,aAAa;IAAA,IAAAD,gBAAA,GAAAC,OAAA,+BACE;AACzB;AACA,EAAE,IAAAI,yBAAY,EAAC,sBAAsB,CAAE,EAAC;EAEK;EAE3C,MAAMC,MAAMA,CAAC,CAACC,SAAS,EAAEC,OAAO,CAAmB,EAAE;IACnD,IAAIA,OAAO,EAAE;MACX,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACV,SAAS,CAACW,YAAY,CAACF,OAAO,CAAC;MAChE,MAAMG,UAAU,GAAG,MAAM,IAAI,CAACZ,SAAS,CAACa,2BAA2B,CAACH,aAAa,EAAEF,SAAS,CAAC;MAC7F,OAAOM,gBAAK,CAACC,KAAK,CAAE,oBAAmBD,gBAAK,CAACE,IAAI,CAACR,SAAS,CAAE;AACnE,IAAIM,gBAAK,CAACG,KAAK,CAACL,UAAU,CAACM,GAAG,CAAEC,EAAE,IAAKA,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,CAAE,EAAC,CAAC;IAChE;IACA,MAAMC,QAAQ,GAAG,IAAI,CAACtB,SAAS,CAACuB,YAAY;IAC5C,MAAM,IAAI,CAACvB,SAAS,CAACwB,eAAe,CAAChB,SAAS,CAAC;IAC/C,OAAOM,gBAAK,CAACC,KAAK,CACf,qDAAoDD,gBAAK,CAACE,IAAI,CAACR,SAAS,CAAE,0BAAyBc,QAAS,IAC/G,CAAC;EACH;AACF;AAACG,OAAA,CAAA3B,WAAA,GAAAA,WAAA"}
|
package/dist/workspace.d.ts
CHANGED
|
@@ -382,12 +382,14 @@ export declare class Workspace implements ComponentFactory {
|
|
|
382
382
|
*/
|
|
383
383
|
setDefaultScopeToComponents(componentIds: ComponentID[], scopeName: string): Promise<ComponentID[]>;
|
|
384
384
|
setDefaultScope(scopeName: string): Promise<void>;
|
|
385
|
-
addSpecificComponentConfig(id: ComponentID, aspectId: string, config?: Record<string, any>, shouldMergeWithExisting
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
385
|
+
addSpecificComponentConfig(id: ComponentID, aspectId: string, config?: Record<string, any>, { shouldMergeWithExisting, shouldMergeWithPrevious, }?: {
|
|
386
|
+
shouldMergeWithExisting?: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* relevant only when writing to .bitmap.
|
|
389
|
+
* eject config of the given aspect-id, so then it won't override previous config. (see "adding prod dep, tagging then adding devDep" e2e-test)
|
|
390
|
+
*/
|
|
391
|
+
shouldMergeWithPrevious?: boolean;
|
|
392
|
+
}): Promise<void>;
|
|
391
393
|
removeSpecificComponentConfig(id: ComponentID, aspectId: string, markWithMinusIfNotExist?: boolean): Promise<void>;
|
|
392
394
|
getAspectIdFromConfig(componentId: ComponentID, aspectIdStr: string, ignoreAspectVersion?: boolean): Promise<string | undefined>;
|
|
393
395
|
getSpecificComponentConfig(id: ComponentID, aspectId: string): Promise<any>;
|
package/dist/workspace.js
CHANGED
|
@@ -553,7 +553,9 @@ class Workspace {
|
|
|
553
553
|
*/
|
|
554
554
|
async filterIds(ids) {
|
|
555
555
|
const workspaceIds = await this.listIds();
|
|
556
|
-
return ids.filter(id => workspaceIds.find(wsId => wsId.isEqual(id
|
|
556
|
+
return ids.filter(id => workspaceIds.find(wsId => wsId.isEqual(id, {
|
|
557
|
+
ignoreVersion: !id.hasVersion()
|
|
558
|
+
})));
|
|
557
559
|
}
|
|
558
560
|
|
|
559
561
|
/**
|
|
@@ -1313,12 +1315,13 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1313
1315
|
dir: _path2().default.dirname(config.workspaceConfig.path)
|
|
1314
1316
|
}));
|
|
1315
1317
|
}
|
|
1316
|
-
async addSpecificComponentConfig(id, aspectId, config = {},
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1318
|
+
async addSpecificComponentConfig(id, aspectId, config = {}, {
|
|
1319
|
+
shouldMergeWithExisting,
|
|
1320
|
+
shouldMergeWithPrevious
|
|
1321
|
+
} = {
|
|
1322
|
+
shouldMergeWithExisting: false,
|
|
1323
|
+
shouldMergeWithPrevious: false
|
|
1324
|
+
}) {
|
|
1322
1325
|
const componentConfigFile = await this.componentConfigFile(id);
|
|
1323
1326
|
if (componentConfigFile) {
|
|
1324
1327
|
await componentConfigFile.addAspect(aspectId, config, this.resolveComponentId.bind(this), shouldMergeWithExisting);
|