Skip to content

Commit

Permalink
Merge pull request #250 from multiversx/merge_main_in_feat/erdjs12
Browse files Browse the repository at this point in the history
Merge main in feat/erdjs12
  • Loading branch information
schimih authored Jan 26, 2023
2 parents d06182d + bc2d14a commit 493ed58
Show file tree
Hide file tree
Showing 40 changed files with 476 additions and 2,878 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/erdjs.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build and Test erdjs
name: Build and Test

on:
pull_request:
branches: [ main, development ]
workflow_dispatch:

jobs:
build-erdjs:
build:

runs-on: ubuntu-latest

Expand All @@ -26,5 +26,4 @@ jobs:
- run: npm ci
- run: npm run compile
- run: npm run compile-browser
- run: npm run compile-browser-min
- run: npm test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish erdjs (alpha / beta)
name: Publish (not main)

on:
workflow_dispatch:
Expand All @@ -9,6 +9,7 @@ on:
options:
- alpha
- beta
- previous

permissions:
contents: write
Expand All @@ -27,12 +28,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo " - [npmjs](https://www.npmjs.com/package/@elrondnetwork/erdjs)" >> notes.txt
echo " - [CHANGELOG](https://github.com/ElrondNetwork/elrond-sdk-erdjs/blob/main/CHANGELOG.md)" >> notes.txt
echo "" >> notes.txt
RELEASE_TAG=v$(node -p "require('./package.json').version")
gh release create --prerelease $RELEASE_TAG --target=$GITHUB_SHA --title="$RELEASE_TAG" --generate-notes --notes-file=notes.txt
gh release create --prerelease $RELEASE_TAG --target=$GITHUB_SHA --title="$RELEASE_TAG" --generate-notes
- run: npm ci
- run: npm test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish erdjs
name: Publish

on:
workflow_dispatch:
Expand All @@ -20,12 +20,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo " - [npmjs](https://www.npmjs.com/package/@elrondnetwork/erdjs)" >> notes.txt
echo " - [CHANGELOG](https://github.com/ElrondNetwork/elrond-sdk-erdjs/blob/main/CHANGELOG.md)" >> notes.txt
echo "" >> notes.txt
RELEASE_TAG=v$(node -p "require('./package.json').version")
gh release create $RELEASE_TAG --target=$GITHUB_SHA --title="$RELEASE_TAG" --generate-notes --notes-file=notes.txt
gh release create $RELEASE_TAG --target=$GITHUB_SHA --title="$RELEASE_TAG" --generate-notes
- run: npm ci
- run: npm test
Expand Down
475 changes: 0 additions & 475 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The MIT License (MIT)

Copyright (c) 2015 Chris Kibble
Copyright (c) MultiversX

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
27 changes: 9 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
.PHONY: clean browser-tests

browser-tests: out-browser-tests/erdjs-tests-unit.js out-browser-tests/erdjs-tests-unit-min.js out-browser-tests/erdjs-tests-localnet.js out-browser-tests/erdjs-tests-devnet.js out-browser-tests/erdjs-tests-testnet.js
browser-tests: out-browser-tests/tests-unit.js out-browser-tests/tests-localnet.js out-browser-tests/tests-devnet.js out-browser-tests/tests-testnet.js

out-browser-tests/erdjs-tests-unit.js: out-tests
npx browserify $(shell find out-tests -type f -name '*.js' ! -name '*.net.spec.*') --require buffer/:buffer -o out-browser-tests/erdjs-tests-unit.js --standalone erdjs-tests -p esmify
out-browser-tests/tests-unit.js: out-tests
npx browserify $(shell find out-tests -type f -name '*.js' ! -name '*.net.spec.*') --require buffer/:buffer -o out-browser-tests/tests-unit.js --standalone tests -p esmify

out-browser-tests/erdjs-tests-unit-min.js: out-tests
npx browserify $(shell find out-tests -type f -name '*.js' ! -name '*.net.spec.*') --require buffer/:buffer -o out-browser-tests/erdjs-tests-unit-min.js --standalone erdjs-tests -p esmify -p tinyify
out-browser-tests/tests-localnet.js: out-tests
npx browserify $(shell find out-tests -type f -name '*.js' ! -name '*.spec.*') $(shell find out-tests -type f -name '*.local.net.spec.js') --require buffer/:buffer -o out-browser-tests/tests-localnet.js --standalone tests -p esmify

out-browser-tests/erdjs-tests-localnet.js: out-tests
npx browserify $(shell find out-tests -type f -name '*.js' ! -name '*.spec.*') $(shell find out-tests -type f -name '*.local.net.spec.js') --require buffer/:buffer -o out-browser-tests/erdjs-tests-localnet.js --standalone erdjs-tests -p esmify
out-browser-tests/tests-devnet.js: out-tests
npx browserify $(shell find out-tests -type f -name '*.js' ! -name '*.spec.*') $(shell find out-tests -type f -name '*.dev.net.spec.js') --require buffer/:buffer -o out-browser-tests/tests-devnet.js --standalone tests -p esmify

out-browser-tests/erdjs-tests-devnet.js: out-tests
npx browserify $(shell find out-tests -type f -name '*.js' ! -name '*.spec.*') $(shell find out-tests -type f -name '*.dev.net.spec.js') --require buffer/:buffer -o out-browser-tests/erdjs-tests-devnet.js --standalone erdjs-tests -p esmify

out-browser-tests/erdjs-tests-testnet.js: out-tests
npx browserify $(shell find out-tests -type f -name '*.js' ! -name '*.spec.*') $(shell find out-tests -type f -name '*.test.net.spec.js') --require buffer/:buffer -o out-browser-tests/erdjs-tests-testnet.js --standalone erdjs-tests -p esmify
out-browser-tests/tests-testnet.js: out-tests
npx browserify $(shell find out-tests -type f -name '*.js' ! -name '*.spec.*') $(shell find out-tests -type f -name '*.test.net.spec.js') --require buffer/:buffer -o out-browser-tests/tests-testnet.js --standalone tests -p esmify

out-tests:
npx tsc -p tsconfig.tests.json

publish-erdjs-beta:
npm publish --tag=beta --access=public

publish-erdjs:
npm publish --access=public

clean:
rm -rf out-tests
rm -rf out-browser-tests
24 changes: 9 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
# Elrond SDK for JavaScript
# MultiversX SDK for JavaScript and TypeScript

Elrond SDK for JavaScript and TypeScript (written in TypeScript).
MultiversX SDK for JavaScript and TypeScript (written in TypeScript).

## Documentation

- [Cookbook](https://docs.elrond.com/sdk-and-tools/erdjs/erdjs-cookbook/)
- [TypeDoc](https://elrondnetwork.github.io/elrond-sdk-docs/erdjs/latest)

## CHANGELOG

[CHANGELOG](CHANGELOG.md)
- [Cookbook](https://docs.multiversx.com/sdk-and-tools/erdjs/erdjs-cookbook/)

## Distribution

[npm](https://www.npmjs.com/package/@elrondnetwork/erdjs)
[npm](https://www.npmjs.com/package/@multiversx/sdk-core)

## Installation

`erdjs` is delivered via **npm** and it can be installed as follows:
`sdk-core` is delivered via **npm** and it can be installed as follows:

```
npm install @elrondnetwork/erdjs
npm install @multiversx/sdk-core
```

## Development
Expand All @@ -29,21 +24,20 @@ Feel free to skip this section if you are not a contributor.

### Prerequisites

`browserify` is required to compile the browser-friendly versions of `erdjs`. It can be installed as follows:
`browserify` is required to compile the browser-friendly versions of `sdk-core`. It can be installed as follows:

```
npm install --global browserify
```

### Building the library

In order to compile `erdjs`, run the following:
In order to compile the library, run the following:

```
npm install
npm run compile
npm run compile-browser
npm run compile-browser-min
```

### Running the tests
Expand All @@ -69,4 +63,4 @@ In order to run the tests **in the browser**, do as follows:
make clean && npm run browser-tests
```

For the `localnet` tests, make sure you have a *local testnet* up & running. A *local testnet* can be started from the Elrond IDE or from [erdpy](https://docs.elrond.com/developers/setup-local-testnet/).
For the `localnet` tests, make sure you have a *local testnet* up & running. In order to start a *local testnet*, follow [this](https://docs.multiversx.com/developers/setup-local-testnet/).
15 changes: 5 additions & 10 deletions browser-tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<base href="../" />
<meta charset="utf-8">
<title>Run erdjs Tests in the Browser</title>
<title>Run Tests in the Browser</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="/node_modules/mocha/mocha.css">
</head>
Expand All @@ -14,27 +14,22 @@
<div class="col-sm-12">
<ul id="TestChoices" class="list-group">
<li class="list-group-item">
<button class="btn btn-link" onclick="runTests('/out-browser-tests/erdjs-tests-unit.js')">
<button class="btn btn-link" onclick="runTests('/out-browser-tests/tests-unit.js')">
Unit tests
</button>
</li>
<li class="list-group-item">
<button class="btn btn-link" onclick="runTests('/out-browser-tests/erdjs-tests-unit-min.js')">
Unit tests (minified code)
</button>
</li>
<li class="list-group-item">
<button class="btn btn-link" onclick="runTests('/out-browser-tests/erdjs-tests-localnet.js')">
<button class="btn btn-link" onclick="runTests('/out-browser-tests/tests-localnet.js')">
Integration tests - local testnet
</button>
</li>
<li class="list-group-item">
<button class="btn btn-link" onclick="runTests('/out-browser-tests/erdjs-tests-devnet.js')">
<button class="btn btn-link" onclick="runTests('/out-browser-tests/tests-devnet.js')">
Integration tests - devnet
</button>
</li>
<li class="list-group-item">
<button class="btn btn-link" onclick="runTests('/out-browser-tests/erdjs-tests-testnet.js')">
<button class="btn btn-link" onclick="runTests('/out-browser-tests/tests-testnet.js')">
Integration tests - testnet
</button>
</li>
Expand Down
Loading

0 comments on commit 493ed58

Please sign in to comment.