Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
overrides: [
{
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
extends: 'standard-with-typescript',
parserOptions: {
project: './tsconfig.spec.json'
},
rules: {
'@typescript-eslint/no-unused-expressions': 'off'
}
}
]
}
19 changes: 0 additions & 19 deletions .eslintrc.js

This file was deleted.

48 changes: 16 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,22 @@ name: Node.js CI
on: [push]

jobs:
test-node:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- name: Run test with Node.js ${{ matrix.node-version }}
run: npm run test-node
env:
CI: true
test-karma:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- name: Run karma tests
run: npm run test-karma
env:
CI: true
# test-node:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# node-version: [18.x]
# steps:
# - uses: actions/checkout@v2
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
# - run: npm install
# - name: Run test with Node.js ${{ matrix.node-version }}
# run: npm run test-node
# env:
# CI: true
lint:
runs-on: ubuntu-latest
strategy:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# bnid ChangeLog

## 4.0.0 -

### Changed
- **BREAKING**: Convert to Typescript (still also exports Javascript).

## 3.0.1 - 2024-01-23

### Changed
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# JavaScript Base-N Id Generator _(@digitalcredentials/bnid)_
# JS/TS Base-N Id Generator _(@digitalcredentials/bnid)_

[![Node.js CI](https://github.com/digitalcredentials/bnid/workflows/Node.js%20CI/badge.svg)](https://github.com/digitalcredentials/bnid/actions?query=workflow%3A%22Node.js+CI%22)
[![NPM Version](https://img.shields.io/npm/v/@digitalcredentials/bnid.svg)](https://npm.im/@digitalcredentials/bnid)

> A JavaScript library for Web browsers, React Native, and Node.js apps to generate random
> A Typescript/JavaScript library for Web browsers, React Native, and Node.js apps to generate random
> ids and encode and decode them using various base-N encodings.

## Table of Contents
Expand All @@ -19,15 +19,15 @@

## Background

This library provides tools for Web and Node.js to generate random ids and
encode and decode them in various base-N encodings.
This library provides tools for Web browsers, React Native, and Node.js apps to
generate random ids and encode and decode them in various base-N encodings.

## Install

### NPM

```
npm install bnid
npm install @digitalcredentials/bnid
```

### Git
Expand Down Expand Up @@ -92,7 +92,7 @@ Some setup overhead can be avoided by using the component `IdGenerator` and
`IdEncoder` classes.

```js
import {IdGenerator, IdEncoder} from 'bnid';
import { IdGenerator, IdEncoder } from 'bnid';

// 64 bit random id generator
const generator = new IdGenerator({
Expand Down
19 changes: 0 additions & 19 deletions build-dist.sh

This file was deleted.

37 changes: 13 additions & 24 deletions karma.conf.js → karma.conf.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2020-2022 Digital Bazaar, Inc. All rights reserved.
*/
module.exports = function(config) {

module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
Expand All @@ -13,7 +12,7 @@ module.exports = function(config) {

// list of files / patterns to load in the browser
files: [
'test/*.spec.js'
'test/*.spec.mjs'
],

// list of files to exclude
Expand All @@ -22,29 +21,19 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/*.js': ['webpack', 'sourcemap']
// 'tests/*.js': ['webpack', 'babel', 'sourcemap']
'test/*.mjs': ['webpack', 'sourcemap']
},

webpack: {
//mode: 'production',
mode: 'development',
devtool: 'inline-source-map',
node: {
global: true
},
resolve: {
fallback: {
url: false,
util: false,
crypto: false
}
}
devtool: 'inline-source-map'
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
//reporters: ['progress'],
// reporters: ['progress'],
reporters: ['mocha'],

// web server port
Expand All @@ -58,17 +47,17 @@ module.exports = function(config) {
// config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// enable / disable watching file and executing test whenever any
// enable / disable watching file and executing tests whenever any
// file changes
autoWatch: false,

// start these browsers
// browser launchers: https://npmjs.org/browse/keyword/karma-launcher
//browsers: ['ChromeHeadless', 'Chrome', 'Firefox', 'Safari'],
// browsers: ['ChromeHeadless', 'Chrome', 'Firefox', 'Safari'],
browsers: ['ChromeHeadless'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the test and exits
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
Expand All @@ -81,8 +70,8 @@ module.exports = function(config) {
// increase from default 2s
timeout: 10000,
reporter: 'html'
//delay: true
// delay: true
}
}
});
};
})
}
4 changes: 0 additions & 4 deletions lib/baseX.js

This file was deleted.

21 changes: 0 additions & 21 deletions lib/util-browser.js

This file was deleted.

19 changes: 0 additions & 19 deletions lib/util-reactnative.js

This file was deleted.

17 changes: 0 additions & 17 deletions lib/util.js

This file was deleted.

Loading