Skip to content

Commit

Permalink
Release v0.0.2 of the QPM package
Browse files Browse the repository at this point in the history
- Automatically publish with a script
- Update the README
- Properly namespace the resources file
- Remove unused files
  • Loading branch information
iBelieve committed Mar 19, 2016
1 parent aaa7105 commit f851a28
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 61 deletions.
70 changes: 33 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,55 @@
Quickly
=======

Quickly is a build tool and QML module with provides an NodeJS-like ES6 environment for Javascript used in QML. The goal of the project is to allow you to write awesome modern ES6 Javascript taking advantage of classes, decorators, arrow functions, and best of all, many of the vast array of NPM packages available using the standard ES6 module imports. You can then take that code and use in directly from QML, just as you would with plain, old, QML-specific Javascript. You can even build a library using ES6 and NPM packages, and then distribute that as a standard QML module or QPM package for other developers to use in regular QML or QML-specific Javascript.
Quickly is a QML/JS library offering additional classes and methods that are part of the ES6 JS spec that QML's JS framework does not have. In addition, it offers several of the core modules that Node.js has.

For those who would prefer to stick with standard QML-specific Javascript, you can also do that and still use the Quickly library, which gives you promises, the fetch API, and many polyfills. This is great for longtime QML developers or existing projects that just want to drop in some easy-to-use features from modern JS core libraries.
The Quickly library is designed to be used with [QMLify](https://www.npmjs.com/package/qmlify) to offer a Node.js-like ES6 environment for Javascript used in QML. However, in can be used by itself to add the additional classes, methods, and core modules to a QML project.

Check out the [documentation](http://quickly.readthedocs.org/en/latest/) for more details, usage, and API documentation.

### Examples
### Installation

Write modern ES6 like this:
Install using qpm:

import * as url from 'url' // Use core Node modules
qpm install com.sonrisesoftware.quickly

const data = url.parse('http://www.google.com')
### Usage

// Use the Promise polyfill
Here are some sample uses:

const promise = new Promise((resolve, reject) => {
resolve('Why again did we need a promise here?')
})

// Use the Array.prototype.includes() poylfill

const array = ['A', 'B', 'C']
console.log(array.includes('B'))

// Use ES6 classes

export class Document {
title = ''
body = ''

constructor(title, body) {
this.title = title
this.body = body
}
}

And compile that into JS that QML understands:

import "file.js" as JS
import QtQuick 2.4
import Quickly 0.1

Item {
Component.onCompleted: {
var doc = new JS.Document('Hello, World', 'Contents')
var set = new Polyfills.Set()
set.add(4)
set.add(2)
set.add(4)
console.log(set.size) // Prints 2

var promise = new Promise.Promise(function(resolve, reject) {
resolve("Why again did we need a promise here?")
}).then(function(result) {
console.log(result)
})

Http.fetch('http://www.google.com')
.then(function(response) {
return response.text()
}).then(function(text) {
console.log(text)
})

var url = Url.parse('http://www.google.com')
}
}

### Licensing

**QMLify**
### Acknowledgements

QMLify is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
* The `url` module is from https://github.com/defunctzombie/node-url
* The polyfills are from https://github.com/aurelia/polyfills, https://github.com/github/fetch, and https://github.com/stefanpenner/es6-promise

**Quickly core modules**
### Licensing

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
78 changes: 78 additions & 0 deletions dependencies/aurelia-pal/dist/commonjs/aurelia-pal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.pragma library

var __filename = Qt.resolvedUrl('aurelia-pal.js').substring(7);
var __dirname = __filename.substring(0, __filename.lastIndexOf('/'));

var module = { exports: {} };
var exports = module.exports;
var global = {};

function require(qualifier) {
return qualifier.module ? qualifier.module.exports : qualifier;
}

'use strict';

exports.__esModule = true;
exports.AggregateError = AggregateError;
exports.initializePAL = initializePAL;

function AggregateError(message, innerError, skipIfAlreadyAggregate) {
if (innerError) {
if (innerError.innerError && skipIfAlreadyAggregate) {
return innerError;
}

if (innerError.stack) {
message += '\n------------------------------------------------\ninner error: ' + innerError.stack;
}
}

var e = new Error(message);
if (innerError) {
e.innerError = innerError;
}

return e;
}

var FEATURE = {};

exports.FEATURE = FEATURE;
var PLATFORM = {
noop: function noop() {},
eachModule: function eachModule() {}
};

exports.PLATFORM = PLATFORM;
PLATFORM.global = (function () {
if (typeof self !== 'undefined') {
return self;
}

if (typeof global !== 'undefined') {
return global;
}

return new Function('return this')();
})();

var DOM = {};

exports.DOM = DOM;

function initializePAL(callback) {
if (typeof Object.getPropertyDescriptor !== 'function') {
Object.getPropertyDescriptor = function (subject, name) {
var pd = Object.getOwnPropertyDescriptor(subject, name);
var proto = Object.getPrototypeOf(subject);
while (typeof pd === 'undefined' && proto !== null) {
pd = Object.getOwnPropertyDescriptor(proto, name);
proto = Object.getPrototypeOf(proto);
}
return pd;
};
}

callback(PLATFORM, FEATURE, DOM);
}
20 changes: 0 additions & 20 deletions polyfills/fetch.js

This file was deleted.

2 changes: 1 addition & 1 deletion qpm.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "git@github.com:iBeliever/quickly.git"
},
"version": {
"label": "0.0.1",
"label": "0.0.2",
"revision": "",
"fingerprint": ""
},
Expand Down
2 changes: 1 addition & 1 deletion quickly.pri
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

RESOURCES += \
$$PWD/quickly.qrc
$$PWD/resources.qrc
4 changes: 2 additions & 2 deletions quickly.qrc → resources.qrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!DOCTYPE RCC>
<RCC version="1.0">

<qresource>
<qresource prefix="/Quickly">
<file>dependencies/aurelia-pal/dist/commonjs/aurelia-pal.js</file>
<file>dependencies/aurelia-polyfills/src/array.js</file>
<file>dependencies/aurelia-polyfills/src/collections.js</file>
<file>dependencies/aurelia-polyfills/src/number.js</file>
Expand All @@ -19,7 +20,6 @@
<file>dependencies/whatwg-fetch/fetch.js</file>
<file>nodejs/url.js</file>
<file>polyfills/Timeout.qml</file>
<file>polyfills/fetch.js</file>
<file>polyfills/http.js</file>
<file>polyfills/index.js</file>
<file>polyfills/promise.js</file>
Expand Down

0 comments on commit f851a28

Please sign in to comment.