Skip to content

Commit f6f725b

Browse files
chore: prepare 1.0.0 trusted npm release
1 parent ab9663d commit f6f725b

102 files changed

Lines changed: 22820 additions & 1212 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
name: CI (non-main)
1+
name: CI
22

33
on:
44
push:
5-
branches-ignore:
5+
branches:
66
- main
77
pull_request:
8-
branches:
9-
- '**'
8+
9+
permissions:
10+
contents: read
1011

1112
jobs:
12-
build-test:
13+
library:
1314
runs-on: ubuntu-latest
1415

1516
steps:
@@ -19,14 +20,28 @@ jobs:
1920
- name: Setup Node.js
2021
uses: actions/setup-node@v4
2122
with:
22-
node-version: '20'
23-
registry-url: 'https://registry.npmjs.org'
23+
node-version: 22.x
24+
25+
- name: Enable Corepack
26+
run: corepack enable
2427

2528
- name: Install dependencies
26-
run: npm install
29+
run: pnpm install --frozen-lockfile
30+
31+
- name: Lint
32+
run: pnpm lint
2733

2834
- name: Run tests
29-
run: npm test
35+
run: pnpm test:ci
3036

3137
- name: Build library
32-
run: npm run build
38+
run: pnpm build
39+
40+
- name: Verify release package
41+
run: pnpm release:verify
42+
43+
- name: Inspect npm package contents
44+
run: pnpm pack:dry-run
45+
46+
- name: Audit production dependencies
47+
run: pnpm security:audit

.github/workflows/release.yml

Lines changed: 51 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,75 @@
1+
name: Release @angular-bootstrap/ngbootstrap
2+
13
on:
4+
release:
5+
types:
6+
- published
27
push:
3-
branches:
4-
- main
8+
tags:
9+
- 'v*.*.*'
10+
11+
permissions:
12+
contents: read
13+
id-token: write
514

615
jobs:
7-
build-test-release:
16+
publish:
17+
name: Publish to npm
818
runs-on: ubuntu-latest
9-
permissions:
10-
contents: write
11-
id-token: write # CRITICAL: This enables OIDC authentication
12-
packages: write
19+
environment: npm-production
1320

1421
steps:
1522
- name: Checkout
1623
uses: actions/checkout@v4
17-
with:
18-
fetch-depth: 0
1924

2025
- name: Setup Node.js
2126
uses: actions/setup-node@v4
2227
with:
23-
node-version: '20'
24-
registry-url: 'https://registry.npmjs.org'
25-
always-auth: true
26-
scope: '@angular-bootstrap'
28+
node-version: 22.x
29+
registry-url: https://registry.npmjs.org
2730

28-
- name: Clean dist
29-
run: rm -rf dist
31+
- name: Enable Corepack
32+
run: corepack enable
3033

3134
- name: Install dependencies
32-
run: npm install
35+
run: pnpm install --frozen-lockfile
36+
37+
- name: Lint
38+
run: pnpm lint
3339

3440
- name: Run tests
35-
run: npm test
41+
run: pnpm test:ci
3642

3743
- name: Build library
38-
run: npm run build
44+
run: pnpm build
3945

40-
- name: Publish to npm
41-
working-directory: dist/ngbootstrap
42-
env:
43-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
44-
run: npm publish --provenance --access public
46+
- name: Validate package metadata
47+
run: pnpm release:verify
4548

46-
- name: Read version
47-
id: pkg
49+
- name: Validate release tag
4850
run: |
49-
VERSION=$(node -p "require('./package.json').version")
50-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
51+
set -euo pipefail
52+
VERSION="$(node -p "require('./package.json').version")"
53+
TAG="${GITHUB_REF_NAME}"
54+
if [ "$TAG" != "v$VERSION" ]; then
55+
echo "Release tag $TAG must match package version v$VERSION."
56+
exit 1
57+
fi
5158
52-
- name: Create GitHub Release
53-
uses: actions/create-release@v1
54-
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56-
with:
57-
tag_name: v${{ steps.pkg.outputs.version }}
58-
release_name: v${{ steps.pkg.outputs.version }}
59-
generate_release_notes: true
59+
- name: Verify version is unpublished
60+
run: |
61+
set -euo pipefail
62+
VERSION="$(node -p "require('./package.json').version")"
63+
if npm view "@angular-bootstrap/ngbootstrap@$VERSION" version >/dev/null 2>&1; then
64+
echo "@angular-bootstrap/ngbootstrap@$VERSION is already published."
65+
exit 1
66+
fi
67+
68+
- name: Inspect npm package contents
69+
run: pnpm pack:dry-run
70+
71+
- name: Audit production dependencies
72+
run: pnpm security:audit
73+
74+
- name: Publish to npm
75+
run: npm publish ./dist/ngbootstrap --access public --provenance

AGENTS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# AGENTS.md
2+
3+
## Scope
4+
5+
This folder is the source for the `@angular-bootstrap/ngbootstrap` Angular library.
6+
7+
## Rules
8+
9+
- Treat `src/**` public exports, components, directives, services, inputs, outputs, and types as the source of truth.
10+
- Keep code Angular 21/22 compatible and prefer built-in control flow (`@if`, `@for`, `@switch`) in templates.
11+
- Keep Angular packages as peer dependencies. Mark optional integrations as optional peers.
12+
- Add or update focused specs for behavior changes.
13+
- Validate with the relevant Jest test and `pnpm build` before handing off.
14+
15+
## Commands
16+
17+
- `pnpm test -- <spec> --runInBand`
18+
- `pnpm build`

README.md

Lines changed: 61 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,80 @@
11
# @angular-bootstrap/ngbootstrap
22

3-
Angular UI library providing Datagrid, Drag‑and‑drop, Pagination, Stepper, Splitter, Tree, Typeahead, and Chips components with Bootstrapfriendly styling.
3+
Standalone Angular UI components with Bootstrap-friendly styling.
44

5-
## Features
5+
## What Is Included
66

7-
- Datagrid – sortable, filterable, paginated, Sticky Header/Footer, Sticky Rows, Grid Styling, editable table with export (PDF/Excel) support and accessible templates.
8-
- Drag & drop – lightweight list and item directives with keyboard‑friendly a11y helpers.
9-
- Pagination – standalone Bootstrap‑styled pagination component.
10-
- Stepper – horizontal/vertical stepper with custom labels, error states, theming hooks, and keyboard support.
11-
- Splitter – resizable horizontal/vertical panes with collapsing, keyboard resizing, and ARIA semantics.
12-
- Tree – keyboard-accessible tree with optional checkboxes, JSON-style expanders, and expand/collapse helpers.
13-
- Typeahead – Bootstrap dropdown overlay with debouncing, virtualization, single/multi select, chips/tags mode, custom templates, and Reactive Forms support.
14-
- Chips – small reusable chips/tags component used by Typeahead (can also be used standalone).
15-
- Angular + Bootstrap first – built for modern Angular (v21) and works with plain Bootstrap CSS; Material/Tailwind can be layered via custom styles.
7+
- DataGrid
8+
- Pagination
9+
- Typeahead
10+
- Tree
11+
- Splitter
12+
- Stepper
13+
- Chips
14+
- Drag and drop
1615

17-
## Installation
16+
## Requirements
1817

19-
```bash
20-
npm install @angular-bootstrap/ngbootstrap
21-
```
22-
23-
Make sure your app:
18+
- Angular `>=21.0.0 <23.0.0`
19+
- RxJS `^7.8.0`
20+
- Bootstrap CSS in the consuming app
21+
- Bootstrap Icons when icon-based examples are used
2422

25-
- Uses Angular 21 (peer deps: `>=21 <22`).
26-
- Includes Bootstrap CSS + Bootstrap Icons (for example in `angular.json` or global styles):
23+
## Install
2724

28-
```css
29-
@import 'bootstrap/dist/css/bootstrap.min.css';
30-
@import 'bootstrap-icons/font/bootstrap-icons.css';
25+
```bash
26+
npm install @angular-bootstrap/ngbootstrap bootstrap bootstrap-icons
3127
```
3228

33-
## Usage overview
34-
35-
All components are standalone, so you import them directly into your feature components.
29+
Optional integrations are installed only when you use those features:
3630

37-
Key datagrid capabilities:
38-
39-
- Sorting (`enableSorting`, `sortChange`).
40-
- Column/global filtering (`enableFiltering`, `enableGlobalFilter`, `filtersChange`).
41-
- Pagination (`enablePagination`, `pageSize`, `pageChange`).
42-
- Inline add/edit/delete (`enableAdd`, `enableEdit`, `enableDelete`, `rowAdd`, `rowSave`, `rowDelete`).
43-
- Stable row identity via `trackBy` (defaults to index).
44-
- Pluggable editing logic via `editService` (implement `NgbDatagridEditService`).
45-
- Export to PDF/Excel via `exportOptions`.
46-
47-
Export requires optional peer dependencies. Install only if you use export:
48-
49-
```sh
50-
npm install jspdf jspdf-autotable xlsx
31+
```bash
32+
npm install chart.js jspdf jspdf-autotable xlsx
5133
```
5234

53-
Stepper highlights:
54-
55-
- Horizontal/vertical variants via `orientation`.
56-
- Custom labels with the `ngbStepLabel` directive.
57-
- Label and content positioning (`labelPosition`, `contentPosition`).
58-
- Error states and messages (`errorMessage` on steps).
59-
- Controlled navigation (`allowRevisit`, `next()`, `prev()`, `reset()` and events).
60-
- Theming hooks via `theme` and CSS classes (`bootstrap`, `material`, `tailwind`).
61-
62-
Refer to the source under `src/drag-drop` and `src/datagrid`/`src/stepper` for full API details until a dedicated docs site is added.
35+
## Use
36+
37+
Import standalone components directly in your Angular component.
38+
39+
```ts
40+
import { Component } from '@angular/core';
41+
import { NgbDatagridComponent, type ColumnDef } from '@angular-bootstrap/ngbootstrap';
42+
43+
@Component({
44+
selector: 'app-users-grid',
45+
standalone: true,
46+
imports: [NgbDatagridComponent],
47+
template: `
48+
<ngb-datagrid
49+
[data]="users"
50+
[columns]="columns"
51+
[enableSorting]="true"
52+
filterable="row"
53+
[enablePagination]="true"
54+
[pageSize]="10"
55+
/>
56+
`,
57+
})
58+
export class UsersGridComponent {
59+
users = [
60+
{ id: 1, name: 'Ava Patel', role: 'Admin' },
61+
{ id: 2, name: 'Noah Chen', role: 'Editor' },
62+
];
63+
64+
columns: ColumnDef[] = [
65+
{ field: 'id', header: 'ID', type: 'number', width: 90, sortable: true },
66+
{ field: 'name', header: 'Name', type: 'text', sortable: true, filterable: true },
67+
{ field: 'role', header: 'Role', type: 'text', filterable: true },
68+
];
69+
}
70+
```
6371

6472
## Development
6573

66-
Local setup:
67-
6874
```bash
69-
npm install
70-
npm run lint
71-
npm test
72-
npm run build
75+
pnpm install
76+
pnpm test
77+
pnpm build
7378
```
7479

75-
- Build artefacts go to `dist/`.
76-
- Tests are powered by Jest + `jest-preset-angular`.
77-
78-
## Releasing
79-
80-
Releases are automated via GitHub Actions:
81-
82-
- Non‑`main` branches:
83-
- `.github/workflows/ci.yml` runs install, tests, build only.
84-
- `main` branch:
85-
- `.github/workflows/release.yml` runs install, tests, build and publishes to npm using `NPM_TOKEN` from repository secrets.
86-
87-
Recommended release flow:
88-
89-
- On your local machine:
90-
- Decide the new version (e.g. `1.1.0`).
91-
- Run `npm version minor` or `npm version patch` to bump `package.json` and create the tag.
92-
- Push the commit and tag: `git push origin main --tags`.
93-
- GitHub Actions will build and publish that tagged version to npm.
80+
Build output is written to `dist/`.

0 commit comments

Comments
 (0)