Skip to content

Commit

Permalink
Merge pull request #3 from RebeccaStevens/uom-types
Browse files Browse the repository at this point in the history
feat: increase the exponent range to +-12
feat: add predefined units
feat: add conversion functions
build: cleanup build process

BREAKING CHANGE: Extra details of a unit, such as its scalar factor, are now stored as part of the unit's meta, not on a subcomponent of the unit.

BREAKING CHANGE: "si-units" submodule removed. It has been replaced by "units".
  • Loading branch information
RebeccaStevens committed Aug 7, 2023
1 parent 5d81095 commit d6f0c76
Show file tree
Hide file tree
Showing 221 changed files with 11,202 additions and 1,889 deletions.
12 changes: 0 additions & 12 deletions .c8rc.json

This file was deleted.

33 changes: 32 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
"**/*.json",
"**/*.jsonc",
"**/CHANGELOG.md",
"**/.type-coverage/**",
"**/coverage/**",
"**/coverage-ts/**",
"**/dist/**",
"**/docs/generated/**",
"**/node_modules/**",
"pnpm-lock.yaml"
],
Expand All @@ -34,26 +37,54 @@
"\\(#.+?\\)"
],
"words": [
"atto",
"bar",
"baz",
"centi",
"corge",
"deci",
"deka",
"exa",
"femto",
"foo",
"fred",
"garply",
"giga",
"gradian",
"gradians",
"grault",
"hecto",
"kilo",
"litecoin",
"mega",
"micro",
"milli",
"monero",
"nano",
"noreply",
"peta",
"pico",
"plugh",
"quecto",
"quetta",
"quux",
"qux",
"Rebecca",
"rebeccastevens",
"ronna",
"ronto",
"sonarjs",
"subvalue",
"subvalues",
"tera",
"thud",
"typesafe",
"waldo",
"xyzzy"
"xyzzy",
"yocto",
"yotta",
"zepto",
"zetta"
],
"overrides": [
{
Expand Down
44 changes: 32 additions & 12 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,33 @@
"parserOptions": {
"project": ["./tsconfig.json"]
},
"ignorePatterns": ["/coverage/", "/dist/"],
"ignorePatterns": [
"/.type-coverage/",
"/coverage/",
"/coverage-ts/",
"/docs/generated/",
"/dist/",
"/src/exponents.ts",
"/src/units/converters/prefixes.ts",
"/src/units/modifiers/prefixes.ts"
],
"rules": {
"@typescript-eslint/naming-convention": "off",
"import/extensions": "off",
"n/no-extraneous-import": "off"
"jsdoc/check-tag-names": [
"error",
{
"definedTags": ["category", "group", "symbol"]
}
],
"n/no-extraneous-import": "off",
"unicorn/no-empty-file": "warn"
},
"overrides": [
{
"files": ["src/base/**/*"],
"rules": {
"@typescript-eslint/naming-convention": "off"
}
},
{
"files": ["**/*.test.ts"],
"plugins": ["ava"],
"extends": ["plugin:ava/recommended", "plugin:functional/off"],
"plugins": ["vitest"],
"extends": ["plugin:vitest/recommended", "plugin:functional/off"],
"rules": {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unsafe-argument": "off",
Expand All @@ -40,9 +51,18 @@
}
},
{
"files": ["**/*.test-d.ts"],
"files": ["./**/*.md/**"],
"parserOptions": {
"project": null
},
"extends": [
"plugin:markdown/recommended",
"plugin:@typescript-eslint/disable-type-checked",
"plugin:functional/off"
],
"rules": {
"import/no-useless-path-segments": "off"
"@typescript-eslint/no-unused-vars": "off",
"unicorn/filename-case": "off"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
workflow_call:

jobs:
build_node:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
- run: pnpm run build:node
- run: pnpm run build
1 change: 1 addition & 0 deletions .github/workflows/lint-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
- run: pnpm run generate-files
- run: pnpm run lint:js
1 change: 1 addition & 0 deletions .github/workflows/lint-knip-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
- run: pnpm run generate-files
- run: pnpm run lint:knip:development
1 change: 1 addition & 0 deletions .github/workflows/lint-knip-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
- run: pnpm run generate-files
- run: pnpm run lint:knip:production
86 changes: 86 additions & 0 deletions .github/workflows/release-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Release Docs

on:
workflow_dispatch:
workflow_call:

permissions:
contents: write
pages: write
id-token: write

concurrency:
group: Release Docs
cancel-in-progress: false

jobs:
get_old_docs:
runs-on: ubuntu-latest
steps:
- name: get the gh-pages repo
uses: actions/checkout@v3
with:
ref: gh-pages
continue-on-error: true

- name: tar the existing docs
run: |
mkdir -p ./docs/generated
tar -cvf old-docs.tar ./docs/generated
- name: create a document artifact
uses: actions/upload-artifact@v3
with:
name: old-docs
path: old-docs.tar

update_and_deploy_docs:
needs: get_old_docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout src
uses: actions/checkout@v3

- uses: ./.github/actions/prepare

- run: mkdir -p ./docs/generated
- name: Download the existing documents artifact
uses: actions/download-artifact@v3
with:
name: old-docs

- run: tar -xf old-docs.tar ./docs/generated -C ./docs/generated

- name: Build docs
run: pnpm run docs

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./docs/generated

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

- run: 'echo "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: ''{ print $2 }'' | sed ''s/[", ]//g'')" >> $GITHUB_ENV'
- name: Update Coverage Badge
run: cp ./docs/generated/v$PACKAGE_VERSION/coverage.svg ./docs/coverage.svg

- id: coverage_changed
run: echo "coverage_changed=$(git status --porcelain -u | grep -c docs/coverage.svg)" >> "$GITHUB_OUTPUT"

- id: push_coverage
env:
COVERAGE_CHANGED: ${{ steps.coverage_changed.outputs.coverage_changed }}
UP_TO_DATE: ${{ github.ref == 'refs/heads/main' }}
run: echo "push_coverage=$(if [[ "$COVERAGE_CHANGED" != '0' && "$UP_TO_DATE" == "true" ]] ; then echo '1' ; else echo '0' ; fi)" >> "$GITHUB_OUTPUT"

- if: steps.push_coverage.outputs.push_coverage != '0'
run: |
git add docs/coverage.svg
git commit -m "docs: updated documentation coverage"
git push
14 changes: 11 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
- test_types
- type_check
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -53,8 +55,14 @@ jobs:
- name: Build
run: pnpm run build

- name: Release
run: pnpm run release
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
id: semantic
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

release_docs:
needs: release
if: needs.release.outputs.new_release_published == 'true'
uses: ./.github/workflows/release-docs.yml
1 change: 1 addition & 0 deletions .github/workflows/test-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
- run: pnpm run generate-files
- run: pnpm run test:js
- uses: codecov/codecov-action@v3
7 changes: 4 additions & 3 deletions .github/workflows/test-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ on:
workflow_call:

jobs:
test_js:
test_types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
- run: BUILD_TYPES_ONLY=1 pnpm run build
- run: pnpm run generate-files
- run: pnpm run build
- run: pnpm run test:types
- uses: codecov/codecov-action@v3
- run: pnpm run test:types-coverage
1 change: 1 addition & 0 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
- run: pnpm run generate-files
- run: pnpm run type-check
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
node_modules/

/.type-coverage/
/coverage/
/coverage-ts/
/dist/

*.log

# Autogen files
/docs/generated/
/docs/coverage.svg
/src/exponents.ts
/src/units/converters/prefixes.ts
/src/units/modifiers/prefixes.ts
11 changes: 10 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/CHANGELOG.md
/coverage
/.type-coverage/
/coverage/
/coverage-ts/
/dist/
/pnpm-lock.yaml

# Autogen files
/docs/generated/
/docs/coverage.svg
/src/exponents.ts
/src/units/converters/prefixes.ts
/src/units/modifiers/prefixes.ts

0 comments on commit d6f0c76

Please sign in to comment.