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

Bit bundle #7180

Draft
wants to merge 116 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
151bf9b
import all core aspects main runtimes to make sure it's part of the b…
GiladShoham Jan 19, 2023
fbaedad
now that we import all the core aspect main runtimes we don't need to…
GiladShoham Jan 19, 2023
613ee4e
require yargs instead of import it as it causes bundling issues
GiladShoham Jan 19, 2023
b053368
WIP - first bundling script (with hard coded stuff)
GiladShoham Jan 19, 2023
83935fc
externals updates
GiladShoham Jan 19, 2023
95b3f0d
remove tsconfig from eslint config (it will anyway generated on runtime)
GiladShoham Jan 19, 2023
3d174e4
update externals
GiladShoham Jan 19, 2023
cadc837
move imports
GiladShoham Jan 19, 2023
e861f01
Merge branch 'master' into bit-bundle
GiladShoham Mar 21, 2023
9589d7c
add esbuild plugins to policy
GiladShoham Mar 26, 2023
2484fe6
adjust bundle script
GiladShoham Mar 26, 2023
8e37f88
Merge branch 'master' into bit-bundle
GiladShoham Jul 16, 2023
dba67b1
Merge branch 'master' into bit-bundle
GiladShoham Jul 16, 2023
0009c69
fixes
GiladShoham Jul 16, 2023
96a78d7
Merge branch 'master' into bit-bundle
GiladShoham Jul 20, 2023
e34dc54
manifests fixes
GiladShoham Jul 20, 2023
6dd2505
move jest config inside instead of top
GiladShoham Jul 20, 2023
1dbdd6d
expose manifests map as a function (to support the bundling hoisting …
GiladShoham Jul 20, 2023
1b0549f
add more ignores
GiladShoham Jul 20, 2023
5614efc
fix config aspect instances
GiladShoham Jul 20, 2023
2b6c8ea
restructure bundle files and add readme
GiladShoham Jul 23, 2023
5ecf019
restore core aspects to manifests
GiladShoham Jul 23, 2023
76b3e02
bundle - generateCoreAspectsBarrelFile
GiladShoham Jul 23, 2023
f91bf9e
ignore bundle outputs
GiladShoham Jul 23, 2023
18c027b
generate core aspects modules
GiladShoham Jul 23, 2023
8c7b59b
export from generate core aspects barrel file
GiladShoham Jul 23, 2023
0d51e30
handle exports / modules for harmony / legacy
GiladShoham Jul 23, 2023
52b88a6
fix generated modules path
GiladShoham Jul 23, 2023
c1db47a
do not load core aspects defs when exclude core is true
GiladShoham Jul 23, 2023
b1b40b2
add todo about sourcemaps
GiladShoham Jul 23, 2023
3a87c27
fix gitignore
GiladShoham Jul 23, 2023
52a6fe1
update core aspects exports
GiladShoham Jul 23, 2023
10076bd
do not add core envs aspect defs to env runtime
GiladShoham Jul 23, 2023
942d6c9
add esbuild config files plugin
GiladShoham Jul 24, 2023
9162021
esbuild plugin handle module paths config files
GiladShoham Jul 24, 2023
abe239f
handle more files to copy
GiladShoham Jul 24, 2023
7fe2467
improve config files esbuild plugin
GiladShoham Jul 24, 2023
78eac1c
handle more config files (also from node_modules)
GiladShoham Jul 24, 2023
cf83bdb
externalize more packages
GiladShoham Jul 24, 2023
dcbfbac
remove file extensions from jest config
GiladShoham Jul 24, 2023
5efed4e
force some react env jest config bundling (hack)
GiladShoham Jul 24, 2023
d0d7e29
Merge branch 'master' into bit-bundle
GiladShoham Jul 25, 2023
1706167
Merge branch 'master' into bit-bundle
GiladShoham Jul 26, 2023
d9743e5
Merge branch 'master' into bit-bundle
GiladShoham Jul 26, 2023
d2ba72d
clean logs
GiladShoham Jul 26, 2023
f6315f3
output esbuild duration
GiladShoham Jul 26, 2023
465b11d
create package.json with external deps
GiladShoham Jul 26, 2023
1775e68
generate npmrc with bit's registry
GiladShoham Jul 26, 2023
4a342a6
copy pacakge.json of core aspects
GiladShoham Jul 26, 2023
8cdda40
move externals to a dedicated file
GiladShoham Jul 26, 2023
a640fa5
update main flow
GiladShoham Jul 26, 2023
ed4c523
update readme
GiladShoham Jul 26, 2023
d0b7dcb
add missing core aspects
GiladShoham Jul 26, 2023
c0c702a
add bundle script
GiladShoham Jul 27, 2023
a266483
Merge branch 'master' into bit-bundle
GiladShoham Aug 7, 2023
9d05d28
Merge branch 'master' into bit-bundle
GiladShoham Aug 7, 2023
798d9c8
trying tsup
GiladShoham Aug 7, 2023
c41f2e6
ensure folder exists
GiladShoham Aug 7, 2023
2b98ada
Merge branch 'master' into bit-bundle
GiladShoham Aug 10, 2023
ced0b86
move back to esbuild
GiladShoham Aug 13, 2023
7e0759d
Merge branch 'master' into bit-bundle
GiladShoham Aug 14, 2023
a08f376
add more externals
GiladShoham Aug 14, 2023
e707df9
update browserslist version
GiladShoham Aug 14, 2023
953986c
add copy files of core aspects
GiladShoham Aug 14, 2023
34490c3
improve copy files for core aspects
GiladShoham Aug 14, 2023
dc2b486
improve copy files
GiladShoham Aug 14, 2023
5c6bd02
improve core aspect path calc
GiladShoham Aug 14, 2023
540b342
derefrence copied files
GiladShoham Aug 14, 2023
d68863e
readability
GiladShoham Aug 14, 2023
58d7751
add more externals required for tests (jest config)
GiladShoham Aug 14, 2023
160f6fa
handle asset.d.ts and style.d.ts files
GiladShoham Aug 15, 2023
1f1f621
copy ts d.ts files
GiladShoham Aug 15, 2023
7b80033
add minify in comment
GiladShoham Aug 15, 2023
bf82ed9
Merge branch master into bit-bundle
GiladShoham Jan 21, 2024
e29685b
Merge branch 'master' into bit-bundle
GiladShoham Jan 21, 2024
5836d5d
remove elements leftovers
GiladShoham Jan 21, 2024
f0969a4
improve config files esbuild plugin resolution
GiladShoham Jan 21, 2024
53237f9
remove elements left overs
GiladShoham Jan 21, 2024
2b09cea
add missing exports in esm files
GiladShoham Jan 28, 2024
f97c391
Merge branch 'master' into bit-bundle
GiladShoham Jan 28, 2024
5a8e42e
Merge branch 'master' into bit-bundle
GiladShoham Feb 13, 2024
296c48a
add missing export in merging esm.mjs
GiladShoham Feb 13, 2024
74494ad
add missing externals
GiladShoham Feb 13, 2024
b42c56a
handle jest cjs transformer
GiladShoham Feb 13, 2024
946cfc9
fixes for workspace config proto
GiladShoham Feb 19, 2024
212e41a
Merge branch 'master' into bit-bundle
GiladShoham Feb 19, 2024
cf98ad4
refactor(core-aspects) - use named import to import aspects manifests
GiladShoham Feb 20, 2024
5089cdb
add config merger aspect to core ids
GiladShoham Feb 21, 2024
edb0d68
esm fixes on package.json and esm.mjs file copy
GiladShoham Feb 21, 2024
5f27727
improve core aspect loading when using bundle
GiladShoham Feb 21, 2024
d9dea87
generate sea and pkg configs (WIP)
GiladShoham Feb 29, 2024
0e7feeb
Merge branch 'master' of https://github.com/teambit/bit into bit-bundle
GiladShoham Feb 29, 2024
1473cf0
bump esbuild
GiladShoham Feb 29, 2024
3558b09
add binary script to readme
GiladShoham Mar 4, 2024
c4e190e
generate esbuild metafile for bundle analysis
GiladShoham Mar 5, 2024
0b6cbfd
Merge branch 'master' into bit-bundle
GiladShoham Mar 7, 2024
08a26da
Merge branch 'master' of https://github.com/teambit/bit into bit-bundle
GiladShoham Mar 10, 2024
4858ce2
Merge branch 'master' of https://github.com/teambit/bit into bit-bundle
GiladShoham Mar 10, 2024
59a2528
Merge branch 'master' of https://github.com/teambit/bit into bit-bundle
GiladShoham Mar 12, 2024
6b0771d
Merge branch 'master' of https://github.com/teambit/bit into bit-bundle
GiladShoham Mar 12, 2024
61bb165
Merge branch 'master' into bit-bundle
GiladShoham May 15, 2024
0f7aaf5
fix getting bit version from bundle
GiladShoham May 16, 2024
2b5b9c1
Merge commit 'b01aa9901ad7937cdb18c9142f48a4e7edb93b71' into bit-bundle
GiladShoham May 16, 2024
195bd58
Merge branch 'master' into bit-bundle
GiladShoham Dec 16, 2024
3d2a32a
update esbuild
GiladShoham Dec 16, 2024
417c9f3
remove old file
GiladShoham Dec 16, 2024
07d43f0
remove react-native
GiladShoham Dec 16, 2024
62a8ef6
fixes
GiladShoham Dec 16, 2024
6217a28
fixes
GiladShoham Dec 16, 2024
c2a9e53
Merge branch 'master' of https://github.com/teambit/bit into bit-bundle
GiladShoham Dec 17, 2024
1b2c3a6
remove react native
GiladShoham Dec 17, 2024
de8b463
replace getConsumerInfo with getWorkspaceInfo
GiladShoham Dec 17, 2024
b65b4d1
Merge branch 'master' of https://github.com/teambit/bit into bit-bundle
GiladShoham Dec 17, 2024
0f7240a
fixes
GiladShoham Dec 17, 2024
43c0aab
more fixes
GiladShoham Dec 17, 2024
2ea0c3c
update manifests file
GiladShoham Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Merge branch 'master' into bit-bundle
# Conflicts:
#	.gitignore
#	package.json
#	scopes/harmony/bit/app.ts
#	scopes/harmony/bit/bootstrap.ts
#	scopes/harmony/bit/load-bit.ts
#	scopes/harmony/cli/cli-parser.ts
#	scopes/harmony/config/config.main.runtime.ts
#	scopes/react/react-native/react-native.main.runtime.ts
#	scopes/react/react/jest/jest.base.config.js
#	scopes/react/react/jest/jest.cjs.config.js
GiladShoham committed Dec 16, 2024
commit 195bd588863aaec75735c2b2132238aebf4de122
1,020 changes: 692 additions & 328 deletions .bitmap

Large diffs are not rendered by default.

163 changes: 48 additions & 115 deletions .circleci/config.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
e2e/fixtures
components/legacy/e2e-helper/fixtures
scopes/semantics/schema/mock

# A temp file should be required from outside (via npm) so no point to fix it
34 changes: 1 addition & 33 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -23,13 +23,9 @@ coverage
# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages
!fixtures/filing-cabinet/node_modules
!scopes/dependencies/dependencies/files-dependency-builder/fixtures/filing-cabinet/node_modules

# Optional npm cache directory
.npm
@@ -40,10 +36,6 @@ jspm_packages
# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
!e2e/fixtures/**/*.tgz

# Yarn Integrity file
.yarn-Integrity

@@ -54,21 +46,10 @@ jspm_packages
.idea/

#output
dist/*
public/
!components/*/dist/
eslint-report.html
types/*

#distrubution
distribution/

artifacts/
bit-*.tar.gz
tmp/
bin/node
nodeBin

# bit directories
.bit

@@ -78,13 +59,6 @@ nodeBin
#vscode history
.history

#gitbook
_book

# pkg releases
/releases/
bin/bit

# sonarcloud dir
.scannerwork

@@ -100,11 +74,5 @@ package-lock.json
!.yarn/sdks
!.yarn/versions

# component issues
scopes/component/component-issues/dist/

# component version
scopes/component/component-version/dist/

# bundle output
/bundle
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"printWidth": 120,
"singleQuote": true
}
"singleQuote": true,
"trailingComma": "es5"
}
20 changes: 1 addition & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -18,10 +18,7 @@ the setup process is more involving than expected because we write bit using bit
the script does the following:

1. runs `bit install` to install all dependencies.
2. runs `npm run link-bit-legacy` to create a symlink for the bit-legacy package.
3. runs `bit compile` to compile all components in the workspace (Harmony code).
4. compiles bit-legacy code (by `npm run build`).
5. generates the d.ts files for the bit-legacy code (by `npm run build:types`).
2. runs `bit compile` to compile all components in the workspace.

install command globally and link (in order to use the "bit-dev" command globally and always use the
latest development build)
@@ -50,15 +47,6 @@ bit will install these commands in `/usr/local/bin/` directory, so in order to r

### Build

Depends on where your changes were made, you'll need to build the legacy code or Harmony code.
If the changes were done in `src/` directory, then it's the legacy. Otherwise, it's probably in `scopes/` directory and it's the new code.

- build bit-legacy code

```bash
npm run build
```

- build bit Harmony code

```bash
@@ -69,12 +57,6 @@ If the changes were done in `src/` directory, then it's the legacy. Otherwise, i

It's easier to leave the watch process running instead of re-build for every change.

- watch bit-legacy code

```bash
npm run watch
```

- watch bit Harmony code

```bash
85 changes: 39 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -23,21 +23,20 @@
<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](https://bit.dev) is a complete solution for building **composable software**. It simplifies the creation, maintenance and reuse of software using independent and reusable components.

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.
You can use Bit components to build new projects or reuse components to modernize your existing applications. Here are few examples to components people build with Bit:

People often use Bit to run a Monorepo, a Polyrepo or without using repositories at all.
- [Reusable components](#getting-started)
- [Backend services](https://bit.dev/docs/quick-start/platforms)
- [Design systems](https://bit.dev/docs/quick-start/design-system)
- [Composable platforms](https://bit.dev/docs/composable-platforms)
- [Shell applications](https://bit.dev/docs/quick-start/react)
- [Micro frontends](https://bit.dev/docs/micro-frontends/react-micro-frontends)

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.
Bit supports all tooling in the JS ecosystem and comes out of the box with official dev environments for [NodeJS](https://bit.dev/docs/backend-intro), [React](https://bit.dev/docs/react-intro), [Angular](https://bit.dev/docs/angular-introduction), [Vue](https://bit.dev/docs/vue-intro), [React Native](https://bit.dev/docs/react-native-intro), [NextJS](https://bit.dev/docs/quick-start/hello-world-nextjs) and [far more](https://bit.dev/docs). All are native to TypeScript and ESM and equipped with the best dev tooling.

- 📦 **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.
- ⚓ **Reusable development environments.** Reusable components including all of your dev config. No more duplication of countless `tsconfig.json`, `eslintrc` or `prettierrc` 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.
Bit is a fit to every codebase structure. You can use Bit components in a monorepo, polyrepo, or even without repositories at all.

## Getting started

@@ -49,37 +48,35 @@ Use the Bit installer to install Bit to be available on your PATH.
npx @teambit/bvm install
```

For better VSCode dev experience, install the [Bit VSCode Plugin](https://marketplace.visualstudio.com/items?itemName=bit.vscode-bit).

### Create a new workspace

Run the following to create a workspace with a few components included, using the hello-world starter:
Initialize Bit on a new folder or in an existing project by running the following command:

```bash
bit new hello-world my-hello-world --env teambit.community/starters/hello-world
bit init --default-scope my-org.my-project
```

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).
Make sure to create your scope on the Bit platform and use the right org and project name. After running the command, Bit is initialized on the chosen directory, and ready to be used via Bit commands, your editor or the Bit UI!

### Run the app
### Create components

Your workspace maintains a number of components. One of these components is also an [app](https://bit.dev/reference/apps/application-types/). Run it using:
Start creating components using the default component generators, or [create your own](https://bit.dev/docs/node-env/generators).

```bash
bit run hello-world-app
bit templates
```

You can get any component to become an app by adding a single file to it.
The following command uses the React UI component template to create a new reusable React component:

### Create components
```bash
bit create react hello-world
```

Start creating components using the default component generators, or [create your own](https://bit.dev/docs/node-env/generators).
You can find simple guides for creating NodeJS modules, UI components and apps, backend services and more on the [Create Component docs](https://bit.dev/docs/getting-started/composing/creating-components/). Run the Bit UI to preview components using the following command:

```bash
bit create react buttons/button
```
bit start
```

You can view other built-in component templates, by running the `bit templates` command.
Use `bit run` to preview applications during development. To create an application, follow the [Create App docs section](https://bit.dev/docs/getting-started/composing/create-apps/).

### Use components

@@ -89,46 +86,42 @@ After creating a new component, start using it by adding an import statement in
import { Button } from '@org/scope-name.buttons.button';
```

Once added, Bit will autodetect the dependency between these components. Use `bit show` or the VSCode plugin to view the list of dependencies Bit detected for your components.
Once added, Bit will autodetect the dependency between these components. Use `bit show` or the [VSCode plugin](https://bit.dev/docs/getting-started/installing-bit/editor-setup) to view the list of dependencies Bit detected for your components.

### Create a remote scope
### Release components

You can either use hosted scopes on [Bit Cloud](https://bit.cloud) or by [hosting scopes on your own](https://bit.dev/reference/scope/running-a-scope-server). Use the following command to create your Bit Cloud account and your first scope.

```bash
bit login
```

Once done, change to your own owner and scope names using this command:
Use semantic versioning to version your components:

```bash
bit scope rename org.scope-name my-org.my-scope-name --refactor
bit tag --message "my first release" --major
```

This command will refactor your components to use the new owner and scope names.

### Record component and dependency changes
By default, Bit uses [Ripple CI](https://bit.cloud/products/ripple-ci) to build components. You can use the `--build` flag to build the components on the local machine. To tag and export from your CI of choice to automate the release process or use [our official CI scripts](https://bit.dev/docs/getting-started/collaborate/exporting-components#ci-scripts).

Run `snap` or `tag` to record component changes, and assign a semantic version to them. Bit will version the dependents graph of each modified components.
After versioning, you can proceed to release your components:

```bash
bit snap --message 'initial release'
bit export
```

Snapped components are ready to be built upon 'export' (see next step). The build artifacts will also be stored in the component's new version ('snap').

By default, components are built using bit.cloud's CI platform, Ripple CI. However, you can run the components' build locally by adding the --build flag, or use your own CI platform. [To learn more see Set up CI](https://bit.dev/reference/git/automating-component-releases).

### Export components to a remote scope

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.
Head over to your [bit.cloud account](https://bit.cloud) to see your components build progress. Once the build process is completed, the components will be available for use using standard package managers:

```bash
bit export
npm install @my-org/my-project.hello-world
```

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. 🎉🎉🎉
## Next steps

- [Create more components](https://bit.dev/docs/getting-started/composing/creating-components/)
- [Setup your editor](https://bit.dev/docs/getting-started/installing-bit/editor-setup)
- [Configure CI of choice](https://bit.dev/docs/getting-started/collaborate/exporting-components/#ci-scripts)
- [Start from an existing project](https://bit.dev/docs/getting-started/installing-bit/start-from-existing-project)

## Contributors

2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ module.exports = function (api) {
'@babel/preset-env',
{
targets: {
node: 8,
node: 20,
},
useBuiltIns: 'usage',
corejs: 3,
83 changes: 0 additions & 83 deletions bin/bit-updates.js

This file was deleted.

Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.