发布 oclif v2!
Hello and happy new year! It's our great pleasure to announce that we have released oclif v2, which uses the new @oclif/core library! 🎉
oclif v2 includes many changes that improve the experience of both creating and using an oclif CLI.
Going forward, we don't plan to make any updates to oclif v1 and its corresponding libraries, except for critical security fixes. See the compatibility matrix for a list of these libraries. In order to give developers time to migrate from v1 to v2, we're not completely dropping support yet. But at some point in the future we'll archive the v1 repositories and deprecate their versions on npm.
What’s changing?
Repository Changes
All repositories under the oclif org now use main
as their primary branch and oclif-v1
as the legacy branch. The main
branch corresponds to oclif v2 and the oclif-v1
branch to oclif v1. If you find any repos that don’t have a main
branch, you can safely assume that they're not used in oclif v2 and will be deprecated in the future.
Consolidating Tools & Libraries
The oclif-dev
CLI has now been incorporated into oclif
. You now no longer need to install a separate package to manage your entire CLI’s lifecycle.
The following libraries have been consolidated under @oclif/core
and will be deprecated at some point in the future. Read the migration guide to learn how to update your CLI or plugin to use the new core library.
@oclif/command
@oclif/config
@oclif/error
@oclif/help
@oclif/parser
No more single vs multi command CLIs
There's only one "type" of oclif v2 CLI, but it can have as few or as many commands as a developer wants. As a result, there’s only one command to generate CLIs, oclif generate
, as opposed to the old oclif single
and oclif multi
commands.
Node > 12
To ensure oclif CLIs are as secure as possible, all v2 libraries and plugins support only Node 12 or higher as of now. Going forward, they'll support only Node Maintenance or higher, as defined by Node's release schedule here: https://nodejs.org/en/about/releases/.
What’s new?
New example CLI
oclif-hello-world
is our new example repo. This is also the repo that's used as a template when running oclif generate
to create a new CLI. This repo will always be able to be referenced as an example of what an oclif v2 CLI should look like.
Spaced commands
oclif CLIs can now use spaces, instead of colons, to separate topics and subcommands. To enable this feature, simply add “topicSeparator": " "
to the oclif config in your package.json. See an example in our example repo.
// Old commands that use :
$ mycli do:something