Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an UMD fallback #104

Merged
merged 1 commit into from
Oct 30, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Publish
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
publish:
name: Publish
Expand All @@ -16,6 +17,8 @@ jobs:
node-version: current
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: npm test
- name: Publish
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
test:
name: Test
Expand All @@ -18,5 +19,7 @@ jobs:
node-version: ${{ matrix.node_version }}
- name: Install dependencies
run: npm ci --no-audit
- name: Build
run: npm run build
- name: Run tests
run: npm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
npm-debug.*
umd/index.js
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ In some use cases, however, it is required to be able to reliably work with and
Usage
-----

The class is compatible with CommonJS and AMD loaders and is exposed globally as `Long` if neither is available.
The package exports an ECMAScript module with an UMD fallback.

```javascript
```js
import Long from "long";

var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);
Expand All @@ -38,6 +38,8 @@ console.log(longVal.toString());
...
```

Note that mixing ESM and CommonJS is not recommended as it yield different classes with the same functionality.

API
---

Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,4 +423,4 @@ declare class Long {
xor(other: Long | number | string): Long;
}

export default Long;
export = Long; // compatible with `import Long from "long"`