Skip to content

Commit

Permalink
feat: script
Browse files Browse the repository at this point in the history
  • Loading branch information
udayvunnam committed Mar 29, 2024
1 parent 403f2a6 commit ecd4dd9
Show file tree
Hide file tree
Showing 8 changed files with 422 additions and 151 deletions.
346 changes: 346 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@
"style": "css"
}
},
"nxCloudAccessToken": "YThmMjIzN2EtMTcyNC00MDA0LTgwYjEtYjljMDk0NjkyNzM4fHJlYWQtd3JpdGU="
"nxCloudAccessToken": "YThmMjIzN2EtMTcyNC00MDA0LTgwYjEtYjljMDk0NjkyNzM4fHJlYWQtd3JpdGU=",
"defaultProject": "material-ui"
}
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
"version": "0.0.0",
"license": "MIT",
"scripts": {
"start": "nx serve"
"start": "nx serve",
"build": "nx build xng-breadcrumb",
"build:app": "nx build material-ui",
"affected:build": "nx affected:build",
"affected:e2e": "nx affected:e2e",
"affected:lint": "nx affected:lint",
"serve-docs": "docsify serve docs"
},
"private": true,
"dependencies": {
Expand Down Expand Up @@ -68,4 +74,4 @@
"ts-node": "10.9.1",
"typescript": "~5.3.2"
}
}
}
23 changes: 23 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Checkout main branch
git checkout main

# Pull latest changes from origin main
git pull origin main

# Copy README.md to libs/xng-breadcrumb/README.md
cp README.md libs/xng-breadcrumb/README.md

# Get npm package version
VERSION=$(npm -s run env | grep npm_package_version | sed 's/npm_package_version=//')

# Change directory to libs/xng-breadcrumb and update npm version
cd libs/xng-breadcrumb
npm version "$VERSION"
cd ..

# Add changes, commit, and push to origin main
git add .
git commit -m "$VERSION"
git push origin main
7 changes: 3 additions & 4 deletions xng-breadcrumb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@
"peerDependencies": {
"@angular/common": "^17.2.0",
"@angular/core": "^17.2.0",
"@angular/router": "^17.2.0"
},
"dependencies": {
"tslib": "^2.3.0"
"@angular/router": "^17.2.0",
"rxjs": "*"
},
"dependencies": {},
"sideEffects": false
}
28 changes: 5 additions & 23 deletions xng-breadcrumb/src/lib/breadcrumb.component.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<nav aria-label="breadcrumb" class="xng-breadcrumb-root" [ngClass]="class">
<ol class="xng-breadcrumb-list">
<ng-container
*ngFor="
let breadcrumb of breadcrumbs$ | async;
last as isLast;
first as isFirst;
index as index;
count as count
"
>
<ng-container *ngFor="let breadcrumb of breadcrumbs$ | async; last as isLast; first as isFirst; index as index; count as count">
<li class="xng-breadcrumb-item">
<a
*ngIf="!isLast"
Expand All @@ -17,14 +9,8 @@
[attr.aria-disabled]="breadcrumb.disable"
[attr.tabIndex]="breadcrumb.disable ? -1 : 0"
rel="noopener noreferrer"
[routerLink]="
breadcrumb.routeInterceptor
? breadcrumb.routeInterceptor(breadcrumb.routeLink, breadcrumb)
: breadcrumb.routeLink
"
[queryParams]="
preserveQueryParams ? breadcrumb.queryParams : undefined
"
[routerLink]="breadcrumb.routeInterceptor ? breadcrumb.routeInterceptor(breadcrumb.routeLink, breadcrumb) : breadcrumb.routeLink"
[queryParams]="preserveQueryParams ? breadcrumb.queryParams : undefined"
[fragment]="preserveFragment ? breadcrumb.fragment : undefined"
[target]="anchorTarget ? anchorTarget : '_self'"
>
Expand All @@ -41,9 +27,7 @@
}
"
></ng-container>
<ng-container *ngIf="!itemTemplate">{{
breadcrumb.label
}}</ng-container>
<ng-container *ngIf="!itemTemplate">{{ breadcrumb.label }}</ng-container>
</a>

<label *ngIf="isLast" class="xng-breadcrumb-trail">
Expand All @@ -60,9 +44,7 @@
}
"
></ng-container>
<ng-container *ngIf="!itemTemplate">{{
breadcrumb.label
}}</ng-container>
<ng-container *ngIf="!itemTemplate">{{ breadcrumb.label }}</ng-container>
</label>
</li>

Expand Down
14 changes: 2 additions & 12 deletions xng-breadcrumb/src/lib/breadcrumb.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
Component,
ContentChild,
Input,
OnInit,
TemplateRef,
ViewEncapsulation,
} from '@angular/core';
import { Component, ContentChild, Input, OnInit, TemplateRef, ViewEncapsulation } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, RouterModule } from '@angular/router';
import { Observable, map } from 'rxjs';
Expand Down Expand Up @@ -90,10 +83,7 @@ export class BreadcrumbComponent implements OnInit {
setupMessage = 'not set up yet';
someParameterValue = null;

constructor(
private breadcrumbService: BreadcrumbService,
activateRoute: ActivatedRoute
) {
constructor(private breadcrumbService: BreadcrumbService, activateRoute: ActivatedRoute) {
// breadcrumb inside ngIf works only this way
activateRoute.params.subscribe((params) => {
this.setupComponent(params['someParam']);
Expand Down
Loading

0 comments on commit ecd4dd9

Please sign in to comment.