"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
const rxjs_1 = require("rxjs");
const lib_1 = require("../../lib");
const socketio_project_linker_server_1 = require("../../lib/project-linker/socketio-project-linker-server");
const DEFAULT_PORT = 8888;
function default_1(_options) {
    return schematics_1.chain([
        (host, context) => {
            let project = lib_1.loadProject(host, context);
            return new rxjs_1.Observable(observer => {
                try {
                    let server = new socketio_project_linker_server_1.SocketIOProjectLinkerServer(project);
                    server.start(_options.port || DEFAULT_PORT);
                }
                catch (err) {
                    observer.error(err);
                }
                // setTimeout(() => {
                //     observer.next(host);
                //     observer.complete();
                // }, 9999999);
            });
        }
    ]);
}
exports.default = default_1;
// function waitingRule(options: any): Rule {
//     return (host: Tree) => {
//         console.info('WAIT RULE')
//         let obs = of(host)
//             .pipe(
//                 delay(10000),
//                 tap(d => {
//                     console.info('WAIT RULE DONE')
//                 })
//             );
//         return obs;
//     };
// }
//# sourceMappingURL=index.js.map