Skip to content

Commit e26c67a

Browse files
authored
Add @ni/unit-format library (#2787)
# Pull Request ## 🀨 Rationale Moves `UnitFormat` to a standalone npm library and modifies it to be usable from both browser and node applications. ## πŸ‘©β€πŸ’» Implementation - Added `@ni/unit-format` using node esm compliant import paths - Breaking: Renamed types to align with folder layout and with nimble components naming conventions, [see discussion](#2787 (comment)). - Did regex searches for `\w+unitformat` and `\w+unitscale` which are the primary uses of the public api for missed renames ## πŸ§ͺ Testing - Added jasmine node and karma browser tests - Draft [SystemLinkShared PR](https://dev.azure.com/ni/DevCentral/_git/Skyline/pullrequest/1139993), looks like usage was well-encapsulated so trivial change ## βœ… Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. Added README and Contributing for library.
1 parent 224ec91 commit e26c67a

64 files changed

Lines changed: 908 additions & 477 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.

β€ŽREADME.mdβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ Tools and utilities hosted in the repository.
6969

7070
[![Nimble Tokens NPM version and repo link](https://img.shields.io/npm/v/@ni/nimble-tokens.svg?label=@ni/nimble-tokens)](https://www.npmjs.com/package/@ni/nimble-tokens)
7171
[![Jasmine parameterized NPM version and repo link](https://img.shields.io/npm/v/@ni/jasmine-parameterized.svg?label=@ni/jasmine-parameterized)](https://www.npmjs.com/package/@ni/jasmine-parameterized)
72+
[![Unit Format NPM version and repo link](https://img.shields.io/npm/v/@ni/unit-format.svg?label=@ni/unit-format)](https://www.npmjs.com/package/@ni/unit-format)
7273
[![XLIFF to JSON Converter for Angular NPM version and repo link](https://img.shields.io/npm/v/@ni/xliff-to-json-converter.svg?label=@ni/xliff-to-json-converter)](https://www.npmjs.com/package/@ni/xliff-to-json-converter)
7374

7475
- [`@ni/nimble-tokens`](/packages/nimble-tokens/) - Base design tokens used by the Nimble and Spright component packages.
75-
- [`@ni/jasmine-parameterized`](/packages/jasmine-parameterized/) - a utility for writing [Jasmine](https://jasmine.github.io/) parameterized tests.
76-
- [`@ni/xliff-to-json-converter`](/packages/xliff-to-json-converter/) - a utility to convert translation files from XLIFF to JSON for Angular localization.
76+
- [`@ni/jasmine-parameterized`](/packages/jasmine-parameterized/) - A utility for writing [Jasmine](https://jasmine.github.io/) parameterized tests.
77+
- [`@ni/unit-format`](/packages/unit-format/) - NumberFormat aligned library to format numbers with scaled units.
78+
- [`@ni/xliff-to-json-converter`](/packages/xliff-to-json-converter/) - A utility to convert translation files from XLIFF to JSON for Angular localization.
7779

7880
The above packages follow [Semantic Versioning](https://semver.org). Consult the `CHANGELOG.md` for each package to see the changes in each version, including instructions for adapting your application in response to breaking changes.
7981

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "major",
3+
"comment": "Breaking: `@ni/nimble-angular/pipes` unit scales renamed, i.e. `byteUnitScale` to `unitScaleByte`",
4+
"packageName": "@ni/nimble-angular",
5+
"email": "rajsite@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "major",
3+
"comment": "Breaking: Rename `NumberTextUnitFormat` to `UnitFormatNumberText`",
4+
"packageName": "@ni/nimble-components",
5+
"email": "rajsite@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "major",
3+
"comment": "First release of `@ni/unit-format` πŸŽ‰",
4+
"packageName": "@ni/unit-format",
5+
"email": "rajsite@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

0 commit comments

Comments
Β (0)