Skip to content

Commit 5632759

Browse files
authored
feat(sandbox): create the sandox-angular-lib project (ARCH-285) (#2848)
1 parent ca25d15 commit 5632759

16 files changed

+181
-3
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
<app-nx-welcome></app-nx-welcome> <router-outlet></router-outlet>
1+
<app-nx-welcome></app-nx-welcome>
2+
<sandbox-angular-lib></sandbox-angular-lib>
3+
<router-outlet></router-outlet>

apps/sandbox/angular-app/src/app/app.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { Component } from '@angular/core';
22
import { RouterModule } from '@angular/router';
33
import { NxWelcomeComponent } from './nx-welcome.component';
4+
import { SandboxAngularLibComponent } from '@sagebionetworks/sandbox-angular-lib';
45

56
@Component({
67
standalone: true,
7-
imports: [NxWelcomeComponent, RouterModule],
8+
imports: [NxWelcomeComponent, RouterModule, SandboxAngularLibComponent],
89
selector: 'app-root',
910
templateUrl: './app.component.html',
1011
styleUrl: './app.component.scss',
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"extends": ["../../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
8+
"rules": {
9+
"@angular-eslint/directive-selector": [
10+
"error",
11+
{
12+
"type": "attribute",
13+
"prefix": "sandbox",
14+
"style": "camelCase"
15+
}
16+
],
17+
"@angular-eslint/component-selector": [
18+
"error",
19+
{
20+
"type": "element",
21+
"prefix": "sandbox",
22+
"style": "kebab-case"
23+
}
24+
]
25+
}
26+
},
27+
{
28+
"files": ["*.html"],
29+
"extends": ["plugin:@nx/angular-template"],
30+
"rules": {}
31+
}
32+
]
33+
}

libs/sandbox/angular-lib/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# sandbox-angular-lib
2+
3+
This library was generated with [Nx](https://nx.dev).
4+
5+
## Running unit tests
6+
7+
Run `nx test sandbox-angular-lib` to execute the unit tests.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export default {
2+
displayName: 'sandbox-angular-lib',
3+
preset: '../../../jest.preset.js',
4+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
5+
coverageDirectory: '../../../coverage/libs/sandbox/angular-lib',
6+
transform: {
7+
'^.+\\.(ts|mjs|js|html)$': [
8+
'jest-preset-angular',
9+
{
10+
tsconfig: '<rootDir>/tsconfig.spec.json',
11+
stringifyContentPathRegex: '\\.(html|svg)$',
12+
},
13+
],
14+
},
15+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
16+
snapshotSerializers: [
17+
'jest-preset-angular/build/serializers/no-ng-attributes',
18+
'jest-preset-angular/build/serializers/ng-snapshot',
19+
'jest-preset-angular/build/serializers/html-comment',
20+
],
21+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "sandbox-angular-lib",
3+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "libs/sandbox/angular-lib/src",
5+
"prefix": "lib",
6+
"projectType": "library",
7+
"tags": [],
8+
"targets": {
9+
"test": {
10+
"executor": "@nx/jest:jest",
11+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
12+
"options": {
13+
"jestConfig": "libs/sandbox/angular-lib/jest.config.ts"
14+
}
15+
},
16+
"lint": {
17+
"executor": "@nx/eslint:lint"
18+
}
19+
}
20+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './lib/sandbox-angular-lib/sandbox-angular-lib.component';

libs/sandbox/angular-lib/src/lib/sandbox-angular-lib/sandbox-angular-lib.component.css

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>sandbox-angular-lib works!</p>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { SandboxAngularLibComponent } from './sandbox-angular-lib.component';
3+
4+
describe('SandboxAngularLibComponent', () => {
5+
let component: SandboxAngularLibComponent;
6+
let fixture: ComponentFixture<SandboxAngularLibComponent>;
7+
8+
beforeEach(async () => {
9+
await TestBed.configureTestingModule({
10+
imports: [SandboxAngularLibComponent],
11+
}).compileComponents();
12+
13+
fixture = TestBed.createComponent(SandboxAngularLibComponent);
14+
component = fixture.componentInstance;
15+
fixture.detectChanges();
16+
});
17+
18+
it('should create', () => {
19+
expect(component).toBeTruthy();
20+
});
21+
});

0 commit comments

Comments
 (0)