pubm

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

pubm

Overview #
PUBM, short for Pubspec Manager, is a Dart-Command Line tool created to manage multiple versions of pubspec.yaml files in a single project. This tool helps in merging multiple pubspec.yaml files into a single pubspec.yaml file as per the selected flavor.
📋 Installation #
To install the pubm package, add it as a new dev dependency in your pubspec.yaml file. Run the following command in your terminal:
PS c:\src\flutter_project> dart pub add --dev pubm
copied to clipboard
For Flutter projects, use:
PS c:\src\flutter_project> flutter pub add --dev pubm
copied to clipboard
🎯 Activate from https://pub.dev
to use the executable, run the following command in your terminal:
dart pub global activate pubm
copied to clipboard
📋 Usage #
To manage different versions of pubspec.yaml files, create a new file for each flavor with the name pubspec_<flavor>.yaml. When the following command is executed, the pubspec.yaml file is updated with the contents of the pubspec_<flavor>.yaml file. This can be used to update, change, or add dependencies and their respective versions, as well as Flutter fonts.
# if activated from https://pub.dev
pubm -f <flavor>

# else
dart run pubm:manage -f <flavor>
copied to clipboard
Use the -v flag to print detailed logs (verbose logs) in the console.console.
# if activated from https://pub.dev
pubm -f <flavor> -v

# else
dart run pubm:manage -f <flavor> -v
copied to clipboard
Once the pubspec is managed, this run the pub get command, if the pubspec.yaml file contains flutter sdk dependency then it will run flutter pub get else dart pub get.
To stop calling pub get after managing the pubspec.yaml file, use the -b flag with no-pub-get value.
-b (--build-args)
# if activated from https://pub.dev
pubm -f <flavor> -b no-pub-get -v

# else
dart run pubm:manage -f <flavor> -b no-pub-get -v
copied to clipboard
Pubm also supports managing the overridden dependencies in pubspec_overrides.yaml file.
📋 Example: pubspec_dev.yaml #
Here's an example of a flavor-specific pubspec.yaml file for a 'dev' flavor:
description: dev version of pubspec.yaml
version: 0.0.1-dev

dependencies:
example_dependency:
path: example/dependency

dev_dependencies:
lints: ^2.1.1


flutter:
fonts:
- family: font1
fonts:
- asset: dev/font1/700.ttf
weight: 700
- asset: dev/font1/600.ttf
weight: 600
- asset: dev/font1/500.ttf
weight: 500
- asset: dev/font1/400.ttf
weight: 400
- family: font2
fonts:
- asset: dev/font2/700.ttf
weight: 700
- asset: dev/font2/600.ttf
weight: 600
- asset: dev/font2/500.ttf
weight: 500
- asset: dev/font2/400.ttf
weight: 400
copied to clipboard
The above values present in the pubspec_
📋 Example: pubspec.yaml #
Here's an example of the main pubspec.yaml file:
name: pubm
description: Actual description
version: 0.0.1

environment:
sdk: ^3.0.0

dependencies:
cupertino_icons: ^1.0.2

flutter:
uses-material-design: true
generate: true
fonts:
- family: font1
fonts:
- asset: actual/font1/700.ttf
weight: 700
- asset: actual/font1/600.ttf
weight: 600
- asset: actual/font1/500.ttf
weight: 500
- asset: actual/font1/400.ttf
weight: 400
- family: font2
fonts:
- asset: actual/font2/700.ttf
weight: 700
- asset: actual/font2/600.ttf
weight: 600
- asset: actual/font2/500.ttf
weight: 500
- asset: actual/font2/400.ttf
weight: 400
copied to clipboard
After running the below command, the output pubspec.yaml file will be as follows:
Command:
# if activated from https://pub.dev
pubm -f dev

# else
dart run pubm:manage -f dev
copied to clipboard
Output
name: pubm
description: dev version of pubspec.yaml
version: 0.0.1-dev

environment:
sdk: ^3.0.0

dependencies:
# normal dependencies
cupertino_icons: ^1.0.2
# path related dependencies
example_dependency:
path: example/dependency

dev_dependencies:
# normal dev_dependencies
lints: ^2.1.1

flutter:
uses-material-design: true
generate: true
fonts:
- family: font1
fonts:
- asset: dev/font1/700.ttf
weight: 700
- asset: dev/font1/600.ttf
weight: 600
- asset: dev/font1/500.ttf
weight: 500
- asset: dev/font1/400.ttf
weight: 400
- family: font2
fonts:
- asset: dev/font2/700.ttf
weight: 700
- asset: dev/font2/600.ttf
weight: 600
- asset: dev/font2/500.ttf
weight: 500
- asset: dev/font2/400.ttf
weight: 400
copied to clipboard
📋 Example: Removing values from pubspec.yaml #
To remove a dependency from the pubspec.yaml file, add the following line to the pubspec_
To remove dependency from dependencies section:
add it to the dependencies section of the pubspec_
the same with dev_dependencies and dependency_overrides section.
Remove section should have the same format of the yaml file.
After going through all the updating values, it will look for the remove section,
if found it will look into the data and remove respective form the actual pubspec.yaml file.
Actual pubspec.yaml file: #
name: pubm
description: test version of pubspec.yaml
version: 0.0.1

environment:
sdk: ^3.0.0

dependencies:
# normal dependencies
cupertino_icons: ^1.0.2
example_dependency: ^0.0.1

dev_dependencies:
# normal dev_dependencies
lints: ^2.1.1
example_dependency_dev: ^0.0.1

dependency_overrides:
# normal dependency_overrides
example_dependency_overrides: ^0.0.1

flutter:
uses-material-design: true
generate: true

assets:
- assets/images/
- assets/1.png
fonts:
- family: font1
fonts:
- asset: dev/font1/700.ttf
weight: 700
- asset: dev/font1/600.ttf
weight: 600
- asset: dev/font1/500.ttf
weight: 500
- asset: dev/font1/400.ttf
weight: 400
- family: font2
fonts:
- asset: dev/font2/700.ttf
weight: 700
- asset: dev/font2/600.ttf
weight: 600
- asset: dev/font2/500.ttf
weight: 500
- asset: dev/font2/400.ttf
weight: 400
any_other_section:
name: Name
version: 0.0.1
copied to clipboard
Example of pubspec_dev.yaml file: #
description: dev version of pubspec.yaml
version: 0.0.1-dev

remove:
home_page:

dependencies:
example_dependency:

dev_dependencies:
example_dependency_dev:

dependency_overrides:
example_dependency_overrides:

flutter:
assets:
- assets/1.png

fonts:
- family: font1

any_other_section:
copied to clipboard
Output #
name: pubm
description: dev version of pubspec.yaml
version: 0.0.1-dev

environment:
sdk: ^3.0.0

dependencies:
# normal dependencies
cupertino_icons: ^1.0.2

dev_dependencies:
# normal dev_dependencies
lints: ^2.1.1

flutter:
uses-material-design: true
generate: true

assets:
- assets/images/

fonts:
- family: font2
fonts:
- asset: dev/font2/700.ttf
weight: 700
- asset: dev/font2/600.ttf
weight: 600
- asset: dev/font2/500.ttf
weight: 500
- asset: dev/font2/400.ttf
weight: 400
copied to clipboard
By default, this tool also sorts the dependencies and dev_dependencies in alphabetical order by category. The categories are as follows:

git related dependencies
path related dependencies
normal dependencies
hosted dependencies
sdk dependencies

Contributors #



Made with contrib.rocks.
Support #
This plugin is free to use and currently in its early stages of development. We plan to add many more features soon. Please visit the Github Project to know about the upcoming feature and fixes. If you encounter any issues or would like additional features, please raise an issue in the GitHub repository.
Feel free to contribute to this project by creating a pull request with a clear description of your changes.
If this plugin was useful to you, helped you in any way, saved you a lot of time, or you just want to support the project, I would be very grateful if you buy me a cup of coffee. Your support helps maintain and improve this project.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.