Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
fix: template formating
Browse files Browse the repository at this point in the history
  • Loading branch information
JamilOmar committed Sep 19, 2019
1 parent 0e4d2d7 commit 23bc546
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 18,559 deletions.
1 change: 1 addition & 0 deletions templates/angular-package/_labsharerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"tsConfig":"tsconfig.json",
"createLSConfigurationFile":"false",
"build":{
"main":"ui/main",
"polyfills":"ui/polyfills",
Expand Down
1 change: 1 addition & 0 deletions templates/angular-package/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"baseUrl":"./",
"moduleResolution": "node",
"target": "es5",
"module": "commonjs",
Expand Down
4 changes: 1 addition & 3 deletions templates/angular-package/ui/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export class AppComponent implements OnInit {
constructor(private authService: AuthService) {}
title = '<%= appNameSlug %>';
ngOnInit(): void {
this.authService.configure().subscribe(done => {
this.authService.onAuthCallback();
});
this.authService.onAuthCallback();
}
}
21 changes: 18 additions & 3 deletions templates/angular-package/ui/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {BrowserModule} from '@angular/platform-browser';
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {NgModule, APP_INITIALIZER} from '@angular/core';
import {HttpClientModule} from '@angular/common/http';
import {AppRoutingModule} from './app-routing.module';
import {CoreModule} from './core/core.module';
Expand All @@ -10,8 +10,16 @@ import {ShellModule} from './shell/shell.module';
import '../assets/styles.scss';
import '../favicon.ico';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {AuthService} from '@labshare/ngx-core-services';

// Export Angular 6 feature module
// app initializer for Auth
function initializeAuth(auth: AuthService): () => Promise<any> {
return async () => {
return auth.configure().toPromise();
};
}

// Export Angular 8 feature module
@NgModule({
declarations: [AppComponent],
entryComponents: [],
Expand All @@ -27,7 +35,14 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms';
ThemeModule,
AppRoutingModule
],
providers: [],
providers: [
{
provide: APP_INITIALIZER,
useFactory: initializeAuth,
deps: [AuthService],
multi: true
}
],
bootstrap: [AppComponent]
})
export class AppModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {AuthService} from '@labshare/ngx-core-services';
export class LoginComponent implements OnInit {
constructor(private authService: AuthService) {}
ngOnInit() {
this.authService.configure().subscribe(done => {
this.authService.login();
});
this.authService.login();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {AuthService} from '@labshare/ngx-core-services';
export class LogoutComponent implements OnInit {
constructor(private authService: AuthService) {}
ngOnInit() {
this.authService.configure().subscribe(done => {
this.authService.logout();
});
this.authService.logout();
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {Injectable} from '@angular/core';
import {Injectable, Injector} from '@angular/core';
import {Router} from '@angular/router';
@Injectable()
export class NgRoutingService {
constructor(private router: Router) {}
navigate(url: string) {
this.router.navigate([url]);
constructor(private injector: Injector) {}
navigate(state: string) {
const router = this.injector.get(Router);
router.navigate([state]);
}
}
24 changes: 16 additions & 8 deletions templates/library-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,29 @@ This is a template project that will create a base library.

- Install all the packages: `npm i`

* To build this project as a production bundle, you need to use the command line: `lsc build lib`
* To build this project as a production bundle, you need to use the command
line: `lsc build lib`

* **Note** To build correctly you must update the public_api.ts file with all your publicly exported components.
* **Note** To build correctly you must update the public_api.ts file with all
your publicly exported components.

* If you have to install a new dependency, prefer adding it to `devDependencies` and `peerDependencies` instead of `dependencies` field in package.json
* If you have to install a new dependency, prefer adding it to `devDependencies`
and `peerDependencies` instead of `dependencies` field in package.json

* If there needs to be any `dependencies` that not peer or dev dependencies, add them to the whitelist located in `ng-package.json`
* If there needs to be any `dependencies` that not peer or dev dependencies, add
them to the whitelist located in `ng-package.json`

* If you need to load an image in your component:

* If you need to load an image in your component:
1. Add a variable to your component as follows. E.g.: `myImg = require('@labshare/ngx-labshare-base/src/assets/my-image.png')`
2. Inject into template: `<img [src]="myImg" />`
* Please note that the require path above **must** be referenced from `@labshare/ngx-labshare-base/src/assets` to ensure consistent loading behavior.

1. Add a variable to your component as follows. E.g.:
`myImg = require('@labshare/ngx-labshare-base/src/assets/my-image.png')`
2. Inject into template: `<img [src]="myImg" />`

- Please note that the require path above **must** be referenced from
`@labshare/ngx-labshare-base/src/assets` to ensure consistent loading
behavior.

* For more information, go to @labshare/shell-ui.

Expand Down Expand Up @@ -51,7 +60,6 @@ This is a template project that will create a base library.
- **prettier:cli**: Run the prettier cli
- **prettier:fix**:Fixes any prettier issue


## Docs

Section for the project's documentation.
Expand Down
34 changes: 20 additions & 14 deletions templates/library-package/_releaserc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
module.exports = {
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
["@semantic-release/npm", {
"pkgRoot": "dist",
}],
["@semantic-release/exec", {
"prepareCmd": "node ./scripts/update-root-package.js"
}],
"@semantic-release/git",
"@semantic-release/github"
]
}
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/changelog',
[
'@semantic-release/npm',
{
pkgRoot: 'dist',
},
],
[
'@semantic-release/exec',
{
prepareCmd: 'node ./scripts/update-root-package.js',
},
],
'@semantic-release/git',
'@semantic-release/github',
],
};
Loading

0 comments on commit 23bc546

Please sign in to comment.