-
Notifications
You must be signed in to change notification settings - Fork 940
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
Improve export
command to support implicit exports and better upstream management
#1956
Comments
…ke sure to throw when a bare-scope name is "current", implement "--include-dependencies" flag to behave like a fork
All improvements are implemented on #1954, except the "Possible future options".
|
* task #1956, replace "--last-scope" with a reserved word "current", make sure to throw when a bare-scope name is "current". * implement "--include-dependencies" flag to behave like a fork. Meaning, when exporting with this flag, it'll export the component and all its dependencies to the remote scope, not only cached them. So then it'll be possible to completely work with the new remote without the old one. * exporting to a different remote, does not change the component from staging to exported, unless "--set-current-scope" is used * save "listScopes" data into the Model Component. * implement "all" flag for exporting non-staged components. * implement "force" flag for exporting multiple components while changing the remote-scope for some. * show the scopes-list in show command
…ort" to replace the import/require statements in the source to the newly exported scope
* implements a part of #1956, introduce a new flag --codemod for "bit export" to replace the import/require statements in the source to the newly exported scope * re-import components when using codemod to have the updated code on the workspace * do not show a warning about components missing from .bitmap when "include-dependencies" flag was used * remove components with the old scope from the package.json file and from node_modules dir
can we rename --code-mod to --redirect? code-mod can do any change. |
@Tallyb , not sure about |
maybe |
--rename-scope? |
@Tallyb , not sure that |
@Tallyb I agree with @davidfirst . rename scope is a bit confusing because it's not say anything about code changes. |
--codemod -> --rewire-imports / --refactor-imports : changes the import statement for components that are exported to a new collection to depend on the component in the new scope. |
I'm renaming it to |
resolved as part of b15 |
Context
bit export
is lacking the support of managing and syncing a single component between many collections. This means that it is very hard to:bit export
command that will export each component to the correct collection (need to manually define to which collection which component will be exported to).To resolve it there are several features and improvements to implement.
Support
defaultCollection
in workspace configurationTo allow implicit exports for staged components that have never been exported, Bit needs to support a
defaultCollection
property for a workspace. It is not mandatory but will improve user experience.Add a list of upstream collections to component
A component should contain an ordered list of objects representing the remote upstreams. Each item on the list should have:
url
- the location of the remote collection. if upstream was resolved inhub_domain
use it as aurl
.name
.date
.Workspace should contain the current upstream that the component is synced to.
To allow implicit exports for components that were already exported, the workspace should distinct a specific collection as the
current
collection to sync the component with.current
after export and set it to the location I have exported the component to, the component is stillstaged
. But when I try to export again, Bit will figure out that the component was already exported, and unstage it.Show
current
inbit show
bit show
is the main API for providing data on a component. It should support showing the workspace data aboutcurrent
collection.Update export command synopsis.
Options
--eject
After
export
, removes the exported components and install them as node modules using npm/yarn.--set-current
Ensure the component's remote scope is set according to the target location.
--force
Ignore prompt about moving components to another scope.
<scope>
The "remote" scope that is the destination of the export operation.
<component id patterns>
Component name, ID or a glob-pattern. Bit to parses it to get the component IDs to export.
--include-dependencies
Include the component's dependencies as part of the export to the remote scope.
Examples
$ bit export
Works just like
bit export <scope>
, where<scope>
is current component's scope.If no scope is defined for a component, triggers a message to add a scope (upstream) to the component.
Implicit
export
only applied forstaged
components.$ bit export current
Without additional configuration, exports each component to their current scope (upstream).
If no scope is defined for a component, triggers a message to add a scope (upstream) to the component.
If a workspace has
default-scope
defined and a component does not have a scope, sets thedefault-scope
as an upstream for the component, and export.Implicit
export
only applied forstaged
components.$ bit export current foo/bar
Exports component
foo/bar
to its current scope. If a component has no scope defined, and a workspace hasdefault-scope
defined and a component does not have a scope, sets thedefault-scope
as an upstream for the component, and export.$ bit export moon foo/bar
Add the scope
moon
tofoo/bar
as an upstream (scope) and exports component to it.If the component does not have any upstream defined, sets
moon
as thecurrent scope
.If the component has other upstreams defined, the command does not change the
current scope
.$ bit export moon *
Add the scope
moon
to all components as an upstream (scope) and exports component to it.If the component does not have any upstream defined, sets
moon
as thecurrent scope
.If the component has other upstreams defined, the command does not change the
current scope
.If there's a mix of components that some of them might move to another scope, trigger a message asking user to approve (or use
--force
).$ bit export sun foo/bar --set-current-upstream
Exports
foo/bar
tosun
and set the workspace to usesun
as the current (default) scope for the components.Possible future options
--code-mod
Update the exported component's
import
andrequire
statements (if found) to the scope they are being exported to.--eject-dependencies
Eject component dependencies and installs them as node modules. Does not mean Bit ejects itself. Only relevant for directly imported components that are dependencies.
The text was updated successfully, but these errors were encountered: