@teambit/workspace 1.0.346 → 1.0.348
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/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_workspace_workspace-preview.js +1 -1
- package/artifacts/schema.json +2688 -2290
- package/commands/local-only-cmd.ts +85 -0
- package/dist/bit-map.d.ts +3 -0
- package/dist/bit-map.js +22 -0
- package/dist/bit-map.js.map +1 -1
- package/dist/commands/local-only-cmd.d.ts +46 -0
- package/dist/commands/local-only-cmd.js +101 -0
- package/dist/commands/local-only-cmd.js.map +1 -0
- package/dist/filter.d.ts +3 -2
- package/dist/filter.js +9 -2
- package/dist/filter.js.map +1 -1
- package/dist/{preview-1721618348248.js → preview-1721791303259.js} +2 -2
- package/dist/types.d.ts +5 -0
- package/dist/types.js.map +1 -1
- package/dist/ui/workspace/use-workspace.d.ts +1 -0
- package/dist/workspace.d.ts +8 -0
- package/dist/workspace.js +34 -3
- package/dist/workspace.js.map +1 -1
- package/dist/workspace.main.runtime.js +10 -0
- package/dist/workspace.main.runtime.js.map +1 -1
- package/dist/workspace.ui.runtime.d.ts +1 -1
- package/package.json +28 -28
package/dist/workspace.js
CHANGED
|
@@ -439,6 +439,14 @@ class Workspace {
|
|
|
439
439
|
return this.consumer.getPath();
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
+
/**
|
|
443
|
+
* Get the location of the bit roots folder
|
|
444
|
+
*/
|
|
445
|
+
get rootComponentsPath() {
|
|
446
|
+
const baseDir = this.config.rootComponentsDirectory != null ? _path().default.join(this.path, this.config.rootComponentsDirectory) : this.modulesPath;
|
|
447
|
+
return _path().default.join(baseDir, _constants().BIT_ROOTS_DIR);
|
|
448
|
+
}
|
|
449
|
+
|
|
442
450
|
/** get the `node_modules` folder of this workspace */
|
|
443
451
|
get modulesPath() {
|
|
444
452
|
return _path().default.join(this.path, 'node_modules');
|
|
@@ -547,6 +555,7 @@ class Workspace {
|
|
|
547
555
|
|
|
548
556
|
/**
|
|
549
557
|
* get ids of all workspace components.
|
|
558
|
+
* deleted components are filtered out. (use this.listIdsIncludeRemoved() if you need them)
|
|
550
559
|
*/
|
|
551
560
|
listIds() {
|
|
552
561
|
return this.consumer.bitmapIdsFromCurrentLane;
|
|
@@ -651,7 +660,7 @@ class Workspace {
|
|
|
651
660
|
*/
|
|
652
661
|
async listPotentialTagIds() {
|
|
653
662
|
const deletedIds = await this.locallyDeletedIds();
|
|
654
|
-
const allIdsWithoutDeleted =
|
|
663
|
+
const allIdsWithoutDeleted = this.listIds();
|
|
655
664
|
return [...deletedIds, ...allIdsWithoutDeleted];
|
|
656
665
|
}
|
|
657
666
|
async getNewAndModifiedIds() {
|
|
@@ -1677,8 +1686,11 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1677
1686
|
await this.clearCache();
|
|
1678
1687
|
}
|
|
1679
1688
|
async getComponentPackagePath(component) {
|
|
1680
|
-
const
|
|
1681
|
-
|
|
1689
|
+
const relativePath = this.dependencyResolver.getRuntimeModulePath(component, {
|
|
1690
|
+
workspacePath: this.path,
|
|
1691
|
+
rootComponentsPath: this.rootComponentsPath,
|
|
1692
|
+
isInWorkspace: this.hasId(component.id)
|
|
1693
|
+
});
|
|
1682
1694
|
return _path().default.join(this.path, relativePath);
|
|
1683
1695
|
}
|
|
1684
1696
|
|
|
@@ -2092,6 +2104,25 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
2092
2104
|
async getComponentStatusById(id) {
|
|
2093
2105
|
return this.componentStatusLoader.getComponentStatusById(id);
|
|
2094
2106
|
}
|
|
2107
|
+
async setLocalOnly(ids) {
|
|
2108
|
+
const staged = (0, _lodash().compact)(await (0, _pMapSeries().default)(ids, async id => {
|
|
2109
|
+
const componentStatus = await this.getComponentStatusById(id);
|
|
2110
|
+
if (componentStatus.staged) return id;
|
|
2111
|
+
}));
|
|
2112
|
+
if (staged.length) {
|
|
2113
|
+
throw new (_bitError().BitError)(`unable to set the following component(s) as local-only because they have local snaps/tags: ${staged.join(', ')}`);
|
|
2114
|
+
}
|
|
2115
|
+
this.bitMap.setLocalOnly(ids);
|
|
2116
|
+
await this.bitMap.write('setLocalOnly');
|
|
2117
|
+
}
|
|
2118
|
+
async unsetLocalOnly(ids) {
|
|
2119
|
+
const successfullyUnset = this.bitMap.unsetLocalOnly(ids);
|
|
2120
|
+
await this.bitMap.write('unsetLocalOnly');
|
|
2121
|
+
return successfullyUnset;
|
|
2122
|
+
}
|
|
2123
|
+
listLocalOnly() {
|
|
2124
|
+
return _componentId().ComponentIdList.fromArray(this.bitMap.listLocalOnly());
|
|
2125
|
+
}
|
|
2095
2126
|
}
|
|
2096
2127
|
|
|
2097
2128
|
/**
|