JFrog : How to Use Pub Repositories in Artifactory

FROG

If you're one of the growing number of client app developers embracing the Dart programming languageand Flutterand AngularDarttoolkits, we've got some exciting news for you!

JFrog can now welcome Dart developers to the empowerment of Artifactory's robust binaries managementand the ways that it contributes to continuous integration. We've added Pub, the package manager for Dart, to the long list of package types Artifactory supportsfor both local, remote, and virtual repositories.

As the variety of mobile and web platforms grows, more and more client app developers have embraced Dart, Flutter, and AngularDart as a more optimized and versatile alternative to JavaScript for platform-independent coding.

What has Dart got that GitHub ranked it #1 as the fastest growing language in 2019, after a year's 532% usage increase? And how can you use Pub repositories in Artifactory to accelerate your software development lifecycle?

Developed by Google, the Dart programming language is an alternative to JavaScript that is optimized for client development such as web and mobile apps. It's the basis of the open source Flutter toolkit and framework for UI, as well as Angular, which enable developing applications for a variety of platforms (such as Android, iOs, Linux, and Windows) from a single codebase.

The public Pub repositoryis the official package repository for Flutter, Angular, and many other open source packages written for Dart.

Dart has been gaining greater adoption by developers, and rose into the top 10 ranking in Stack Overflow's 2021 developer survey of most loved technologies. GitHub has ranked it as one of the 10 high-demand languagesfor 2022. Flutter has grown significantly since its introduction, with a notable contributor increase in 2021.

With its standards governed by ECMA International, Dart offers these benefits for client-based applications:

When combined with Flutter and/or Angular, Dart enables developers to quickly and reliably produce UI-based apps that can operate across many mobile and web-based platforms.

As a Dart developer, you'll rely on the growing pub.dev package repository for Flutter, Angular, and many other core services.

To help assure uninterrupted speed and consistency of your Dart builds and Flutter or Angular apps across teams, use an Artifactory remote repository to proxy pub.dev.

A remote repository in Artifactory serves as a read-only caching proxy for a repository or registry managed at a remote URL. There will be no difference between the contents of the remote repo and the native source.

When you put this best DevOps practiceto work, you and your team gain:

It's easy to set up a remote repository proxy for pub.dev:

Following this successful setup, all of your Dart dependencies will be resolved from your proxy in Artifactory instead of directly from pub.dev. (See the section below on virtual repositories for an alternative configuration.)

For the Dart packages that you will create and share only within your team or department, you should maintain local Pub repositories in Artifactory. You can create as many as you need, and specify their URLs in your pubspec filefor your dependencies.

For example, a team working on "Project X" might set up and use a local Pub repo:

With Artifactory, you can combine any set of local and/or remote repositories into a virtual repositorythat acts as a single, logical repository that can be accessed through a common URL.

For example, you can maintain separate repositories for Project X, Project Y, and Project Z, but create a virtual repository that can conveniently access all three repos through a single, secure URL. You can also balance convenience with security by creating a virtual repo that includes Projects X and Y, another virtual repo that includes Projects X and Z, and use Artifactory's fine-grained permissionsto control who can access them and how.

You can also combine into a virtual repo any or all of your private Pub repositories with your remote repository for pub.dev, to create a single-access URL for all hosted dependencies. In this case, you would set the PUB_HOSTED_URL environment variable to the virtual Pub repo's URL to make it the default for resolving Dart dependencies.

Since the virtual repo is a distinct URL, you will also need to add your Artifactory access token to the pub tool using dart pub token add for that URL.

For example, to use a pub_virtual virtual repository that combines your pub_local_projectx and pub_remote repositories to resolve all hosted dependencies:

With strategic use of remote, local, and virtual repositories for Pub in Artifactory by Dart developers, you'll be putting to work some of the most important best practices for your SDLC to enable DevOps success. You can ensure consistency across all your Dart developer teams for dependencies and packages, with native Pub, Flutter, and AngularDart support that doesn't get in their way. And you can also govern access across teams with Artifactory's fine-grained permissions system.

Try Artifactory's Pub repositories for yourself and see! You can start putting these methods into practice with a free JFrog cloud account!

Disclaimer

JFrog Ltd. published this content on 16 March 2022 and is solely responsible for the information contained therein. Distributed by Public, unedited and unaltered, on 16 March 2022 16:37:07 UTC.