-
Notifications
You must be signed in to change notification settings - Fork 122
Cli
To install cli, you should type:
$ npm install oc -g
Autocomplete is supported for Mac and Linux.
To enable it in zsh, you should type:
echo '. <(oc completion)' >> .zshrc
To enable it in bash, you should type:
oc completion >> ~/.bashrc
or
oc completion >> ~/.bash_profile
After enabling autocomplete you should reload the shell.
Basic usage:
$ oc <command> [options]
Hint: Run -h with any command to show the help
For a list of all the available commands, ype oc in your terminal
$ oc
Remove the node_modules directory from each component's subfolder
$ oc clean <dirPath> [options]
Name | Description | Default |
---|---|---|
dirPath |
The name of the directory where the components are stored |
Name | Description |
---|---|
--yes |
Skip all confirmation prompts |
$ oc clean ../all-components --yes
Runs a local oc test registry in order to develop and test components
$ oc dev <dirPath> [port] [baseUrl] [options]
Name | Description | Default |
---|---|---|
dirPath |
The name of the directory to watch, where the components are stored | |
port |
The port where to start a local oc instance. | 3000 |
baseUrl |
The base url the component is hosted from. | http://localhost:port/ |
Name | Description | Default |
---|---|---|
--fallbackRegistryUrlUrl |
Url to another registry which will be used by dev registry when component cannot be found in local registry | empty |
--hotReloading |
Enables hot reloading. Note: when hot reloading is set to true, each request to the component will make the registry to create a new instance for the javascript closures to be loaded, while when false the instance will be recycled between components executions | true |
--verbose |
Verbosity | false |
--watch |
enable the watcher | true |
--production |
force packaging for production | false |
$ oc dev ../all-components 3001 127.0.0.1:3001 --fallbackRegistryUrl=http://anotherhost:anotherport/
Creates a new empty component in the current folder
$ oc init <componentPath> [templateType]
Name | Description | Default |
---|---|---|
componentPath |
The relative path with a name of the component to create | |
templateType |
The name of the published template module on npm | oc-template-handlebars |
$ oc init test-component oc-template-jade
or with using relative path:
$ oc init components/test-component oc-template-jade
which will create test-component
in components
directory.
Allows to mock configuration in order to facilitate local development
$ oc mock <targetType> <targetName> <targetValue>
Name | Description | Default |
---|---|---|
targetType |
The type of item to mock | |
targetName |
The item to mock | |
targetValue |
The mocked value (static plugin) or the file to read (dynamic plugin) |
$ oc mock plugin hash "always-returned-value"
Creates static mock for a "hash" plugin which always returns "always-returned-value" value
To run a dynamic plugin, you can run a plugin locally. This could be the same one running in your registry, or a mock js that behaves differently locally.
$ oc mock plugin <targetName> <path to mock .js>
Creates the packaged component ready to be published
$ oc package <componentPath> [options]
Name | Description | Default |
---|---|---|
componentPath |
The path of the component to package |
Name | Description | Default |
---|---|---|
--compress |
Create zipped file | false |
--useComponentDependencies |
Reuse already installed dependencies to save packaging time and network bandwidth | false |
$ oc publish my-new-component/
Runs a test page consuming a component
$ oc preview <componentHref>
Name | Description | Default |
---|---|---|
componentHref |
The name of the component to preview |
$ oc preview "http://localhost:3000/my-new-component/1.0.0/?param1=hello&name=Arthur"
Publish a component
$ oc publish <componentPath> [options]
Name | Description | Default |
---|---|---|
componentPath |
The path of the component to publish |
Name | Description | Default |
---|---|---|
--password |
password used to authenticate when publishing to registry | |
--username |
username used to authenticate when publishing to registry | |
--skipPackage |
to skip packaging step (useful if you publish at a different stage than packaging) | false |
$ oc publish my-new-component/
Shows, adds, removes oc registries to the current project
$ oc registry <command>
Name | Description | Default |
---|---|---|
registryUrl |
url of registry |
Name | Description | Default |
---|---|---|
add <registryUrl> |
Adds oc registries to the current project | |
ls |
Shows oc registries added to the current project | |
remove <registryUrl> |
Removes oc registries from the current project |
$ oc registry add http://my-registry.in.my.domain/
$ oc registry ls
$ oc registry remove http://my-registry.in.my.domain/