feat: reduce number of steps needed to get going for local development (#454)

* feat: reduce number of steps to get going for local development

* fix: set default sync server in SNJS

* chore: keep --force in submodules command
This commit is contained in:
Baptiste Grob
2020-09-02 17:37:50 +02:00
committed by GitHub
parent 6a1c10d3f7
commit 57aa942c91
11 changed files with 449 additions and 25 deletions

View File

@@ -54,12 +54,18 @@ import { isDev } from './utils';
import { Bridge, BrowserBridge } from './services/bridge';
if (__WEB__) {
startApplication(new BrowserBridge());
startApplication(
(window as any)._default_sync_server,
new BrowserBridge()
);
} else {
(window as any).startApplication = startApplication;
}
function startApplication(bridge: Bridge) {
function startApplication(
defaultSyncServerHost: string,
bridge: Bridge
) {
angular.module('app', ['ngSanitize']);
// Config
@@ -67,6 +73,7 @@ function startApplication(bridge: Bridge) {
.module('app')
.config(configRoutes)
.constant('bridge', bridge)
.constant('defaultSyncServerHost', defaultSyncServerHost)
.constant('appVersion', __VERSION__);
// Controllers

View File

@@ -56,6 +56,7 @@ export class WebApplication extends SNApplication {
$timeout: ng.ITimeoutService,
scope: ng.IScope,
onDeinit: (app: WebApplication) => void,
defaultSyncServerHost: string,
bridge: Bridge,
) {
const namespace = '';
@@ -73,6 +74,7 @@ export class WebApplication extends SNApplication {
namespace,
undefined,
undefined,
defaultSyncServerHost
);
this.$compile = $compile;
this.scope = scope;

View File

@@ -29,7 +29,8 @@ export class ApplicationGroup {
$compile: ng.ICompileService,
$rootScope: ng.IRootScopeService,
$timeout: ng.ITimeoutService,
private bridge: Bridge
private defaultSyncServerHost: string,
private bridge: Bridge,
) {
this.$compile = $compile;
this.$timeout = $timeout;
@@ -71,7 +72,8 @@ export class ApplicationGroup {
this.$timeout,
scope,
this.onApplicationDeinit,
this.bridge
this.defaultSyncServerHost,
this.bridge,
);
const appState = new AppState(
this.$rootScope,