Log In

Blog

Sharing and Versioning in Simpl.js

posted February 28, 2016, by Klaus

Becoming a member of Simpl.js entitles you to publish to and install apps and modules from the Simpl.js Gallery. This is a powerful feature of the Simpl.js platform, but it requires some attention to namespacing and versioning semantics.

Namespacing

Apps and modules from other users appear as linked entries in your workspace when installed.

namespaced modulesnamespaced dependencies

When importing a linked module as a dependency in your own app or module, you must use its @username-namespaced property name in your code.

var bytes = modules['string@simpljs'].toUTF8Buffer('Hello World');

When using your own modules as dependencies, the namespace will not be present. As long as your module name is a valid javascript identifier, you’ll be able to access it with dot instead of bracket notation:

var bytes = modules.mystring.toUTF8Buffer('Hello World');

Versioning

Simpl.js enforces a simple major-minor versioning scheme. Major versions of an app or module can be developed simultaneously, with minor versions of each representing backward-compatible enhancements.

Linked apps and modules from other users are pegged at their major version number, but are automatically upgraded to their latest minor version. This gives the author of the app or module the ability to push changes to any user who has installed it, and the responsibility to ensure that it remains backward-compatible.

If you want to prevent minor version upgrades from the author, or if you want to make changes to the code yourself, you must fork the app or module. Simply make a change to it in the code editor, save, and you will be prompted to save the entry as your own app or module.

version forking

You won’t need the @username namespace to access your new module from any of your own apps or modules. After forking an app or module, remember also to update the dependency names in its code as appropriate, either removing or adding namespaces to account for the new scope of ownership.