From e4acefc06ecfade9cf261e6149e25cfa84a5f3b8 Mon Sep 17 00:00:00 2001 From: Boris Voropaev Date: Mon, 30 Oct 2023 16:10:12 +0300 Subject: [PATCH] multi-app --- angular.json | 4 +-- projects/app-a/src/main.ts | 2 +- projects/app-a/src/styles-a.scss | 7 +++++ .../styles.scss => app-a/src/styles-b.scss} | 0 projects/app-a/src/styles.scss | 1 - projects/app-b/src/app/app-routing.module.ts | 10 ------- projects/app-b/src/app/app.component.html | 1 - projects/app-b/src/app/app.component.scss | 0 projects/app-b/src/app/app.component.spec.ts | 29 ------------------- projects/app-b/src/app/app.component.ts | 10 ------- projects/app-b/src/app/app.module.ts | 18 ------------ projects/app-b/src/assets/styles-c.scss | 8 +++++ projects/app-b/src/main.ts | 2 +- projects/app-b/src/styles-c.scss | 8 +++++ .../{app-a/src => }/app/app-routing.module.ts | 0 .../{app-a/src => }/app/app.component.html | 0 .../{app-a/src => }/app/app.component.scss | 0 .../{app-a/src => }/app/app.component.spec.ts | 0 projects/{app-a/src => }/app/app.component.ts | 0 projects/{app-a/src => }/app/app.module.ts | 0 20 files changed, 27 insertions(+), 73 deletions(-) create mode 100644 projects/app-a/src/styles-a.scss rename projects/{app-b/src/styles.scss => app-a/src/styles-b.scss} (100%) delete mode 100644 projects/app-a/src/styles.scss delete mode 100644 projects/app-b/src/app/app-routing.module.ts delete mode 100644 projects/app-b/src/app/app.component.html delete mode 100644 projects/app-b/src/app/app.component.scss delete mode 100644 projects/app-b/src/app/app.component.spec.ts delete mode 100644 projects/app-b/src/app/app.component.ts delete mode 100644 projects/app-b/src/app/app.module.ts create mode 100644 projects/app-b/src/assets/styles-c.scss create mode 100644 projects/app-b/src/styles-c.scss rename projects/{app-a/src => }/app/app-routing.module.ts (100%) rename projects/{app-a/src => }/app/app.component.html (100%) rename projects/{app-a/src => }/app/app.component.scss (100%) rename projects/{app-a/src => }/app/app.component.spec.ts (100%) rename projects/{app-a/src => }/app/app.component.ts (100%) rename projects/{app-a/src => }/app/app.module.ts (100%) diff --git a/angular.json b/angular.json index 2fc14fd..24a2e4b 100644 --- a/angular.json +++ b/angular.json @@ -30,7 +30,7 @@ "projects/app-a/src/assets" ], "styles": [ - "projects/app-a/src/styles.scss" + "projects/app-a/src/styles-b.scss" ], "scripts": [] }, @@ -127,7 +127,7 @@ "projects/app-b/src/assets" ], "styles": [ - "projects/app-b/src/styles.scss" + "projects/app-b/src/styles-c.scss" ], "scripts": [] }, diff --git a/projects/app-a/src/main.ts b/projects/app-a/src/main.ts index c58dc05..55667f3 100644 --- a/projects/app-a/src/main.ts +++ b/projects/app-a/src/main.ts @@ -1,6 +1,6 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { AppModule } from './app/app.module'; +import { AppModule } from '../../app/app.module'; platformBrowserDynamic().bootstrapModule(AppModule) diff --git a/projects/app-a/src/styles-a.scss b/projects/app-a/src/styles-a.scss new file mode 100644 index 0000000..0671782 --- /dev/null +++ b/projects/app-a/src/styles-a.scss @@ -0,0 +1,7 @@ +/* You can add global styles to this file, and also import other style files */ +body{ + background-color: aquamarine; + h1{ + color: midnightblue; + } +} \ No newline at end of file diff --git a/projects/app-b/src/styles.scss b/projects/app-a/src/styles-b.scss similarity index 100% rename from projects/app-b/src/styles.scss rename to projects/app-a/src/styles-b.scss diff --git a/projects/app-a/src/styles.scss b/projects/app-a/src/styles.scss deleted file mode 100644 index 90d4ee0..0000000 --- a/projects/app-a/src/styles.scss +++ /dev/null @@ -1 +0,0 @@ -/* You can add global styles to this file, and also import other style files */ diff --git a/projects/app-b/src/app/app-routing.module.ts b/projects/app-b/src/app/app-routing.module.ts deleted file mode 100644 index 0297262..0000000 --- a/projects/app-b/src/app/app-routing.module.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -const routes: Routes = []; - -@NgModule({ - imports: [RouterModule.forRoot(routes)], - exports: [RouterModule] -}) -export class AppRoutingModule { } diff --git a/projects/app-b/src/app/app.component.html b/projects/app-b/src/app/app.component.html deleted file mode 100644 index 35a6214..0000000 --- a/projects/app-b/src/app/app.component.html +++ /dev/null @@ -1 +0,0 @@ -

App-B

\ No newline at end of file diff --git a/projects/app-b/src/app/app.component.scss b/projects/app-b/src/app/app.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/projects/app-b/src/app/app.component.spec.ts b/projects/app-b/src/app/app.component.spec.ts deleted file mode 100644 index 4a27273..0000000 --- a/projects/app-b/src/app/app.component.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { TestBed } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { AppComponent } from './app.component'; - -describe('AppComponent', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [RouterTestingModule], - declarations: [AppComponent] - })); - - it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app).toBeTruthy(); - }); - - it(`should have as title 'app-b'`, () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app.title).toEqual('app-b'); - }); - - it('should render title', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.nativeElement as HTMLElement; - expect(compiled.querySelector('.content span')?.textContent).toContain('app-b app is running!'); - }); -}); diff --git a/projects/app-b/src/app/app.component.ts b/projects/app-b/src/app/app.component.ts deleted file mode 100644 index 6f6dc38..0000000 --- a/projects/app-b/src/app/app.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] -}) -export class AppComponent { - title = 'app-b'; -} diff --git a/projects/app-b/src/app/app.module.ts b/projects/app-b/src/app/app.module.ts deleted file mode 100644 index b1c6c96..0000000 --- a/projects/app-b/src/app/app.module.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; - -import { AppRoutingModule } from './app-routing.module'; -import { AppComponent } from './app.component'; - -@NgModule({ - declarations: [ - AppComponent - ], - imports: [ - BrowserModule, - AppRoutingModule - ], - providers: [], - bootstrap: [AppComponent] -}) -export class AppModule { } diff --git a/projects/app-b/src/assets/styles-c.scss b/projects/app-b/src/assets/styles-c.scss new file mode 100644 index 0000000..f2cb9fe --- /dev/null +++ b/projects/app-b/src/assets/styles-c.scss @@ -0,0 +1,8 @@ +/* You can add global styles to this file, and also import other style files */ +body{ + background-color:cadetblue; + h1{ + color:darkolivegreen; + font-family:'Times New Roman', Times, serif; + } +} \ No newline at end of file diff --git a/projects/app-b/src/main.ts b/projects/app-b/src/main.ts index c58dc05..55667f3 100644 --- a/projects/app-b/src/main.ts +++ b/projects/app-b/src/main.ts @@ -1,6 +1,6 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { AppModule } from './app/app.module'; +import { AppModule } from '../../app/app.module'; platformBrowserDynamic().bootstrapModule(AppModule) diff --git a/projects/app-b/src/styles-c.scss b/projects/app-b/src/styles-c.scss new file mode 100644 index 0000000..f2cb9fe --- /dev/null +++ b/projects/app-b/src/styles-c.scss @@ -0,0 +1,8 @@ +/* You can add global styles to this file, and also import other style files */ +body{ + background-color:cadetblue; + h1{ + color:darkolivegreen; + font-family:'Times New Roman', Times, serif; + } +} \ No newline at end of file diff --git a/projects/app-a/src/app/app-routing.module.ts b/projects/app/app-routing.module.ts similarity index 100% rename from projects/app-a/src/app/app-routing.module.ts rename to projects/app/app-routing.module.ts diff --git a/projects/app-a/src/app/app.component.html b/projects/app/app.component.html similarity index 100% rename from projects/app-a/src/app/app.component.html rename to projects/app/app.component.html diff --git a/projects/app-a/src/app/app.component.scss b/projects/app/app.component.scss similarity index 100% rename from projects/app-a/src/app/app.component.scss rename to projects/app/app.component.scss diff --git a/projects/app-a/src/app/app.component.spec.ts b/projects/app/app.component.spec.ts similarity index 100% rename from projects/app-a/src/app/app.component.spec.ts rename to projects/app/app.component.spec.ts diff --git a/projects/app-a/src/app/app.component.ts b/projects/app/app.component.ts similarity index 100% rename from projects/app-a/src/app/app.component.ts rename to projects/app/app.component.ts diff --git a/projects/app-a/src/app/app.module.ts b/projects/app/app.module.ts similarity index 100% rename from projects/app-a/src/app/app.module.ts rename to projects/app/app.module.ts