Skip to content

Commit bc3928e

Browse files
committed
add support for Angular v10
Closes #4
1 parent 526bb0b commit bc3928e

25 files changed

+949
-9
lines changed

.bitmap

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
"mainFile": "index.ts",
1414
"rootDir": "packages/eslint-config"
1515
},
16+
"angular-v10": {
17+
"scope": "",
18+
"version": "",
19+
"mainFile": "index.ts",
20+
"rootDir": "packages/angular-v10"
21+
},
1622
"angular-v11": {
1723
"scope": "teambit.angular",
1824
"version": "0.0.13",
@@ -32,4 +38,4 @@
3238
"rootDir": "packages/ng-packagr"
3339
},
3440
"$schema-version": "14.9.0"
35-
}
41+
}

.github/workflows/main.yml

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ jobs:
3131

3232
- uses: actions/checkout@v2
3333

34-
- name: Remove other aspects
34+
- name: Remove v11
3535
run: bit remove angular-v11 -s -f
3636

37+
- name: Remove v10
38+
run: bit remove angular-v10 -s -f
39+
3740
- name: Add example app
3841
run: bit add examples/demo-lib-v12
3942

@@ -77,9 +80,12 @@ jobs:
7780

7881
- uses: actions/checkout@v2
7982

80-
- name: Remove other aspects
83+
- name: Remove v12
8184
run: bit remove angular-v12 -s -f
8285

86+
- name: Remove v10
87+
run: bit remove angular-v10 -s -f
88+
8389
- name: Add example app
8490
run: bit add examples/demo-lib-v11
8591

@@ -108,3 +114,52 @@ jobs:
108114
with:
109115
name: debug-log
110116
path: $HOME/Library/Caches/Bit/logs
117+
118+
# Test angular-v10
119+
v10:
120+
runs-on: ubuntu-latest
121+
if: "!contains(github.event.head_commit.message, 'skip-ci')"
122+
container:
123+
image: docker://bitcli/bit:latest
124+
steps:
125+
- uses: teambit/setup-action@v1
126+
with:
127+
name: angular-github-actions
128+
BIT_TOKEN: ${{ env.BIT_TOKEN }}
129+
130+
- uses: actions/checkout@v2
131+
132+
- name: Remove v12
133+
run: bit remove angular-v12 -s -f
134+
135+
- name: Remove v11
136+
run: bit remove angular-v11 -s -f
137+
138+
- name: Add example app
139+
run: bit add examples/demo-lib-v10
140+
141+
- name: Install dependencies
142+
run: bit install
143+
144+
# Compile the aspects
145+
- name: Bit compile aspects
146+
run: bit compile ng-packagr angular-eslint-config angular angular-v10 --log
147+
148+
# Run bit link to regenerate the package.json of the example component
149+
- name: Bit link
150+
run: bit link
151+
152+
# Compile the example component
153+
- name: Bit compile example
154+
run: bit compile demo-lib-v10 --log
155+
156+
- name: Bit test
157+
run: bit test --log
158+
159+
- name: Bit build
160+
run: bit build --log
161+
162+
- uses: actions/upload-artifact@v2
163+
with:
164+
name: debug-log
165+
path: $HOME/Library/Caches/Bit/logs
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)