Package and Publish Your Standards

Examples for:
Gradle + Kotlin Maven + Java

Now that you’ve created reusable configuration components, let’s package them so they can be shared across projects and teams. This tutorial shows how to publish your ScheduledGreeting workflow and StandardRepoFiles as a versioned Typeflows package by structuring them for distribution, configuring build files for publishing, and making them available through artifact repositories.

Prerequisites

  • Completion of the Writing Reusable Configuration tutorial
  • Familiarity with your language’s package manager (Gradle/Maven)
  • Access to an artifact repository (GitHub Packages, Maven Central, or local repository)

Step 1: Prepare Your Package

First, let’s move your configurations from the Typeflows export structure into a standard library structure. This transforms them from something that generates files for this repository into a reusable library that other repositories can consume:

Better Experience in Landscape Mode

The code examples look much better when viewed horizontally. Please rotate your device for the best experience!

Or view on a larger screen to see the code!

Additionally, let’s add a StandardRepoFiles configuration that packages common repository files that we don’t want to represent as code:

Better Experience in Landscape Mode

The code examples look much better when viewed horizontally. Please rotate your device for the best experience!

Or view on a larger screen to see the code!

And the corresponding resource file that will be packaged:

Better Experience in Landscape Mode

The code examples look much better when viewed horizontally. Please rotate your device for the best experience!

Or view on a larger screen to see the code!

Notice the structural changes:

From Typeflows Export Structure to Standard Package Structure: We’re moving from the Typeflows-specific layout to the standard package structure for your language, following its established conventions for publishable libraries.

Key Aspects:

  1. Standard Package Layout: Using your language’s conventions for publishable libraries
  2. Package Namespace: The configurations use a clear namespace following your language’s conventions, making it clear where the code comes from when others import it
  3. Builder Pattern: Both ScheduledGreeting and StandardRepoFiles implement Builder<T>, which is the standard pattern for creating reusable Typeflows components
  4. Resource Packaging: TypeflowsResources packages files from the associated resource directory into your configuration library

The Builder pattern is crucial because it allows other Typeflows repositories to instantiate your configurations with different parameters while maintaining type safety.

Why the Builder Pattern?

Typeflows treats configurations as data. Your ScheduledGreeting doesn’t become a workflow - it produces workflow data.

This separation means:

  • Builders contain logic and parameters
  • Configurations are pure data structures
  • One builder creates many configuration variations
  • Resources are packaged as reusable file collections

This is the “Typeflows Way” - your classes are factories that build configurations, not configurations themselves.

Step 2: Configure Publishing

Next, add build configuration to make your package publishable. This includes metadata like name, version, and dependencies:

Better Experience in Landscape Mode

The code examples look much better when viewed horizontally. Please rotate your device for the best experience!

Or view on a larger screen to see the code!

Key points in the configuration:

  • Package Coordinates: The unique identifier for your package in the repository
  • Version: Start with 1.0.0 following semantic versioning
  • Typeflows Dependency: Your package depends on Typeflows core libraries
  • Publishing Configuration: Specifies where to publish and with what credentials

Step 3: Build and Publish

Now you can build and publish your package:

Better Experience in Landscape Mode

The code examples look much better when viewed horizontally. Please rotate your device for the best experience!

Or view on a larger screen to see the code!

The build process creates a package artifact containing your ScheduledGreeting class, StandardRepoFiles class, and the packaged resource files, and the publish step uploads it to your configured repository.

Conclusion

Your ScheduledGreeting and StandardRepoFiles are now shareable packages, demonstrating the “Share” phase of the Typeflows Cycle.

Key capabilities of your package:

  • Type-safe instantiation via Builder pattern
  • Resource packaging for reusable file collections
  • Semantic versioning for controlled updates
  • Standard dependency management