From 464566a94a8673cb18500244355653ecf24e5b1f Mon Sep 17 00:00:00 2001 From: tenretC Date: Mon, 26 Mar 2018 10:54:21 +0200 Subject: [PATCH] feat(http): correction for imports --- packages/stark-build/tsconfig.json | 1 + packages/stark-core/package.json | 4 +- packages/stark-core/src/http/http.module.ts | 2 +- .../logging/entities/log-message.entity.ts | 2 +- .../logging/reducers/logging.reducer.spec.ts | 57 ------------------- packages/stark-core/tsconfig.json | 2 +- 6 files changed, 7 insertions(+), 61 deletions(-) diff --git a/packages/stark-build/tsconfig.json b/packages/stark-build/tsconfig.json index 3179a5be5b..a9837837e5 100644 --- a/packages/stark-build/tsconfig.json +++ b/packages/stark-build/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "allowSyntheticDefaultImports": true, "allowUnreachableCode": false, "allowUnusedLabels": false, "alwaysStrict": true, diff --git a/packages/stark-core/package.json b/packages/stark-core/package.json index f9896bd772..f11af93903 100644 --- a/packages/stark-core/package.json +++ b/packages/stark-core/package.json @@ -26,10 +26,11 @@ "npm": ">=5.3.0" }, "dependencies": { + "@ngrx/store": "5.2.0", "@types/core-js": "0.9.46", + "@types/jasmine": "2.8.6", "@types/node": "6.0.102", "@types/uuid": "3.4.3", - "@ngrx/store": "5.2.0", "cerialize": "0.1.18", "class-validator": "0.7.3", "core-js": "2.5.3", @@ -57,6 +58,7 @@ "@angular/platform-browser-dynamic": "5.x" }, "scripts": { + "ngc": "ngc", "lint": "tslint --config tslint.json --project ./tsconfig.json --format codeFrame", "test-fast": "node ./node_modules/@nationalbankbelgium/stark-testing/node_modules/karma/bin/karma start ./karma.conf.typescript.js", "test-fast:ci": "node ./node_modules/@nationalbankbelgium/stark-testing/node_modules/karma/bin/karma start karma.conf.typescript.ci.js", diff --git a/packages/stark-core/src/http/http.module.ts b/packages/stark-core/src/http/http.module.ts index 9b0d48285f..55b0c8daf2 100644 --- a/packages/stark-core/src/http/http.module.ts +++ b/packages/stark-core/src/http/http.module.ts @@ -1,6 +1,6 @@ import { NgModule } from "@angular/core"; import { HttpClient, HttpClientModule } from "@angular/common/http"; -import { StarkHttpServiceImpl, starkHttpServiceName } from "./service/index"; +import { StarkHttpServiceImpl, starkHttpServiceName } from "./services/index"; // FIXME: remove this factory once LoggingService and SessionService are implemented const starkHttpServiceFactory: any = (httpClient: HttpClient) => { diff --git a/packages/stark-core/src/logging/entities/log-message.entity.ts b/packages/stark-core/src/logging/entities/log-message.entity.ts index 832cf1cfda..859cafd4fe 100644 --- a/packages/stark-core/src/logging/entities/log-message.entity.ts +++ b/packages/stark-core/src/logging/entities/log-message.entity.ts @@ -1,6 +1,6 @@ "use strict"; -import * as moment from "moment"; +import moment from "moment"; import { autoserialize, autoserializeAs } from "cerialize"; import { StarkLogMessageType } from "./log-message-type.entity"; import { StarkLogMessage } from "./log-message.entity.intf"; diff --git a/packages/stark-core/src/logging/reducers/logging.reducer.spec.ts b/packages/stark-core/src/logging/reducers/logging.reducer.spec.ts index fe66b298a9..6990bd8c32 100644 --- a/packages/stark-core/src/logging/reducers/logging.reducer.spec.ts +++ b/packages/stark-core/src/logging/reducers/logging.reducer.spec.ts @@ -25,15 +25,6 @@ describe("Reducer: LoggingReducer", () => { expect(initialState.messages.length).toBe(2); deepFreeze(initialState); //Enforce immutability - // const payload: any = { message: new StarkLogMessageImpl(StarkLogMessageType.DEBUG, "Message N", "") }; - // deepFreeze(payload); //Enforce immutability - // - // // Send the LOG_MESSAGE action to the loggingReducer - // const changedState: StarkLogging = loggingReducer(initialState, { - // type: StarkLoggingActions.LOG_MESSAGE, - // payload - // }); - const changedState: StarkLogging = loggingReducer( initialState, new LogMessage(new StarkLogMessageImpl(StarkLogMessageType.DEBUG, "Message N", "")) @@ -46,14 +37,6 @@ describe("Reducer: LoggingReducer", () => { }); it("should add the given messages to the array even if the state is not defined", () => { - // const payload: any = { message: new StarkLogMessageImpl(StarkLogMessageType.DEBUG, "Message N", "") }; - // deepFreeze(payload); //Enforce immutability - // - // // Send the LOG_MESSAGE action to the loggingReducer - // const changedState: StarkLogging = loggingReducer(undefined, { - // type: StarkLoggingActions.LOG_MESSAGE, - // payload - // }); const changedState: StarkLogging = loggingReducer( undefined, new LogMessage(new StarkLogMessageImpl(StarkLogMessageType.DEBUG, "Message N", "")) @@ -79,14 +62,6 @@ describe("Reducer: LoggingReducer", () => { expect(initialState.messages.length).toBe(5); deepFreeze(initialState); //Enforce immutability - // const payload: any = { numberOfMessagesToFlush: 3 }; - // deepFreeze(payload); //Enforce immutability - // - // // Send the FLUSH_LOG action to the loggingReducer - // const changedState: StarkLogging = loggingReducer(initialState, { - // type: StarkLoggingActions.FLUSH_LOG, - // payload - // }); const changedState: StarkLogging = loggingReducer(initialState, new FlushLogMessages(3)); expect(changedState.messages.length).toBe(2); @@ -102,46 +77,14 @@ describe("Reducer: LoggingReducer", () => { initialState.applicationId = "whatever"; deepFreeze(initialState); //Enforce immutability - // const payload: any = { applicationId: "new appID" }; - // deepFreeze(payload); //Enforce immutability - - // Send the LOGGING_SET_APPLICATION_ID action to the loggingReducer - // const changedState: StarkLogging = loggingReducer(initialState, { - // type: StarkLoggingActions.LOGGING_SET_APPLICATION_ID, - // payload - // }); const changedState: StarkLogging = loggingReducer(initialState, new SetApplicationId("new appID")); expect(changedState.applicationId).toBe("new appID"); }); it("should set the application id even if the state is not defined", () => { - // const payload: any = { applicationId: "new appID" }; - // deepFreeze(payload); //Enforce immutability - // - // // Send the LOGGING_SET_APPLICATION_ID action to the loggingReducer - // const changedState: StarkLogging = loggingReducer(undefined, { - // type: StarkLoggingActions.LOGGING_SET_APPLICATION_ID, - // payload - // }); const changedState: StarkLogging = loggingReducer(undefined, new SetApplicationId("new appID")); expect(changedState.applicationId).toBe("new appID"); }); }); - - // describe("on any other Action", () => { - // it("should invoke the default state", () => { - // const initialState: StarkLogging = starkLogging; - // deepFreeze(initialState); //Enforce immutability - // - // // Send the MOCK_ACTION action to the loggingReducer - // const changedState: StarkLogging = loggingReducer(initialState, { - // type: "MOCK_ACTION" - // }); - // - // loggingReducer - // - // expect(changedState).toBe(initialState); - // }); - // }); }); diff --git a/packages/stark-core/tsconfig.json b/packages/stark-core/tsconfig.json index 97658f10c1..8cc970f378 100644 --- a/packages/stark-core/tsconfig.json +++ b/packages/stark-core/tsconfig.json @@ -29,7 +29,7 @@ "allowEmptyCodegenFiles": false, "annotateForClosureCompiler": true, "skipTemplateCodegen": true, - // "flatModuleOutFile": "stark-core.js", + "flatModuleOutFile": "stark-core.js", "flatModuleId": "@nationalbankbelgium/stark-core" } }