initial
This commit is contained in:
commit
0352a8ce21
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
node_modules/
|
||||||
|
pages/
|
||||||
|
public/
|
3
coverage/coverage-final.json
Normal file
3
coverage/coverage-final.json
Normal file
File diff suppressed because one or more lines are too long
88
coverage/lcov.info
Normal file
88
coverage/lcov.info
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
TN:
|
||||||
|
SF:/Users/philkunz/gitlab/pushrocks/smartbrowser/dist/index.js
|
||||||
|
FN:3,(anonymous_1)
|
||||||
|
FN:3,defineProperties
|
||||||
|
FN:3,(anonymous_3)
|
||||||
|
FN:5,_classCallCheck
|
||||||
|
FN:12,(anonymous_5)
|
||||||
|
FN:13,Smartbrowser
|
||||||
|
FN:31,start
|
||||||
|
FN:36,(anonymous_8)
|
||||||
|
FN:40,(anonymous_9)
|
||||||
|
FN:47,(anonymous_10)
|
||||||
|
FN:59,stop
|
||||||
|
FNF:11
|
||||||
|
FNH:10
|
||||||
|
FNDA:1,(anonymous_1)
|
||||||
|
FNDA:1,defineProperties
|
||||||
|
FNDA:1,(anonymous_3)
|
||||||
|
FNDA:1,_classCallCheck
|
||||||
|
FNDA:1,(anonymous_5)
|
||||||
|
FNDA:1,Smartbrowser
|
||||||
|
FNDA:1,start
|
||||||
|
FNDA:1,(anonymous_8)
|
||||||
|
FNDA:1,(anonymous_9)
|
||||||
|
FNDA:0,(anonymous_10)
|
||||||
|
FNDA:1,stop
|
||||||
|
DA:3,2
|
||||||
|
DA:5,1
|
||||||
|
DA:7,1
|
||||||
|
DA:12,1
|
||||||
|
DA:13,1
|
||||||
|
DA:14,1
|
||||||
|
DA:16,1
|
||||||
|
DA:17,1
|
||||||
|
DA:20,1
|
||||||
|
DA:21,1
|
||||||
|
DA:22,1
|
||||||
|
DA:29,1
|
||||||
|
DA:32,1
|
||||||
|
DA:34,1
|
||||||
|
DA:35,1
|
||||||
|
DA:36,1
|
||||||
|
DA:37,1
|
||||||
|
DA:38,1
|
||||||
|
DA:39,1
|
||||||
|
DA:40,1
|
||||||
|
DA:41,1
|
||||||
|
DA:42,1
|
||||||
|
DA:43,1
|
||||||
|
DA:47,0
|
||||||
|
DA:48,0
|
||||||
|
DA:51,1
|
||||||
|
DA:60,1
|
||||||
|
DA:61,1
|
||||||
|
DA:62,1
|
||||||
|
DA:63,1
|
||||||
|
DA:64,1
|
||||||
|
DA:68,1
|
||||||
|
DA:71,1
|
||||||
|
LF:33
|
||||||
|
LH:31
|
||||||
|
BRDA:3,1,0,2
|
||||||
|
BRDA:3,1,1,2
|
||||||
|
BRDA:3,2,0,2
|
||||||
|
BRDA:3,2,1,0
|
||||||
|
BRDA:3,3,0,1
|
||||||
|
BRDA:3,3,1,0
|
||||||
|
BRDA:3,4,0,0
|
||||||
|
BRDA:3,4,1,1
|
||||||
|
BRDA:5,5,0,0
|
||||||
|
BRDA:5,5,1,1
|
||||||
|
BRDA:35,6,0,1
|
||||||
|
BRDA:35,6,1,0
|
||||||
|
BRF:12
|
||||||
|
BRH:7
|
||||||
|
end_of_record
|
||||||
|
TN:
|
||||||
|
SF:/Users/philkunz/gitlab/pushrocks/smartbrowser/dist/smartbrowser.plugins.js
|
||||||
|
FNF:0
|
||||||
|
FNH:0
|
||||||
|
DA:3,1
|
||||||
|
DA:4,1
|
||||||
|
DA:5,1
|
||||||
|
LF:3
|
||||||
|
LH:3
|
||||||
|
BRF:0
|
||||||
|
BRH:0
|
||||||
|
end_of_record
|
32
dist/index.d.ts
vendored
Normal file
32
dist/index.d.ts
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/// <reference types="browser-sync" />
|
||||||
|
/// <reference types="q" />
|
||||||
|
import * as plugins from './smartbrowser.plugins';
|
||||||
|
/**
|
||||||
|
* the options interface of a Smartbrowser instance
|
||||||
|
*/
|
||||||
|
export interface ISmartbrowserOptions {
|
||||||
|
webroot: string;
|
||||||
|
watchFiles: string[];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Type of status that a bsInstance can have
|
||||||
|
*/
|
||||||
|
export declare type bsStatus = 'idle' | 'starting' | 'running';
|
||||||
|
/**
|
||||||
|
* class smartbrowser controls a browser-sync instance for you
|
||||||
|
*/
|
||||||
|
export declare class Smartbrowser {
|
||||||
|
bsInstance: plugins.browserSync.BrowserSyncInstance;
|
||||||
|
bsConfig: plugins.browserSync.Options;
|
||||||
|
bsStatus: bsStatus;
|
||||||
|
bsStarted: plugins.q.Promise<void>;
|
||||||
|
constructor(optionsArg: ISmartbrowserOptions);
|
||||||
|
/**
|
||||||
|
* starts the server and returns the browserSync instance in a resolved Promise
|
||||||
|
*/
|
||||||
|
start(): plugins.q.Promise<plugins.browserSync.BrowserSyncInstance>;
|
||||||
|
/**
|
||||||
|
* stops the smartbrowser instance
|
||||||
|
*/
|
||||||
|
stop(): plugins.q.Promise<void>;
|
||||||
|
}
|
48
dist/index.js
vendored
Normal file
48
dist/index.js
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
"use strict";
|
||||||
|
const plugins = require("./smartbrowser.plugins");
|
||||||
|
/**
|
||||||
|
* class smartbrowser controls a browser-sync instance for you
|
||||||
|
*/
|
||||||
|
class Smartbrowser {
|
||||||
|
constructor(optionsArg) {
|
||||||
|
this.bsInstance = plugins.browserSync.create();
|
||||||
|
this.bsConfig = {
|
||||||
|
server: {}
|
||||||
|
};
|
||||||
|
this.bsStatus = 'idle';
|
||||||
|
this.bsConfig.server.baseDir = optionsArg.webroot;
|
||||||
|
this.bsConfig.files = optionsArg.watchFiles;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* starts the server and returns the browserSync instance in a resolved Promise
|
||||||
|
*/
|
||||||
|
start() {
|
||||||
|
let done = plugins.q.defer();
|
||||||
|
if (this.bsStatus === 'idle') {
|
||||||
|
this.bsStatus = 'starting';
|
||||||
|
let localDone = plugins.q.defer();
|
||||||
|
this.bsStarted = localDone.promise;
|
||||||
|
this.bsInstance.init(this.bsConfig, () => {
|
||||||
|
this.bsStatus = 'running';
|
||||||
|
localDone.resolve();
|
||||||
|
done.resolve(this.bsInstance);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.bsStarted.then(() => { done.resolve(this.bsInstance); });
|
||||||
|
}
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* stops the smartbrowser instance
|
||||||
|
*/
|
||||||
|
stop() {
|
||||||
|
let done = plugins.q.defer();
|
||||||
|
this.bsInstance.exit();
|
||||||
|
this.bsStatus = 'idle';
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Smartbrowser = Smartbrowser;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsa0RBQWlEO0FBZ0JqRDs7R0FFRztBQUNIO0lBT0ksWUFBWSxVQUFnQztRQU41QyxlQUFVLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxNQUFNLEVBQUUsQ0FBQTtRQUN6QyxhQUFRLEdBQWdDO1lBQ3BDLE1BQU0sRUFBRSxFQUFFO1NBQ2IsQ0FBQTtRQUNELGFBQVEsR0FBYSxNQUFNLENBQUE7UUFHdkIsSUFBSSxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsT0FBTyxHQUFHLFVBQVUsQ0FBQyxPQUFPLENBQUE7UUFDakQsSUFBSSxDQUFDLFFBQVEsQ0FBQyxLQUFLLEdBQUcsVUFBVSxDQUFDLFVBQVUsQ0FBQTtJQUMvQyxDQUFDO0lBRUQ7O09BRUc7SUFDSCxLQUFLO1FBQ0QsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQTJDLENBQUE7UUFDck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sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0lBQ3ZCLENBQUM7Q0FDSjtBQTFDRCxvQ0EwQ0MifQ==
|
3
dist/smartbrowser.plugins.d.ts
vendored
Normal file
3
dist/smartbrowser.plugins.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import 'typings-global';
|
||||||
|
export import browserSync = require('browser-sync');
|
||||||
|
export import q = require('q');
|
5
dist/smartbrowser.plugins.js
vendored
Normal file
5
dist/smartbrowser.plugins.js
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
"use strict";
|
||||||
|
require("typings-global");
|
||||||
|
exports.browserSync = require("browser-sync");
|
||||||
|
exports.q = require("q");
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRicm93c2VyLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGJyb3dzZXIucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLDhDQUFtRDtBQUNuRCx5QkFBOEIifQ==
|
33
package.json
Normal file
33
package.json
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "smartbrowser",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "wraps browser-sync",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"typings": "dist/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"test": "(npmts)"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+ssh://git@gitlab.com/pushrocks/smartbrowser.git"
|
||||||
|
},
|
||||||
|
"author": "Lossless GmbH",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://gitlab.com/pushrocks/smartbrowser/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://gitlab.com/pushrocks/smartbrowser#README",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/browser-sync": "0.0.32",
|
||||||
|
"@types/q": "0.0.30",
|
||||||
|
"browser-sync": "^2.16.0",
|
||||||
|
"q": "^1.4.1",
|
||||||
|
"typings-global": "^1.0.14"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/should": "^8.1.29",
|
||||||
|
"npmts-g": "^5.2.8",
|
||||||
|
"should": "^11.1.0",
|
||||||
|
"typings-test": "^1.0.3"
|
||||||
|
}
|
||||||
|
}
|
1
test/test.d.ts
vendored
Normal file
1
test/test.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
import 'typings-test';
|
33
test/test.js
Normal file
33
test/test.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
"use strict";
|
||||||
|
require("typings-test");
|
||||||
|
const should = require("should");
|
||||||
|
const smartbrowser = require("../dist/index");
|
||||||
|
let testSmartBrowser;
|
||||||
|
describe('smartbrowser', () => {
|
||||||
|
it('should instanstiate a new browser ', function () {
|
||||||
|
testSmartBrowser = new smartbrowser.Smartbrowser({
|
||||||
|
webroot: './test/assets/',
|
||||||
|
watchFiles: ['./test/assets/']
|
||||||
|
});
|
||||||
|
should(testSmartBrowser).be.instanceof(smartbrowser.Smartbrowser);
|
||||||
|
});
|
||||||
|
it('should start the browser ', function (done) {
|
||||||
|
testSmartBrowser.start().then((bsInstance) => {
|
||||||
|
done();
|
||||||
|
}).catch((err) => { console.log(err); });
|
||||||
|
});
|
||||||
|
it('should stop the browser ', function (done) {
|
||||||
|
this.timeout(10000);
|
||||||
|
setTimeout(() => {
|
||||||
|
testSmartBrowser.stop().then(() => {
|
||||||
|
done();
|
||||||
|
}).catch((err) => { console.log(err); });
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
it('should exit correctly', function () {
|
||||||
|
setTimeout(() => {
|
||||||
|
process.exit(0);
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=data: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Q0FBQztnQkFDekIsSUFBSSxFQUFFLENBQUE7WUFDVixDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxHQUFHLE9BQU8sT0FBTyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQSxDQUFDLENBQUMsQ0FBQyxDQUFBO1FBQzNDLENBQUMsRUFBRSxJQUFJLENBQUMsQ0FBQTtJQUNaLENBQUMsQ0FBQyxDQUFBO0lBQ0YsRUFBRSxDQUFDLHVCQUF1QixFQUFDO1FBQ3ZCLFVBQVUsQ0FBQztZQUNQLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUE7UUFDbkIsQ0FBQyxFQUFDLElBQUksQ0FBQyxDQUFBO0lBQ1gsQ0FBQyxDQUFDLENBQUE7QUFDTixDQUFDLENBQUMsQ0FBQSJ9
|
34
test/test.ts
Normal file
34
test/test.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import 'typings-test'
|
||||||
|
import * as should from 'should'
|
||||||
|
|
||||||
|
import * as smartbrowser from '../dist/index'
|
||||||
|
|
||||||
|
let testSmartBrowser: smartbrowser.Smartbrowser
|
||||||
|
|
||||||
|
describe('smartbrowser', () => {
|
||||||
|
it('should instanstiate a new browser ', function () {
|
||||||
|
testSmartBrowser = new smartbrowser.Smartbrowser({
|
||||||
|
webroot: './test/assets/',
|
||||||
|
watchFiles: ['./test/assets/']
|
||||||
|
})
|
||||||
|
should(testSmartBrowser).be.instanceof(smartbrowser.Smartbrowser)
|
||||||
|
})
|
||||||
|
it('should start the browser ', function (done) {
|
||||||
|
testSmartBrowser.start().then((bsInstance) => {
|
||||||
|
done()
|
||||||
|
}).catch((err) => { console.log(err) })
|
||||||
|
})
|
||||||
|
it('should stop the browser ', function (done) {
|
||||||
|
this.timeout(10000)
|
||||||
|
setTimeout(() => {
|
||||||
|
testSmartBrowser.stop().then(() => {
|
||||||
|
done()
|
||||||
|
}).catch((err) => { console.log(err) })
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
|
it('should exit correctly',function(){
|
||||||
|
setTimeout(() => {
|
||||||
|
process.exit(0)
|
||||||
|
},2000)
|
||||||
|
})
|
||||||
|
})
|
62
ts/index.ts
Normal file
62
ts/index.ts
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import * as plugins from './smartbrowser.plugins'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the options interface of a Smartbrowser instance
|
||||||
|
*/
|
||||||
|
export interface ISmartbrowserOptions {
|
||||||
|
webroot: string
|
||||||
|
watchFiles: string[]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of status that a bsInstance can have
|
||||||
|
*/
|
||||||
|
export type bsStatus = 'idle' | 'starting' | 'running'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class smartbrowser controls a browser-sync instance for you
|
||||||
|
*/
|
||||||
|
export class Smartbrowser {
|
||||||
|
bsInstance = plugins.browserSync.create()
|
||||||
|
bsConfig: plugins.browserSync.Options = {
|
||||||
|
server: {}
|
||||||
|
}
|
||||||
|
bsStatus: bsStatus = 'idle'
|
||||||
|
bsStarted: plugins.q.Promise<void>
|
||||||
|
constructor(optionsArg: ISmartbrowserOptions) {
|
||||||
|
this.bsConfig.server.baseDir = optionsArg.webroot
|
||||||
|
this.bsConfig.files = optionsArg.watchFiles
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* starts the server and returns the browserSync instance in a resolved Promise
|
||||||
|
*/
|
||||||
|
start(): plugins.q.Promise<plugins.browserSync.BrowserSyncInstance> {
|
||||||
|
let done = plugins.q.defer<plugins.browserSync.BrowserSyncInstance>()
|
||||||
|
if (this.bsStatus === 'idle') {
|
||||||
|
this.bsStatus = 'starting'
|
||||||
|
let localDone = plugins.q.defer<void>()
|
||||||
|
this.bsStarted = localDone.promise
|
||||||
|
this.bsInstance.init(this.bsConfig, () => {
|
||||||
|
this.bsStatus = 'running'
|
||||||
|
localDone.resolve()
|
||||||
|
done.resolve(this.bsInstance)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.bsStarted.then( () => { done.resolve(this.bsInstance) })
|
||||||
|
}
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stops the smartbrowser instance
|
||||||
|
*/
|
||||||
|
stop(): plugins.q.Promise<void> {
|
||||||
|
let done = plugins.q.defer<void>()
|
||||||
|
this.bsInstance.exit()
|
||||||
|
this.bsStatus = 'idle'
|
||||||
|
done.resolve()
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
}
|
3
ts/smartbrowser.plugins.ts
Normal file
3
ts/smartbrowser.plugins.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import 'typings-global'
|
||||||
|
export import browserSync = require('browser-sync')
|
||||||
|
export import q = require('q')
|
3
tslint.json
Normal file
3
tslint.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tslint-config-standard"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user