Links

App packages overview

App packages are only supported in TypeScript apps and where the JourneyApps Runtime Build version exceeds 2.0.0.
App packages provide a way to write and maintain reusable code throughout an application while also providing a way to run tests, generate PDFs and create custom <html/> components.
Previously, developers could only bind and maintain a single source file to an <html/> component within OXIDE (by uploading it as an asset). With app packages, developers can maintain large custom HTML projects in OXIDE very easily, thereby improving developer productivity.

Example use cases

  • Custom <html/> components​
  • Offline PDF generation (see below)
  • Libraries with unit tests (see below)
  • Coming soon: Sharing code across CloudCode and views (useful for example, when writing validation logic)

Overview

The high level architecture of app packages is outlined below.
App packages architecture
  1. 1.
    A package is created from a template and source files can now be edited.
  2. 2.
    A developer triggers a deploy which sends all the source code over to the JourneyApps build system.
  3. 3.
    The JourneyApps build system starts building the app, and looks for app packages.
  4. 4.
    For each app package, the JourneyApps build system will execute the build command inside each corresponding package.json > script section.
  5. 5.
    dist directories and other build artifacts are created, but are hidden to the developer.
  6. 6.
    The build artifacts are packaged along with the compiled application and uploaded to the update system.
  7. 7.
    The JourneyApps Runtime downloads the application update along with the compiled package's build artifacts, and they are executed inside your code.
  8. 8.
    Some components such as <html/> component can display build artifacts from an app package such as an index.html file.

Structure of a package

  1. 1.
    packages are defined inside the /packages directory in your application's project files.
  2. 2.
    A package will always contain a single package.json file with:
  3. 3.
    A scripts section that contains a build command.
  4. 4.
    A name that starts with @local such @local/my_package.

Where can I use packages?

The initial release of packages will only be useable from within your app (i.e. the JourneyApps Runtime), but in the near future, packages will also be useable inside CloudCode tasks. This will enable you to write code that can be shared across the app as well as in CloudCode.

Types of package templates

OXIDE by default, ships with 2 package templates, with more being added soon.

Basic TS Package

This template is useful for authoring libraries or writing code which can be run in unit tests. To give this a try, follow this guide.

PDF Report

Use this package to easily create PDF reports that can be dynamically generated from within the app and rendered offline inside an <html> component. To learn more about this template, and to see an example on how to use it, follow this guide.

FAQs

When are app packages built?

Upon deploying your app.

How do packages differ from TypeScript app's modules?

App modules are lightweight ways to share code between views in your app. App packages can also be used to share code, however they also provide a way to run custom build commands upon a “deploy” action, and can also generate assets that can then be used in your app.

How do files within packages differ from app assets?

Static assets which are uploaded directly to the app, are simply copied in when the app is deployed, and accessible when the app runs.
Assets that are copied into packages are not directly accessible unless they go through a compilation step. Some packages such as the ones which use the PDF template as a base, contain a webpack file which compile the assets and make them accessible to the rest of the app.

How can I upgrade the JourneyApps Runtime Build version for my app?

This version can be configured in the app's package.json file. You need to run the Update yarn.lock action in OXIDE after making updates to this file.