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 all 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
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,27 @@
<a href="https://github.com/prettier/prettier"><img alt ="Styled with Prettier" src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg">
<a href="https://join.slack.com/t/bit-dev-community/shared_invite/zt-1vq1vcxxu-CEVobR1p9BurmW8QnQFh1w" ><img alt="Join Slack" src="https://img.shields.io/badge/Slack-Join%20Bit%20Slack-blueviolet"/></a>


Bit is a build system for development of **composable software**. It makes the composition of applications from independently versioned components seamless and fast.

Bit is similar in sense, but stands as the opposite for the "Monorepo" approach, which aims to center all code under a central repository. Instead, Bit is bringing simplicity for distribution of source code into independently versioned components, depending on each other.
Bit is similar in sense, but stands as the opposite for the "Monorepo" approach, which aims to center all code under a central repository. Instead, Bit is bringing simplicity for distribution of source code into independently versioned components, depending on each other.

People often use Bit to run a Monorepo, a Polyrepo or without using repositories at all.

The core innovation of Bit is the ["Bit Component"](https://bit.dev/#component), a composable and versioned container for source code, whereas dependencies are first-class citizens. Components can be used as packages, ESM modules, runtime scripts, and any other artifact a build task can generate.

- 📦 **Descriptive module names**. Use components through descriptive package names. No aliases required.
- 🚀 **Dependency versioning.** Automatic detection and versioning of dependency changes. No more redundant package.json files.
- 🚀 **Dependency versioning.** Automatic detection and versioning of dependency changes. No more redundant package.json files.
- ⚓ **Reusable development environments.** Reusable components including all of your dev config. No more duplication of countless `tsconfig.json`, `eslintrc` or `pretterrc` configs.
- ⚒️ **Build pipelines**. Independently build and store packages, bundles, and binaries.
- 👓 **Preview and auto-generated docs**. Every component is an asset with auto-generated docs and component previews.
- 🛫 **Change review**. Use Lanes to propose and preview changes and collaborate on them with others.
- 🧑‍💻 **Component generators**. Create new components using pre-built or custom templates for any type of component.


## Getting started

### Install Bit
Use the Bit installer to install Bit to be available on your PATH.

Use the Bit installer to install Bit to be available on your PATH.

```bash
npx @teambit/bvm install
Expand All @@ -55,8 +54,9 @@ For better VSCode dev experience, install the [Bit VSCode Plugin](https://market
### Create a new workspace

Run the following to create a workspace with a few components included, using the hello-world starter:

```bash
bit new hello-world my-hello-world --env teambit.community/starters/hello-world
bit new hello-world my-hello-world --env teambit.community/starters/hello-world
```

For the quick start, we use two React components and one Node module, though you can create components using any JS-based framework. You can explore our [official starters](https://bit.dev/docs) for [Vue](https://bit.dev/docs/quick-start/hello-world-vue), [Angular](https://bit.dev/docs/quick-start/hello-world-angular), and other supported tools or [learn how to create your own](https://bit.dev/docs/node-env/set-up-your-env).
Expand All @@ -72,6 +72,7 @@ bit run hello-world-app
You can get any component to become an app by adding a single file to it.

### Create components

Start creating components using the default component generators, or [create your own](https://bit.dev/docs/node-env/generators).

```bash
Expand Down Expand Up @@ -99,8 +100,9 @@ bit login
```

Once done, change to your own owner and scope names using this command:

```bash
bit scope rename org.scope-name my-org.my-scope-name --refactor
bit scope rename org.scope-name my-org.my-scope-name --refactor
```

This command will refactor your components to use the new owner and scope names.
Expand All @@ -119,7 +121,7 @@ By default, components are built using bit.cloud's CI platform, Ripple CI. Howev

### Export components to a remote scope

Export your staged components from your workspace to their remote scopes. This will make them available to
Export your staged components from your workspace to their remote scopes. This will make them available to
be used by components outside of your workspace, and from your other projects.

```bash
Expand All @@ -129,6 +131,7 @@ bit export
Head over to your bit.cloud account to see your components build progress. Once the build process is completed, the components will be available for use in their remote scopes. 🎉🎉🎉

## Contributors

Bit is entirely built with Bit and you can find all its components on [Bit Cloud](https://bit.cloud/teambit/~scopes).

<a href="../../graphs/contributors"><img src="https://opencollective.com/bit/contributors.svg?width=890&button=false" /></a>
Expand All @@ -137,6 +140,6 @@ Your contribution, no matter how big or small, is much appreciated. Before contr

See [Contributing](CONTRIBUTING.md).

## License
## License

[Apache License, Version 2.0](https://github.com/teambit/bit/blob/master/LICENSE)
24 changes: 19 additions & 5 deletions pnpm-lock.yaml

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

10 changes: 9 additions & 1 deletion scopes/dependencies/dependency-resolver/dependency-linker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { uniq, compact, flatten, head, omit } from 'lodash';
import { Stats } from 'fs';
import fs from 'fs-extra';
import resolveFrom from 'resolve-from';
import { findCurrentBvmDir } from '@teambit/bvm.path';
import { ComponentMap, Component, ComponentID, ComponentMain } from '@teambit/component';
import { Logger } from '@teambit/logger';
import { PathAbsolute } from '@teambit/legacy/dist/utils/path';
Expand Down Expand Up @@ -110,6 +111,8 @@ type NestedModuleFolderEntry = {
};

export class DependencyLinker {
private _currentBitDir: string | null;

constructor(
private dependencyResolver: DependencyResolverMain,

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

private linkingContext: DepLinkerContext = {}
) {}
) {
this._currentBitDir = findCurrentBvmDir();
}

async calculateLinkedDeps(
rootDir: string | undefined,
Expand Down Expand Up @@ -630,6 +635,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
2 changes: 1 addition & 1 deletion scopes/docs/docs/docs.ui.runtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class DocsUI {
private _emptyState?: ComponentType;

registerEmptyState(emptyState: ComponentType) {
return this._emptyState = emptyState;
return (this._emptyState = emptyState);
}

getEmptyState() {
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 @@ -2,6 +2,7 @@ import { BitError } from '@teambit/bit-error';
import { existsSync, readdir } from 'fs-extra';
import { join, resolve } from 'path';
import { Config } from '@teambit/bvm.config';
import { findCurrentBvmDir } from '@teambit/bvm.path';

let _bvmConfig;

Expand All @@ -13,7 +14,14 @@ function getAspectDirFromPath(id: string, pathsToResolveAspects?: string[]): str
if (pathsToResolveAspects && pathsToResolveAspects.length) {
moduleDirectory = require.resolve(packageName, { paths: pathsToResolveAspects });
} else {
moduleDirectory = require.resolve(packageName);
try {
moduleDirectory = require.resolve(packageName);
} catch {
const currentBitDir = findCurrentBvmDir();
if (currentBitDir) {
return resolve(currentBitDir, 'node_modules', packageName);
}
}
}
const dirPath = join(moduleDirectory, '../..'); // to remove the "index.js" at the end
if (!existsSync(dirPath)) {
Expand Down
1 change: 1 addition & 0 deletions workspace.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,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.1.2",
"@teambit/capsule": "0.0.12",
"@teambit/code.ui.code-compare": "^0.0.281",
"@teambit/code.ui.code-compare-section": "0.0.5",
Expand Down