Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: symlink core aspects from a symlink that points to the current Bit CLI #7696

Merged
merged 67 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
49a6348
feat: symlink core aspects from a symlink that points to the current …
zkochan Jul 25, 2023
ecb0372
link legacy and harmony
zkochan Jul 25, 2023
fe90d91
style: fix
zkochan Jul 25, 2023
4870b3f
update bvm.path
zkochan Jul 25, 2023
c2855b9
fix(new/starters), sort the components to fork to create envs first (…
davidfirst Jul 26, 2023
f0bc398
fix(lane-merge-abort), restore components deleted by the last lane-me…
davidfirst Jul 26, 2023
09d6be7
bump @teambit/legacy version to 1.0.528 [skip ci]
Jul 26, 2023
853589f
bump teambit version to 0.2.10 [skip ci]
Jul 26, 2023
343a951
API(scope) - expose new getIsolateAspectsOpts API from scope main run…
GiladShoham Jul 26, 2023
441c000
bump teambit version to 0.2.11 [skip ci]
Jul 26, 2023
7fe63fc
fix(snap), fetch components from their lane during populateFlattenedD…
davidfirst Jul 26, 2023
645a9e1
fix(refactoring): handle member transformations (#7701)
luvkapur Jul 26, 2023
77b4a8b
feat: make progress throttle configurable (#7703)
zkochan Jul 26, 2023
c78ecae
fix(aspect-merger | merging): make sure consumer reference is not sta…
luvkapur Jul 26, 2023
b008f9f
bump @teambit/legacy version to 1.0.529 [skip ci]
Jul 27, 2023
a956a6a
fix(snap), prevent snapping when dependencies are from another lane (…
davidfirst Jul 27, 2023
f9d1ea4
bump @teambit/legacy version to 1.0.530 [skip ci]
Jul 27, 2023
eebf9f8
bump teambit version to 0.2.12 [skip ci]
Jul 27, 2023
4e52c7c
fix(bit new) - compile components again once all envs and their depen…
GiladShoham Jul 27, 2023
6100399
fix(apps) - pass deploy context correctly from build app to deploy ap…
GiladShoham Jul 27, 2023
c4fc7ff
remove ComponentStatus.nested, it is not relevant in Harmony (#7630)
davidfirst Jul 27, 2023
3f9dee0
fix(watch), fix high CPU by removing "useFsEvents: false" from chokid…
davidfirst Jul 28, 2023
3699164
bump @teambit/legacy version to 1.0.531 [skip ci]
Jul 28, 2023
7128b3a
bump teambit version to 0.2.13 [skip ci]
Jul 28, 2023
b16b80f
add(webpack): watch options polling (#7708)
leimonio Jul 28, 2023
87f6c0a
bump teambit version to 0.2.14 [skip ci]
Jul 29, 2023
5139111
bump teambit version to 0.2.14 [skip ci]
Jul 30, 2023
257412e
fix: update pnpm to fix auth issue in artifactory (#7714)
zkochan Jul 30, 2023
835f0b2
fix: add missing dependencies to package.json (#7716)
zkochan Jul 30, 2023
de7ced3
types(envs) - expose more envs types (#7715)
GiladShoham Jul 30, 2023
cbfb0fa
fix: don't try to relink components in bit roots (#7665)
zkochan Jul 30, 2023
398b705
bump @teambit/legacy version to 1.0.532 [skip ci]
Jul 31, 2023
20a56f3
bump teambit version to 0.2.15 [skip ci]
Jul 31, 2023
8d21828
improvement(ws-config) - re-enable auto writing workspace config duri…
GiladShoham Jul 31, 2023
9ad5a9a
fix(generator) - cleanup envs / aspect loading errors during bit new …
GiladShoham Jul 31, 2023
43e26eb
fix(refactoring): source file formatting after transform (#7720)
luvkapur Jul 31, 2023
6d9d42b
fix: peer dependencies should be deduped when root components are use…
zkochan Jul 31, 2023
d3efeba
chore(deps) - remove browserslist (#7721)
GiladShoham Jul 31, 2023
853861a
chore(isolator) - replace fs.remove with rimraf when clean capsules o…
GiladShoham Jul 31, 2023
48b7c59
bump teambit version to 0.2.16 [skip ci]
Aug 1, 2023
e9e42c6
refactor, replace importManyIfMissingWithoutDeps call with importWith…
davidfirst Aug 1, 2023
886daba
fix(remove), fix soft-removing a component after recovering it (#7724)
davidfirst Aug 2, 2023
44a4395
bump teambit version to 0.2.17 [skip ci]
Aug 2, 2023
c4e93f5
Aspect cache config (#7725)
ranm8 Aug 2, 2023
7511c8a
bump teambit version to 0.2.18 [skip ci]
Aug 2, 2023
a2984c5
fix(typescript): import alias and function type reference transform (…
luvkapur Aug 2, 2023
379465e
fix(switch), ensure components from other lanes are unavailable (#7706)
davidfirst Aug 2, 2023
678ea08
improve an error when snapping/tagging a dependency from another lane…
davidfirst Aug 2, 2023
920be09
fix(env-get), remove wrong pipelines data, instead refer to using "bi…
davidfirst Aug 2, 2023
98c238c
add onLanesOnly when snapping on a lane (#7730)
davidfirst Aug 2, 2023
1f86be9
remove isAvailableOnCurrentLane if is true before writing to the .bit…
davidfirst Aug 2, 2023
9984920
fix(code-compare): code compare navigation loading styles (#7732)
luvkapur Aug 3, 2023
a58be69
fix(scope-rename), rename scope of envs in .bitmap config (#7733)
davidfirst Aug 3, 2023
2a3d01b
bump @teambit/legacy version to 1.0.533 [skip ci]
Aug 3, 2023
8a820b6
decouple ignore-build-errors and disable-snap/tag-pipeline flags (#7727)
benjgil Aug 3, 2023
2820435
fix(snap), import from original lane in case of fork and the lane is …
davidfirst Aug 3, 2023
2a23d48
chore(e2e) - update react-env version in e2e tests (#7747)
GiladShoham Aug 7, 2023
d018f18
change(isolator) - do not install extensions dependencies (like envs)…
GiladShoham Aug 7, 2023
7a1c760
feat: update selected packages by passing patterns to the update comm…
zkochan Aug 7, 2023
02377a1
fix: don't relink local components in node_modules on repeat install …
zkochan Aug 7, 2023
bc516d4
Merge remote-tracking branch 'origin/master' into bit-link
zkochan Aug 7, 2023
9e0d942
Merge remote-tracking branch 'origin/master' into bit-link
zkochan Aug 7, 2023
d8a6dc8
Merge branch 'master' into bit-link
zkochan Aug 8, 2023
638d501
Merge remote-tracking branch 'origin/master' into bit-link
zkochan Aug 20, 2023
7650882
fix: make changes suggested in PR comments
zkochan Aug 21, 2023
4b2ae51
Merge remote-tracking branch 'origin/master' into bit-link
zkochan Aug 21, 2023
48d6661
Merge branch 'master' into bit-link
GiladShoham Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions scopes/dependencies/dependency-resolver/dependency-linker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { BitError } from '@teambit/bit-error';
import componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';
import { EnvsMain } from '@teambit/envs';
import { AspectLoaderMain, getCoreAspectName, getCoreAspectPackageName, getAspectDir } from '@teambit/aspect-loader';
import { findCurrentBvmDir } from '@teambit/bvm.path';
import {
MainAspectNotLinkable,
RootDirNotDefined,
Expand Down Expand Up @@ -103,6 +104,8 @@ type NestedModuleFolderEntry = {
};

export class DependencyLinker {
private _currentBitDir: string | null;

constructor(
private dependencyResolver: DependencyResolverMain,

Expand All @@ -119,7 +122,9 @@ export class DependencyLinker {
private linkingOptions?: LinkingOptions,

private linkingContext: DepLinkerContext = {}
) {}
) {
this._currentBitDir = findCurrentBvmDir(process.argv[1]);
}

async calculateLinkedDeps(
rootDir: string | undefined,
Expand Down Expand Up @@ -532,7 +537,7 @@ export class DependencyLinker {
const isAspectDirExist = fs.pathExistsSync(aspectDir);
if (!isAspectDirExist) {
this.logger.debug(`linkCoreAspect: aspectDir ${aspectDir} does not exist, linking it to ${target}`);
aspectDir = getAspectDir(id);
aspectDir = getAspectDir(id, this._currentBitDir);
return { aspectId: id, linkDetail: { packageName, from: aspectDir, to: target } };
}

Expand Down Expand Up @@ -580,6 +585,9 @@ export class DependencyLinker {

const packageName = `@teambit/${name}`;
const target = path.join(rootDir, 'node_modules', packageName);
if (this._currentBitDir) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need to handle this also in some places of load-bit.ts
for example we have there getMainAspect which later used to link the @teambit/bit itself. which I think will now point to the wrong location.
you can also look on linkBit in this file, and see if you get the correct location or not in action.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you are right. May I just update the getAspectDir to alway prefer reading from currentBitDir? Is there any scenario where currentBitDir should not be used?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zkochan yes you can change the getAspectDir

return { packageName, from: path.join(this._currentBitDir, 'node_modules', packageName), to: target };
}
const isDistDirExist = fs.pathExistsSync(distDir);
if (!isDistDirExist) {
const newDir = getDistDirForDevEnv(packageName);
Expand Down
10 changes: 9 additions & 1 deletion scopes/harmony/aspect-loader/core-aspects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@ function getAspectDirFromPath(id: string, pathsToResolveAspects?: string[]): str
return dirPath;
}

export function getAspectDir(id: string): string {
export function getAspectDir(id: string, currentBitDir?: string | null): string {
const aspectName = getCoreAspectName(id);
let dirPath;

if (currentBitDir) {
dirPath = resolve(currentBitDir, 'node_modules/@teambit', aspectName);
if (!existsSync(dirPath)) {
throw new Error(`unable to find ${aspectName} in ${dirPath}`);
}
return dirPath;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zkochan why not just pass the currentBitDir as the second arg to the getAspectDirFromPath below

try {
dirPath = getAspectDirFromPath(id);
} catch (err: any) {
Expand Down
1 change: 1 addition & 0 deletions workspace.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"@teambit/base-ui.utils.time-ago": "1.0.1",
"@teambit/bit.content.what-is-bit": "1.96.2",
"@teambit/bvm.config": "0.2.2",
"@teambit/bvm.path": "^0.0.2",
"@teambit/capsule": "0.0.12",
"@teambit/code.ui.code-compare-section": "0.0.5",
"@teambit/code.ui.dependency-tree": "0.0.546",
Expand Down