Initial configuration + build tasks

This commit is contained in:
Roman Gotsiy 2015-10-03 11:54:09 +03:00
parent d0bfad60eb
commit 03d43e3bc7
14 changed files with 619 additions and 0 deletions

25
.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
### Linux ###
*~
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
### Node ###
# Logs
logs
*.log
npm-debug.log*
# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules
#jspm
jspm_packages
/dist
/demo/build

117
.jshintrc Normal file
View File

@ -0,0 +1,117 @@
{
"bitwise" : false,
"curly" : false,
"eqeqeq" : true,
"forin" : true,
"immed" : true,
"latedef" : true,
"newcap" : true,
"noarg" : true,
"noempty" : true,
"nonew" : true,
"plusplus" : false,
"quotmark" : "single",
"regexp" : false,
"undef" : true,
"unused" : true,
"strict" : false,
"camelcase" : false,
"trailing" : true,
"indent" : 2,
"maxlen" : 120,
"maxdepth" : 4,
"maxstatements" : 30,
"maxcomplexity" : 5,
"asi" : false,
"boss" : true,
"debug" : true,
"eqnull" : true,
"esnext" : true,
"evil" : true,
"expr" : true,
"funcscope" : false,
"globalstrict" : false,
"iterator" : false,
"lastsemic" : true,
"laxbreak" : false,
"laxcomma" : false,
"loopfunc" : false,
"multistr" : false,
"onecase" : false,
"proto" : false,
"regexdash" : false,
"scripturl" : false,
"smarttabs" : false,
"shadow" : false,
"sub" : false,
"supernew" : false,
"validthis" : false,
"browser" : true,
"couch" : false,
"devel" : true,
"dojo" : false,
"jquery" : true,
"mootools" : false,
"node" : true,
"nonstandard" : false,
"prototypejs" : false,
"rhino" : false,
"wsh" : false,
"nomen" : false,
"onevar" : false,
"passfail" : false,
"white" : false,
"maxerr" : 100,
"globals": {
"_": true,
"queryCss": true,
"SVGInjector": true
},
"predef" : [
"__dirname",
"System",
"element",
"browser",
"require",
"jasmine",
"protractor",
"ptor",
"describe",
"ddescribe",
"xdescribe",
"it",
"iit",
"angular",
"inject",
"xit",
"beforeEach",
"afterEach",
"expect",
"input",
"pause",
"spyOn",
"runs",
"waits",
"waitsFor",
"Benchmark",
"Raphael",
"Backbone",
"Modernizr",
"Handlebars",
"Ext",
"_gaq",
"module",
"exports",
"define",
"$",
"jQuery",
"grunt",
"phantom",
"WebPage",
"by"
]
}

6
build/paths.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
source: 'lib/**/*.js',
sourceEntryPoint: 'lib/index.js',
outputFolder: 'dist/',
demo: 'demo/**/*'
};

28
build/tasks/build.js Normal file
View File

@ -0,0 +1,28 @@
var gulp = require('gulp');
var runSequence = require('run-sequence');
var Builder = require('systemjs-builder');
var path = require('path');
var paths = require('../paths');
gulp.task('build', function (callback) {
return runSequence(
'clean',
['bundle'],
callback
);
});
gulp.task('bundle', function(cb) {
var builder = new Builder('./', 'system.config.js');
builder
.buildStatic(paths.sourceEntryPoint, path.join(paths.outputFolder, 'redoc.full.js'),
{ globalName: 'Redoc' })
.then(function() {
console.log('Bundle complete');
cb();
})
.catch(function(err) {
cb(new Error(err));
});
});

9
build/tasks/clean.js Normal file
View File

@ -0,0 +1,9 @@
var gulp = require('gulp');
var paths = require('../paths');
var del = require('del');
var vinylPaths = require('vinyl-paths');
gulp.task('clean', function () {
return gulp.src([paths.outputFolder])
.pipe(vinylPaths(del));
});

13
build/tasks/serve.js Normal file
View File

@ -0,0 +1,13 @@
var gulp = require('gulp');
var browserSync = require('browser-sync').create('bs');
gulp.task('serve', ['watch'], function (done) {
browserSync.init({
open: false,
notify: false,
port: 9000,
server: {
baseDir: ['./demo', '.']
}
}, done);
});

12
build/tasks/watch.js Normal file
View File

@ -0,0 +1,12 @@
var gulp = require('gulp');
var paths = require('../paths');
var browserSync = require('browser-sync').get('bs');
function changed(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
}
gulp.task('watch', ['build'], function () {
gulp.watch([ paths.source ], [ 'bundle', browserSync.reload ]).on('change', changed);
gulp.watch([ paths.demo ], [ '', browserSync.reload ]).on('change', changed);
});

3
demo/app.js Normal file
View File

@ -0,0 +1,3 @@
console.log("test");
console.log("test2");

20
demo/index.html Normal file
View File

@ -0,0 +1,20 @@
<!-- index.html -->
<html>
<head>
<title>Angular 2 Quickstart</title>
<title>Angular 2 Quickstart</title>
</head>
<body>
<!-- The wrapper component-->
<redoc-test>
Loading...
</redoc-test>
<!-- ReDoc built file with all dependencies included -->
<script src="dist/redoc.full.js"> </script>
<script>
//init redoc
Redoc.init();
</script>
</body>
</html>

1
gulpfile.js Normal file
View File

@ -0,0 +1 @@
require('require-dir')('build/tasks');

View File

@ -0,0 +1,10 @@
import {Component, View} from 'angular2/angular2';
@Component({selector: 'redoc-test'})
@View({template: '<h1>Hello {{ name }}!</h1>'})
// Component controller
export class RedocTest {
constructor() {
this.name = 'ReDoc';
}
}

13
lib/index.js Normal file
View File

@ -0,0 +1,13 @@
import 'zone.js';
import 'reflect-metadata';
import { bootstrap } from 'angular2/angular2';
import { RedocTest } from './RedocTest/redoc-test';
export * from './RedocTest/redoc-test';
export function init() {
bootstrap(RedocTest).then(
() => console.log('ReDoc bootstrapped!'),
error => console.log(error)
);
}

43
package.json Normal file
View File

@ -0,0 +1,43 @@
{
"name": "redoc-proto",
"description": "Prototype of component based Swagger documentation",
"version": "0.0.1",
"scripts": {
"server": "webpack-dev-server --hot --inline --colors --display-error-details --display-cached",
"start": "npm run server",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"Swagger",
"JSON-Schema",
"API",
"documentation",
"Angular 2"
],
"author": "Roman Hotsiy",
"license": "MIT",
"jspm": {
"configFile": "system.config.js",
"dependencies": {
"angular2": "npm:angular2@^2.0.0-alpha.37",
"es6-shim": "github:es-shims/es6-shim@^0.33.6",
"reflect-metadata": "npm:reflect-metadata@^0.1.2",
"zone.js": "npm:zone.js@^0.5.7"
},
"devDependencies": {
"babel": "npm:babel-core@^5.8.24",
"babel-runtime": "npm:babel-runtime@^5.8.24",
"core-js": "npm:core-js@^1.1.4"
}
},
"devDependencies": {
"browser-sync": "^2.9.8",
"del": "^2.0.2",
"gulp": "^3.9.0",
"jspm": "^0.16.11",
"require-dir": "^0.3.0",
"run-sequence": "^1.1.4",
"systemjs-builder": "^0.14.7",
"vinyl-paths": "^2.0.0"
}
}

319
system.config.js Normal file
View File

@ -0,0 +1,319 @@
System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system",
'es7.decorators',
'es7.classProperties'
]
},
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
},
map: {
"angular2": "npm:angular2@2.0.0-alpha.37",
"babel": "npm:babel-core@5.8.25",
"babel-runtime": "npm:babel-runtime@5.8.25",
"core-js": "npm:core-js@1.2.0",
"es6-shim": "github:es-shims/es6-shim@0.33.6",
"reflect-metadata": "npm:reflect-metadata@0.1.2",
"zone.js": "npm:zone.js@0.5.7",
"github:jspm/nodelibs-assert@0.1.0": {
"assert": "npm:assert@1.3.0"
},
"github:jspm/nodelibs-buffer@0.1.0": {
"buffer": "npm:buffer@3.5.0"
},
"github:jspm/nodelibs-constants@0.1.0": {
"constants-browserify": "npm:constants-browserify@0.0.1"
},
"github:jspm/nodelibs-crypto@0.1.0": {
"crypto-browserify": "npm:crypto-browserify@3.10.0"
},
"github:jspm/nodelibs-events@0.1.1": {
"events": "npm:events@1.0.2"
},
"github:jspm/nodelibs-path@0.1.0": {
"path-browserify": "npm:path-browserify@0.0.0"
},
"github:jspm/nodelibs-process@0.1.1": {
"process": "npm:process@0.10.1"
},
"github:jspm/nodelibs-stream@0.1.0": {
"stream-browserify": "npm:stream-browserify@1.0.0"
},
"github:jspm/nodelibs-string_decoder@0.1.0": {
"string_decoder": "npm:string_decoder@0.10.31"
},
"github:jspm/nodelibs-url@0.1.0": {
"url": "npm:url@0.10.3"
},
"github:jspm/nodelibs-util@0.1.0": {
"util": "npm:util@0.10.3"
},
"github:jspm/nodelibs-vm@0.1.0": {
"vm-browserify": "npm:vm-browserify@0.0.4"
},
"npm:angular2@2.0.0-alpha.37": {
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1",
"reflect-metadata": "npm:reflect-metadata@0.1.2",
"rx": "npm:rx@2.5.1",
"url": "github:jspm/nodelibs-url@0.1.0",
"zone.js": "npm:zone.js@0.5.7"
},
"npm:asn1.js@2.2.1": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"bn.js": "npm:bn.js@2.2.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"inherits": "npm:inherits@2.0.1",
"minimalistic-assert": "npm:minimalistic-assert@1.0.0",
"vm": "github:jspm/nodelibs-vm@0.1.0"
},
"npm:assert@1.3.0": {
"util": "npm:util@0.10.3"
},
"npm:babel-runtime@5.8.25": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:browserify-aes@1.0.5": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"buffer-xor": "npm:buffer-xor@1.0.3",
"cipher-base": "npm:cipher-base@1.0.1",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"evp_bytestokey": "npm:evp_bytestokey@1.0.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"inherits": "npm:inherits@2.0.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:browserify-cipher@1.0.0": {
"browserify-aes": "npm:browserify-aes@1.0.5",
"browserify-des": "npm:browserify-des@1.0.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"evp_bytestokey": "npm:evp_bytestokey@1.0.0"
},
"npm:browserify-des@1.0.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"cipher-base": "npm:cipher-base@1.0.1",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"des.js": "npm:des.js@1.0.0",
"inherits": "npm:inherits@2.0.1"
},
"npm:browserify-rsa@2.0.1": {
"bn.js": "npm:bn.js@2.2.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"constants": "github:jspm/nodelibs-constants@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"randombytes": "npm:randombytes@2.0.1"
},
"npm:browserify-sign@3.0.8": {
"bn.js": "npm:bn.js@2.2.0",
"browserify-rsa": "npm:browserify-rsa@2.0.1",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"create-hmac": "npm:create-hmac@1.1.4",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"elliptic": "npm:elliptic@3.1.0",
"inherits": "npm:inherits@2.0.1",
"parse-asn1": "npm:parse-asn1@3.0.2",
"stream": "github:jspm/nodelibs-stream@0.1.0"
},
"npm:buffer-xor@1.0.3": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:buffer@3.5.0": {
"base64-js": "npm:base64-js@0.0.8",
"ieee754": "npm:ieee754@1.1.6",
"is-array": "npm:is-array@1.0.1"
},
"npm:cipher-base@1.0.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"inherits": "npm:inherits@2.0.1",
"stream": "github:jspm/nodelibs-stream@0.1.0",
"string_decoder": "github:jspm/nodelibs-string_decoder@0.1.0"
},
"npm:constants-browserify@0.0.1": {
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:core-js@1.2.0": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:core-util-is@1.0.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:create-ecdh@2.0.1": {
"bn.js": "npm:bn.js@2.2.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"elliptic": "npm:elliptic@3.1.0"
},
"npm:create-hash@1.1.2": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"cipher-base": "npm:cipher-base@1.0.1",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"inherits": "npm:inherits@2.0.1",
"ripemd160": "npm:ripemd160@1.0.1",
"sha.js": "npm:sha.js@2.4.4"
},
"npm:create-hmac@1.1.4": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"inherits": "npm:inherits@2.0.1",
"stream": "github:jspm/nodelibs-stream@0.1.0"
},
"npm:crypto-browserify@3.10.0": {
"browserify-cipher": "npm:browserify-cipher@1.0.0",
"browserify-sign": "npm:browserify-sign@3.0.8",
"create-ecdh": "npm:create-ecdh@2.0.1",
"create-hash": "npm:create-hash@1.1.2",
"create-hmac": "npm:create-hmac@1.1.4",
"diffie-hellman": "npm:diffie-hellman@3.0.2",
"inherits": "npm:inherits@2.0.1",
"pbkdf2": "npm:pbkdf2@3.0.4",
"public-encrypt": "npm:public-encrypt@2.0.1",
"randombytes": "npm:randombytes@2.0.1"
},
"npm:des.js@1.0.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"inherits": "npm:inherits@2.0.1",
"minimalistic-assert": "npm:minimalistic-assert@1.0.0"
},
"npm:diffie-hellman@3.0.2": {
"bn.js": "npm:bn.js@2.2.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"miller-rabin": "npm:miller-rabin@2.0.1",
"randombytes": "npm:randombytes@2.0.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:elliptic@3.1.0": {
"bn.js": "npm:bn.js@2.2.0",
"brorand": "npm:brorand@1.0.5",
"hash.js": "npm:hash.js@1.0.3",
"inherits": "npm:inherits@2.0.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:es6-promise@3.0.2": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:evp_bytestokey@1.0.0": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0"
},
"npm:hash.js@1.0.3": {
"inherits": "npm:inherits@2.0.1"
},
"npm:inherits@2.0.1": {
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:miller-rabin@2.0.1": {
"bn.js": "npm:bn.js@2.2.0",
"brorand": "npm:brorand@1.0.5"
},
"npm:parse-asn1@3.0.2": {
"asn1.js": "npm:asn1.js@2.2.1",
"browserify-aes": "npm:browserify-aes@1.0.5",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"evp_bytestokey": "npm:evp_bytestokey@1.0.0",
"pbkdf2": "npm:pbkdf2@3.0.4",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:path-browserify@0.0.0": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:pbkdf2@3.0.4": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"child_process": "github:jspm/nodelibs-child_process@0.1.0",
"create-hmac": "npm:create-hmac@1.1.4",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:public-encrypt@2.0.1": {
"bn.js": "npm:bn.js@2.2.0",
"browserify-rsa": "npm:browserify-rsa@2.0.1",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"create-hash": "npm:create-hash@1.1.2",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"parse-asn1": "npm:parse-asn1@3.0.2",
"randombytes": "npm:randombytes@2.0.1"
},
"npm:punycode@1.3.2": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:randombytes@2.0.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:readable-stream@1.1.13": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"core-util-is": "npm:core-util-is@1.0.1",
"events": "github:jspm/nodelibs-events@0.1.1",
"inherits": "npm:inherits@2.0.1",
"isarray": "npm:isarray@0.0.1",
"process": "github:jspm/nodelibs-process@0.1.1",
"stream-browserify": "npm:stream-browserify@1.0.0",
"string_decoder": "npm:string_decoder@0.10.31"
},
"npm:reflect-metadata@0.1.2": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:ripemd160@1.0.1": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:rx@2.5.1": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:sha.js@2.4.4": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:stream-browserify@1.0.0": {
"events": "github:jspm/nodelibs-events@0.1.1",
"inherits": "npm:inherits@2.0.1",
"readable-stream": "npm:readable-stream@1.1.13"
},
"npm:string_decoder@0.10.31": {
"buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:url@0.10.3": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"punycode": "npm:punycode@1.3.2",
"querystring": "npm:querystring@0.2.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:util@0.10.3": {
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:vm-browserify@0.0.4": {
"indexof": "npm:indexof@0.0.1"
},
"npm:zone.js@0.5.7": {
"es6-promise": "npm:es6-promise@3.0.2",
"process": "github:jspm/nodelibs-process@0.1.1"
}
}
});