Skip to content

Commit

Permalink
MAJOR: Switch to ESM / modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Oct 28, 2021
1 parent 0e50ccb commit 8641039
Show file tree
Hide file tree
Showing 26 changed files with 1,939 additions and 5,736 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish
on:
push:
branches:
- main
jobs:
publish:
name: Publish
if: github.repository == 'dcodeIO/long.js'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
ref: main
- uses: dcodeIO/setup-node-nvm@master
with:
node-version: current
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
VERSION=$(npx aspublish --version)
if [ -z "$VERSION" ]; then
echo "Changes do not trigger a release"
else
echo "Publishing new version: $VERSION"
npx aspublish
fi
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test
on:
push:
branches:
- main
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node_version: ["current", "lts_latest"]
steps:
- uses: actions/checkout@v1.0.0
- uses: dcodeIO/setup-node-nvm@master
with:
node-version: ${{ matrix.node_version }}
- name: Install dependencies
run: npm ci --no-audit
- name: Run tests
run: npm test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules/
npm-debug.*
package-lock.json
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ long.js
A Long class for representing a 64 bit two's-complement integer value derived from the [Closure Library](https://github.com/google/closure-library)
for stand-alone use and extended with unsigned support.

[![npm](https://img.shields.io/npm/v/long.svg)](https://www.npmjs.com/package/long) [![Build Status](https://travis-ci.org/dcodeIO/long.js.svg)](https://travis-ci.org/dcodeIO/long.js)
[![Build Status](https://img.shields.io/github/workflow/status/dcodeIO/long.js/Test/main?label=test&logo=github)](https://github.com/dcodeIO/long.js/actions?query=workflow%3ATest) [![Publish Status](https://img.shields.io/github/workflow/status/dcodeIO/long.js/Publish/main?label=publish&logo=github)](https://github.com/dcodeIO/long.js/actions?query=workflow%3APublish) [![npm](https://img.shields.io/npm/v/long.svg?label=npm&color=007acc&logo=npm)](https://www.npmjs.com/package/long)

Background
----------
Expand All @@ -30,7 +30,7 @@ Usage
The class is compatible with CommonJS and AMD loaders and is exposed globally as `Long` if neither is available.

```javascript
var Long = require("long");
import Long from "long";

var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);

Expand Down Expand Up @@ -238,18 +238,11 @@ API
WebAssembly support
-------------------

[WebAssembly](http://webassembly.org) supports 64-bit integer arithmetic out of the box, hence a [tiny WebAssembly module](./src/wasm.wat) is used to compute operations like multiplication, division and remainder more efficiently (slow operations like division are around twice as fast), falling back to floating point based computations in JavaScript where WebAssembly is not yet supported, e.g., in older versions of node.
[WebAssembly](http://webassembly.org) supports 64-bit integer arithmetic out of the box, hence a [tiny WebAssembly module](./wasm.wat) is used to compute operations like multiplication, division and remainder more efficiently (slow operations like division are around twice as fast), falling back to floating point based computations in JavaScript where WebAssembly is not yet supported, e.g., in older versions of node.

Building
--------

To build an UMD bundle to `dist/long.js`, run:

```
$> npm install
$> npm run build
```

Running the [tests](./tests):

```
Expand Down
11 changes: 0 additions & 11 deletions bower.json

This file was deleted.

8 changes: 0 additions & 8 deletions dist/long.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/long.js.map

This file was deleted.

Loading

0 comments on commit 8641039

Please sign in to comment.