Skip to content

Commit

Permalink
Merge pull request #724 from christophercr/feature/starter-sync
Browse files Browse the repository at this point in the history
feat(starter): update starter to be in sync with the showcase
  • Loading branch information
christophercr authored Sep 26, 2018
2 parents 049fbbb + b0ffd95 commit 9fa725c
Show file tree
Hide file tree
Showing 55 changed files with 547 additions and 407 deletions.
2 changes: 1 addition & 1 deletion packages/stark-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"clean:modules": "npx rimraf ./node_modules package-lock.json",
"clean:all": "npm run clean && npm run clean:modules",
"docs": "node ../../node_modules/@compodoc/compodoc/bin/index-cli src --theme material --tsconfig ../tsconfig.json --output ../../reports/api-docs/stark-core",
"docs:coverage": "npm run docs -- --coverageTest 85 --coverageThresholdFail true",
"docs:coverage": "npm run docs -- --coverageTest 85 --coverageTestThresholdFail true",
"docs:serve": "npm run docs -- --watch --serve --port 4321",
"ngc": "node ../../node_modules/@angular/compiler-cli/src/main.js -p ./tsconfig-build.json",
"lint": "npm run lint-ts && npm run lint-css",
Expand Down
2 changes: 1 addition & 1 deletion packages/stark-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"clean:modules": "npx rimraf ./node_modules package-lock.json",
"clean:all": "npm run clean && npm run clean:modules",
"docs": "node ../../node_modules/@compodoc/compodoc/bin/index-cli src --theme material --tsconfig ../tsconfig.json --output ../../reports/api-docs/stark-ui",
"docs:coverage": "npm run docs -- --coverageTest 85 --coverageThresholdFail true",
"docs:coverage": "npm run docs -- --coverageTest 85 --coverageTestThresholdFail true",
"docs:serve": "npm run docs -- --watch --serve --port 4321",
"ngc": "node ../../node_modules/@angular/compiler-cli/src/main.js -p ./tsconfig-build.json",
"lint": "npm run lint-ts && npm run lint-css",
Expand Down
2 changes: 0 additions & 2 deletions showcase/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { MockAppSidebarService } from "@nationalbankbelgium/stark-ui/testing";
* Load the implementations that should be tested
*/
import { AppComponent } from "./app.component";
import { AppState } from "./app.service";
import { STARK_LOGGING_SERVICE, STARK_ROUTING_SERVICE } from "@nationalbankbelgium/stark-core";
import { MockStarkLoggingService, MockStarkRoutingService } from "@nationalbankbelgium/stark-core/testing";
import Spy = jasmine.Spy;
Expand All @@ -31,7 +30,6 @@ describe(`App`, () => {
{ provide: STARK_LOGGING_SERVICE, useValue: new MockStarkLoggingService() },
{ provide: STARK_ROUTING_SERVICE, useClass: MockStarkRoutingService },
{ provide: STARK_APP_SIDEBAR_SERVICE, useValue: new MockAppSidebarService() },
AppState,
TranslateService
]
})
Expand Down
4 changes: 1 addition & 3 deletions showcase/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { Component, Inject, OnInit } from "@angular/core";
import { STARK_LOGGING_SERVICE, STARK_ROUTING_SERVICE, StarkLoggingService, StarkRoutingService } from "@nationalbankbelgium/stark-core";
import { STARK_APP_SIDEBAR_SERVICE, StarkAppSidebarService } from "@nationalbankbelgium/stark-ui";
import { AppState } from "./app.service";

/**
* App Component
Expand All @@ -17,14 +16,13 @@ import { AppState } from "./app.service";
})
export class AppComponent implements OnInit {
public constructor(
public appState: AppState,
@Inject(STARK_APP_SIDEBAR_SERVICE) public sidebarService: StarkAppSidebarService,
@Inject(STARK_LOGGING_SERVICE) public logger: StarkLoggingService,
@Inject(STARK_ROUTING_SERVICE) public routingService: StarkRoutingService
) {}

public ngOnInit(): void {
this.logger.debug("Initial App State", this.appState.state);
this.logger.debug("app: component loaded");
this.routingService.addTransitionHook("ON_SUCCESS", {}, () => {
this.sidebarService.close();
});
Expand Down
5 changes: 0 additions & 5 deletions showcase/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ import { environment } from "../environments/environment";
import { APP_STATES } from "./app.routes";
// App is our top level component
import { AppComponent } from "./app.component";
import { AppState } from "./app.service";
import { HomeComponent } from "./home";
import { NoContentComponent } from "./no-content";
import { DemoModule } from "./demo";
Expand All @@ -90,9 +89,6 @@ import "../styles/styles.pcss";
import "../styles/styles.scss";
/* tslint:enable */

// Application wide providers
const APP_PROVIDERS: any[] = [AppState];

// TODO: where to put this factory function?
export function starkAppConfigFactory(): StarkApplicationConfig {
const config: any = require("../stark-app-config.json");
Expand Down Expand Up @@ -241,7 +237,6 @@ export const metaReducers: MetaReducer<State>[] = ENV !== "production" ? [logger
*/
providers: [
environment.ENV_PROVIDERS,
APP_PROVIDERS,
{ provide: NgModuleFactoryLoader, useClass: SystemJsNgModuleLoader }, // needed for ui-router
{ provide: STARK_APP_CONFIG, useFactory: starkAppConfigFactory },
{ provide: STARK_APP_METADATA, useFactory: starkAppMetadataFactory },
Expand Down
2 changes: 1 addition & 1 deletion showcase/src/app/material-icons.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MatIconRegistry } from "@angular/material";
import { MatIconRegistry } from "@angular/material/icon";
import { DomSanitizer } from "@angular/platform-browser";

/**
Expand Down
2 changes: 1 addition & 1 deletion showcase/src/environments/environment.hmr.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StarkEnvironment } from "@nationalbankbelgium/stark-core";
import { NgModuleRef } from "@angular/core";
import { StarkEnvironment } from "@nationalbankbelgium/stark-core";

export const environment: StarkEnvironment = {
production: false,
Expand Down
1 change: 0 additions & 1 deletion showcase/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<link href="<%= htmlWebpackPlugin.options.dllFiles.css[i] %>" rel="stylesheet">
<% } %>
<% } %>

</head>

<body class="">
Expand Down
2 changes: 1 addition & 1 deletion showcase/src/stark-app-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"name": "userProfile",
"url": "http://localhost:5000",
"authenticationType": 1,
"devaAuthenticationEnabled": false,
"devAuthenticationEnabled": false,
"devAuthenticationRolePrefix": "",
"loginResource": "",
"token": ""
Expand Down
7 changes: 7 additions & 0 deletions starter/config/json-server/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"profiles": [
{ "uuid": "1", "username": "janedoe", "firstName": "Jane", "lastName": "Doe", "language": "en", "roles": ["admin"] },
{ "uuid": "2", "username": "johndoe", "firstName": "John", "lastName": "Doe", "language": "fr", "roles": ["manager"] },
{ "uuid": "3", "username": "chucknorris", "firstName": "Chuck", "lastName": "Norris", "language": "nl", "roles": ["developer"] }
]
}
13 changes: 12 additions & 1 deletion starter/karma.conf.ci.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
/**
* Load karma config from Stark
*/
module.exports = require("./node_modules/@nationalbankbelgium/stark-testing/karma.conf.ci.js");
const defaultKarmaCIConfig = require("./node_modules/@nationalbankbelgium/stark-testing/karma.conf.ci.js").rawKarmaConfig;
const karmaTypescriptExclusions = require("./karma.conf").karmaTypescriptExclusions;

// start customizing the KarmaCI configuration from stark-testing
const starkStarterSpecificConfiguration = Object.assign({}, defaultKarmaCIConfig, {
exclude: [...defaultKarmaCIConfig.exclude, ...karmaTypescriptExclusions]
});

// export the configuration function that karma expects and simply return the stark configuration
module.exports = config => {
return config.set(starkStarterSpecificConfiguration);
};
24 changes: 23 additions & 1 deletion starter/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
/**
* Load karma config from Stark
*/
module.exports = require("./node_modules/@nationalbankbelgium/stark-testing/karma.conf.js");
const helpers = require("./node_modules/@nationalbankbelgium/stark-testing/helpers");

/**
* Load karma config from Stark
*/
const defaultKarmaConfig = require("./node_modules/@nationalbankbelgium/stark-testing/karma.conf.js").rawKarmaConfig;

// entry files of the "@nationalbankbelgium/stark-ui" module imported in mock files
const karmaTypescriptExclusions = [...defaultKarmaConfig.exclude, "src/assets/**"];

// start customizing the KarmaCI configuration from stark-testing
const starkStarterSpecificConfiguration = Object.assign({}, defaultKarmaConfig, {
// list of files to exclude
exclude: karmaTypescriptExclusions
});

// export the configuration function that karma expects and simply return the stark configuration
module.exports = {
default: function(config) {
return config.set(starkStarterSpecificConfiguration);
},
karmaTypescriptExclusions: karmaTypescriptExclusions
};
116 changes: 101 additions & 15 deletions starter/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9fa725c

Please sign in to comment.