# OnePub

An Introduction to Onepub.dev

OnePub - [onepub.dev](https://onepub.dev/drive/a50d4f6f-e0fb-40bd-af7b-2dcc295b0332) - is the one-stop solution that allows you to create your own private Dart/Flutter package repository.

Your private OnePub repository can be securely shared amongst internal team members for the development of Flutter/Dart projects.

It is safe, fast, and easy to use.

{% hint style="info" %}
**OnePub** is a private SAAS repository that is modelled on pub.dev for a team's internal Dart/Flutter projects.
{% endhint %}

OnePub allows you to utilize your existing dart command line tools (pub get/publish/upgrade) providing a seamless experience across both public and private packages. To publish a package to your own private OnePub repository:

**For flutter users use the 'flutter' CLI tools.**

```
flutter pub global activate onepub
onepub login
cd <my package>
onepub pub private
flutter pub publish
```

**For Dart users use the 'dart' CLI tools**

```
dart pub global activate onepub
onepub login
cd <my package>
onepub pub private
dart pub publish
```

Once you have published a package to OnePub, you and your Teammates can add dependencies to your pubspec.yaml.

Watch the video play-through on how to publish a package.

To add a dependency to a private package hosted on OnePub, simply run the following commands:

```
onepub pub add <myprivatepackage>
flutter pub get
```

Note: if you are running a dart version prior to 2.12 see the [alternate install](/guides/installing/pre-dart-2.12) guide.

{% embed url="<https://onepub.dev/static/video-blogs/OnePub%20Videw%20Blog%20Episode%201%20-%20v3.mp4>" %}

## Why OnePub?

The aim of OnePub is to turn code into a long-term asset by allowing you to create a library of ready-to-use packages.

Useful code is often left buried in larger projects. The result is next time you need the feature it's more likely that the code will be rewritten rather than re-used.

Instead, you can use OnePub to build up a library of reusable packages shared by your team.

OnePub aims to make it quick and easier to publish internal packages by:

* allowing you to publish Dart/Flutter packages to a private repository
* share private packages with colleagues
* easily add dependencies to a private package
* publishes dart doc for each of your packages
* simplifying version management
* provide a single interface to search for public and private packages
* email team notifications for new package versions
* seamless integration with Pub tooling

## Need a little help to publish your first package?

If you are new to publishing dart/flutter packages read one of our how-to blogs to get started:

* [Publish your first package](https://onepub.dev/Blog?id=zuhnoflygz)
* [Share code between your own projects](https://onepub.dev/Blog?id=yvuhnoflyg)
* [Private copies of public packages](https://onepub.dev/Blog?id=favuhnofly)

### Quick Guides: Let's Get Down To It!

Follow our handy guides to get started on the basics:

{% content-ref url="/pages/mN2rujGlTIqblE0NKndW" %}
[Invite a member](/guides/installing/invite-a-member)
{% endcontent-ref %}

{% content-ref url="/pages/EFYzNBwxgqeLX7XgvreW" %}
[IDE integration](/guides/installing/ide-integration)
{% endcontent-ref %}

{% content-ref url="/pages/eyOMqcEMW8qHDEikxRV7" %}
[CLI integration](/guides/installing/cli-integration)
{% endcontent-ref %}

{% hint style="info" %}
**Online Documentation**: OnePub generates api documentation for your private packages which is available to your team online at: <https://onepub.dev/packages/\\><your package name>
{% endhint %}

### Fundamentals: Dive a little deeper

Learn the fundamentals of OnePub to develop a deeper understanding of its core features:

{% content-ref url="/pages/uPMzEss584Vow6ghZUtn" %}
[Members](/fundamentals/members)
{% endcontent-ref %}

{% content-ref url="/pages/HUydffmRFqV5XaooZcIJ" %}
[Roles](/fundamentals/roles)
{% endcontent-ref %}

{% content-ref url="/pages/XlgSR0YpDg8wVLW6Kk4w" %}
[Publishing Packages](/guides/publishing-packages)
{% endcontent-ref %}

***


# Installing

To registration with[ onepub.dev ](https://onepub.dev)and install the OnePub command-line tools, we provide the following guides:

* [Installing CLI tools](/guides/installing/install-cli-tools)
* [Register](/guides/installing/create-a-publisher)
* [Inviting Members](/guides/installing/invite-a-member)
* [Accepting an Invitation](/guides/installing/accept-an-invite)
* [CLI integration](/guides/installing/cli-integration)
* [IDE Integration](/guides/installing/ide-integration)
* [Pre Dart 2.12](/guides/installing/pre-dart-2.12)
* [Create a Publisher](/guides/installing/create-a-publisher)
* [Publishing Packages](/guides/publishing-packages)
* [Private package dependencies](/guides/package-dependencies)

###


# Install CLI tools

OnePub includes a couple of CLI tools to make it easy to publish directly from the CLI using the existing dart tooling.

The following guide explains how to install the OnePub CLI tools.

For the majority of our users, we naturally assume they have Dart or Flutter installed, in case you don't, please follow the instructions to install Dart from here:

{% embed url="<https://dart.dev/get-dart>" %}

{% hint style="danger" %}
If you are running a dart version prior to 2.12 then follow the [alternate install](/guides/installing/pre-dart-2.12) instructions.
{% endhint %}

{% hint style="warning" %}
If you are running a dart version prior to 2.15 then read the [pre 2.15 guide](/guides/installing/pre-dart-2.15).
{% endhint %}

Once you have dart installed and running, run the following commands:

```bash
dart pub global activate onepub
onepub login
```

Note that \`onepub login\` runs a webserver on your local machine to collect the token as returned from the auth provider. This only runs from the moment it opens your browser to the moment the login completes. This is on `http://127.0.0.1:42666/.`

You may need you to unblock tcp port 42666 temporarily if you are running a firewall on your PC.

{% hint style="info" %}
If you have flutter installed replace `dart pub` with `flutter pub`
{% endhint %}

{% hint style="danger" %}
If you are running a dart version prior to 2.12 then follow the [alternate install](/guides/installing/pre-dart-2.12) instructions.
{% endhint %}

See the section on [CLI Tools](/guides/cli-integration) for details on the commands available.


# Register

Registering, becoming administrator and creating a private repository.

In OnePub an Organisation equates to a Repository.

A repository can host any number of packages.

With the Team or Enterprise versions of OnePub, you can break the Repository into Teams with each team controlling a set of packages (packages can also be shared between teams).

As a Member of OnePub, you can belong to multiple Organisations including having a free version for your personal use - conditions apply.

{% hint style="success" %}
**Tip:** You can authenticate using your Google, Apple or Github credentials.
{% endhint %}

Once you have registered with OnePub, you need to [install the OnePub command-line tools](/guides/installing/install-cli-tools).

## Create a new organisation

As part of the registration process, a new Organisation is created.

To register with OnePub, go to <https://onepub.dev/register>.

Once registered you can [invite other users](/guides/installing/invite-a-member) to join your Organisation.

## Join an existing organisation

If you are looking to join an existing organisation then ask that Organisation's OnePub Administrator or a Team Leader to send you an [invite](/guides/installing/invite-a-member).

When you accept your first invitation OnePub will add you as a member of that Organisation as well creating your private organisation for your personal use.

## Tell a friend

If you like OnePub [tell your friends](https://onepub.dev/invite) about us.


# Invite a member

Inviting members from different pages to become part of different teams

Administrators and Team Leaders can send invitations to colleagues to join their OnePub Organisation or Team respectively.

To add new members to OnePub, send them an invitation.

Login to OnePub and from the OnePub home page click the 'Invite' link.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2Fe4aA3u3u29GHfXE3yrVN%2Fimage.png?alt=media\&token=159c91ee-db6d-4b30-a60d-da414a26c73e)

{% hint style="info" %}
If you are on the Free plan, upgrade to the Pro edition to invite a colleague to your organisation.
{% endhint %}

An invitation expires after 12 hours. In case an invitation has expired, another invitation can be sent in its place.

The user can use any one of the offered Single Sign On (SSO) providers (GitHub, Google, Apple ...) or enter their email address and password to register.

##


# Accept an Invite

How to accept invitation as a recipient

Upon receiving an email invite to OnePub, click the supplied link to accept the invite via the OnePub website.

For the majority of our users, we naturally assume they have Dart installed, in case you don't, please follow the instructions to install Dart from here:

{% embed url="<https://dart.dev/get-dart>" %}

To start, you must first install the OnePub command-line tools.

```
dart pub global activate onepub
```

{% hint style="success" %}
You can authenticate using your Google or Github credentials or an email/password.
{% endhint %}

Run the following command to accept your invite and complete your registration:

```
onepub login
```

All done.

The next steps are:

* Adding a dependency to a [private package](/guides/package-dependencies).
* [Publishing your first private package.](/guides/publishing-packages)


# CLI integration

Integration of Command Line Interface on Onepub.dev with Dart

OnePub CLI tooling is designed to work alongside your existing Dart CLI tooling.

When you install the OnePub CLI tooling two applications are added to your PATH.

* [onepub](#onepub)
* [opub](#opub)

## onepub

The onepub CLI app is the primary tool you use when interacting with OnePub from the CLI.

The onepub app supports a number of commands.

You can view a full list of the commands by running:

```bash
onepub --help
```

To get help on an individual command run:

```bash
onepub <command> --help
```

#### onepub commands

The onepub app supports the following commands:

<table><thead><tr><th width="150"></th><th></th><th></th></tr></thead><tbody><tr><td>login</td><td>Login to a OnePub Organisation</td><td>Your email address can be associated with multiple Organisations and you use the login command to switch between them.</td></tr><tr><td>logout</td><td>Logout of OnePub</td><td><code>pub get</code> will fail if you have a private dependency in your project.</td></tr><tr><td>doctor</td><td>Displays your OnePub configuration details.</td><td>Use the output of doctor when you are reporting bugs or want to check the status of OnePub.</td></tr><tr><td>export</td><td>Export a OnePub Token</td><td>Tokens can be used to auth in a <a href="/guides/ci-cd">CI/CD</a> environement or over an <a href="/guides/ssh">SSH</a> session.</td></tr><tr><td>import</td><td>Import a OnePub Token</td><td>Allows you to login when a Web browser and/or user interaction is viable such as in a <a href="/guides/ci-cd">CI/CD</a> or <a href="/guides/ssh">SSH</a> environment.</td></tr><tr><td>pub add [--dev]</td><td>Add a dependency on a private package.</td><td>Works the same as the <code>dart pub add</code> but for your own private packages.</td></tr><tr><td>pub private</td><td>Marks your project as a private package.</td><td>After marking your package as private you can <a href="/guides/publishing-packages">publish</a> it to your OnePub private repo using the standard Dart tooling.</td></tr><tr><td><a href="/guides/cli-integration/globally-activate">pub global activate</a></td><td>Globally activate a private package.</td><td>If you have a private package that contains CLI tools this command installs them and adds them to your PATH.</td></tr><tr><td><a href="/guides/cli-integration/globally-activate">pub global deactivate</a></td><td>Globally deactivate a private package.</td><td>If you have activated a global package this command will un-install it and remove it from your PATH.</td></tr></tbody></table>

## opub

The opub app is used provided for users that are using versions of Dart prior to 2.15.

The Dart development team made significant changes with respect to how the Dart CLI tools interact with a private repository and older versions of the Dart `pub` command aren't compatible with OnePub.

To circumvent this problem OnePub provide the `opub` app which replaces the `dart pub` and `flutter pub` commands.

When running a command (such as dart pub get) that operates on a private package or a package that depends on a private package then you simply substitute 'dart pub get' or 'flutter pub get' with 'opub get'. The same goes for all of the `pub` commands.

If you are running an even older version of Dart (pre-2.12) then read the section on using [Dart pre-2.1](/guides/installing/pre-dart-2.12)2.


# Manually add publish\_to

#### Manually edit pubspec.yaml

Login to OnePub and copy the \`publish\_to:\` URL from the profile page:

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FOA5qcBDys1OUaWBEnJSp%2Fimage.png?alt=media\&token=68d71df3-ba83-4c1d-a521-5bdd958fff3c)

Add a `publish_to` key to your `pubspec.yaml`.

```yaml
name: onepub
version: 1.1.0

# Set onepub as the publish target.
publish_to: https://onepub.dev/api/xxxxxxx

```


# Implicit Integration

In this guide, users will learn tips and recommendations on using OnePub with the Dart CLI tools.

OnePub supports both explicit and implicit integration.

{% hint style="success" %}
**Recommendation:** It is recommended to use explicit Integration unless you have an Enterprise license.
{% endhint %}

The OnePub team recommends using Explicit Integration, as it allows the users to make the most of OnePub at the cost of a minor change to each of their pubspec.yaml files.

## Explicit Integration

With explicit integration, a user needs to modify each `pubspec.yaml` file that uses or publishes a private package.

#### Pros

* Only requires the user to run `onepub login` and they are fully configured
* using `publish_to` in your pubspec stops the package from being accidentally published to pub.dev
* Dependencies work for other users without any environment configuration
* No configuration is required for your IDE

**Cons**

* Users need to explicitly configure each Private Dependency

### Configure a package to be published to OnePub

You can edit your `pubspec.yaml` file manually or use the `onepub pub private` command. The outcome is the same, using the `onepub pub private` command is faster.

#### Use the onepub private command.

```bash
cd mypackage
onepub pub private
# now publish your package to OnePub
dart pub publish
```

#### Manually edit pubspec.yaml

Login to OnePub and copy the \`publish\_to:\` url from the profile page:

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FOA5qcBDys1OUaWBEnJSp%2Fimage.png?alt=media\&token=68d71df3-ba83-4c1d-a521-5bdd958fff3c)

Add a `publish_to` key to your `pubspec.yaml`.

```yaml
name: onepub
version: 1.1.0

# Set onepub as the publish target.
publish_to: https://onepub.dev/api/xxxxxxx

```

Now publish your package

```bash
cd mypackage
dart pub publish
```

### Configure a OnePub dependency

Once you have published a package to OnePub you are going to want to update your projects to use the package from OnePub.

You can either manually edit your `pubspec.yaml` or use the onepub cli tools to do the work for you.

#### Use the onepub add command

To add or change a package dependency to get the package from OnePub run:

```bash
cd <my project>
onepub pub add [--dev] <package>
```

Use the `--dev` switch to add the package as a dev dependency.

If the package already exists as a dependency the onepub will simply update (or add) the hosted-url to point to OnePub.

#### Manually configure a OnePub dependency

For each project that depends on a private package, you can add a hosted key.

Copy the 'publish\_to' URL from your profile page:

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FOA5qcBDys1OUaWBEnJSp%2Fimage.png?alt=media\&token=68d71df3-ba83-4c1d-a521-5bdd958fff3c)

Now paste it into the 'hosted' key for the package.

```yaml
dependencies: 
  my_private_package:
    version: 1.0.2
    hosted: https://onepub.dev/api/xxxxxxxx
```

{% hint style="danger" %}
If your dart version is older than 2.15, then you must use the older hosted format.
{% endhint %}

```yaml
dependencies: 
  my_private_package:
    version: 1.0.2
    hosted: 
      name: my_private_package
      url: https://onepub.dev/api/xxxxx
```

## Implicit Integration

Implicit Integration involves setting the PUB\_HOSTED\_URL environment variable.

Copy the `publish_to` url from your profile page:

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FOA5qcBDys1OUaWBEnJSp%2Fimage.png?alt=media\&token=68d71df3-ba83-4c1d-a521-5bdd958fff3c)

Now add the PUB\_HOSTED\_URL environment variable to your system.

{% tabs %}
{% tab title="Linux" %}
Add an export statement to your \~/.bashrc file:

export PUB\_HOSTED\_URL=<https://onepub.dev/api/xxxxxxx>

Restart your shell and check the environment variable is available.
{% endtab %}

{% tab title="MacOs" %}
Add an export statement to your \~/.zshrc file:

PUB\_HOSTED\_URL=<https://onepub.dev/api/xxxxxxx>

Restart your shell and check the environment variable is available.
{% endtab %}

{% tab title="Windows" %}
Added the environment variable to your registry.

export PUB\_HOSTED\_URL=<https://onepub.dev/api/xxxxxxx>

Restart your shell and check the environment variable is available.
{% endtab %}
{% endtabs %}

Once it is configured, all requests made by the pub command are sent to your OnePub private repo.

This method is doesn't interfere with your ability to get public packages from pub.dev.

#### Pros

* No need to configure each package and dependency
* Restrict devs to only using packages from verified publishers (Enterprise Edition)
* Constrain what packages your team can use via a OnePub curated list (Enterprise Edition)

#### Cons

* Users need to configure an environment variable
* Risk of users accidentally publishing a private package to pub.dev


# IDE integration

This section provides tips and recommendations on integrating onepub with your IDE of choice.


# Android Studio

Providing that you are using at least dart 2.15 then OnePub works with Android Studio out of the box.

The only actions required are to install OnePub and then login:

```dart
flutter pub global activate onepub
onepub login
```

If you are running a version of Dart pre 2.15 then you will need to run the pub commands manually.

{% hint style="info" %}
If you are running a Dart version pre 2.12 then follow the[ pre 2.12](/guides/installing/pre-dart-2.12) install instructions.
{% endhint %}


# Visual Studio Code

Providing that you are using at least dart 2.15 then OnePub works with Visual Studio Code out of the box.

The only actions required are to install OnePub and then login:

```dart
flutter pub global activate onepub
onepub login
```

{% hint style="info" %}
If you are running a Dart version pre 2.12 then follow the[ pre 2.12](/guides/installing/pre-dart-2.12) install instructions.
{% endhint %}

## Docker containers

VS Code provides the ability to do your debugging in a local docker container via the command:

`Remote-Containers: Open Folder in Container...`

The OnePub cli tooling works as normal in a docker container but please read the section on [Docker](/guides/docker) for further details and non-interactive auth with OnePub from within a Docker container.

### Install onepub into docker

You will also want to install onepub into the Docker container.

To do this edit the the .devcontainer/Dockerfile and add the following command to the end of the file:

```docker
RUN dart pub global activate onepub
```


# Pre Dart 2.15

## opub

The opub app is provided for users that are using versions of Dart prior to 2.15.

{% hint style="success" %}
Use `opub xxx` in place of `dart`/flutter `pub xxx`
{% endhint %}

The Dart development team made significant changes with respect to how the Dart CLI tools interact with a private repository and older versions of the Dart `pub` command aren't compatible with OnePub.

{% hint style="info" %}
The opub command simply contains a complete copy of the `dart pub` command back ported to dart 2.12.
{% endhint %}

To circumvent this problem OnePub provide the `opub` app which replaces the `dart pub` and `flutter pub` commands.

When running a command (such as dart pub get) that operates on a private package or a package that depends on a private package then you simply substitute 'dart pub get' or 'flutter pub get' with 'opub get'. The same goes for all of the `pub` commands.

If you are running an even older version of Dart (pre-2.12) then read the section on using [Dart pre-2.1](/guides/installing/pre-dart-2.12)2.


# Pre Dart 2.12

If you are running an older version of Dart (prior to 2.12) then you need to use one of these alternate installation methods which involve either compiling or downloading the onepub and opub executables.

{% hint style="success" %}

* download the [pre-compiled](#download) OnePub commands
* use `opub xxx` in place of `dart/flutter pub xxx`
  {% endhint %}

{% hint style="info" %}
If you are hesitating about upgrading your Dart version because of Null Safety then don't be. It's a fairly painless process with google's migration tools doing most of the heavy lifting. You will reap the benefits almost immediately, often finding and fixing bugs as part of the migration.
{% endhint %}

With the release of Dart 2.15 Google introduced support for private package repositories such as OnePub. Older versions of Dart are unable to authenticate against a private package repository.

To get around this problem, OnePub includes a back ported version of the full `dart/flutter pub` command as the `opub` CLI command.

This allows you to substitute any `flutter pub` or `dart pub` command with `opub`.

{% hint style="success" %}

* Use `opub xxx` in place of `dart pub xxx` or `flutter pub xxx`
  {% endhint %}

The problem for users of pre 2.12 versions of Dart is that the opub command requires dart 2.12 (the code is null safe). This means you can't globally activate the opub command on systems running older versions of Dart.

To solve this problem you can either compile your own version of OnePub or download our pre-compiled versions.

Downloading the executables is the easiest path forward but if you don't want to trust a third party executable we also provide instructions on compiling the code from source.

## Download

For pre dart 2.12 users download the pre-compiled OnePub command line tools.

{% tabs %}
{% tab title="Linux" %}
onepub

```
wget https://github.com/onepub-dev/onepub/releases/download/Linux%2Flatest/onepub
```

opub

```
wget https://github.com/onepub-dev/onepub/releases/download/Linux%2Flatest/opub
```

After downloading each exe run:

```bash
chmod +x onepub
chmod +x opub
```

{% endtab %}

{% tab title="Windows" %}
[Windows latest release of onepub](https://github.com/onepub-dev/onepub/releases/tag/Windows%2Flatest/onepub)

[Windows latest release of opub](https://github.com/onepub-dev/onepub/releases/tag/Windows%2Flatest/opub)
{% endtab %}

{% tab title="MacOS" %}
[MacOS latest release of onepub](https://github.com/onepub-dev/onepub/releases/tag/macOS%2Flatest/onepub)

[MacOS latest release of opub](https://github.com/onepub-dev/onepub/releases/tag/macOS%2Flatest/opub)

After downloading each exe run:

```bash
chmod +x onepub
chmod +x opub
```

{% endtab %}
{% endtabs %}

Download both onepub and opub and add them to your system PATH.

Now use opub anywhere you would normally use `dart pub...` or `flutter pub...`

## Compiling

For either of the alternate compile techniques **you must be** **running at least version 2.12 of Dart**.

You can either do this on a separate machine (or a VM), temporarily install a more recent version of Dart or use [fvm](https://onepub.dev/packages/fvm) which supports as far back as Dart 2.5. If you are not familiar with fvm (flutter version manager) it allows you to rapidly switch between different versions of flutter.

Once you have compiled the two executables you can copy the to your local system and revert your Dart version.

You can compile your own version of OnePub using a couple of techniques. The simplest is to compile from .pub-cache using [DCli](https://onepub.dev/packages/dcli).

### Compile `from .pub-cache`

Start by ensuring you are running at least Dart 2.12.

`dart --version`

DCli, known as the `Console SDK for Dart`, allows you to compile a Dart CLI package directly from your local .pub-cache adding the resulting executables to your path.

Start by installing DCli

```bash
dart pub global activate dcli
dcli install
```

The install step provides instructions to add the \~/.dcli/bin path to your PATH. Make certain you complete this step. You may need to restart your terminal (or even logout) to see the PATH changes.

Now we can install and compile OnePub.

```bash
dart pub global activate onepub
dcli compile --package onepub
```

The above compile command will compile both of the onepub executables (onepub and opub).

We have now compiled two executables, onepub and opub which have been copied to the \~/.dcli/bin directory which should be on your PATH.

You can now revert to your preferred version of Dart.

### Compile from git

Start by ensuring you are running at least Dart 2.12.

`dart --version`

If you want to use all dart native tooling then you can compile OnePub by cloning the OnePub git repo.

{% embed url="<https://github.com/onepub-dev/onepub>" %}
Clone the OnePub repo
{% endembed %}

To compile the OnePub commands run:

```
git clone https://github.com/onepub-dev/onepub
cd onepub
dart pub get
dart compile exe bin/onepub.dart -o bin/onepub
dart compile exe bin/opub.dart -o bin/onepub
```

Now copy the resulting exectuables (located in the bin directory) to a directory on your local system's PATH.

The `onepub` and `opub` commands will now run regardless of which version of Dart is active.

You can now revert to your preferred version of Dart.

##


# Searching

OnePub's search interface is based on pub.dev to provide a familiar interface.

{% hint style="info" %}
Search both public and private packages via a single interface.
{% endhint %}

One of our design objectives was to provide a single interface to search both public and private packages so you don't need to keep switching between pub.dev and onepub.dev.

As such the OnePub search interface provide the same set of features as pub.dev and is a viable alternative for searching the full list of public packages hosted on pub.dev.

{% hint style="info" %}
If you use a public package we still recommend that you `like` it on pub.dev as this is an important signal of quality to other developers.
{% endhint %}

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FiXBJunuuwE3S8YKY8BLt%2Fimage.png?alt=media\&token=2fec0b5a-bf5d-43f5-a31c-27db90e5e1c1)

The advanced search option allows you to select to search only public or private repositories as well as the standard set of search criteria you are used to seeing on pub.dev.

<img src="https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2F826fZI9sFpbpXh9r1wjB%2Fimage.png?alt=media&amp;token=1bdc4218-8b9d-4a96-b4ef-0821bdcc4087" alt="" data-size="original">

{% hint style="info" %}
OnePub has a live feed from pub.dev so the list of public packages is always up to date.
{% endhint %}


# Watching packages

OnePub allows you to add a 'watch' to one or more public and/or private packages.

Watching a package provides two features:

1\) we create a bookmark on your OnePub search page for quick access

2\) we send you an email notification whenever a new version of the package is uploaded.

To add a watch click on the eye ![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FHeh0AdI4ISyrl9fnwgoD%2Fwatch-eye.png?alt=media\&token=fee563a7-16d8-4de3-9333-6d579f811c1d) next to the package name in the search results:

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FuX43uPRjO9uiG3rvwDjz%2Fimage.png?alt=media\&token=eed8dcc5-0fbf-4967-a9b3-a05c743fc301)

If you only want the bookmark feature then you can turn of notifications for each watched package.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FmbZJy6UpiZg6yjnbc06z%2Fimage.png?alt=media\&token=77bb0bbb-e4cc-45d3-a97e-411aa4eb1427)


# Publishing Packages

## Permissions

Only Uploaders may publish a package. Each edition of OnePub defines an Uploader differently.

{% tabs %}
{% tab title="Free/Pro" %}
As all Members are Uploaders any Member can create a new package by running 'dart | flutter pub publish'.

All packages are associated with the Default Team and as such all Members have access to the package.
{% endtab %}

{% tab title="Team" %}
As all Members are Uploaders any Member can create a new package by running 'dart | flutter pub publish'.

To share a package it must be associated with a Team which only Team Leaders and/or Administrators may do.
{% endtab %}

{% tab title="Enterprise" %}
As all Members are Uploaders any Member can create a new package by running 'dart | flutter pub publish'.

To share a package it must be associated with a Team which only Team Leaders and/or Administrators may do.
{% endtab %}
{% endtabs %}

{% hint style="success" %}
The secret to successfully publishing a package is.... good documentation.

Add a readme.md, take some time to document your public API and throw in some examples.
{% endhint %}

## Security

The largest risk you face is accidentally publishing your package to pub.dev.

## Publishing

If this is your first time publishing a package then you might find our blog article on publishing useful:

* [Publish your first package](https://onepub.dev/Blog?id=zuhnoflygz)

### Mark package as private

To prepare a package for uploading to OnePub you must mark it as a private package.

Run the `onepub pub private` command:

```bash
onepub login # if you are not already authed
onepub pub private 
```

This has the effect of adding a `publish_to` key to your `pubspec.yaml` file. The `publish_to` instructs dart to publish you package to OnePub rather than pub.dev.

And now publish your package to OnePub:

```
dart pub publish
```

{% hint style="warning" %}
Note: you can add the publish\_to key manually by following [the hard way](/guides/publishing-packages/the-hard-way) instructions.
{% endhint %}

### Public Packages

Some of your team members may need to publish both private and public packages.

All **public** packages should be published directly to pub.dev using the standard dart tooling/processes.

**Public packages** you upload to pub.dev will be cached on onepub.dev within a few minutes of you publishing to pub.dev, so you can easily find these packages on OnePub as well as pub.dev

## Teams

If your OnePub organisation has multiple teams (you need the Team or Enterprise license) then are some additional steps required when uploading a package.

The core issue is that you need to nominate the team the package belongs to before uploading the package.

A package may be associated with multiple teams.

To associate a package with a Team

* Navigate to My OnePub | [Managed Packages](https://onepub.dev/DartPackageList)
* Create a new package
* Enter the package name and description.
* On the Teams tab, select each of the teams the package is associated with.
* Save the new package.

You can now publish your package from the CLI as per the normal process.


# The hard way

Instead of using the `onepub pub private` command to make a package private you can achieve the same objective by manually adding the `publish_to` key to your `pubspec.yaml`.

{% hint style="info" %}
There is no advantage to doing it the hard way. We provide these details so you fully understand what the `onepub pub private` command is doing.
{% endhint %}

Find your organisation's publish\_to URL on your OnePub profile page:

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FshmeJFU6TjVGkF3sDUau%2Fimage.png?alt=media\&token=a48dd51a-e485-4fef-ab98-5a01e1398553)

Edit the pubspec.yaml of the package you wish to publish and add the `publish_to` keyword:

```yaml
name: mypackage
description: A simple command-line application.
version: 1.0.0
publish_to: https://onepub.dev/api/xxxxxxxx
```

To publish the package, login into OnePub (if you haven't already) then run the dart (or flutter) publish command.

```bash
onepub login
cd mypackage
dart pub publish
```


# Private dependencies

So you have either published a package to OnePub, one of your colleagues has suggested that you use a package they have published on OnePub or you found a private package whilst searching OnePub.

First, make certain your package is a private package hosted on [OnePub](https://onepub.dev).

When you perform a package search in OnePub we show both public and private packages.

{% hint style="info" %}
Public packages should be added to your pubspec.yaml using the standard dart tooling.
{% endhint %}

When doing a search, OnePub clearly labels private packages in the search results:

<img src="https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2Fx64CsjksPkkkU3rNPKr9%2Fimage.png?alt=media&amp;token=b9bdfd73-270f-49b5-9afb-6fc252571d6c" alt="" data-size="original">

In the above screenshot, we have two versions of the cli\_menu package. You can clearly tell which version is the private package from the ![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2F5RLzhUaR61rxJvaLiCNc%2Fimage.png?alt=media\&token=c141d850-60d4-49c1-8db1-342500b068c5)label.

### Configure a OnePub dependency

Once you have published a private package to OnePub you are going to want to update your projects to use the package from OnePub.

The simplest way is to use the `onepub pub add` command.

#### Use the onepub add command

To add or change a package dependency to get the package from OnePub run:

```bash
cd <my project>
onepub pub add [--dev] <package> [version]
```

Use the `--dev` switch to add the package as a dev dependency.

Pass the `version` if you want to control what version to pull, otherwise OnePub selects the latest compatible version. We recommend that in most cases you don't supply the \[version].

If the package already exists as a dependency the onepub will simply update the hosted-url to point to OnePub.

####


# The hard way

We recommend you use the [`onepub pub add`](/guides/package-dependencies) command to add a dependency. However, you can also add the dependency by hand.

#### Manually configure a OnePub dependency

The onepub pub add command simply adds a hosted dependency to your pubspec.yaml which of course you can also do manually (but why would you?).

For each private package that your project depends on, you can add a hosted key.

Copy the 'publish\_to' URL from your OnePub profile page:

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FOA5qcBDys1OUaWBEnJSp%2Fimage.png?alt=media\&token=68d71df3-ba83-4c1d-a521-5bdd958fff3c)

Now paste it into the 'hosted' key for the package.

```yaml
dependencies: 
  my_private_package:
    version: 1.0.2
    hosted: https://onepub.dev/api/xxxxxxxx
```

{% hint style="danger" %}
If your dart version is older than 2.15, then you must use the older hosted format.
{% endhint %}

```yaml
dependencies: 
  my_private_package:
    version: 1.0.2
    hosted: 
      name: my_private_package
      url: https://onepub.dev/api/xxxxx
```


# CLI Tools

Integration of Command Line Interface on Onepub.dev with Dart

OnePub CLI tooling is designed to work alongside your existing Dart CLI tooling.

The OnePub CLI tooling makes it easy to publish packages and manage dependencies held by your private repository.

To install the OnePub CLI tooling:

```bash
dart pub global activate onepub
```

or

```bash
flutter pub global activate onepub
```

> **NOTE: Ensure that the \~/.pub-cache/bin is on your PATH !!!**

To see a list of onepub CLI commands run:

```
onepub --help
```

When you install the OnePub CLI tooling two applications are added to your PATH.

* [onepub](#onepub)
* [opub](#opub)

## onepub

The onepub CLI app is the primary tool you use when interacting with OnePub from the CLI.

The onepub app supports a number of commands.

You can view a full list of the commands by running:

```bash
onepub --help
```

To get help on an individual command run:

```bash
onepub <command> --help
```

#### onepub commands

The onepub app supports the following commands:

<table><thead><tr><th width="150"></th><th></th><th></th></tr></thead><tbody><tr><td><a href="/guides/cli-integration/cli-tools">login</a></td><td>Login to a OnePub Organisation</td><td>Your email address can be associated with multiple Organisations and you use the login command to switch between them.</td></tr><tr><td><a href="/guides/cli-integration/logout">logout</a></td><td>Logout of OnePub</td><td><code>pub get</code> will fail if you have a private dependency in your project.</td></tr><tr><td><a href="/guides/cli-integration/doctor">doctor</a></td><td>Displays your OnePub configuration details.</td><td>Use the output of doctor when you are reporting bugs or want to check the status of OnePub.</td></tr><tr><td><a href="/guides/cli-integration/export">export</a></td><td>Export a OnePub Token</td><td>Tokens can be used to auth in a <a href="/guides/ci-cd">CI/CD</a> environement or over an <a href="/guides/ssh">SSH</a> session.</td></tr><tr><td><a href="/guides/cli-integration/import">import</a></td><td>Import a OnePub Token</td><td>Allows you to login when a Web browser and/or user interaction isn't viable such as in a <a href="/guides/ci-cd">CI/CD</a> or <a href="/guides/ssh">SSH</a> environment.</td></tr><tr><td><a href="/guides/cli-integration/pub-add">pub add [--dev]</a></td><td>Add a dependency on a private package.</td><td>Works the same as the <code>dart pub add</code> but for your own private packages.</td></tr><tr><td><a href="/guides/cli-integration/pub-private">pub private</a></td><td>Marks your project as a private package.</td><td>After marking your package as private you can <a href="/guides/publishing-packages">publish</a> it to your OnePub private repo using the standard Dart tooling.</td></tr><tr><td><a href="/guides/cli-integration/globally-activate">pub global activate</a></td><td>Globally activate a private package.</td><td>If you have a private package that contains CLI tools this command installs them and adds them to your PATH.</td></tr><tr><td><a href="/guides/cli-integration/globally-activate">pub global deactivate</a></td><td>Globally deactivate a private package.</td><td>If you have activated a global package this command will un-install it and remove it from your PATH.</td></tr></tbody></table>

## opub

The opub app is used provided for users that are using versions of Dart prior to 2.15.

The Dart development team made significant changes with respect to how the Dart CLI tools interact with a private repository and older versions of the Dart `pub` command aren't compatible with OnePub.

To circumvent this problem, OnePub provides the `opub` app which replaces the `dart pub` and `flutter pub` commands.

When running a command (such as dart pub get) that operates on a private package or a package that depends on a private package, then you simply substitute 'dart pub get' or 'flutter pub get' with 'opub get'. The same goes for all of the `pub` commands.

If you are running an even older version of Dart (pre-2.12) then read the section on using [Dart pre-2.12](/guides/installing/pre-dart-2.12).


# login

## Authentication

Before you can run any OnePub command, you must first log in to OnePub.

```
onepub login
```

{% hint style="warning" %}
You don't need to run `dart pub token add` as the `onepub login` command does this for you.
{% endhint %}

#### Multiple devices

You can log in to the OnePub CLI from multiple devices.


# logout

To log out of the OnePub CLI on **all** your devices, run the logout command from **any** device.

```
onepub logout
```

If you log out from any of your devices then you will be logged out from all of your devices.

If you have previously logged into multiple devices then to regain access an any given device, you will need to run `onepub login` on that device.

If your device gets stolen you can simply run `onepub logout` from any device or the onepub.dev website; go to the Member page and click the Logout CLI action.

Note: logging out of a stolen device still leaves the .pub-cache on the device so a thief will still have access to all source code in that device's cache.


# doctor

Use the output of `onepub doctor` when you are reporting bugs or want to check the status of OnePub.

The `doctor` command prints out your core environment settings and connects to the OnePub server to check it is operational.

```bash
onepub doctor
```


# export

The `onepub export` command works in concert with the `onepub import` command to log in to devices where the standard OnePub OAuth mechanism won't work as you don't have access to a browser.

See the [CI/CD](/guides/ci-cd) and [SSH](/guides/ssh) section for further details on using the onepub export/import commands in these scenarios.

{% hint style="danger" %}
The OnePub Token should always be managed and stored securely, as any person with access to the Token will have all the permissions of the Member the token is attached to.
{% endhint %}

### To export your own OnePub Token run:

```bash
onepub export
```

### To export another user's OnePub Token run:

```bash
onepub export --user <user email address>
```

You must be an Administrator or a Team Leader to export another Member's OnePub

token. An Administrator can export anyone's token. A Team Leader can export the token of any Member of their team.

### Export to a file

The above export commands will display the OnePub Token to the console. You can combine the `--file` option with either of the above commands to output the token to a file. If no file name is provided then we export the token to onepub.token.yaml.

```bash
onepub export --file
```

Alternatively, you can pass the name of the file to export the token to:

```bash
onepub export --file token.yaml
```


# import

The `onepub import` command allows you to login when a Web browser and/or user interaction isn't viable such as in a [CI/CD](/guides/ci-cd), [SSH](/guides/ssh) or [Docker](/guides/docker) environment.

The `import` command imports a OnePub authentication Token which you obtain by running the [`onepub export`](/guides/cli-integration/export) command.

The `export` command can either display the token to the console or save it to a file.

### import

If run the import command with no arguments it expects to find an environment variable called `ONEPUB_TOKEN`.

This technique is mostly used in a CI/CD environment which provides a **secret store** (e.g. github actions).

If you need to import into a shell that you have logged in to, then use the `onepub import --ask` option.

The value of the `ONEPUB_TOKEN` environment variable is the authentication token reported by the onepub export command.

Run the onepub export command on your local machine after login into onepub

```bash
> onepub login
...
> onepub export
OnePub version: 1.4.1 

Exporting OnePub token for OnePub.

Add the following environment variable to your CI/CD secrets.

ONEPUB_TOKEN=8a3e9999-b79b-46ad-b9dc-968ff99993c1
```

Create the ONEPUB\_TOKEN environment variable (this is usually done using your CI/CD secret store).

```
export ONEPUB_TOKEN=8a3e9999-b79b-46ad-b9dc-968ff99993c1
onepub import
```

### import --ask

If you used the `export` command to display the token to the console then use the `import --ask` option and type the token into the console:

```bash
onepub import --ask
ONEPUB_TOKEN: 
```

### import --file

If you exported the token in a file then you use the `onepub import --file` command to import the token.

If you didn't specify a filename when exporting the OnePub Token then the token will have been saved into \`./onepub.token.yaml\`.

If you run the `import --file` command without providing a file name then the `import` command will assume the file `onepub.token.yaml` contains the token and lives in the current directory.

### import --file \<path to file>

If you exported the OnePub Token to an alternatively named file or the token file is in a different directory then you can provide the path to the OnePub Token file.

```bash
onepub import --file <path to token file>
```


# pub add

The `onepub pub add` command serves the same purpose as the `dart pub add` command in that it adds a named dependency to your `pubspec.yaml` file.

The difference is that the dependency includes a hosted URL which indicates that the dependency is hosted on OnePub.

### pub add \<dependency>

To add a dependency, hosted within your OnePub private repository, called `mypackage` run:

```bash
onepub pub add mypackage
```

### pub add -dev \<dependency>

To add a dev dependency, hosted within your OnePub private repository, called `mytestpackage` run:

```bash
onepub pub add --dev mytestpackage
```


# pub private

To publish a package to OnePub it must be marked as a private package by adding a `publish_to` key/value pair to your `pubspec.yaml`.

Whilst you can do that manually the `onepub pub private` command automates this for you.

To mark your package as private run:

```bash
cd mypackage
onepub pub private
```


# pub global activate

If your private package hosted on OnePub includes executables, then you may want to globally activate them to run them from the CLI.

Run:

```bash
onepub pub global activate <your private package>
```


# pub global deactivate

To deactivate a globally activated private package

Run:

```
onepub pub global deactivate <your private package>
```


# CI/CD

OnePub is simple to integrate into your CI/CD framework.

In most CI/CD environments there is no user interaction, so it's not possible to run 'onepub login'.

To overcome this limitation OnePub provides the ability to authenticate to OnePub (from the CLI) using a OnePub token.

To use a OnePub token in your CI/CD environment you need to first 'export' a OnePub token and then import it into your CI/CD environment.

To move forward you will need:

* You will need the OnePub CLI tools installed into your CI/CD environment.
* A OnePub token with the requisite privileges.
* Modifications to your test scripts (e.g. GitHub Actions) to import a OnePub Token

The following describes the process for setting up your CI/CD environment.

## Create a CI/CD Member

OnePub recommends that you create a dedicated CI/CD member account. The CI/CD Member will be used from your CI/CD environment to authenticate to OnePub from your test scripts (e.g. GitHub actions).

To create a CI/CD member account:

1\) log into the [OnePub](https://onepub.dev) web interface.

2\) Open the [Members View](httsp://onepub.dev/Members).

3\) Open the context menu and select 'Create CI/CD User'.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FIKe7NMULw4JmcSDQrc6R%2Fimage.png?alt=media\&token=d540af27-8eb4-4e94-9ff3-40c9318cce3b)

4\) Enter a name for the CI/CD user. The name might be derived from the name of the CI/CD server it will run on, just choose something meaningful to your team.

### Permissions

{% hint style="danger" %}
A OnePub Administrator can export any other Member's OnePub Token. A OnePub Team Leader can export any of their team's OnePub Tokens.
{% endhint %}

Within OnePub, a OnePub Token is always tied to a member and that member's permissions.

When deploying a OnePub Token to your CI/CD environment you need to ensure that the member associated with the OnePub Token has sufficient permissions for the actions the CI/CD will take.

#### Teams

When you created the above CI/CD member they will have been added to the 'EveryOne' Team. This gives them access to every package associated with the EveryOne team. You may want to change the Team(s) the CI/CD member is associated with to restrict what packages they have access to.

## Import the CI/CD Member token

To use a OnePub CI/CD Member account you need to import the member's OnePub token into the CI/CD environment.

To do this you must first obtain a token.

Two methods are available to obtain a OnePub Token.

## Via OnePub Web UI

After creating your CI/CD member (as described above) you can export the OnePub token from the [Members](https://onepub.dev/Members) page.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2F6T5lYvEN0wIVAppXW2OY%2Fimage.png?alt=media\&token=97e95713-469e-4677-8993-54574d6da60b)

Clicking the 'Export Token' button will copy the OnePub token to the clipboard. You need to be an Administrator

### Via CLI tools

To export a OnePub token from the CLI:

Obtain the email address of the CI/CD User from the [Members](https://onepub.dev/Members) page.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FRzQGTt7LXB1gp2dyWwmi%2Fimage.png?alt=media\&token=ca838291-c574-4738-b96a-f999fde2c153)

Login to the CLI of your local machine:

```
onepub login
onepub export --user xxx@cicd.xxxxxx.onepub.dev
```

## Import token to CI/CD environment

Now you have a OnePub token you are ready to import it into your CI/CD environment.

{% hint style="danger" %}
Your OnePub token is an access token and as such MUST be treated as a secret.

If you accidentally leak your token you can invalidate it from the Members page 'Invalidate Tokens' button.
{% endhint %}

You will need the OnePub CLI tools deployed as part of your CI/CD infrastructure so that your CI/CD environment can access your private packages hosted on onepub.dev.

To include OnePub into your build/test scripts you will need to install the onepub CLI tooling and ensure that the dart .pub-cache/bin is on your PATH.

How you add the .pub-cache/bin directory to your PATH will depend on your test environment OS.

```
export PATH="$PATH:/home/.pub-cache/bin" -- this is probably not correct
dart pub global activate onepub
onepub import xxxxx
```

The next step is to decide where to store your OnePub token and therefore which method you will use to import the token.

### Environment variable

The `onepub import` command can import the OnePub token from an environment variable called ONEPUB\_TOKEN.

This is an excellent method as many tools such as GitHub actions allow you to populate an environment variable from their secret store.

Change the above example from:

```
onepub import xxxxx
```

to

```
export ONEPUB_TOKEN="<secret store source>";onepub import
```

### File

OnePub can import a OnePub token from a file.

{% hint style="danger" %}
OnePub **does NOT recommend this method** as it requires that you add your OnePub credentials to your source control system. However, if your CI/CD environment doesn't provide a method to store a token securely then this is the process you need to employ.
{% endhint %}

You can create the file when you export your OnePub token via:

```
onepub export --file --user xxxx
```

The file will be called onepub.token.yaml and contain a single line:

```
onepubToken: "NzE2OjBjM2RmVkLThkMDUtNDNy1iYmRiLWIyNzgODdmODc3Zg=="
```

Alternatively, you can manually create the file.

Change the above example from:

```
onepub import xxxxx
```

to

```
onepub import --file /path/to/onepub.token.yaml
```

## Docker

If you are using a local Docker instance to run unit tests please refer to the [Docker section](/guides/docker) for some alternate methods.

## Publishing

If your CI/CD environment is going to publish a package into OnePub then the owner of the OnePub Token must be an owner of that package.

A package owner is one of, Administrator, Team Leader (when the package is associated with that team) or an Uploader. An Uploader can upload a package to any team they are associated with.

When publishing a package the 'dart pub publish' command will prompt the user to confirm the act of publishing. When running a CI/CD action there is no user involved, so you need to use the --force switch:

```
dart pub publish --force
```

#### Dependencies

If the package you are building has a dependency (**or a transitive dependency**) on one of your private packages then the owner of the OnePub Token must belong to a team(s) that is associated with each of the dependent packages.

{% hint style="info" %}
If you are on the Free or Pro subscription tier there is only one Team (called Everyone) and every member belongs to that team. With the Free tier, every member is an Administrator.
{% endhint %}

## Use an existing account for CI/CD

Whilst you can use any Member account in your CI/CD environment we recommend you created a dedicated CI/CD account.

The process for using an existing Member account (such as your own) are exactly the same as the processes described above, except that you use your OnePub token which can be obtained by running:

`onepub export`

There are several advantages to using a dedicated CI/CD account.

{% hint style="success" %}
We recommend that you create a specific OnePub member for use in your CI/CD environment to reduce the risk of breaking your CI/CD environment if a regular member's permissions change.
{% endhint %}

### pros

1\) a member logout won't break your CI/CD environment.

The `onepub logout` logs a user out of ALL of their devices including the CI/CD environment.

This means that if the owner of the shared account logs out of their onepub account then they will inadvertently invalidate the OnePub token used by the CI/CD environment.

2\) The CI/CD environment permissions will be affected by any permission changes to the member. This can result in the CI/CD environment being given too many permissions or too few.

## cons

The only disadvantage is that using a separate CI/CD member does mean that you need to purchase an additional OnePub license.


# Trusted Publishers - Beta

OnePub supports Trusted Publisher allowing you to publishing directly from your preferred CI/CD provider without using a token.

A Trusted Provider, using OIDC, can be 'paired' with OnePub on a per package basis. This simplifies the publishing process while enhancing security by removing the need for long lived security tokens.

OnePub supports the following Publishers:

* GitHub
* GitLab
* Bitbucket
* CircleCI
* Azure Pipelines

Once a Trusted Provider is paired to OnePub, publish a package from your CI/CD pipeline use:

```
dart pub global activate onepub
onepub login trusted
dart pub publish --force
```

## Establishing Trust

To setup a Trusted Provider, you must 'pair' the provider with **each** **package** that you will publish to OnePub.

Log in to the OnePub website: <https://onepub.dev>

Navigate to: My OnePub | Managed Packages

Select the package you want to publish.

On the right hand side of the screen, select the 'Trusted publishing' tab.

<figure><img src="https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FVr4J7kE1P44T5fetmc01%2Fimage.png?alt=media&amp;token=42947d92-9be3-4ef0-9072-b712426e21eb" alt=""><figcaption></figcaption></figure>

Click 'New Publisher'.

Select the provider from which you run you CI/CD pipeline.

The 'Help' tab on the right-hand side of your screen provides details about configuring each supported Publisher.

<figure><img src="https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FpMCrqpFXDdB5rj7p0CXL%2Fimage.png?alt=media&amp;token=5ac01990-1a63-4490-b0c9-f515b43990e8" alt=""><figcaption></figcaption></figure>

Once you have entered all of the required details click the 'Save' button.

If you have an existing CI/CD pipeline then remove the `onepub import` command and replace it with `onepub login trusted`

You can also remove the OnePub token from your environment settings. We also recommend that you disable your OnePub CI/CD account to prevent it being used.

You can now trigger your CI/CD pipeline.

Repeat the above process for each of your packages that are published into OnePub.


# SSH

If you are running the OnePub CLI tooling over an ssh connection then the `onepub login` command won't work.

Instead, you need to export the OnePub authentication Token from your PC and import it into the ssh session.

Exit your ssh session and run:

```bash
onepub login
onepub export
```

Note: you only need to run onepub login if you are not currently logged in.

Restart your ssh session and run:

```bash
onepub import --ask
```

When prompted for the ONEPUB\_TOKEN, enter the token displayed when you ran the `onepub export` command.

You are now logged in to OnePub on the remote server.


# Docker

OnePub is Docker aware and designed to be run in a Docker container as well as on your host.

The are a few issues you need to be aware of when using a local or remote Docker container.

If you are going to use OnePub in your Docker container you will of course need to have Dart installed. You should also install OnePub by adding the following to your Dockerfile:

```docker
RUN dart pub global activate onepub
```

Dart must already have been installed into your Docker container in a prior step and be on the path.

{% hint style="info" %}
Where possible start with a Docker container that includes Dart such as the [official Dart Docker](https://hub.docker.com/_/dart) container.
{% endhint %}

## onepub login

If you are using the Docker container interactively (e.g. `docker exec -it xxx /bash`) then you can log into OnePub from within the Docker container by running `onepub login`.

If you Docker container runs without user interaction (the normal course of action) then you need to use the `onepub import/export` methods or directly mount the Dart token store.

The same problem will exists in your CI/CD environment (which is usually running in a Docker container). See the [CI/CD instructions](/guides/ci-cd) for additional details pertinent to typical CI/CD environments.

### Use export/import

The simplest method is to use the onepub export/import commands.

{% hint style="info" %}
For additional details on authenticating onepub read the [CI/CD guide](/guides/ci-cd)
{% endhint %}

From your desktop CLI run:

> Note: you only need to run onepub login if you are not currently logged in.

```bash
onepub login
onepub export --user <cicd user email>
```

The `onepub export` command will print your OnePub token.

**Start an interactive docker session** (e.g. docker exec -it xxxx /bash) and run:

```bash
onepub import --ask
```

When prompted for the ONEPUB\_TOKEN, enter the token displayed when you ran the `onepub export` command.

You are now logged in to OnePub with the Docker session.

If your Docker home directory isn't persistent then you will have to re-do the import each time you restart your container.

### Environment variable

The `onepub import` command can also able to take the OnePub token from an environment variable. Refer to the [import](#use-export-import) documentation for details.

### Mount the Dart token store

If your docker container is running on your local PC then you can mount the OnePub and Dart configuration files directly into your docker container.

This will result in the Docker container running with your OnePub account.

For a container running on your local system, the docker `mount bind` option has the advantage that you don't have to log in to your Docker container separately (and each time you rebuild it). Simply log in to onepub on the host and the container will also be logged in.

```
docker exec \
-it \
--mount type=bind,source="/home/me/.config/dart/pub-tokens.json",destination="/home/root/.config/dart/pub-tokens.json" \
--mount type=bind,source="/home/me/.onepub/onepub.yaml",destination="/home/root/.onepub/onepub.yaml" \
dart:latest
```

If you are using VS Code the command :

`Remote-Containers: Open Folder in Container...`

then see the [VS Code](/guides/installing/ide-integration/visual-code) documentation for details on creating the mounts.

### CI/CD

If your container is running in a CI/CD environment such as a github action then refer to the [CI/CD ](#ci-cd)documentation.

##


# Okta single sign-on

Set up Okta sign-in for your OnePub organisation.

Use Okta to sign in to OnePub through SAML 2.0. You can require members to use Okta while continuing to manage their roles and teams in OnePub.

SAML uses your Okta public signing certificate. You do not need to share a client secret or private key with OnePub.

To have Okta add and deactivate members or manage team access, see [SCIM provisioning](/guides/scim-provisioning). You can set up either feature separately.

## Before you start

You need administrator access to OnePub and Okta. Contact OnePub support to arrange the connection. Support configures the OnePub settings and works with your Okta administrator to set up the application.

## 1. Connect Okta

OnePub support will provide your **Single sign-on URL** and **Audience URI (SP Entity ID)**.

**In the Okta Admin Console:**

1. Open **Applications and Resources > Applications > Create App Integration** and select **Classic experience**.
2. Choose **SAML 2.0** and name the application **OnePub**.
3. Enter the **Single sign-on URL** and **Audience URI (SP Entity ID)** supplied by support.
4. Add these attribute statements:

   | Name         | Value            |
   | ------------ | ---------------- |
   | `email`      | `user.email`     |
   | `first_name` | `user.firstName` |
   | `last_name`  | `user.lastName`  |
   | `uid`        | `user.id`        |
5. Under the advanced SAML settings, set both **Response** and **Assertion Signature** to **Signed**. Leave **Assertion Encryption** set to **Unencrypted**.
6. Save the application. On **Sign On**, open **SAML Signing Certificates > Actions > View IdP Metadata** for the active certificate and send the metadata to OnePub support.
7. Under **Assignments**, assign the people who will use OnePub.

Support uses the metadata to finish the connection and saves its settings in your OnePub organisation. See [Okta's SAML application guide](https://help.okta.com/en-us/content/topics/apps/apps_app_integration_wizard_saml.htm) for help with the Okta screens.

**In OnePub:**

1. Sign in at [onepub.dev](https://onepub.dev) and select your organisation.
2. Open **My OnePub > Account > Okta**.
3. Check that support has configured the connection under **Organisation sign-in**. Leave **Require Okta sign-in** off while you test.

## 2. Test with one or two members

Ask one or two existing members to sign in with Okta. Their Okta email must match their OnePub login email.

OnePub links each account automatically within your organisation. Members keep their packages, roles and teams. There is no separate linking step.

Check that they can access their existing packages. You can then assign the application to the rest of your members in Okta.

While **Require Okta sign-in** is off, members can use either Okta or their existing sign-in method.

An Okta sign-in gives access only to the connected OnePub organisation. To access another organisation, sign out and sign in for that organisation.

These steps cover Okta without SCIM. If you also use SCIM, follow [SCIM provisioning](/guides/scim-provisioning) for account setup.

## 3. Require Okta sign-in

After testing, open **My OnePub > Account > Okta** in OnePub. This setting applies to all human members of the selected organisation.

1. Click **Verify Okta connection** and sign in through Okta using your administrator account.
2. Turn on **Require Okta sign-in**.
3. For existing CLI tokens, either:
   * Leave **Existing human CLI token transition ends** empty to require new tokens immediately.
   * Set a date up to 30 days ahead to give members time to replace their tokens.
4. Click **Save sign-in policy**.

Members may need to sign in again. For CLI access, run `onepub login` and sign in through Okta in the browser. OnePub supplies the token used by `dart pub publish` and `dart pub get`; there is no need to sign in for each command. CI/CD accounts are managed separately.

## Removing access

Suspending someone in Okta prevents new Okta sign-ins. It does not end their existing OnePub sessions or disable their CLI tokens.

If you use SCIM, see [Removing access](/guides/scim-provisioning#removing-access) for deactivation and immediate access removal. Otherwise, contact OnePub support for help removing access.

## Turning off required Okta sign-in

In OnePub, open **My OnePub > Account > Okta**, turn off **Require Okta sign-in**, and click **Save sign-in policy**.

Members can then use other supported sign-in methods, including people suspended only in Okta. Members deactivated in OnePub remain inactive.

## Troubleshooting

| Problem                              | Check                                                                                                                                     |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| The Okta tab is missing              | You must be an administrator of the selected OnePub organisation.                                                                         |
| A member cannot sign in              | Check that they are assigned to the Okta application, belong to this OnePub organisation, and have matching Okta and OnePub login emails. |
| OnePub will not let you require Okta | Complete **Verify Okta connection** using your administrator account.                                                                     |
| A member's CLI access stops          | Run `onepub login` and sign in through Okta to get a new token.                                                                           |

For help, contact [OnePub support](/faq/how-do-i-get-support) with the step that failed and any error reference.


# SCIM provisioning

Use Okta to manage OnePub members, roles and teams through SCIM.

SCIM lets Okta add members to OnePub, update their details and remove their access when they leave. You can also use Okta groups to assign OnePub roles and teams.

You can use SCIM without requiring members to sign in through Okta. Their accounts still need to be linked so OnePub can match each person to the right Okta account.

## Before you start

You need administrator access to OnePub and Okta. Contact OnePub support to set up the OnePub application in Okta and provide the connection settings.

For existing members, follow [Connect Okta](https://docs.onepub.dev/guides/pages/04tVVo2mzLUysk8PK6fy#id-1.-connect-okta). Once the SCIM account mappings are prepared, each member signs in to their existing OnePub account, selects the organisation, opens their profile menu and chooses **Link my Okta account**. They then complete the Okta sign-in. Leave **Require Okta sign-in** off unless you want to require it.

## 1. Connect provisioning

**In the Okta Admin Console:**

1. Open **Applications > Applications** and select the OnePub application configured with support.
2. Open **Provisioning** and use **Authenticate with OnePub**.
3. In the OnePub window, sign in as an administrator, choose your organisation and approve the connection.
4. Back in Okta, open **Provisioning > To App** and configure user creation, profile updates and deactivation with support.
5. Assign a few members to the application. If you want Okta groups to control OnePub permissions, configure **Push Groups** too.

SCIM uses OAuth to let Okta manage members in OnePub. This is separate from SAML sign-in. You do not need to copy a member's OnePub token into Okta. Support supplies the connection URLs and checks that new Okta accounts will be matched correctly in OnePub.

See [Okta's provisioning setup guide](https://help.okta.com/en-us/Content/Topics/Apps/Apps_App_Integration_Wizard_SCIM.htm) for more about the Okta settings.

**In OnePub:**

1. Sign in to OnePub, select your organisation, and open **My OnePub > Account > Okta**.
2. Under **SCIM mappings**, click **Refresh SCIM inventory**.
3. Check that the members and groups match those you assigned in Okta.

During setup, OnePub receives users and groups without granting new access. Deactivation still takes effect: if Okta deactivates a member whose account link has been approved, they lose access even if they have not finished linking.

## 2. Map groups to roles and teams

In OnePub, open **My OnePub > Account > Okta** and find **SCIM mappings**.

1. Select an Okta group.
2. Choose the OnePub roles, team memberships and team leader positions it should grant.
3. Click **Save draft mapping**. Repeat for each group.
4. Under **Review ownership and activate**, choose which roles and teams Okta will manage.
5. Click **Review changes** and check the additions and removals. Confirm that all expected members and groups have arrived from Okta.
6. Click **Review and activate**.

Select existing teams from the lists, or use **Create a target team** to add an empty team. Matching group and team names do not link them automatically.

Okta groups can grant **Collaborator**, **Team Leader** and **Uploader**, but not administrator roles. A team leader also needs the **Team Leader** role. The **Uploader** role applies across the member's accessible teams. See [Roles](/fundamentals/roles) for details.

When Okta manages a role, it controls who has that role throughout the organisation. When it manages a team, it controls both members and leaders. Make those changes in Okta; other roles and teams remain editable in OnePub.

Taking over a role or team can remove existing assignments. Save a record of those assignments before activating the mappings: disconnecting SCIM will not restore them.

New members receive only the access you configure. Until they have access, they remain pending. At their first sign-in, they accept OnePub's terms without creating a separate personal organisation.

## 3. Test provisioning

Use a few members to check these actions before adding everyone:

| Action in Okta            | Expected result in OnePub                                                      |
| ------------------------- | ------------------------------------------------------------------------------ |
| Assign an existing member | Their existing account and packages are retained.                              |
| Assign a new member       | They receive the roles and teams you configured.                               |
| Change a name or email    | The same OnePub account is updated.                                            |
| Change group membership   | The corresponding roles and team access change.                                |
| Deactivate a member       | Access to this organisation stops, including existing sessions and CLI tokens. |
| Reactivate a member       | Access can resume, but they must sign in again and get new CLI tokens.         |

Check any failed provisioning jobs in Okta before adding more members. Changes take effect only after OnePub receives them successfully.

## Removing access

With deactivation enabled in Okta, deactivating a member or removing their OnePub application assignment removes their access to the connected OnePub organisation. Their account is retained, and access to other organisations is unchanged.

**Suspending a user in Okta does not send a deactivation to OnePub.** It prevents new Okta sign-ins but leaves existing OnePub sessions and CLI tokens working. See [Okta's SCIM reference](https://developer.okta.com/docs/api/openapi/okta-scim/guides/scim-20/).

To block access immediately in OnePub:

1. Open **My OnePub > Account > Okta** and find **Local security holds**.
2. Enter the **Provisioned username** and click **Place security hold**.

Okta cannot clear this hold. **Release security hold** removes it, but does not reactivate a member who is still deactivated in OnePub or restore old tokens.

Deleting an Okta group removes the access supplied by that group. It does not delete the OnePub team or its packages.

## Disconnecting SCIM

In OnePub, open **My OnePub > Account > Okta** and click **Disconnect provisioning**.

This stops provisioning updates. It leaves members' access, role and team assignments, and the Okta sign-in requirement unchanged. Deactivated members stay inactive.

To manage roles and teams in OnePub again, change their ownership under **Review ownership and activate**. This keeps their current assignments; it does not restore earlier ones.

## Troubleshooting

| Problem                                   | Check                                                                                                                                   |
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| A member has no access                    | Check that their account is linked, they are active, and their group mappings have been activated. Check for a local security hold too. |
| A role or team cannot be edited in OnePub | Check whether Okta manages it.                                                                                                          |
| Mappings cannot be activated              | Resolve the problems shown, refresh the users and groups, and review the changes again.                                                 |
| Deactivation has not taken effect         | Check failed provisioning jobs in Okta and whether the user was suspended rather than deactivated.                                      |
| The connection stops working              | Contact support to check the provisioning connection.                                                                                   |

OnePub does not support password synchronisation, SCIM bulk operations or deleting users through SCIM. Users are deactivated instead.

For help, contact [OnePub support](/faq/how-do-i-get-support) with the step that failed and any error reference.


# Community Choice Awards

## Flutter/Dart Community Choice Awards

To celebrate the coming launch of onepub.dev, OnePub is hosting the Flutter Community Choice Awards in September 2022

\
The winner will receive a minimum of **$1000 of funding** towards their open-source work.\
OnePub is a heavy user of Open Source code and believes that every company should give back to the community.\
\
The Onepub Community Choice Awards is intended to reward Open Source developers working in the Dart/Flutter eco-system.\
Developers can nominate a feature or bug they want to contribute.\
\
The Dart/Flutter community will then be invited to vote on the best idea with the funding awarded to the developer with the top votes on completion of the work.\
Full terms and conditions will be posted before the competition commences.

To register your interest in nominating a project or voting please go to:

<https://onepub.dev/Competition>


# Members

The user who first registers an Organisation on OnePub is nominated as the owner/administrator.

The owner can invite additional members to their Organisation via the 'Invite' button on the home page.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FrYBuJnM29BcOi7E8Of8R%2Fimage.png?alt=media\&token=3973aeb6-c8fe-4fa9-a861-e80ca256366f)

{% tabs %}
{% tab title="Free" %}
The free edition allows two members per Organisation.
{% endtab %}

{% tab title="Pro" %}
Only the original owner can invite other team members.
{% endtab %}

{% tab title="Team" %}
Only the Team owner can invite members to their team.

Only the Organisation owner can create teams.
{% endtab %}

{% tab title="Enterprise" %}
Specify multiple Team owners and multiple Publisher owners to manage teams.
{% endtab %}
{% endtabs %}

You can use a single email address across multiple OnePub Organisations and [switch between organisations](/workflows/switching-organisations) via the OnePub profile and the OnePub CLI tooling.

Once a user has become a member they can publish new packages and add a private package as a dependency to their project (subject to permissions).

The user who first publishes a package is considered the owner of that package.

{% tabs %}
{% tab title="Pro" %}
Any member can publish a package and upload a new version to any existing package.
{% endtab %}

{% tab title="Team" %}
Only a Team leader can publish a package or update a published version.
{% endtab %}

{% tab title="Enterprise" %}
Designate multiple package owners who can update existing packages.
{% endtab %}
{% endtabs %}


# Teams

OnePub supports the concept of Teams.

A Team owns a collection of Packages and the Team controls who has access to the owned packages.

The system starts with a single Default Team for which all Members are Team Leaders and Team Members.

{% tabs %}
{% tab title="Pro" %}
Only the Default Team is allowed.
{% endtab %}

{% tab title="Team" %}
You may create additional Teams with a **single** Team leader and nominate specific Members as Team Members.

You may disable the Default Team to stop the uncontrolled uploading of packages.
{% endtab %}

{% tab title="Enterprise" %}
You may create additional Teams with **multiple** Team Leaders and nominate specific Members as Team Members.

You may disable the Default Team to stop the uncontrolled uploading of packages.
{% endtab %}
{% endtabs %}

A Team leader is able to:

* Define new packages
* Add Members as Team Members
* Deactivate a Package


# Roles

OnePub supports the concept of roles. A role describes the set of actions a user may perform.

## Administrator

Administrators are the super users of OnePub. An Administrator can perform any operation on the system that any other user can as well as some specialised functions only available to an Administrator.

{% tabs %}
{% tab title="Pro" %}
The Member that created the first OnePub account is the only Administrator. They may assign someone else to take over the role of Administrator.

An Administrator cannot create Teams as only a single Default team is supported.
{% endtab %}

{% tab title="Team" %}
The Member that created the first OnePub account is the only Administrator. They may assign someone else to take over the role of Administrator.
{% endtab %}

{% tab title="Enterprise" %}
The Member that created the first OnePub account is the only Administrator.

Additional Members may be nominated as Administrators.
{% endtab %}
{% endtabs %}

An Administrator may:

* create a new packages and assign them to a Team.
* upload new versions of a package
* Invite people to become OnePub Members
* create/delete/edit Teams
* nominate a Member as a Team Leader
* move packages between Teams
* cancel, upgrade or downgrade the service
* Update/view billing details
* use onepub.dev to search for private packages from any team

## Uploader

An Uploader has the ability to maintain a specific package including:

* uploading a new version
* edit any package properties.

An Administrator is also an Uploader.

If an Uploader needs assistance in managing one of their packages they may assign other Members as Uploaders .

## Team Leader

A team creates a group of Members that are able to access a group of packages.

The Team Leaders may add and remove Members and packages from their team.

A Team Leader may:

* add/remove other members to the team.
* invite people to become OnePub Members and join their team.
* Associate a package with the Team
* Disassociate a package from a Team
* use OnePub to search for private packages from any team

## Member

All users of OnePub are Members.

A Member with no other roles:

* Is a member of the Default Team.
* may download packages from any team they are a member of.
* use onepub.dev to search for public packages and private packages from any team

## CI/CD

The CI/CD role is a specialised role used to grant access to your CI/CD processes such as a GitHub action.

The CI/CD role has very limited access.

* may NOT log in to the OnePub Web site.
* may only perform get and publish operations.

The ability to perform get and publish operations is further restricted.

### Publish

To publish a package the CI/CD user must be marked as an owner of the package.

### Dependency

To access a package dependency (during a pub get operation) the CI/CD user must be a member of a team that has access to the package.

Don't forget to give the user access to any transitive dependencies.


# Naming Packages

OnePub allows you to name your private package using a name that is already taken by a public package on pub.dev.

We however generally don't recommend this as it may cause confusion at a later stage if you need to use the same named package from pub.dev.

If you are using the OnePub tools (`onepub pub private` `onepub pub add <dep>`) then there is no issue using existing public names as every package is explicitly referenced with the OnePub URL.

## PUB\_HOST\_URL

**not recommended!**

Dart supports configuring your private Package repository by setting an environment variable PUB\_HOST\_URL.

When you set the PUB\_HOST\_URL environment variable then every `dart pub` command will be sent via the OnePub repository.

This has a couple of consequences.

1\) OnePub will see every package you depend on. Probably not a big deal, but if you are particularly sensitive about this information then it's not desirable

2\) If you use any package name that is already used by a package on pub.dev then you will no longer be able to access the public package of that name. Remember that whilst your package name isn't used today someone may publish a package to pub.dev at a later date.

To avoid these types of name conflicts, we recommend that you prefix your package names with your reverse domain name.

e.g. dev.onepub.test


# Distributing to Customers

OnePub can be used as a safe and easy method to distribute licensed packages to your customers.

Customers are given limited 'read only' access which allows them to:

* to add a dependency to your private package(s) published via OnePub
* participate in the OnePub discussion threads for your package.
* view your package's; readme, changelog, install instruction, version history and dependency chart
* Add 'package watches' to receive a notification whenever you publish a new version of a package.

You can control what packages a Customer has access to by creating Teams and allocating packages/customers to the team. A customer will only see packages from the teams that they are members of.

{% hint style="danger" %}
Your customer will have full access to the package's source code!

The package source will be stored in their .pub-cache folder.
{% endhint %}

The following guides are provide to help you get setup.

* [Purchase a Distribution license](/workflows/distributing-to-customers/purchase-a-customer-distribution-license)
* [Publish a package](/guides/publishing-packages)
* Set up Customer Teams
* [Invite a customers](/workflows/distributing-to-customers/how-a-customer-installs-a-package)
* Customer installation instructions
* [Conditions Apply](/workflows/distributing-to-customers/conditions-apply)

##


# Purchase a Customer Distribution License

To use OnePub's distribution system you need to purchase a Customer Distribution License (CDL).

You can trigger this process via the 'Invite' link on the OnePub Home page.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FtcbuwfUMCrYPrikraegY%2Fimage.png?alt=media\&token=59ec5219-e444-44b5-a81a-be59c7cc2b01)

Select the 'Invite a Customer' option:

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FFPq8ROpaad2Pt4sM1nS6%2Fimage.png?alt=media\&token=32296a61-a247-4b05-8275-3c0bcb78ef18)

OnePub will then provide instructions on pricing and how to purchase a CDL.

Requirements for the CDL are:

* Subscribe to either the Team or Enterprise plan
* A Customer Distribution License.

A single CDL allows you to invite an unlimited no. of customers however, download limits etc still apply. See the [Conditions](/workflows/distributing-to-customers/conditions-apply) for additional details.


# Security considerations

Once you have purchased a Customer Distribution License (CDL) you need to do some preparation before inviting your first customer:

OnePub uses Teams to control which packages a customer has access to.

## Security

Configuring your Customer/Teams incorrectly may result in data leakage between customers.

The primary concern is breaching a Non-disclosure Agreement (NDA). You may have an NDA that forbids you from disclosing a customer's name publicly.

All members of a team can see each other's details, so associating customers in a single team may reveal their identity, breaching your NDA.

Even if you don't have such an NDA, segmenting customers by team, is considered good practice.

{% hint style="danger" %}
Members of different Customers should NEVER be added to the same team.
{% endhint %}

### 'Team per customer' model

To keep you and your customer's data safe we use a 'Team per customer' model.

* create a OnePub Team for each customer.
* associate each package (that the customer has a license for) with the Customer's team.
* Invite each of the Customer's developers, selecting the team you created above.

If the customer purchases another package then you can simply associate it with the Customer's team, to give all of the Customer's devs instant access.

Never associate developers from different customers with the same team!!!

{% hint style="info" %}
We recommend that the Team name is the Customer's business name.
{% endhint %}


# Publish a package

Publish a private package for distribution to you customers is almost identical to publishing any package to OnePub.

The exception is that you will want to create a OnePub Team for each customer and associate each package with that customer's OnePub Team.

Follow our standard guide on [publishing a package](/guides/publishing-packages) with careful attention to the section on associating a package with a Team.

## Additional customers

Over time you will have additional customers purchase a license to your package.

Each time a customer comes on you will need to implement the following steps:

* create a new OnePub Team for the customer
* associate each package with the customer's OnePub Team
* send each of the customers developers an invitation to the newly created team.

## Additional Packages

If you developer a new package and want to license it to existing customers then follow our [publish a package guide](/guides/publishing-packages).

As part of the publishing process you can associate the package with each customer's Team or come back at a later stage to associate the package with customers as customers acquire a license.


# Invite a customer

Once you have purchased a Customer Distribution License (CDL) you need to do some preparation before inviting your first customer:

OnePub uses Teams to control which packages a customer has access to.

## Security

Configuring your Customer/Teams incorrectly may result in data leakage between customers.

The primary concern is breaching a Non-disclosure Agreement (NDA). You may have an NDA that forbids you from disclosing a customer's name publicly.

All members of a team can see each other's details, so associating customers in a single team may reveal their identity, breaching your NDA.

Even if you don't have such an NDA, segmenting customers by team, is considered good practice.

{% hint style="danger" %}
Members of different Customers should NEVER be added to the same team.
{% endhint %}

### 'Team per customer' model

To keep you and your customer's data safe we use a 'Team per customer' model.

* create a OnePub Team for each customer.
* associate each package (that the customer has a license for) with the Customer's team.
* Invite each of the Customer's developers, selecting the team you created above.

If the customer purchases another package then you can simply associate it with the Customer's team, to give all of the Customer's devs instant access.

Never associate developers from different customers with the same team!!!

{% hint style="info" %}
We recommend that the Team name is the Customer's business name.
{% endhint %}


# Customer installation instructions

Once you have invited a customer to your OnePub organisation and provided them with the required permissions, the customer adds a dependency to your package as follows:

```bash
dart pub global activate onepub
onepub login
cd the-customers-app-dir
onepub pub add <your package>
dart/flutter pub get
```

The customer's team members can also log into the OnePub website, use the OnePub search interface and access your package documentation, all through a familiar interface modelled on pub.dev.


# Conditions Apply

A Customer Distribution License (CDL) has a number of conditions to ensure that it isn't abused.

The following conditions must be met

* Your organisation has purchased a CDL.
* Your organisation has either the Team or Enterprise plan
* All of your staff (that use OnePub) must have a per-seat license for your organisation.
* All of your staff must use a single common corporate domain email address (e.g. <me@onepub.dev>, not <me@gmail.com>).
* The email addresses used to register customers must come from a corporate domain email address.
* The standard plan limits apply (downloads etc) with the exception that Customers are excluded from the Seat count.
* You may be required to purchase an additional allowance if you exceed the included download allowance or storage allowance.


# For Support

Support is provided via GitHub [discussions](https://github.com/onepub-dev/onepub/discussions) where you can interact directly with our dev team.

You can raise bug and feature requests via the GitHub [issue](https://github.com/onepub-dev/onepub/issues) tracker.

Security related issues should be emailed to support @ onepub dot dev


# Setting up CI/CD

OnePub provides integration with your CI/CD tool environment.

{% hint style="danger" %}
The leakage of a OnePub token is a serious security risk.

A person with access to a OnePub Token can perform any action the owner of that token can perform.
{% endhint %}

### Continuous Integration (testing)

When you run integration tests you need the ability to get package dependencies (including transitive dependencies).

If any of these dependencies are hosted by OnePub then you need to provide your CI environment with a OnePub Token.

#### Permissions

If the CI action downloads one or more dart dependencies (including transitive dependencies) then the Member associated with the OnePub Token must have the download privileges for each of those packages.

The most common to ensure the required privileges is to associate the Member with the set of Teams that manage those packages.

### Continuous Deployment

If your CD environment needs to publish packages hosted on OnePub then you need to provide your CD environment with a OnePub token.

#### Permissions

If the CD action uploads a new version of a package then the Member associated with the OnePub Token must have upload privileges.

If the CI action downloads one or more dart dependencies (including transitive dependencies) then the Member associated with the OnePub Token must have the download privileges for each of those packages.

If you are going to publish multiple packages during a single CD action then you need to make the user an Uploader for each of the packages.

#### Expiry

All OnePub tokens, whether obtained during a login or via the `onepub export` command, expire after 30 days. However, each time a token is used to access OnePub, it's expiry is automatically extended by 30 days.

## Workflow

The following steps need to be carried out:

* Create a specialised Member for the CI/CD action.
* Add the new Member to a Team associated with each of the package dependencies (don't forget transitional dependencies).
* If necessary add the Member to multiple Teams to acquire access to all of the package dependencies.
* If the CD Action will publish a package then add the Member as a Package Owner to the package(s) the CD Action publishes.
* Export the CD/CI Members token from the CLI using the `onepub export` command.
* Deploy the token to your CI/CD environment
* Add onepub to your CI/CD action
* Import the token into your CI/CD action via the 'onepub import' command.


# Vendoring Dependencies

You may sometimes need to Vendor your dependencies if they come from an unstable source.

The concept of Vendoring a dependency is essentially the concept of building from a local copy of a library rather than relying on the third parties source. You essentially become the vendor of the package.

Vendoring may be necessary if the package owner doesn't release frequently or if you need to create a change to the package that the owner won't accept.

OnePub lets you Vendor a package and subsequently share it with your team or simply your other projects.

### When don't you need to vendor packages?

Any released version of a package published on pub.dev doesn't need to be vendored providing you fix the version of the package within your pubspec.yaml.

Just because a package is released to pub.dev (or OnePub) doesn't mean you can trust it, but you can trust that a specific version won't change.

If your organisation requires that you audit any packages used in your project then you must pull the source of the package from pub.dev (or OnePub) rather than from git. The reason for this is that you need to ensure you are auditing the actual code that makes up the version, not just some source code that claims to come from the same version.

### To vendor a package:

1. clone the source to your local machine
2. mark it as a private package
3. publish it to OnePub
4. have your colleagues update their dependencies to use the vendored version of the package.
5. clone the source

```bash
git clone <repo>
```

2\. mark the package as private

```bash
cd packagedir
onepub pub private enable
```

3\. publish to OnePub

```bash
dart pub publish
```

4\. update packages to use the vendored package

```bash
cd otherpackage
onepub pub add <vendored package>
```


# Switching Organisations

A OnePub member can belong to multiple organisations.

This can be useful as it allows you to have a personal OnePub account as well as multiple work accounts if you are a contractor.

To switch between organisations, click on the profile icon in the top right-hand corner of the OnePub website.

Click the 'Switch' button on the profile dialog and select the desired organisation.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FpZinseunrFcdlNqetvze%2Fimage.png?alt=media\&token=b608db68-23cd-4e58-a514-dc773fcc6641)

## Sticky Organisation

Once you switch to an organisation, each time you return to the OnePub site you will be logged into the same organisation until you once again switch organisations.

## Switching organisation on the CLI

When working from the CLI you can switch organisations by running the `onepub login` command.

The login command will prompt you to select the organisation you want to log in to.

From the CLI, you can actually be logged into multiple organisations simultaneously. This allows you to move between dart projects and run the likes of 'dart pub get' without having to switch organisations.

### Active Organisation

There is however a concept of an 'active' organisation. The active organisation is the last one you logged into on the CLI. You can view the active organisation by running `onepub doctor`.

When you run commands such as `onepub pub private` or `onepub pub add` the active organisation is used.

Run `onepub login` to switch to an alternate active organisation.

## Join an organisation

If you want to join a new organisation you must first receive an invitation to that organisation. Once you have accepted the invite you can then switch to the new Organisation.


# Creating a Team Leader

To create a Team Leader a member must:

* Have the team leader role
* Be a member of the Team
* Be marked as a Team Leader for the Team.

1\) Add the Team Leader role to the Member

On the My OnePub | Members page:

Find the member:

On the Role tab give them the 'Team Leader Role'.

<figure><img src="https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FZqO4bVeEVlsCl1nbpRO9%2Fimage.png?alt=media&amp;token=d9018ed4-5895-4d67-88a3-695fd5d41956" alt=""><figcaption></figcaption></figure>

2\) On the Teams tab for the My OnePub | Member screen add the member to the required team.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FHXjWLVFFcWR1TmR8SBA1%2Fimage.png?alt=media\&token=817e6544-71f5-44ab-8205-3d648d075ac6)

3\) On the Leaders Tab of the My OnePub | Teams page mark the Member as a Leader of the Team.\
\
\
![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FMb6j89e5lD02R204M1i8%2Fimage.png?alt=media\&token=735842e5-cda8-47cb-a272-b3b0230e9916)


# Token Management

## Managing OnePub tokens & how they interact with `dart pub`

In order for the Dart CLI tooling to interact with OnePub, you need to provide it with a OnePub token so the Dart tooling can authenticate itself to OnePub.

The following guide discusses the multiple ways you can provide Dart with a OnePub token but the easiest way is to simply run:

`onepub login`

The Dart CLI tools can now publish and get packages to/from OnePub.

This guide explains OnePub 'Tokens', how to generate/export them, and exactly how they’re consumed by the Dart toolchain (`dart pub`) in local dev, CI, and containers.

***

### 1) OnePub tokens

There is **only one type of token** in OnePub: the **member token**.

* Each token belongs to a specific **member**.
* It lasts **30 days**, but:
  * Every time the token is successfully used, its life is automatically **extended** for another 30 days.
* Tokens grant the same level of package access that the member has.

This single‑token model keeps things simple: whether you're developing locally, publishing a package, or running CI, you always use the same member token.

The Team and Enterprise editions allow you to create a specialised CI/CD member that can be used in your CI/CD pipeline.

***

### 2) Obtaining a Token

You can obtain a OnePub Token via one of three methods.

* Implicitly
  * Run 'onepub login' from any CLI environment. This command authenticates you with OnePub and then makes the token visible to the Dart CLI tooling.
* Export a Token
  * After logging via the `onepub login` command you can run `onepub export` to [export you OnePub token](/guides/cli-integration/export).
  * If you are a OnePub Administrator you can export any Member's token. If you are a Team Leader you can export any of your Team's tokens. The ability to export another Member's Token requires a Team or Enterprise license.
* Copy Token from UI
  * You can copy a token from the Member page within the OnePub UI. (My OnePub | Members - 'Export Token').
* Importing
  * However you have obtained a token you can [import](/guides/cli-integration/import) the Token into your CLI environment (or that of a container) using the `onepub import` command, setting an environment variable or by directly editing the pub-tokens.json file (see below).

### 3) Invalidating a Token

If a OnePub token is compromised you can invalidate any Member's token from the OnePub UI. Navigate to \`My OnePub | Members', find the Member and click the 'Invalidate CLI Tokens... OnePub'.

### 4) Dart's interaction with OnePub tokens

When Dart encounters a 'publish\_to' key or a 'hosted\_url' dependency in you pubspec.yaml it checks Dart's pub-tokens.json file for a matching url. Each url listed in Dart's pub-tokens.json file has an associated token (in our case the OnePub Token) which is then used by Dart to authenticate with the host. When you run the `onepub login` or `onepub import` commands, OnePub simply adds the OnePub Token to to Dart's pub-tokens.json file.

* Manually add a OnePub Token - Not recommended

  If all else fails you can manually add a OnePub token to Dart's pub-tokens.json

```bash
mkdir -p "$HOME/.config/dart/pub-tokens.json"
cat > "$HOME/.config/dart/pub-tokens.json" <<'JSON'
{"version":1,"hosted":[{"url":"https://onepub.dev/api/yzohnoflyg/","token":"<ONEPUB_TOKEN>"}
JSON
```

Replace \<ONEPUB\_TOKEN> with your actual token.

***

***


# FAQ

#### [How do I publish a private package?](#how-do-i-publish-a-private-package)

#### [How do I invite teammates to join my OnePub repository?](#how-do-i-invite-teammates-to-join-my-onepub-repository)

#### [How do I use OnePub from my CI/CD environment?](#how-do-i-use-onepub-from-my-ci-cd-environment)

#### [How do I get support?](#how-do-i-get-support)

#### [What is your SLA?](#what-is-your-sla)

#### [Does OnePub.dev have access to my personal information?](#does-onepub.dev-have-access-to-my-personal-information)

#### [Is GST/VAT/Sales Tax applicable?](#is-gst-vat-sales-tax-applicable)


# Is GST/VAT/Sales Tax applicable?

For residents of Australia, GST is added to the subscription fee otherwise, no taxes are applied.


# Does OnePub.dev have access to my personal information?

As part of the Single Sign-On (SSO) process, we obtain your email address, first and last names.

When you subscribe to a chargeable edition we require your credit card details and your Organisation name and country of origin.

We use a credit card gateway to store your credit card details (OnePub never has access to these details). We use a Credit Card token to apply reoccurring charges to your credit card.

OnePub.dev does not share your details with any third parties unless required by law enforcement agencies, the courts or legislation.

You can view our full [privacy policy.](https://onepub.dev/privacy)


# What is your SLA?

Our target SLA is 99.5% excluding maintenance windows.

Locally cached packages are not affected by maintenance windows (`dart pub get` caches all packages automatically).

We have a weekly 1-hour maintenance window scheduled for Tuesdays 10 am + GMT +10 which is used for updates requiring database upgrades. Updates usually take less than 3 minutes.

As required outages to apply critical security patches or issues affecting a significant no. of users.

We are working towards an upgrade process that requires zero downtime.


# How do I get support?

OnePub support is handled via [GitHub](https://github.com/onepub-dev/onepub). You can raise an issue or start a discussion thread.

Security-related bugs should be emailed to <security@onepub.dev>.

You can read the full security policy on [github](https://github.com/onepub-dev/onepub/blob/main/SECURITY.md).


# How do I use OnePub from my CI/CD environment?

OnePub has a specific user role for using OnePub from your test servers or hosted CI/CD systems such as Git Actions.

See the article on [setting up CI/CD](#how-do-i-use-onepub-in-my-ci-cd-environment) for details on creating a CI/CD account and importing your OnePub token into your CI/CD environment.


# How to invite team members to join OnePub

* Login into <https://onepub.dev>
* Click the invite button.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FlZldO1Crmt7ZQWoUnI2N%2Fimage.png?alt=media\&token=e842b057-a778-40e5-90c6-f1f0e96bcb2a)


# How to publish a private package

Packages are published using command-line tools.

```bash
# install onepub
dart pub global activate onepub

# login to one pub
onepub login

# cd into the directory of the package you want to publish
cd mypackage

# enable private publishing for your package
onepub pub private

# publish the package to onepub using the standard dart publish command.
dart pub publish
```

You can read full details on the [publishing workflow](broken://pages/PbE2uXNQqgvs4v6pk07n).


# 401: Unauthorized

One of my package dependency is hosted on OnePub.

When running `dart pub get` I'm seeing a 401: Unauthorized error.

This means that you are not logged in or not logged into the correct organisation.

The first thing to do is to ensure you are logged into the OnePub on the CLI:

```
onepub login
```

Run `dart pub get` again and hopefully that solves your problem.

If that didn't fix it then read on.

## multiple organisations

You may be a member of multiple OnePub organisations.

If you joined OnePub by accepting an invitation then you will automatically be a member of two OnePub organisations.

When you accept a OnePub invitation we automatically create your own personal OnePub organisation as well as joining you to the organisation you were invited to.

This could mean that when you logged into OnePub from the CLI that you logged into the wrong organisation.

You can check which organisation you are logged into by running:

```
onepub doctor
```

You should see the Organisation name near the bottom of the output.

### switching organisations

To switch between organisations at the CLI run:

```
onepub login
```

When you click on the url displayed by the login command you will be prompted with a droplist showing the organisations that you belong to.

Select the organisation that want to login to.

Run:

```
dart pub get
```

Now your problem should be solved.

No? Then you can reach out for help via the OnePub [discussions](https://github.com/onepub-dev/onepub/discussions) forums


# Solved by OnePub

Here we try to detail some of the common problems encountered in Dart/Flutter development and how you can use OnePub to solve them.

## A single place for your team to find packages

Like most of us, you probably store you code in a git repo such as GitHub.

To reduce code duplication you need to make it easy for team members to find and use the code and its documentation.

The likes of GitHub doesn't make this terribly easy.

The OnePub search is designed specifically for searching Dart packages. Publishing a package on OnePub makes it easy to find and trivial to add as a dependency.

`onepub pub add <my private package>`

No more screwing around with git branch references that go stale! Using OnePub, means that running 'dart pub upgrade' will automatically find the latest package version.

## A common home for API documentation

Like pub.dev, when you publish a private package to OnePub we generate and host your API documentation for your whole team.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FiWWxxvqrHu2SeaZx9mcV%2Fimage.png?alt=media\&token=66a23599-478a-4b1f-8f84-6c2698a05c5c)

Search for your package in OnePub and click the 'api reference' link to go to the documentation.

## Watch for package updates

Added a watch to a public or private package to receive an email notification each time a new version of the package is published to OnePub or pub.dev!

Click the blue star ![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2FU2Pq4Fo04otYnxZm4hIZ%2Fimage.png?alt=media\&token=444f4fd1-692a-4ed0-bdbc-a9f841e5e827)to the left of the package to add a watch.

![](https://2164893338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJazaE7yAHIXZjE9ucSqu%2Fuploads%2F26rGegHiFqdKxUwUNShH%2Fimage.png?alt=media\&token=abb13e88-c90f-48d4-97a4-d2ff406e6e98)

## Share code between my own projects

Often you have code that you need to share between a number of your own projects.

You can solve this problem by using a 'path' dependency, a 'git' dependency or even a mono-repo, but each of these has shortcomings and requires significant additional management overhead and in some cases constant tweaking of your `pubspec.yaml` depending on what actions you are performing.

The OnePub solution is;

Move the shared code into its own Dart package.

> It's often best to create a series of small packages rather than a swiss army knife.

Publish the new code you want to share:

```bash
cd mysharingproject
onepub pub private
flutter pub publish
```

Now you have shared your code, you can add a dependency from any other project.

```bash
cd myotherproject
onepub pub add mysharingproject
flutter pub get
```

And that's it.

## Share code with teammates

This is of course a core reason for using OnePub.

The process to share your code with teammates is exactly the same as for sharing code between projects.

```
cd mysharedproject
onepub pub private
flutter pub publish
```

You will of course need to invite your colleagues to OnePub - [invite a colleague](https://onepub.dev/memberInvite)

To use your published package, your colleague needs to:

```bash
flutter pub global activate onepub
onepub login
cd teammatesproject
onepub pub add mysharedproject
flutter pub get
```

## Patch a public package/Vendor a package

The Dart ecosystem has 10 of thousands of packages, however, not all of them are perfectly maintained. Sometimes you might need to patch a public package and you just can't wait for the maintainer to release and update.

The answer is to create your own private version of the package. Once the maintainer publishes the official version you can revert back to the public version of the package.

To create your own private version:

* Fork the existing public package and clone it to your machine.
* Make any necessary changes to the code.
* Publish the code to OnePub.

You can use the existing package name as OnePub resolves conflicts.

```
git clone <some public package>
cd <some public package>
onepub pub private
flutter pub publish
```

You now have your own private version of the package. You and your colleagues can now use the private version until the new public one has been released.

To add a dependency on the private version of the package.

```
cd myproject
onepub pub add <some public package>
flutter pub get
```

OnePub will update the dependency to point to your private version of the package.

We strongly recommend that you run the unit tests of the public package to ensure that the unpublished version isn't broken in some way.

## Fix 'version solving failed'

One of the most frustrating issues when adding dependency with Dart is the classic 'DLL hell' problem. With Dart, this problem is revealed by the dreaded **'version solving failed'**.

Version solving fails, when you depend on two packages that both depend on different versions of a transient dependency.

You should start by contacting the package maintainers and ask them to publish a new release with more up to date dependencies.

Failing that or whilst you are waiting, you can vendor your own copy of one or more dependencies.

In a similar fashion as the above 'Patch a Public Package' section, we are going to update a package dependency of a public package and publish our own private version until the maintainer releases an updated version.

To create your own private version:

* Fork the existing public package and clone it to your machine.
* Update the set of dependencies (read up on `dart pub upgrade` command).
* Publish the code to OnePub.

You can use the existing package name as OnePub resolves conflicts.

```
git clone <some public package>
cd <some public package>
onepub pub private
flutter pub publish
```

To add a dependency on the private version of the package.

```
cd myproject
onepub pub add <some public package>
flutter pub get
```

OnePub will update the dependency to point to your private version of the package.

We strongly recommend that you run the unit tests of the public package to ensure that the unpublished version isn't broken in some way.

You could also raise a PR against the original package to help the maintainer out.

## Create a CLI toolkit

At OnePub, we use the [DCli console SDK for Dart](https://dcli.onepub.dev/) to automate our development and production environments.

Using OnePub we publish the CLI apps we build with DCli to our private OnePub repository.

Now any of out team can install our CLI tooling with a single command:

```
onepub pub global activate <name of cli tool>

```

Building and deploying CLI tooling with DCli and OnePub is easy:

```
dart pub global activate dcli
dcli install
dcli create --template=full mycliapp
```

The `dcli create` command creates a sample CLI app which you can modify to do something useful.

A single Dart project can contain multiple CLI apps.

To publish your CLI project add an [executables](https://dart.dev/tools/pub/pubspec#executables) section to your pubspec.yaml, listing each dart script in your project's bin directory.

Now publish your project to OnePub

```
onepub pub private
dart pub publish
```

Now any of you team can activate your CLI tooling via:

```
dart pub global activate onepub
onepub login
onpub pub global activatate mycliapp
```

The global activate adds the Dart libraries listed in your pubspec.yaml's exectuables section to the PATH.

If you mycliapp package has a library called bin/start\_mysql.dart then you can now run the script by typing:

```
start_mysql

```


# Data Retention Policy

See our [Terms and Conditions](https://onepub.dev/Terms) for details.


# Payments

## **Upgrading**

* Upgrades are effective immediately.
* When upgrading to a new plan, the full amount for the selected renewal period is due immediately, minus any remaining balance from the current plan.
* The renewal period will start from the current date.
* A payment is taken as part of the upgrade process.

Any change to the plan that results in a higher calculated cost is considered an upgrade.

## Downgrading

* Downgrades take effect at the end of the current billing cycle.

Any change to the plan that results in a lower calculated cost is considered a downgrade.

## Manual Payments

* You may make a manual payment 4 days prior to the expiry of your plan to ensure continuity of your plan.
* When performing a manual payment you may either use an existing payment method or create a new one.

## Automatic Renewal

* 4 days prior to renewal a reminder email will be sent.
* Payment will be automatically deducted on the last day of the billing cycle.


