Skip to content

rbcprolabs/dpm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Run commands upon installing & upgrades packages, powerful package management with CLI. Flutter compatible!

Pub

Features • How to use • Available Commands

Features

  • Lightweight
  • Productive development
  • Fast!

How to use

$ pub global activate dpm

To use packages that integrate with dpm, you should run dpm get instead of pub get. Then, all installed packages will have their get dpm run.

Also replace pub upgrade with dpm upgrade. This will run get dpm as well.

You can run dpm link to link executables into .dpm_bin.

Running your own scripts

It is very likely that you want to run your own scripts during development, or upon package installation. To do so, edit your pubspec.yaml as follows:

name: foo
# ...
scripts:
  build: gcc -o foo src/foo.cc
  post_get:
    - dart_gyp configure
    - dart_gyp build
  post_upgrade: echo ":)"

Installed dev dependencies with executables will automatically be filled in to the PATH during script execution.

Then, in your project root, you can run:

$ dpm build

Available Commands

Add

Can be used to install dependencies without having to search the Pub directory for the current version.

# Install the newest version, and apply caret syntax
$ dpm add my-package

# Install a specific version
$ dpm add my-package@^1.0.0
$ dpm add my-package@0.0.4+25
$ dpm add "my-package@>=2.0.0 <3.0.0"

# Install a Git dependency
$ dpm add my-package@git://path/to/repo.git

# Specify a commit or ref
$ dpm add my-package@git://path/to/repo.git#bleeding-edge

# Install a local package
$ dpm add my-package@path:/Users/john/Source/Dart/pkg

# Install multiple packages
$ dpm add my-package my-other-package yet-another-package

# Install to dev_dependencies
$ dpm add --dev http test my-package@git://repo#dev

# Preview `pubspec.yaml`, without actually installing dependencies,
# or modifying the file.
$ dpm add --dry-run my-experimental-package

Remove

Can be used to remove dependencies without need go to file.

# Remove specific package 
$ dpm remove my-package 

# Remove multiple packages
$ dpm remove my-package my-other-package

Get

This script simply runs pub get.

init

Essentially an npm init for Dart. This command will run you through a series of prompts, after which a pubspec.yaml will be generated for you.

Upgrade

This script simply runs pub upgrade.