Skip to content

Commit f958f0b

Browse files
committed
add support for Angular v9
Closes #5
1 parent 2a8eea4 commit f958f0b

21 files changed

+946
-0
lines changed

.bitmap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
"mainFile": "index.ts",
1414
"rootDir": "packages/eslint-config"
1515
},
16+
"angular-v9": {
17+
"scope": "",
18+
"version": "",
19+
"mainFile": "index.ts",
20+
"rootDir": "packages/angular-v9"
21+
},
1622
"angular-v10": {
1723
"scope": "teambit.angular",
1824
"version": "0.0.2",

.github/workflows/main.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
- name: Remove v10
3838
run: bit remove angular-v10 -s -f
3939

40+
- name: Remove v9
41+
run: bit remove angular-v9 -s -f
42+
4043
- name: Add example app
4144
run: bit add examples/demo-lib-v12
4245

@@ -86,6 +89,9 @@ jobs:
8689
- name: Remove v10
8790
run: bit remove angular-v10 -s -f
8891

92+
- name: Remove v9
93+
run: bit remove angular-v9 -s -f
94+
8995
- name: Add example app
9096
run: bit add examples/demo-lib-v11
9197

@@ -135,6 +141,9 @@ jobs:
135141
- name: Remove v11
136142
run: bit remove angular-v11 -s -f
137143

144+
- name: Remove v9
145+
run: bit remove angular-v9 -s -f
146+
138147
- name: Add example app
139148
run: bit add examples/demo-lib-v10
140149

@@ -163,3 +172,55 @@ jobs:
163172
with:
164173
name: debug-log
165174
path: $HOME/Library/Caches/Bit/logs
175+
176+
# Test angular-v9
177+
v9:
178+
runs-on: ubuntu-latest
179+
if: "!contains(github.event.head_commit.message, 'skip-ci')"
180+
container:
181+
image: docker://bitcli/bit:latest
182+
steps:
183+
- uses: teambit/setup-action@v1
184+
with:
185+
name: angular-github-actions
186+
BIT_TOKEN: ${{ env.BIT_TOKEN }}
187+
188+
- uses: actions/checkout@v2
189+
190+
- name: Remove v12
191+
run: bit remove angular-v12 -s -f
192+
193+
- name: Remove v11
194+
run: bit remove angular-v11 -s -f
195+
196+
- name: Remove v10
197+
run: bit remove angular-v10 -s -f
198+
199+
- name: Add example app
200+
run: bit add examples/demo-lib-v9
201+
202+
- name: Install dependencies
203+
run: bit install
204+
205+
# Compile the aspects
206+
- name: Bit compile aspects
207+
run: bit compile ng-packagr angular-eslint-config angular angular-v9 --log
208+
209+
# Run bit link to regenerate the package.json of the example component
210+
- name: Bit link
211+
run: bit link
212+
213+
# Compile the example component
214+
- name: Bit compile example
215+
run: bit compile demo-lib-v10 --log
216+
217+
- name: Bit test
218+
run: bit test --log
219+
220+
- name: Bit build
221+
run: bit build --log
222+
223+
- uses: actions/upload-artifact@v2
224+
with:
225+
name: debug-log
226+
path: $HOME/Library/Caches/Bit/logs

examples/demo-lib-v9/public-api.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Entry point for this Angular library, do not move or rename this file.
3+
*/
4+
export * from './src/bit-test.component';
5+
export * from './src/bit-test2.component';
6+
export * from './src/bit-test.module';
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Component } from '@angular/core';
2+
import { BitTestService } from './bit-test.service';
3+
4+
@Component({
5+
selector: 'bit-test',
6+
template: `
7+
<p>bit-test component works!</p>
8+
<small>{{ service.content }}</small>
9+
`
10+
})
11+
export class BitTestComponent {
12+
constructor(public service: BitTestService) {}
13+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
labels: ['angular', 'typescript', 'bit-test']
3+
description: 'A `bit-test` component.'
4+
---
5+
6+
# Bit test documentation
7+
Import `BitTestModule` :
8+
9+
```typescript
10+
import { BitTestModule } from './bit-test.module';
11+
12+
// add it to your module imports
13+
@NgModule({
14+
// ...
15+
imports: [
16+
BitTestModule
17+
]
18+
// ...
19+
})
20+
export class AppModule {}
21+
```
22+
23+
Use `BitTestComponent` in your templates :
24+
25+
```html
26+
<bit-test></bit-test>
27+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { NgModule } from '@angular/core';
2+
import { BitTestComponent } from './bit-test.component';
3+
import { BitTest2Component } from './bit-test2.component';
4+
5+
@NgModule({
6+
declarations: [
7+
BitTestComponent,
8+
BitTest2Component
9+
],
10+
exports: [
11+
BitTestComponent,
12+
BitTest2Component
13+
]
14+
})
15+
export class BitTestModule {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Injectable } from '@angular/core';
2+
3+
@Injectable({ providedIn: 'any' })
4+
export class BitTestService {
5+
get content() {
6+
return 'Content from service';
7+
}
8+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { BitTestComponent } from './bit-test.component';
4+
5+
describe('BitTestComponent', () => {
6+
let component: BitTestComponent;
7+
let fixture: ComponentFixture<BitTestComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ BitTestComponent ]
12+
})
13+
.compileComponents();
14+
});
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(BitTestComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
26+
it('should have a service', () => {
27+
expect(component.service).toBeDefined();
28+
expect(component.service.content).toEqual('Content from service');
29+
})
30+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'bit-test2',
5+
template: `
6+
<p>
7+
bit-test 2 works as well!
8+
</p>
9+
`
10+
})
11+
export class BitTest2Component {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Component, NgModule } from '@angular/core';
2+
import { BitTestModule } from '../bit-test.module';
3+
4+
@Component({
5+
selector: 'composition-cmp',
6+
template: `Composition: <bit-test></bit-test>`
7+
})
8+
class CompositionComponent {}
9+
10+
@NgModule({
11+
declarations: [CompositionComponent],
12+
imports: [BitTestModule],
13+
bootstrap: [CompositionComponent]
14+
})
15+
export class CompositionModule {
16+
}

0 commit comments

Comments
 (0)