Skip to content

Instantly share code, notes, and snippets.

@andersevenrud
Last active March 3, 2018 16:24
Show Gist options
  • Save andersevenrud/0741f13610e0d1089fb3d2385c2e21b4 to your computer and use it in GitHub Desktop.
Save andersevenrud/0741f13610e0d1089fb3d2385c2e21b4 to your computer and use it in GitHub Desktop.
OS.js v3 Application Template

OS.js v3 Application Template

This is a WIP bare-bones template for OS.js v3 apps.

Place it in src/packages/MyApplication and the build system will automatically recognice your package.

Then in console OSjs.run('MyApplication')

NOW AVAILABLE AS A PACKAGE: https://github.com/os-js/osjs-example-package

OSjs.make('osjs/packages').register('MyApplication', (core, args, options, metadata) => {
const proc = core.make('osjs/application', {
args,
options,
metadata
});
proc.createWindow({
id: 'MyApplicationWindow',
title: metadata.title.en_EN,
state: {
dimension: {width: 400, height: 400},
position: {left: 700, top: 200}
}
})
.on('destroy', () => proc.destroy())
.render();
return proc;
});
// Blank by default
{
"name": "MyApplication",
"category": null,
"title": {
"en_EN": "My Application"
},
"description": {
"en_EN": "My Application"
},
"files": [
"index.js",
"index.css"
]
}
const path = require('path');
const {
packageWebpackConfiguration,
webpack,
production
} = require('@osjs/cli');
module.exports = (options) => packageWebpackConfiguration(__dirname, options, {
minimize: production,
sourceMap: true,
entry: {
index: [
path.resolve(__dirname, 'index.js'),
path.resolve(__dirname, 'index.scss')
]
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment