@nxrocks/nx-melos v5.0.1
nx-melos
Nx Plugin adding first class support for Melos in your Nx workspace
What is Melos ?
Melos is a CLI tool used to help manage Flutter/Dart projects within a monorepo. It is currently still in active development however is in use on projects such as FlutterFire.
Its features include:
- Automatic versioning & changelog generation.
- Automated publishing of packages to pub.dev.
- Local package linking and installation.
- Executing simultaneous commands across packages.
- Listing of local packages & their dependencies.
Contents
Features
Here is a list of some of the coolest features of the plugin:
- ✅ Automatic installation of
melosas a global package via pub.dev - ✅ Generation of basic
melos.yamlconfiguration, based on workspace setup - ✅ Root-level NPM scripts to run
meloscommands usingNx - ...
Prerequisites
This plugin relies on melos' command-line to do its job. So, you must have Dart SDK installed on your system. If not, head to https://dart.dev/get-dart and follow installation instructions for your OS.
Then, if you have not already, create an Nx workspace with the following:
# npm
npx create-nx-workspace@latest
# yarn
yarn create nx-workspace@latestGetting Started
Then you need to install the plugin in order to manage your workspace with melos later on.
Installing Plugin
# npm
npm install @nxrocks/nx-melos --save-dev
# yarn
yarn add @nxrocks/nx-melos --devInitializing Melos
Once installed, simply run the following command, to set everything up (only needed once):
nx g @nxrocks/nx-melos:initThis will automatically:
- Install
melosas a global Dart package on your workstation - Create a pre-configured
melos.yamlconfiguration file at root of your workspace - Add root-level NPM scripts to run
meloscommands usingNx
Generating Flutter/Dart projects within the workspace
You can use the companion plugin @nxrocks/nx-flutter to generate Flutter/Dart application | library | module | package within the workspace.
Follow this guide to find out how to proceed.
Plugin Usage
Once your apps or libraries are generated inside your workspace, you can now use melosto manage them.
Here the list of meloscommands added to your root package.json file as NPM scripts:
| Root-level Script* | Arguments | Description |
|---|---|---|
melos-bootstrap | see docs | Initializes the workspace, links local packages together and installs remaining package dependencies. |
melos-clean | see docs | Cleans the current workspace and all its packages of temporary pub & generated Melos IDE files. |
melos-exec | see docs | Executes an arbitrary command in each package. |
melos-list | see docs | Lists information about the local packages. |
melos-publish | see docs | Publishes any unpublished packages or package versions in your repository to pub.dev. dry-run is enabled by default. |
melos-run | see docs | Runs a script by name defined in the workspace melos.yaml config file. |
melos-version | see docs | Automatically version and generate changelogs for all packages. |
: The exact name of the scripts depends on the
scriptNameSeparatoroption that you used during the initialisation of the plugin (nx g @nxrocks/nx-melos:init --scriptNameSeparator=<separator_value>). Possible values for the separator are: "-" (default*) or ":"
Each script is based on the original melos command and supports the same arguments.
For example:
$ melos bootstrap --since=main
becomes 👉🏾
$ npx nx melos-bootstrap --since=main
// or
$ yarn nx melos-bootstrap --since=mainCompatibility with Nx
Every Nx plugin relies on the underlying Nx Workspace/DevKit it runs on. This table provides the compatibility matrix between major versions of Nx workspace and this plugin.
| Plugin Version | Nx Workspace version |
|---|---|
>=v3.x.x | >=v17.x.x |
>=v2.x.x | >=v16.x.x |
>=v1.x.x | >=v15.3.x |
License
Copyright (c) 2023-present Tine Kondo. Licensed under the MIT License (MIT)
8 months ago
9 months ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago