Skip to content

Commit

Permalink
Include web3.js in ledgers.js despite size.
Browse files Browse the repository at this point in the history
We'll wait for web3.js to get their size down.
  • Loading branch information
Jakub Ner committed May 23, 2021
1 parent 3f0c3c1 commit d3f8124
Show file tree
Hide file tree
Showing 9 changed files with 538 additions and 485 deletions.
9 changes: 7 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"presets": [
"@babel/preset-env"
["@babel/preset-env", {
"useBuiltIns": false
}]
],
"plugins": [
"@babel/plugin-proposal-class-properties"
"@babel/plugin-proposal-class-properties",
["@babel/plugin-transform-runtime", {
"regenerator": true
}]
]
}
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ This *ledgers.js* library is client-side and abstracts ledgers (see figure above

### Distributable

> **⚠ Why is it so big?**
>
> We depend on [web3.js](https://github.com/ethereum/web3.js/) which has bloat issues:
>
> https://github.com/ChainSafe/web3.js/issues/1178
>
> As soon as that gets resolved, this distro will be smaller.
The *ledgers.js* library ['dist' folder](https://github.com/overhide/ledgers.js/blob/master/dist) contains the distributable artifact.

You'll likely want to [import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) the library along with its dependencies ([web3.js](https://github.com/ethereum/web3.js/)).
Expand Down Expand Up @@ -105,13 +113,9 @@ You can include *ledgers.js* via CDN:

For a specific version, e.g. version *2.1.4*: `https://cdn.jsdelivr.net/npm/ledgers.js@2.1.4/dist/ledgers.min.js`

> The library depends on [web3.js](https://github.com/ethereum/web3.js/), as such you must include the dependency (see first line in example below).
The library can be loaded straight into your HTML and accessed by its `oh$` property in the globals:

```
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.3.4/web3.min.js" integrity="sha512-TTGImODeszogiro9DUvleC9NJVnxO6M0+69nbM3YE9SYcVe4wZp2XYpELtcikuFZO9vjXNPyeoHAhS5DHzX1ZQ==" crossorigin="anonymous"></script>
<script src="`https://cdn.jsdelivr.net/npm/ledgers.js/dist/ledgers.min.js`"></script>
<script>
Expand Down
61 changes: 60 additions & 1 deletion dist/ledgers.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ledgers.js.map

Large diffs are not rendered by default.

924 changes: 459 additions & 465 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ledgers.js",
"version": "4.4.6",
"version": "4.5.0",
"description": "JavaScript library for ledger-based authorizations :: abstracting different ledgers to be used in an application's authentication and authorization workflows.",
"engines": {
"node": ">=10.13.0"
Expand All @@ -24,11 +24,12 @@
},
"homepage": "https://github.com/overhide/ledgers.js#readme",
"dependencies": {
"web3": "1.3.4"
"web3": "1.3.6"
},
"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-transform-runtime": "7.14.3",
"@babel/preset-env": "^7.13.15",
"babel-loader": "^8.2.2",
"chai": "4.2.0",
Expand Down
1 change: 0 additions & 1 deletion play/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ledgers.js API playground</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.3.4/web3.min.js" integrity="sha512-TTGImODeszogiro9DUvleC9NJVnxO6M0+69nbM3YE9SYcVe4wZp2XYpELtcikuFZO9vjXNPyeoHAhS5DHzX1ZQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="../dist/ledgers.js"></script>

<!-- ignore below :: code pane / logging pane setup -->
Expand Down
1 change: 0 additions & 1 deletion test/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
</head>

<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.3.4/web3.min.js" integrity="sha512-TTGImODeszogiro9DUvleC9NJVnxO6M0+69nbM3YE9SYcVe4wZp2XYpELtcikuFZO9vjXNPyeoHAhS5DHzX1ZQ==" crossorigin="anonymous"></script>
<script src="../../dist/ledgers.js"></script>
<script src="https://unpkg.com/chai/chai.js"></script>
</body>
Expand Down
8 changes: 0 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ module.exports = {
plugins: [
new HardSourceWebpackPlugin()
],
externals: {
"web3": {
commonjs: "web3",
commonjs2: "web3",
amd: "web3",
root: "Web3"
}
},
module: {
rules: [
{
Expand Down

0 comments on commit d3f8124

Please sign in to comment.