Skip to content

Commit

Permalink
Only use yarn, fix comments (iotaledger#1953)
Browse files Browse the repository at this point in the history
* Only use yarn, fix comments

* yarn upgrade

* format

* Update readmes

* Review suggestions

* Fix comment

* More changes
  • Loading branch information
Thoralf-M authored Feb 6, 2024
1 parent f764b57 commit cd3345a
Show file tree
Hide file tree
Showing 16 changed files with 1,290 additions and 39,209 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/bindings-nodejs-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: yarn build

- name: Update Cargo.toml with git
run: sed -i 's#path = "../core"#git = "https://github.com/iotaledger/iota-sdk", rev = "'$GITHUB_SHA'"#g' Cargo.toml
run: sed -i 's#path = "../core"#git = "https://github.com/iotaledger/iota-sdk", rev = "'$GITHUB_SHA'"#g' Cargo.toml

- name: Print Cargo.toml
run: cat Cargo.toml
Expand All @@ -50,7 +50,7 @@ jobs:
shell: sh
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
run: yarn publish --access public

nodejs-binding-prebuild:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
id: prepare_release
shell: bash
run: |
echo "tag_name=iota-sdk-nodejs-v$(npm pkg get version --workspaces=false | tr -d \")" >> "$GITHUB_OUTPUT"
echo "tag_name=iota-sdk-nodejs-v$(cat package.json | jq -r '.version')" >> "$GITHUB_OUTPUT"
working-directory: bindings/nodejs

- name: Sign and notarize index.node binary (macOS arm64)
Expand All @@ -235,7 +235,7 @@ jobs:
AC_PASSWORD: ${{ secrets.ASC_PASSWORD }}
working-directory: bindings/nodejs
run: |
TAR_NAME=sdk-v$(npm pkg get version --workspaces=false | tr -d \")-napi-v6-darwin-arm64.tar.gz
TAR_NAME=sdk-v$(cat package.json | jq -r '.version')-napi-v6-darwin-arm64.tar.gz
# unpack to only get the index.node
tar -xvf prebuilds/@iota/$TAR_NAME
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bindings-wasm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ jobs:
shell: sh
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
run: yarn publish --access public

- name: Prepare Github release
id: prepare_release
run: |
yarn pack
echo "tag_name=iota-sdk-wasm-v$(npm pkg get version --workspaces=false | tr -d \")" >> "$GITHUB_OUTPUT"
echo "tag_name=iota-sdk-wasm-v$(cat package.json | jq -r '.version')" >> "$GITHUB_OUTPUT"
- name: Upload package to Github release
uses: softprops/action-gh-release@v1
Expand Down
34 changes: 12 additions & 22 deletions bindings/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@
- [Windows](#windows)
- [Getting Started](#getting-started)
- [Installation Using a Package Manager](#installation-using-a-package-manager)
- [npm](#npm)
- [Yarn](#yarn)
- [Install the Binding from Source](#install-the-binding-from-source)
- [Build nodejs bindings](#build-nodejs-bindings)
- [Client Usage](#client-usage)
- [Wallet Usage](#wallet-usage)
- [Examples](#examples)
- [API Reference](#api-reference)
- [Available Scripts](#available-scripts)
- [`npm install` or `yarn install`](#npm-install-or-yarn-install)
- [`npm run build` or `yarn build`](#npm-run-build-or-yarn-build)
- [`npm run test` or `yarn test`](#npm-run-test-or-yarn-test)
- [`npm run create-api-docs` or `yarn create-api-docs`](#npm-run-create-api-docs-or-yarn-create-api-docs)
- [`yarn install`](#yarn-install)
- [`yarn build`](#yarn-build)
- [`yarn test`](#yarn-test)
- [`yarn create-api-docs`](#yarn-create-api-docs)
- [Important Files and Directories](#important-files-and-directories)
- [Learn More](#learn-more)

Expand All @@ -44,15 +42,7 @@ an environment variable `RUSTFLAGS` to `-C target-feature=+crt-static`.

### Installation Using a Package Manager

To install the library from your package manager of choice, you only need to run the following:

#### npm

```sh
npm i @iota/sdk
```

#### Yarn:
To install the library with yarn, you only need to run the following:

```sh
yarn add @iota/sdk
Expand All @@ -70,7 +60,7 @@ This will guide you in any dependencies and running the build.
If you have already installed the project and only want to run the build, run the following:

```sh
npm run build
yarn run build
```

This command uses the [cargo-cp-artifact](https://github.com/neon-bindings/cargo-cp-artifact) utility to run the Rust
Expand Down Expand Up @@ -159,21 +149,21 @@ You can find the API reference for the Node.js bindings in the

In the project directory, you can run the following:

### `npm install` or `yarn install`
### `yarn install`

Installs the project, including running `npm run build`.
Installs the project, including running `yarn run build`.

### `npm run build` or `yarn build`
### `yarn build`

Builds the Node addon (`index.node`) from source.

### `npm run test` or `yarn test`
### `yarn test`

Runs the unit tests by calling `cargo test`. You can learn more
about [adding tests to your Rust code](https://doc.rust-lang.org/book/ch11-01-writing-tests.html) from
the [Rust book](https://doc.rust-lang.org/book/).

### `npm run create-api-docs` or `yarn create-api-docs`
### `yarn create-api-docs`

This is mainly just used to create the API docs in the [Wiki](https://github.com/iota-wiki/iota-wiki). Executed locally it will generate a `docs` folder in the current working directory with the API docs.

Expand All @@ -197,7 +187,7 @@ This is mainly just used to create the API docs in the [Wiki](https://github.com

- `package.json`

The npm [manifest file](https://docs.npmjs.com/cli/v7/configuring-npm/package-json), which informs the `npm` command.
The npm [manifest file](https://docs.npmjs.com/cli/v7/configuring-npm/package-json), which informs the `yarn` command.

- `src/`

Expand Down
Loading

0 comments on commit cd3345a

Please sign in to comment.