commit ae5021b7285671ae9ba1f3c55509826b3b6d0b7f Author: PhilKunz Date: Thu Oct 6 19:28:00 2016 +0200 initial diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..8ae3da1 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,53 @@ +image: hosttoday/ht-docker-node:npmts +stages: +- test +- release +- trigger +- page +testLEGACY: + stage: test + script: + - npmci test legacy + tags: + - docker + allow_failure: true +testLTS: + stage: test + script: + - npmci test lts + tags: + - docker + +testSTABLE: + stage: test + script: + - npmci test stable + tags: + - docker +release: + stage: release + script: + - npmci publish + only: + - tags + tags: + - docker +trigger: + stage: trigger + script: + - npmci trigger + only: + - tags + tags: + - docker +pages: + image: hosttoday/ht-docker-node:npmpage + stage: page + script: + - npmci command npmpage --host gitlab + only: + - tags + artifacts: + expire_in: 1 week + paths: + - public diff --git a/README.md b/README.md new file mode 100644 index 0000000..641cc0f --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# smartsystem +simplifies lazy loading with TypeScript + +## Availabililty +[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartsystem) +[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/smartsystem) +[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartsystem) +[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartsystem/) + +## Status for master +[![build status](https://gitlab.com/pushrocks/smartsystem/badges/master/build.svg)](https://gitlab.com/pushrocks/smartsystem/commits/master) +[![coverage report](https://gitlab.com/pushrocks/smartsystem/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartsystem/commits/master) +[![Dependency Status](https://david-dm.org/pushrocks/smartsystem.svg)](https://david-dm.org/pushrocks/smartsystem) +[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartsystem/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartsystem/master/dependencies/npm) +[![bitHound Code](https://www.bithound.io/github/pushrocks/smartsystem/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartsystem) +[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) +[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) +[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) + +## Usage +We recommend the use of TypeScript for best Intellisense + +```typescript +import {LazyModule, loadNow } from 'smartsystem' + +import * as myPluginType from 'myPlugin' // plugin does not get loaded here at runtime +let myPluginPromised = LazyModule('myPlugin') + +import * as anotherPluginType from 'anotherPlugin' // plugin does not get loaded here at runtime +let anotherPluginPromised = LazyModule('anotherPlugin') + +myPluginPromised.then(myPlugin => { /* do something with myPlugin */ }) +myPlugin.also(anotherPluginPromised).then((m,a) => {}) // also takes multiple other plugins + +loadNow.only('myPlugin') // loads myPlugin and resolved the lazy promise +loadNow.also('myPlugin') // loads myPlugin and any chained 'also' modules +``` \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..bf64ce9 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "smartsystem", + "version": "1.0.0", + "description": "wraps systemjs for smarter workflows", + "main": "dist/index.js", + "scripts": { + "test": "(npmts)" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@gitlab.com/pushrocks/smartsystem.git" + }, + "author": "Lossless GmbH", + "license": "MIT", + "bugs": { + "url": "https://gitlab.com/pushrocks/smartsystem/issues" + }, + "homepage": "https://gitlab.com/pushrocks/smartsystem#README" +} diff --git a/ts/index.ts b/ts/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/ts/smartsystem.plugins.ts b/ts/smartsystem.plugins.ts new file mode 100644 index 0000000..e69de29