Skip to content

Commit

Permalink
testing and cleanup (#10)
Browse files Browse the repository at this point in the history
* sort exports

* bump to valpha7

* update docs

* update exported readme

* fix selector

* remove unused code

* bump alpha version

* rename folder, and its files
  • Loading branch information
joe-s-avaya authored Feb 27, 2024
1 parent dd06699 commit 7508032
Show file tree
Hide file tree
Showing 65 changed files with 110 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
package: ./dist/neo-standalone-components/package.json
package: ./dist/examples/package.json
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The appli

## Code scaffolding

Run `ng generate component component-name --project neo-standalone-components` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project neo-standalone-components`.
Run `ng generate component component-name --project examples` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project examples`.

> Note: Don't forget to add `--project neo-standalone-components` or else it will be added to the default project in your `angular.json` file.
> Note: Don't forget to add `--project examples` or else it will be added to the default project in your `angular.json` file.
## Build

Expand Down
28 changes: 14 additions & 14 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"neo-standalone-components": {
"examples": {
"projectType": "library",
"root": "projects/neo-standalone-components",
"sourceRoot": "projects/neo-standalone-components/src",
"root": "projects/examples",
"sourceRoot": "projects/examples/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/neo-standalone-components/ng-package.json"
"project": "projects/examples/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/neo-standalone-components/tsconfig.lib.prod.json"
"tsConfig": "projects/examples/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/neo-standalone-components/tsconfig.lib.json"
"tsConfig": "projects/examples/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "projects/neo-standalone-components/tsconfig.spec.json",
"tsConfig": "projects/examples/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
Expand All @@ -38,25 +38,25 @@
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/neo-standalone-components/**/*.ts",
"projects/neo-standalone-components/**/*.html"
"projects/examples/**/*.ts",
"projects/examples/**/*.html"
]
}
},
"storybook": {
"builder": "@storybook/angular:start-storybook",
"options": {
"configDir": "projects/neo-standalone-components/.storybook",
"browserTarget": "neo-standalone-components:build",
"configDir": "projects/examples/.storybook",
"browserTarget": "examples:build",
"compodoc": false,
"port": 6006
}
},
"build-storybook": {
"builder": "@storybook/angular:build-storybook",
"options": {
"configDir": "projects/neo-standalone-components/.storybook",
"browserTarget": "neo-standalone-components:build",
"configDir": "projects/examples/.storybook",
"browserTarget": "examples:build",
"compodoc": false,
"outputDir": "storybook-static"
}
Expand All @@ -69,4 +69,4 @@
"@angular-eslint/schematics"
]
}
}
}
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
"license": "SEE LICENSE IN LICENSE.md",
"homepage": "https://design.avaya.com/docs/setup",
"scripts": {
"storybook": "ng run neo-standalone-components:storybook",
"storybook": "ng run examples:storybook",
"clean": "rm -rf .angular dist storybook-static",
"lint": "ng lint",
"format": "npx prettier --write ./projects/neo-standalone-components/src --log-level warn",
"format:check": "npx prettier --check ./projects/neo-standalone-components/src --log-level warn",
"format": "npx prettier --write ./projects/examples/src --log-level warn",
"format:check": "npx prettier --check ./projects/examples/src --log-level warn",
"build": "ng build",
"build:netlify": "npm i && npm run build && npm run build-storybook",
"build:github": "npm i && npm run lint && npm run format:check && npm run test && npm run build:release",
"build:release": "ng build neo-standalone-components --configuration production",
"build-storybook": "ng run neo-standalone-components:build-storybook",
"build:release": "ng build examples --configuration production",
"build-storybook": "ng run examples:build-storybook",
"test": "ng test --browsers ChromeHeadless --watch false",
"test:watch": "ng test",
"publish:lib": "npm publish ./dist/neo-standalone-components/",
"publish:lib": "npm publish ./dist/examples/",
"ng": "ng",
"start": "ng serve",
"watch": "ng build --watch --configuration development",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions projects/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
![github workflow status](https://github.com/avaya-dux/neo-angular-library/actions/workflows/ci.yml/badge.svg)
[![npm version](https://badge.fury.io/js/@avaya%2Fneo-angular.svg)](https://badge.fury.io/js/@avaya%2Fneo-angular)
[![Netlify Status](https://api.netlify.com/api/v1/badges/3d6c0812-28ca-4bd5-bbdf-bb2430011d28/deploy-status)](https://app.netlify.com/sites/neo-angular-library-storybook/deploys)

# Neo Angular Component Library

> This is the angular version of the shared library called "NEO" buit by Avaya ([storybook site](https://neo-angular-library-storybook.netlify.app/))
## License

Copyright 2020-2024 Avaya Inc. All Rights Reserved.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/neo-standalone-components",
"dest": "../../dist/examples",
"lib": {
"entryFile": "src/public-api.ts"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@avaya/neo-angular",
"version": "0.0.1-alpha.6",
"version": "0.0.1-alpha.8",
"description": "The component library for Avaya NEO in Angular.",
"license": "SEE LICENSE IN LICENSE.md",
"repository": "github:avaya-dux/neo-angular-library",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Input } from "@angular/core";

@Component({
selector: "lib-neo-standalone-components",
selector: "lib-neo-faux-button",
standalone: true,
template: `<button>{{ label }}</button> `,
})
Expand Down
1 change: 1 addition & 0 deletions projects/examples/src/lib/FauxButton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./faux-button.component";
1 change: 1 addition & 0 deletions projects/examples/src/lib/Static/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./static.component";
9 changes: 9 additions & 0 deletions projects/examples/src/lib/Static/static.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Component } from "@angular/core";

@Component({
selector: "lib-neo-static",
standalone: true,
imports: [],
template: ` <p>the static component works!</p> `,
})
export class StaticComponent {}
22 changes: 22 additions & 0 deletions projects/examples/src/lib/Static/static.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { StaticComponent } from "./static.component";

describe("StaticComponent", () => {
let component: StaticComponent;
let fixture: ComponentFixture<StaticComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [StaticComponent],
}).compileComponents();

fixture = TestBed.createComponent(StaticComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it("should create", () => {
expect(component).toBeTruthy();
});
});
13 changes: 13 additions & 0 deletions projects/examples/src/lib/Static/static.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from "@storybook/angular";
import { StaticComponent } from "./static.component";

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
const meta: Meta<StaticComponent> = {
title: "Example/Static Component",
component: StaticComponent,
};

export default meta;
type CustomStory = StoryObj<StaticComponent>;

export const StaticExample: CustomStory = {};
2 changes: 2 additions & 0 deletions projects/examples/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./FauxButton";
export * from "./Static";
5 changes: 5 additions & 0 deletions projects/examples/src/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* Public API Surface of examples
*/

export * from "./lib";
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion projects/neo-standalone-components/README.md

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions projects/neo-standalone-components/src/public-api.ts

This file was deleted.

9 changes: 8 additions & 1 deletion readmes/how-to-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
npm run build:release
```

## for local development, run storybook (WIP)
## for local development, run storybook

```
npm run storybook
Expand Down Expand Up @@ -43,6 +43,13 @@ npm run lint
npm run lint --fix
```

## when creating a new component

- follow the naming conventions of your team
- add a folder under the `src/lib` folder
- add an `index.ts` that exports the necessary files
- add your export to the `src/lib/index.ts`; make sure to follow the alphabetical order

## before commiting to this repo, please read

- our [accessibility guidelines](./accessibility-guidelines.md)
Expand Down
13 changes: 11 additions & 2 deletions readmes/how-to-publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ You can check that the package was properly published by viewing it on NPMJS
- [link to registry](https://registry.npmjs.org/@avaya%2fneo-angular): api call, returns JSON, no cache
- [link to npmjs page](https://www.npmjs.com/package/@avaya/neo-angular): our page on NPMJS, is on a 60min cache

If you made a mistake, you can simply `unpublish` the package via
If you made a mistake, you can simply `unpublish` the package via:

- `npm unpublish @avaya/neo-angular@<version>`
- - [see NPMJS docs](https://docs.npmjs.com/cli/v8/commands/npm-unpublish) for further details on unpublishing

## GitHub release

The final step is to add the release to GitHub
The final step is to add the release to GitHub.

- navigate to our [GitHub releases page](https://github.com/avaya-dux/neo-angular-library/releases)
- click: "Draft a new release" (top right corner)
Expand All @@ -23,3 +23,12 @@ The final step is to add the release to GitHub
- add title using format: "v0.1.0 (Jan 18th 2024)"
- click: "Auto-generate release notes"
- click: "Publish release"


## manual publishing

If you need to manually publish, such as to test an alpha release, you only to build and then publish the created distrobution.

- `npm run all`: to ensure that everything is built properly
- `npm logn`: to ensure that you are logged into NPMJS
- `npm publish ./dist/examples/`: to publish the library
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"paths": {
"neo-standalone-components": ["./dist/neo-standalone-components"]
"examples": ["./dist/examples"]
},
"esModuleInterop": true,
"sourceMap": true,
Expand Down

0 comments on commit 7508032

Please sign in to comment.