Skip to content

Commit e07d873

Browse files
committed
add support for Angular v8
Closes #6
1 parent a76b6a7 commit e07d873

33 files changed

+979
-22
lines changed

.github/workflows/main.yml

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
- name: Remove v9
4141
run: bit remove angular-v9 -s -f
4242

43+
- name: Remove v8
44+
run: bit remove angular-v8 -s -f
45+
4346
- name: Add example app
4447
run: bit add examples/demo-lib-v12
4548

@@ -92,6 +95,9 @@ jobs:
9295
- name: Remove v9
9396
run: bit remove angular-v9 -s -f
9497

98+
- name: Remove v8
99+
run: bit remove angular-v8 -s -f
100+
95101
- name: Add example app
96102
run: bit add examples/demo-lib-v11
97103

@@ -144,6 +150,9 @@ jobs:
144150
- name: Remove v9
145151
run: bit remove angular-v9 -s -f
146152

153+
- name: Remove v8
154+
run: bit remove angular-v8 -s -f
155+
147156
- name: Add example app
148157
run: bit add examples/demo-lib-v10
149158

@@ -196,6 +205,9 @@ jobs:
196205
- name: Remove v10
197206
run: bit remove angular-v10 -s -f
198207

208+
- name: Remove v8
209+
run: bit remove angular-v8 -s -f
210+
199211
- name: Add example app
200212
run: bit add examples/demo-lib-v9
201213

@@ -212,7 +224,62 @@ jobs:
212224

213225
# Compile the example component
214226
- name: Bit compile example
215-
run: bit compile demo-lib-v10 --log
227+
run: bit compile demo-lib-v9 --log
228+
229+
- name: Bit test
230+
run: bit test --log
231+
232+
- name: Bit build
233+
run: bit build --log
234+
235+
- uses: actions/upload-artifact@v2
236+
with:
237+
name: debug-log
238+
path: $HOME/Library/Caches/Bit/logs
239+
240+
# Test angular-v8
241+
v8:
242+
runs-on: ubuntu-latest
243+
if: "!contains(github.event.head_commit.message, 'skip-ci')"
244+
container:
245+
image: docker://bitcli/bit:latest
246+
steps:
247+
- uses: teambit/setup-action@v1
248+
with:
249+
name: angular-github-actions
250+
BIT_TOKEN: ${{ env.BIT_TOKEN }}
251+
252+
- uses: actions/checkout@v2
253+
254+
- name: Remove v12
255+
run: bit remove angular-v12 -s -f
256+
257+
- name: Remove v11
258+
run: bit remove angular-v11 -s -f
259+
260+
- name: Remove v10
261+
run: bit remove angular-v10 -s -f
262+
263+
- name: Remove v9
264+
run: bit remove angular-v9 -s -f
265+
266+
- name: Add example app
267+
run: bit add examples/demo-lib-v8
268+
269+
- name: Install dependencies
270+
run: bit install
271+
272+
# Compile the aspects
273+
- name: Bit compile aspects
274+
run: bit compile ng-packagr angular-eslint-config angular angular-v8 --log
275+
276+
# Run bit link to regenerate the package.json of the example component
277+
- name: Bit link
278+
run: bit link
279+
280+
# Compile the example component
281+
- name: Bit compile example
282+
run: bit compile demo-lib-v8 --log
216283

217284
- name: Bit test
218285
run: bit test --log

examples/demo-lib-v8/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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { NgModule } from '@angular/core';
2+
import { BitTestComponent } from './bit-test.component';
3+
import { BitTestService } from './bit-test.service';
4+
import { BitTest2Component } from './bit-test2.component';
5+
6+
@NgModule({
7+
declarations: [
8+
BitTestComponent,
9+
BitTest2Component
10+
],
11+
providers: [BitTestService],
12+
exports: [
13+
BitTestComponent,
14+
BitTest2Component
15+
]
16+
})
17+
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()
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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
entryComponents: [CompositionComponent],
12+
declarations: [CompositionComponent],
13+
imports: [BitTestModule],
14+
bootstrap: [CompositionComponent]
15+
})
16+
export class CompositionModule {
17+
}

packages/angular-v10/angular-v10.env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class AngularV10Env extends AngularEnv {
7979
'@angular/platform-browser': '~10.2.5',
8080
'@angular/platform-browser-dynamic': '~10.2.5',
8181
rxjs: '^6.6.3',
82-
'zone.js': '^0.10.3',
82+
'zone.js': '~0.10.3',
8383
typescript: '~4.0.2',
8484
},
8585
};

0 commit comments

Comments
 (0)