Skip to content

Commit

Permalink
[AAE-11496] Build and publish aca-about and aca-settings (#2942)
Browse files Browse the repository at this point in the history
* [AAE-11496] Build and publish aca-about and aca-content

* added libs to publish
  • Loading branch information
BSekula committed Jan 30, 2023
1 parent eae27ea commit 7a176eb
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 13 deletions.
6 changes: 4 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@
"production": {
"tsConfig": "projects/aca-about/tsconfig.lib.prod.json"
}
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
Expand Down Expand Up @@ -523,7 +524,8 @@
"production": {
"tsConfig": "projects/aca-settings/tsconfig.lib.prod.json"
}
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
Expand Down
3 changes: 2 additions & 1 deletion app/src/app/extensions.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ import { AcaAboutModule } from '@alfresco/aca-about';
import { AcaSettingsModule } from '@alfresco/aca-settings';
import { AcaFolderRulesModule } from '@alfresco/aca-folder-rules';
import { environment } from '../environments/environment';
import packageJson from 'package.json';

@NgModule({
imports: [
AosExtensionModule,
...(environment.devTools ? [AcaSettingsModule] : []),
AcaAboutModule.forRoot(environment.production),
AcaAboutModule.forRoot(environment.production, packageJson),
AcaFolderRulesModule
]
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prebuild": "mkdir -p ./app/.tmp && cp ./app/src/app.config.json.tpl ./app/.tmp/app.config.json",
"build": "ng build content-ce",
"build.release": "npm run build -- --configuration=production,release",
"build-libs": "ng build aca-shared && ng build adf-office-services-ext",
"build-libs": "ng build aca-shared && ng build adf-office-services-ext && ng build aca-settings && ng build aca-about ",
"test": "ng test",
"test:ci": "ng test adf-office-services-ext && ng test content-ce --code-coverage",
"lint": "NODE_OPTIONS=--max_old_space_size=4096 ng lint && npm run spellcheck && npm run e2e.typecheck",
Expand Down
11 changes: 11 additions & 0 deletions projects/aca-about/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/@alfresco/aca-about",

"lib": {
"entryFile": "src/public-api.ts"
},
"assets": [
"assets"
]
}
11 changes: 11 additions & 0 deletions projects/aca-about/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@alfresco/aca-about",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^14.1.0",
"@angular/core": "^14.1.0"
},
"dependencies": {
"tslib": "^2.3.0"
}
}
2 changes: 1 addition & 1 deletion projects/aca-about/src/lib/about.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<adf-about-panel *ngIf="dev" [label]="'ABOUT.PACKAGES.TITLE' | translate">
<ng-template>
<adf-about-package-list [dependencies]="pkg?.dependencies"></adf-about-package-list>
<adf-about-package-list [dependencies]="packageJson?.dependencies"></adf-about-package-list>
</ng-template>
</adf-about-panel>

Expand Down
8 changes: 5 additions & 3 deletions projects/aca-about/src/lib/about.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/

import { Component, Inject, OnInit } from '@angular/core';
import { Component, Inject, OnInit, Optional } from '@angular/core';
import { DEV_MODE_TOKEN } from './dev-mode.tokens';
import pkg from 'package.json';
import { Observable } from 'rxjs';
import { AppExtensionService, ExtensionRef } from '@alfresco/adf-extensions';
import { AuthenticationService, DiscoveryApiService, RepositoryInfo } from '@alfresco/adf-core';
import { PACKAGE_JSON } from './package-json.token';

@Component({
selector: 'app-about-page',
Expand All @@ -43,12 +43,14 @@ export class AboutComponent implements OnInit {

constructor(
@Inject(DEV_MODE_TOKEN) devMode,
@Optional()
@Inject(PACKAGE_JSON)
public packageJson,
private authService: AuthenticationService,
private appExtensions: AppExtensionService,
private discovery: DiscoveryApiService
) {
this.dev = !devMode;
this.pkg = pkg;
this.extensions$ = this.appExtensions.references$;
}

Expand Down
16 changes: 13 additions & 3 deletions projects/aca-about/src/lib/aca-about.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/

import { ModuleWithProviders, NgModule } from '@angular/core';
import { ModuleWithProviders, NgModule, Provider } from '@angular/core';
import { AboutComponent } from './about.component';
import { CommonModule } from '@angular/common';
import { CoreModule } from '@alfresco/adf-core';
import { SharedModule, PageLayoutModule } from '@alfresco/aca-shared';

import { ExtensionService, provideExtensionConfig } from '@alfresco/adf-extensions';
import { DEV_MODE_TOKEN } from './dev-mode.tokens';
import { PACKAGE_JSON } from './package-json.token';

@NgModule({
imports: [CommonModule, CoreModule.forChild(), SharedModule, PageLayoutModule],
Expand All @@ -44,10 +45,19 @@ export class AcaAboutModule {
});
}

public static forRoot(devMode: any): ModuleWithProviders<AcaAboutModule> {
public static forRoot(devMode: any, packageJson?: any): ModuleWithProviders<AcaAboutModule> {
const providers: Provider[] = [{ provide: DEV_MODE_TOKEN, useValue: devMode }];

if (packageJson) {
providers.push({
provide: PACKAGE_JSON,
useValue: packageJson
});
}

return {
ngModule: AcaAboutModule,
providers: [{ provide: DEV_MODE_TOKEN, useValue: devMode }]
providers
};
}
}
3 changes: 3 additions & 0 deletions projects/aca-about/src/lib/package-json.token.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { InjectionToken } from '@angular/core';

export const PACKAGE_JSON = new InjectionToken<any>('PACKAGE_JSON');
1 change: 1 addition & 0 deletions projects/aca-about/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@

export * from './lib/about.component';
export * from './lib/aca-about.module';
export * from './lib/package-json.token';
7 changes: 6 additions & 1 deletion projects/aca-about/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
"declarationMap": false,
"paths": {
"@alfresco/aca-shared": ["dist/@alfresco/aca-shared"],
"@alfresco/aca-shared/store": ["dist/@alfresco/aca-shared/store"],
"@alfresco/aca-shared/rules": ["dist/@alfresco/aca-shared/rules"]
}
},
"angularCompilerOptions": {
"compilationMode": "partial"
Expand Down
8 changes: 8 additions & 0 deletions projects/aca-settings/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/@alfresco/aca-settings",
"lib": {
"entryFile": "src/public-api.ts"
},
"assets": ["assets"]
}
11 changes: 11 additions & 0 deletions projects/aca-settings/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@alfresco/aca-settings",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^14.1.0",
"@angular/core": "^14.1.0"
},
"dependencies": {
"tslib": "^2.3.0"
}
}
7 changes: 6 additions & 1 deletion projects/aca-settings/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
"declarationMap": false,
"paths": {
"@alfresco/aca-shared": ["dist/@alfresco/aca-shared"],
"@alfresco/aca-shared/store": ["dist/@alfresco/aca-shared/store"],
"@alfresco/aca-shared/rules": ["dist/@alfresco/aca-shared/rules"]
}
},
"angularCompilerOptions": {
"compilationMode": "partial"
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/npm/publish-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ echo -e "Branch is '$TRAVIS_BRANCH', therefore publish with '$TAG_NPM' tag\n"
PROJECTS=(
'aca-shared'
'adf-office-services-ext'
'aca-settings'
'aca-about'
);

for PROJECT in "${PROJECTS[@]}"
Expand Down

0 comments on commit 7a176eb

Please sign in to comment.