UPDATE: Version bump - 2.1.0


#1

THIS IS JUST A DRAFT AS THIS VERSION HAS NOT YET BEEN RELEASED AND MAY CHANGE.

Hi All,

I’m very excited to bring you this release as it brings a lot of new stuff and changes!

A huge thanks to the community members that tested it out before release and reported bugs! :beers:

To give you a sense of scale of this change (this does not include separate packages):

1265 files changed, 36311 insertions(+), 56103 deletions(-)

Changes

The major change here is the usage of ES6 and Webpack.

The server was also rewritten to use Express.

Some general notes

Webpack can be a bit slow depending on your system. If you’ve got a fairly modern CPU and an SSD, you’ll do just fine. Also, it seems that things are a bit slower on Windows during build, which is out of my control.

Now, I’ve enabled caching and if you run node osjs watch (see help command for more info) while developing this is much less of an issue (incremental builds).

All of the changes bring a lot of flexibility and makes development and extension a lot easier.

Compability

You now need Node 6 or newer.

Deprecation

  • The Simple Application type is no longer supported (aka “prototype-less applications”)
  • The `Fake Package* is no longer supported
  • The global OSjs.* namespaces is no longer supported
  • Removed old Scheme methods
  • Server Extension modules (use middleware and services instead)

Configuration

Some configuration entries was removed or changed in this release.

  • Connections are now defined by connection (root entry) only
  • Overlays now automatically discovered
  • Template configuration now moved to build.template
  • Templates now use .ejs by default
  • Some tasks have changed (see node osjs help or manuals)
  • VFS transports are now discovered. No longer defined in config

Building

Now uses Webpack for everything. This makes things very flexible and simplifies.

Tasks are now handled by Ygor but remain mostly the same.

The entire build system was moved into a separate npm module.

Overlays can now also include configuration files, themes and every other module available to OS.js.

Client

Now written in ES6 (Babel). The global namespaces in window.OSjs was removed as everything is now handled by ES6/Webpack import/export features.

Callbacks were removed entirely in favor of Promise which makes it easy to use (and transition into) await/async features of ES7.

For externals like packages a window.OSjs.require() is provided for you to import core modules.

A backward-compability module is provided, but this is not guaranteed to work 100%.

XHR now handled by axios instead of a custom module.

Server

Now written in ES6 (Node) and uses Express.

This brings a simpler codebase and makes it much easier to implement custom modules. Routes and Middleware now work a lot better as well.

Modules

The http object is no longer passed into methods that do not belong to the HTTP chain. This was a problem in previous version as it required two sets of methods (named “virtual” methods).

Now, all methods that require some sort of user reference gets a User object as an argument instead.

Packages

Now also uses Webpack and ES6 (Babel).

Another change is that the “OS.js GUI Scheme” is now almost entirely detached since it is embedded via Webpack. This means you can really easily remove this and replace it with your own GUI components of choice.

Themes

Moved to src/themes. The layout of fonts have changed and less files now resolved with paths defined in Webpack.

Authenticator/Storage

The Database Authenticator and Storage modules now use separated tables. So instead of just users there is now users, groups, settings.

Other

Some things were removed from, and moved around in the repository (and moved elsewhere):

  • Separated X11 launcher
  • Separated graphics sources
  • Removed Installers
  • Removed dist/vendor
  • Moved src/client/themes to src/themes
  • Removed Broadway. Replaced with https://github.com/os-js/osjs-xpra

Documentation

This also brings new documentation (using esdoc) and manuals.

Migration Guide

Configuration

From

{
  "connection": "foo",
  "server": {
    "http": {
      "mode": "foo"
    }
  },
  "build": {
    "javascript": [],
    "stylesheets": [],
    "locales": [],
    "overlays": {
      "bar": {"these options does not matter anymore"}
    },
    "dist": {
       "template": "default",
       "splash": "default",
       "login": "default",
     }
  }
}

To

{
  "connection": "foo",
  "overlays": [
    "path/to/bar"
  ],
  "build": {
    "template": "default",
    "webpack": {"build files here"}
  }
}

Client

The OSjs.* namespaces has been removed. In the core you can use import, and in packages OSjs.require().

In previous versions, everything was grouped into OSjs.API and OSjs.Utils. These now have their own separate files.

To load a backward-compability layer for these namespaces, use the module src/client/javascript/compability.js.

From

OSjs.API.error()

OSjs.Utils.$position()
OSjs.Utils.$bind()
OSjs.Utils.preload()
new OSjs.Helpers.Date
new OSjs.Core.Window

OSjs.API.createNotification()
OSjs.API.createNotificationIcon()

OSjs.API.getIcon()
OSjs.API.getFileIcon()
OSjs.API.getThemeResource()
OSjs.API.getPackageResource()

OSjs.GUI.createMenu()
OSjs.GUI.blurMenu()
OSjs.API.createDialog()
OSjs.API.launch()
OSjs.API.launchList()
OSjs.API.openFile()
OSjs.API.relaunch()

To

OSjs.error()

import * as DOM from 'utils/dom'; // DOM.$position()
import * as Events from 'utils/events'; // Events.$bind()
import {preload} from 'utils/preloader'; // preload()
import ExtendedDate from 'helpers/date'; // new ExtendedDate
import Window from 'core/window'; // new Window

import Notification from 'core/notification'; // Notification.create()
import Notification from 'core/notification'; // Notification.createIcon()

import Theme from 'core/theme'; // Theme.getIcon()
import Theme from 'core/theme'; // Theme.getFileIcon()
import Theme from 'core/theme'; // Theme.getThemeResource()
import PackageManager from 'core/package-manager'; // PackageManager.getPackageResource()

Menu.create() // gui/menu.js
Menu.blur() // gui/menu.js
Dialog.create() // core/dialog.js
Process.create() // core/process.js
Process.createFromArray() // core/process.js
Process.createFromFile() // core.process.js
Process.reload() // core/process.js

Server

The only changes here is the general layout of the modules and that they now are in ES6 classes.

Middleware now uses Express (with a custom wrapper), so these are the only modules that require a significant change.

Packages

The build entry in themetadata.json file has been removed because resources are automatically resolved.

You can still use the prototype (ES5) style instead of ES for the classes in packages since they are compiled by Babel, but you have refactor to the new OSjs.require() method of using modules (if you do not use the BC layer).

The server/main.js now also expects you to return Promises:

module.exports.api = {
  // Before
  foo: function(env, http, resolve, reject, args) {
    resolve(true);
  },

  // After:
  bar: function(env, http, args) {
    return Promise.resolve(true);
  }
};

From

(function(Window, Application) {

  var SomeWindow = function() {
    // ...
  };
  SomeWindow.prototype...;
  SomeWindow.prototype.someMethod = function() {
    OSjs.Foo.Something.method();
  };

  var SomeApplication = function() {
    // ...
  };
  SomeApplication.prototype...;

 OSjs.Applications.SomeApplication.Class = SomeApplication;
})(OSjs,Core.Window, OSjs.Core.Application);

To

const Window = OSjs.require('core/window');
const Application = OSjs.require('core/application');
const Something = OSjs.require('foo/something');

class SomeWindow extends Window {
  someMethod() {
    Something.method();
  }
}
class SomeApplication extends Application {
  // ...
}

OSjs.Applications.SomeApplication = SomeApplication;

Overlays

See this repository for new layout.

Relevant Links

Digest

  • Core: Rewritten to ES6
  • Core: Callbacks replaced with Promise
  • Core: Now using imports
  • Core: Deprecated all marked methods
  • Core: Removed global namespace (available as BC module)
  • Core: Removed support for “simple” packages
  • Core: Removed support for “dummy” packages
  • Core: Removed support for “old” packages
  • Core: Detached Scheme files from applications
  • Core: Changed in namespaces (code separation)
  • API: Now using axios for XHR
  • API: Now using bluebird for better promises
  • VFS: Removed ‘delete’ operation (use ‘unlink’)
  • GUI: Schemes now embed in bundles if used
  • Packages: Default packages refactored
  • build: Now using Ygor as task system
  • build: Rewritten
  • build: Now using Webpack for themes
  • build: Now using Webpack for packages
  • build: Now using Webpack for core
  • build: Removed grunt entirely
  • build: Split up into separate package
  • build: Changed templating generation
  • build: Simplified configuration capabilities
  • build: Better overlay support
  • server-node: Rewritten to ES6
  • server-node: Now using Express
  • server-node: Changed how modules look
  • server-node: Better module APIs
  • server-node: Better user handling
  • conf: Changed overlay layouts
  • conf: Overlays now support themes
  • conf: Overlays now support configuration includes
  • conf: Changed vfs configuration
  • misc: The Database handler now uses separate tables
  • misc: Added OSjs.require() for externals
  • misc: Moved src/client/themes to src/themes
  • misc: Bugfixes and general cleanups
  • misc: Performance improvements
  • misc: No more ‘dist/vendor’ by default
  • misc: Removed automated installers from repo
  • misc: Separated graphics sources to own repo
  • misc: Separated x11 sources to own repo
  • misc: Separated Broadway (will be replaced with Xpra)
  • misc: Updated documentation
  • misc: Now using esdoc

Road to ES6 (ES2015)
Road to ES6 (ES2015)
#2