@teambit/workspace 0.0.1133 → 0.0.1135
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/build-graph-ids-from-fs.d.ts +1 -0
- package/dist/build-graph-ids-from-fs.js +17 -0
- package/dist/build-graph-ids-from-fs.js.map +1 -1
- 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-1692345627885.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-component/workspace-component-loader.d.ts +5 -2
- package/dist/workspace-component/workspace-component-loader.js +15 -4
- package/dist/workspace-component/workspace-component-loader.js.map +1 -1
- package/dist/workspace.d.ts +12 -6
- package/dist/workspace.js +20 -9
- 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.1135.tgz +0 -0
- package/package.json +36 -36
- package/scope-subcommands/scope-set.cmd.ts +6 -7
- package/workspace-component/workspace-component-loader.ts +20 -9
- package/package-tar/teambit-workspace-0.0.1133.tgz +0 -0
|
@@ -16,6 +16,7 @@ export declare class GraphIdsFromFsBuilder {
|
|
|
16
16
|
private consumer;
|
|
17
17
|
private loadedComponents;
|
|
18
18
|
private importedIds;
|
|
19
|
+
private shouldThrowOnInvalidDeps;
|
|
19
20
|
constructor(workspace: Workspace, logger: Logger, dependencyResolver: DependencyResolverMain, shouldThrowOnMissingDep?: boolean);
|
|
20
21
|
/**
|
|
21
22
|
* create a graph with all dependencies and flattened dependencies of the given components.
|
|
@@ -36,6 +36,13 @@ function _lodash() {
|
|
|
36
36
|
};
|
|
37
37
|
return data;
|
|
38
38
|
}
|
|
39
|
+
function _component() {
|
|
40
|
+
const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component"));
|
|
41
|
+
_component = function () {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
39
46
|
function _bitIds() {
|
|
40
47
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/bit-id/bit-ids"));
|
|
41
48
|
_bitIds = function () {
|
|
@@ -83,6 +90,7 @@ function lifecycleToDepType(compDep) {
|
|
|
83
90
|
}
|
|
84
91
|
}
|
|
85
92
|
class GraphIdsFromFsBuilder {
|
|
93
|
+
// for now it has the same value as shouldThrowOnMissingDep. change if needed
|
|
86
94
|
constructor(workspace, logger, dependencyResolver, shouldThrowOnMissingDep = true) {
|
|
87
95
|
this.workspace = workspace;
|
|
88
96
|
this.logger = logger;
|
|
@@ -94,7 +102,9 @@ class GraphIdsFromFsBuilder {
|
|
|
94
102
|
(0, _defineProperty2().default)(this, "consumer", void 0);
|
|
95
103
|
(0, _defineProperty2().default)(this, "loadedComponents", {});
|
|
96
104
|
(0, _defineProperty2().default)(this, "importedIds", []);
|
|
105
|
+
(0, _defineProperty2().default)(this, "shouldThrowOnInvalidDeps", true);
|
|
97
106
|
this.consumer = this.workspace.consumer;
|
|
107
|
+
this.shouldThrowOnInvalidDeps = this.shouldThrowOnMissingDep;
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
/**
|
|
@@ -218,6 +228,13 @@ class GraphIdsFromFsBuilder {
|
|
|
218
228
|
}
|
|
219
229
|
throw new (_bitError().BitError)(`error: component "${idStr}" was not found.\nthis component is a dependency of "${dependenciesOf || '<none>'}" and is needed as part of the graph generation`);
|
|
220
230
|
}
|
|
231
|
+
if (_component().default.isComponentInvalidByErrorType(err)) {
|
|
232
|
+
if (dependenciesOf && !this.shouldThrowOnInvalidDeps) {
|
|
233
|
+
this.logger.warn(`component ${idStr}, dependency of ${dependenciesOf} is invalid. continuing without it`);
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
throw new (_bitError().BitError)(`error: component "${idStr}" is invalid (${err.message}).\nthis component is a dependency of "${dependenciesOf || '<none>'}" and is needed as part of the graph generation`);
|
|
237
|
+
}
|
|
221
238
|
if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);
|
|
222
239
|
throw err;
|
|
223
240
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_graph","_lodash","_bitIds","_exceptions","_scope","_lodash2","_bitError","lifecycleToDepType","compDep","isExtension","lifecycle","Error","GraphIdsFromFsBuilder","constructor","workspace","logger","dependencyResolver","shouldThrowOnMissingDep","_defineProperty2","default","Graph","consumer","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","processManyComponents","graph","depth","importObjects","allDependencies","mapSeries","component","processOneComponent","allDependenciesFlattened","flatten","workspaceIds","listIds","compOnWorkspaceOnly","filter","comp","find","id","isEqual","notImported","map","c","importedIds","includes","toString","withScope","_legacy","dep","hasScope","scopeComponentsImporter","scope","scopeImporter","importMany","BitIds","uniqFromArray","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","preferDependencyGraph","push","idStr","completed","graphFromScope","getSavedGraphOfComponentIfExist","edges","isOnWorkspace","hasId","allDependenciesComps","processCompFromWorkspaceWithGraph","merge","deps","getComponentDependencies","allDepsIds","d","componentId","forEach","addDepEdge","depsInScopeGraph","depsNotInScopeGraph","partition","hasNode","depsInScopeGraphIds","depsInScopeGraphIdsNotCompleted","subGraphs","successorsSubgraph","depId","warn","setEdge","Edge","componentsIds","dependenciesOf","fromCache","loadedComponents","get","setNode","Node","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","error","compact","exports"],"sources":["build-graph-ids-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { flatten, partition } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, ComponentID } from '@teambit/component';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport { ComponentDependency, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { CompIdGraph, DepEdgeType } from '@teambit/graph';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { Workspace } from './workspace';\n\nexport function lifecycleToDepType(compDep: ComponentDependency): DepEdgeType {\n if (compDep.isExtension) return 'ext';\n switch (compDep.lifecycle) {\n case 'dev':\n return 'dev';\n case 'runtime':\n return 'prod';\n default:\n throw new Error(`lifecycle ${compDep.lifecycle} is not support`);\n }\n}\n\nexport class GraphIdsFromFsBuilder {\n private graph = new Graph<ComponentID, DepEdgeType>();\n private completed: string[] = [];\n private depth = 1;\n private consumer: Consumer;\n private loadedComponents: { [idStr: string]: Component } = {};\n private importedIds: string[] = [];\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private shouldThrowOnMissingDep = true\n ) {\n this.consumer = this.workspace.consumer;\n }\n\n /**\n * create a graph with all dependencies and flattened dependencies of the given components.\n * the nodes are component-ids and the edges has a label of the dependency type.\n * to get some info about this the graph build take a look into build-graph-from-fs.buildGraph() docs.\n */\n async buildGraph(ids: ComponentID[]): Promise<Graph<ComponentID, DepEdgeType>> {\n this.logger.debug(`GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids);\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(\n `GraphIdsFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`\n );\n this.depth += 1;\n await this.importObjects(components);\n const allDependencies = await mapSeries(components, (component) => this.processOneComponent(component));\n const allDependenciesFlattened = flatten(allDependencies);\n if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);\n }\n\n /**\n * only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that\n * all their dependencies are imported.\n * once a component from scope is imported, we know that either we have its dependency graph or all flattened deps\n */\n private async importObjects(components: Component[]) {\n const workspaceIds = await this.workspace.listIds();\n const compOnWorkspaceOnly = components.filter((comp) => workspaceIds.find((id) => id.isEqual(comp.id)));\n const notImported = compOnWorkspaceOnly.map((c) => c.id).filter((id) => !this.importedIds.includes(id.toString()));\n const withScope = notImported.map((id) => id._legacy).filter((dep) => dep.hasScope());\n const scopeComponentsImporter = this.consumer.scope.scopeImporter;\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(withScope),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n preferDependencyGraph: true,\n });\n notImported.map((id) => this.importedIds.push(id.toString()));\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const graphFromScope = await this.workspace.getSavedGraphOfComponentIfExist(component);\n if (graphFromScope?.edges.length) {\n const isOnWorkspace = await this.workspace.hasId(component.id);\n if (isOnWorkspace) {\n const allDependenciesComps = await this.processCompFromWorkspaceWithGraph(graphFromScope, component);\n this.completed.push(idStr);\n return allDependenciesComps;\n }\n this.graph.merge([graphFromScope]);\n this.completed.push(idStr);\n return [];\n }\n\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const allDepsIds = deps.map((d) => d.componentId);\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n this.completed.push(idStr);\n\n return allDependenciesComps;\n }\n\n /**\n * this is tricky.\n * the component is in the workspace so it can be modified. dependencies can be added/removed/updated/downgraded.\n * we have the graph-dependencies from the last snap, so we prefer to use it whenever possible for performance reasons.\n * if we can't use it, we have to recursively load dependencies components and get the data from there.\n * to maximize the performance, we iterate the direct dependencies, if we find a dep with the same id in the graph,\n * and that id is not in the workspace then ask the graph for all its successors. otherwise, if it's not there, or\n * it's there but it's also in the workspace (which therefore can be modified), we recursively load the dep components\n * and get its dependencies.\n */\n private async processCompFromWorkspaceWithGraph(\n graphFromScope: CompIdGraph,\n component: Component\n ): Promise<Component[]> {\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const workspaceIds = await this.workspace.listIds();\n const [depsInScopeGraph, depsNotInScopeGraph] = partition(\n deps,\n (dep) =>\n graphFromScope.hasNode(dep.componentId.toString()) && !workspaceIds.find((id) => id.isEqual(dep.componentId))\n );\n\n const depsInScopeGraphIds = depsInScopeGraph.map((dep) => dep.componentId.toString());\n const depsInScopeGraphIdsNotCompleted = depsInScopeGraphIds.filter((id) => !this.completed.includes(id));\n if (depsInScopeGraphIdsNotCompleted.length) {\n const subGraphs = graphFromScope.successorsSubgraph(depsInScopeGraphIdsNotCompleted);\n this.graph.merge([subGraphs]);\n this.completed.push(...depsInScopeGraphIdsNotCompleted);\n }\n\n const allDepsIds = depsNotInScopeGraph.map((d) => d.componentId);\n const idStr = component.id.toString();\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n return allDependenciesComps;\n }\n\n private addDepEdge(idStr: string, dep: ComponentDependency) {\n const depId = dep.componentId;\n if (!this.graph.hasNode(depId.toString())) {\n if (this.shouldThrowOnMissingDep) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.logger.warn(`ignoring missing ${depId.toString()}`);\n return;\n }\n this.graph.setEdge(new Edge(idStr, depId.toString(), lifecycleToDepType(dep)));\n }\n\n private async loadManyComponents(componentsIds: ComponentID[], dependenciesOf?: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (comp) => {\n const idStr = comp.toString();\n const fromCache = this.loadedComponents[idStr];\n if (fromCache) return fromCache;\n try {\n const component = await this.workspace.get(comp);\n this.loadedComponents[idStr] = component;\n this.graph.setNode(new Node(idStr, component.id));\n return component;\n } catch (err: any) {\n if (\n err instanceof ComponentNotFound ||\n err instanceof ComponentNotFoundInScope ||\n err instanceof ScopeNotFound\n ) {\n if (dependenciesOf && !this.shouldThrowOnMissingDep) {\n this.logger.warn(\n `component ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" was not found.\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,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AC7B,MAAM+C,SAAS,GAAG,IAAI,CAACC,gBAAgB,CAAChC,KAAK,CAAC;MAC9C,IAAI+B,SAAS,EAAE,OAAOA,SAAS;MAC/B,IAAI;QACF,MAAMhE,SAAS,GAAG,MAAM,IAAI,CAACvB,SAAS,CAACyF,GAAG,CAAC1D,IAAI,CAAC;QAChD,IAAI,CAACyD,gBAAgB,CAAChC,KAAK,CAAC,GAAGjC,SAAS;QACxC,IAAI,CAACL,KAAK,CAACwE,OAAO,CAAC,KAAIC,aAAI,EAACnC,KAAK,EAAEjC,SAAS,CAACU,EAAE,CAAC,CAAC;QACjD,OAAOV,SAAS;MAClB,CAAC,CAAC,OAAOqE,GAAQ,EAAE;QACjB,IACEA,GAAG,YAAYC,+BAAiB,IAChCD,GAAG,YAAYE,0BAAwB,IACvCF,GAAG,YAAYG,2BAAa,EAC5B;UACA,IAAIT,cAAc,IAAI,CAAC,IAAI,CAACnF,uBAAuB,EAAE;YACnD,IAAI,CAACF,MAAM,CAACiF,IAAI,CACb,aAAY1B,KAAM,mBAAkB8B,cAAe,uCACtD,CAAC;YACD,OAAO,IAAI;UACb;UACA,MAAM,KAAIU,oBAAQ,EACf,qBAAoBxC,KAAM,wDACzB8B,cAAc,IAAI,QACnB,iDACH,CAAC;QACH;QACA,IAAIA,cAAc,EAAE,IAAI,CAACrF,MAAM,CAACgG,KAAK,CAAE,kCAAiCX,cAAe,EAAC,CAAC;QACzF,MAAMM,GAAG;MACX;IACF,CAAC,CAAC;IACF,OAAO,IAAAM,kBAAO,EAACnF,UAAU,CAAC;EAC5B;AACF;AAACoF,OAAA,CAAArG,qBAAA,GAAAA,qBAAA"}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_graph","_lodash","_component","_bitIds","_exceptions","_scope","_lodash2","_bitError","lifecycleToDepType","compDep","isExtension","lifecycle","Error","GraphIdsFromFsBuilder","constructor","workspace","logger","dependencyResolver","shouldThrowOnMissingDep","_defineProperty2","default","Graph","consumer","shouldThrowOnInvalidDeps","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","processManyComponents","graph","depth","importObjects","allDependencies","mapSeries","component","processOneComponent","allDependenciesFlattened","flatten","workspaceIds","listIds","compOnWorkspaceOnly","filter","comp","find","id","isEqual","notImported","map","c","importedIds","includes","toString","withScope","_legacy","dep","hasScope","scopeComponentsImporter","scope","scopeImporter","importMany","BitIds","uniqFromArray","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","preferDependencyGraph","push","idStr","completed","graphFromScope","getSavedGraphOfComponentIfExist","edges","isOnWorkspace","hasId","allDependenciesComps","processCompFromWorkspaceWithGraph","merge","deps","getComponentDependencies","allDepsIds","d","componentId","forEach","addDepEdge","depsInScopeGraph","depsNotInScopeGraph","partition","hasNode","depsInScopeGraphIds","depsInScopeGraphIdsNotCompleted","subGraphs","successorsSubgraph","depId","warn","setEdge","Edge","componentsIds","dependenciesOf","fromCache","loadedComponents","get","setNode","Node","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","ConsumerComponent","isComponentInvalidByErrorType","message","error","compact","exports"],"sources":["build-graph-ids-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { flatten, partition } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, ComponentID } from '@teambit/component';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport { ComponentDependency, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { CompIdGraph, DepEdgeType } from '@teambit/graph';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { Workspace } from './workspace';\n\nexport function lifecycleToDepType(compDep: ComponentDependency): DepEdgeType {\n if (compDep.isExtension) return 'ext';\n switch (compDep.lifecycle) {\n case 'dev':\n return 'dev';\n case 'runtime':\n return 'prod';\n default:\n throw new Error(`lifecycle ${compDep.lifecycle} is not support`);\n }\n}\n\nexport class GraphIdsFromFsBuilder {\n private graph = new Graph<ComponentID, DepEdgeType>();\n private completed: string[] = [];\n private depth = 1;\n private consumer: Consumer;\n private loadedComponents: { [idStr: string]: Component } = {};\n private importedIds: string[] = [];\n private shouldThrowOnInvalidDeps = true; // for now it has the same value as shouldThrowOnMissingDep. change if needed\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private shouldThrowOnMissingDep = true\n ) {\n this.consumer = this.workspace.consumer;\n this.shouldThrowOnInvalidDeps = this.shouldThrowOnMissingDep;\n }\n\n /**\n * create a graph with all dependencies and flattened dependencies of the given components.\n * the nodes are component-ids and the edges has a label of the dependency type.\n * to get some info about this the graph build take a look into build-graph-from-fs.buildGraph() docs.\n */\n async buildGraph(ids: ComponentID[]): Promise<Graph<ComponentID, DepEdgeType>> {\n this.logger.debug(`GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids);\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(\n `GraphIdsFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`\n );\n this.depth += 1;\n await this.importObjects(components);\n const allDependencies = await mapSeries(components, (component) => this.processOneComponent(component));\n const allDependenciesFlattened = flatten(allDependencies);\n if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);\n }\n\n /**\n * only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that\n * all their dependencies are imported.\n * once a component from scope is imported, we know that either we have its dependency graph or all flattened deps\n */\n private async importObjects(components: Component[]) {\n const workspaceIds = await this.workspace.listIds();\n const compOnWorkspaceOnly = components.filter((comp) => workspaceIds.find((id) => id.isEqual(comp.id)));\n const notImported = compOnWorkspaceOnly.map((c) => c.id).filter((id) => !this.importedIds.includes(id.toString()));\n const withScope = notImported.map((id) => id._legacy).filter((dep) => dep.hasScope());\n const scopeComponentsImporter = this.consumer.scope.scopeImporter;\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(withScope),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n preferDependencyGraph: true,\n });\n notImported.map((id) => this.importedIds.push(id.toString()));\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const graphFromScope = await this.workspace.getSavedGraphOfComponentIfExist(component);\n if (graphFromScope?.edges.length) {\n const isOnWorkspace = await this.workspace.hasId(component.id);\n if (isOnWorkspace) {\n const allDependenciesComps = await this.processCompFromWorkspaceWithGraph(graphFromScope, component);\n this.completed.push(idStr);\n return allDependenciesComps;\n }\n this.graph.merge([graphFromScope]);\n this.completed.push(idStr);\n return [];\n }\n\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const allDepsIds = deps.map((d) => d.componentId);\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n this.completed.push(idStr);\n\n return allDependenciesComps;\n }\n\n /**\n * this is tricky.\n * the component is in the workspace so it can be modified. dependencies can be added/removed/updated/downgraded.\n * we have the graph-dependencies from the last snap, so we prefer to use it whenever possible for performance reasons.\n * if we can't use it, we have to recursively load dependencies components and get the data from there.\n * to maximize the performance, we iterate the direct dependencies, if we find a dep with the same id in the graph,\n * and that id is not in the workspace then ask the graph for all its successors. otherwise, if it's not there, or\n * it's there but it's also in the workspace (which therefore can be modified), we recursively load the dep components\n * and get its dependencies.\n */\n private async processCompFromWorkspaceWithGraph(\n graphFromScope: CompIdGraph,\n component: Component\n ): Promise<Component[]> {\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const workspaceIds = await this.workspace.listIds();\n const [depsInScopeGraph, depsNotInScopeGraph] = partition(\n deps,\n (dep) =>\n graphFromScope.hasNode(dep.componentId.toString()) && !workspaceIds.find((id) => id.isEqual(dep.componentId))\n );\n\n const depsInScopeGraphIds = depsInScopeGraph.map((dep) => dep.componentId.toString());\n const depsInScopeGraphIdsNotCompleted = depsInScopeGraphIds.filter((id) => !this.completed.includes(id));\n if (depsInScopeGraphIdsNotCompleted.length) {\n const subGraphs = graphFromScope.successorsSubgraph(depsInScopeGraphIdsNotCompleted);\n this.graph.merge([subGraphs]);\n this.completed.push(...depsInScopeGraphIdsNotCompleted);\n }\n\n const allDepsIds = depsNotInScopeGraph.map((d) => d.componentId);\n const idStr = component.id.toString();\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n return allDependenciesComps;\n }\n\n private addDepEdge(idStr: string, dep: ComponentDependency) {\n const depId = dep.componentId;\n if (!this.graph.hasNode(depId.toString())) {\n if (this.shouldThrowOnMissingDep) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.logger.warn(`ignoring missing ${depId.toString()}`);\n return;\n }\n this.graph.setEdge(new Edge(idStr, depId.toString(), lifecycleToDepType(dep)));\n }\n\n private async loadManyComponents(componentsIds: ComponentID[], dependenciesOf?: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (comp) => {\n const idStr = comp.toString();\n const fromCache = this.loadedComponents[idStr];\n if (fromCache) return fromCache;\n try {\n const component = await this.workspace.get(comp);\n this.loadedComponents[idStr] = component;\n this.graph.setNode(new Node(idStr, component.id));\n return component;\n } catch (err: any) {\n if (\n err instanceof ComponentNotFound ||\n err instanceof ComponentNotFoundInScope ||\n err instanceof ScopeNotFound\n ) {\n if (dependenciesOf && !this.shouldThrowOnMissingDep) {\n this.logger.warn(\n `component ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" was not found.\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n if (dependenciesOf && !this.shouldThrowOnInvalidDeps) {\n this.logger.warn(`component ${idStr}, dependency of ${dependenciesOf} is invalid. continuing without it`);\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" is invalid (${err.message}).\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,YAA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G,qBAAA,GAAAA,qBAAA"}
|
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,OA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
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;IA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perty2().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,OAA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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,SA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f,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.1135/dist/workspace.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.1135/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"}
|
|
@@ -12,7 +12,10 @@ export declare class WorkspaceComponentLoader {
|
|
|
12
12
|
private envs;
|
|
13
13
|
private componentsCache;
|
|
14
14
|
constructor(workspace: Workspace, logger: Logger, dependencyResolver: DependencyResolverMain, envs: EnvsMain);
|
|
15
|
-
getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions): Promise<
|
|
15
|
+
getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions, throwOnFailure?: boolean): Promise<{
|
|
16
|
+
components: Component[];
|
|
17
|
+
invalidComponents: InvalidComponent[];
|
|
18
|
+
}>;
|
|
16
19
|
getInvalid(ids: Array<ComponentID>): Promise<InvalidComponent[]>;
|
|
17
20
|
get(componentId: ComponentID, legacyComponent?: ConsumerComponent, useCache?: boolean, storeInCache?: boolean, loadOpts?: ComponentLoadOptions): Promise<Component>;
|
|
18
21
|
getIfExist(componentId: ComponentID): Promise<Component | undefined>;
|
|
@@ -29,7 +32,7 @@ export declare class WorkspaceComponentLoader {
|
|
|
29
32
|
* legacy-id, the component is the cache has the old id.
|
|
30
33
|
*/
|
|
31
34
|
private getFromCache;
|
|
32
|
-
getConsumerComponent
|
|
35
|
+
private getConsumerComponent;
|
|
33
36
|
private isComponentNotExistsError;
|
|
34
37
|
private executeLoadSlot;
|
|
35
38
|
private newComponentFromState;
|