cycling_adaptive (1.3.0)
Installation
dart pub add cycling_adaptive:1.3.0 --hosted-url=About this package
Dart.Package.Cycling.Adaptive
Template for creating Dart packages, published to this account's Pub feed.
Quick Start
-
On Forgejo, create a new repository and pick this repo (
Dart.Package.Template) as the Repository Template, with Git Content (Default Branch) checked — that's what runs the placeholder substitution below. -
Name the new repo following the
Dart.Package.<Name>convention. EveryDart.Package.Cycling.Adaptiveplaceholder in this template — currently just the README — gets replaced with that exact name on creation. -
Rename
package_nameto your real package name (lowercase_with_underscores, e.g.my_package) and update the places that still saypackage_name:pubspec.yaml— thenamefield (the Pub package name)lib/package_name.dart— rename the file (this is the package's public entrypoint, imported aspackage:my_package/my_package.dart)lib/src/package_name_base.dart— rename the file, and theexportin the file abovetest/package_name_test.dart— rename the file and itsimport 'package:package_name/package_name.dart'example/example.dart'simport 'package:package_name/package_name.dart'.forgejo/workflows/cleanup.yml'spackage-name:input
This has to be manual —
Dart.Package.Cycling.Adaptiveis a dotted name (Dart.Package.Foo), which isn't a legal Pub package name or Dart library identifier, so there's no placeholder substitution that can turn it into the right identifier automatically. -
Write the actual library under
lib/— the public API inlib/<your_package>.dart(onlyexports, no implementation), everything else underlib/src/(implementation, not meant to be imported directly by consumers — a Pub convention, not enforced by the language). Tests go intest/.example/example.dartis a throwaway script for manually exercising the library — delete it if you don't need it. -
Replace the
TODOs inpubspec.yaml'sdescriptionandlib/<your_package>.dart's doc comment. -
Bump
Version.txtand push tomainto publish (see Versioning below).
If you can't create-from-template
Clone this repo directly, then find-and-replace every literal Dart.Package.Cycling.Adaptive
in README.md with the new repo's name yourself before building.
Project structure
pubspec.yaml package metadata + dependencies
analysis_options.yaml package:lints/recommended.yaml
CHANGELOG.md one entry per published version
LICENSE required by `dart pub publish` - a hard error without one
Version.txt The version to publish, same convention as the other package templates
lib/
├── package_name.dart rename me — public API, only exports
└── src/
└── package_name_base.dart rename me — implementation
test/
└── package_name_test.dart rename me — run with `dart test`
example/
└── example.dart throwaway script — manually exercise the library
lib/src/ for implementation (with only exports in the top-level
lib/<package>.dart) is the standard Pub package layout — it signals to
consumers that anything under src/ isn't part of the public API and can
change without a semver-major bump, the same convention dart create -t package scaffolds by default.
Versioning and publishing
Version.txt is the exact version that gets published — nothing is computed
for you. A push to main publishes it only when that version isn't on the
feed yet; leave it alone and the push just resolves and tests, logs that the
version is already published, and stops there. Bump it (patch for an
ordinary change, minor/major for a feature or a breaking change) whenever
you want a release.
Pushes to any other branch never publish — they only resolves and tests.
pubspec.yaml's version: field starts as a placeholder (0.0.0) — CI
overwrites it with Version.txt's value immediately before publishing.
Don't hand-edit it; it's not the source of truth.
CI
.forgejo/workflows/build.yml installs the Dart SDK, resolves dependencies,
and runs dart test on every push. It also computes the next version,
publishes via dart pub publish, tags the commit v<version>, and creates
a matching Release with a source tarball attached — all via the shared
Platform/Forgejo.Package.Actions/dart-publish
composite action. Re-pushing an already-published version is a no-op (the
"already exists" error from dart pub publish is swallowed rather than
failing the build, mirroring nuget-publish's --skip-duplicate). Also has
a workflow_dispatch trigger, so it can be re-run on demand from the repo's
Actions tab (or the API) without a new commit — e.g. to retry after a
transient failure.
.forgejo/workflows/cleanup.yml runs when a branch is deleted and removes
every Pub package version whose prerelease label matches that branch, via
Platform/Forgejo.Package.Actions/dart-cleanup,
so in-progress/abandoned branches don't leave permanent clutter on the feed.
This only applies to prerelease versions — deleting a branch never touches
anything published from main.
Sends a Pushover notification on publish success/failure — see
dart-publish's own docs in the Forgejo.Package.Actions README.
Needs NUGET_PACKAGES_USER/NUGET_PACKAGES_TOKEN (the same account-wide
PAT every other feed uses — nothing NuGet-specific about it, just named from
where it was first set up) and, optionally,
PUSHOVER_APP_TOKEN/PUSHOVER_USER_KEY — all already set as account-level
Actions secrets, so every repo this account owns picks them up
automatically, no per-repo setup needed.
Note: like Python.Package.Template/Cpp.Package.Template, build.yml's
single step is skipped entirely when running against this template repo
itself (if: github.event.repository.name != 'Dart.Package.Template'), so
pushing straight to this repo's main can never try to publish a package
named package_name to the real feed.
Consuming a published package
From another Dart project, add the Forgejo hosted source once:
dart pub add package_name --hosted-url=https://forge.dajno.com/api/packages/Platform/pub
or add it directly to pubspec.yaml:
dependencies:
package_name:
hosted: https://forge.dajno.com/api/packages/Platform/pub
version: ^1.0.0
Pulling from a private feed needs the same PAT registered locally:
dart pub token add https://forge.dajno.com/api/packages/Platform/pub