Sunday, October 28, 2012

Ready for Dart Pub

‹prev | My Chain | next›

After running through the analysis tool in Dart Editor I am fairly confident that my code is ready for M1 usage. In other words, I think Hipster MVC is ready for Dart Pub, the dart package system.

In the grand tradition of minimum viable products, creating a Dart Pub project is a manual request to the Dart Team. But it requires a few things first:
  1. Conform your packages to the pub package layout.
  2. Ensure you have a valid pubspec.yaml file.
  3. Pick an OSS license and correctly add it to your package. If you don't have one, you can always use Dart's BSD-style license.
  4. Host your source code in a public location so we can retrieve it.
  5. Add dartdocs so people can easily use your libraries.
  6. Update your README to contain a getting started guide.
Currently, the Hipster MVC library has all of the code in the top-level directory:
➜  hipster-mvc git:(master) tree -I docs
.
├── HipsterCollection.dart
├── HipsterHistory.dart
├── HipsterModel.dart
├── HipsterRouter.dart
├── HipsterSync.dart
├── HipsterView.dart
├── main.dart
└── README.asciidoc
To conform to the Dart Pub layout (item #1 in the checklist), I need to move all of that into a lib sub-directory:
➜  hipster-mvc git:(master) mkdir lib
➜  hipster-mvc git:(master) git mv *.dart lib
➜  hipster-mvc git:(master) ✗ git ci -m "Move all code into lib directory" -a
[master 5aa2bac] Move all code into lib directory
 7 files changed, 0 insertions(+), 0 deletions(-)
 rename HipsterCollection.dart => lib/HipsterCollection.dart (100%)
 rename HipsterHistory.dart => lib/HipsterHistory.dart (100%)
 rename HipsterModel.dart => lib/HipsterModel.dart (100%)
 rename HipsterRouter.dart => lib/HipsterRouter.dart (100%)
 rename HipsterSync.dart => lib/HipsterSync.dart (100%)
 rename HipsterView.dart => lib/HipsterView.dart (100%)
 rename main.dart => lib/main.dart (100%)
➜  hipster-mvc git:(master) gp origin master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 563 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:eee-c/hipster-mvc.git
   425979e..5aa2bac  master -> master
For #2, I need a pubspec.yaml. There is not too much to these files, this should suffice:
name: hipster-mvc
version: 0.1.0
description: Dart-based MVC framework
author: Chris Strom 
homepage: https://github.com/eee-c/hipster-mvc
I already have the license information in the README (#3). Since the code has always been on GitHub, it is available (#4). I have dartdocs in the code and make it available in the respository: http://eee-c.github.com/hipster-mvc/ (#5). I add brief getting started instructions to the README (#6), which should take care of everything.

With that, I submit a ticket to get the package manually added to pub.dartlang.org. Fingers crossed!



Day #553

No comments:

Post a Comment