-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
US-236: Adding PNPM workspaces to publish to npm (#127)
* Updating Zilliqa JS * Renaming workspace file * Updating bazel workspace * Adding code 429 (rate limiting error) as acceptable for markdown URL checking * Updating packages.json * Removing referrer * Silencing unused variable warning * Settting release candidate to 0 * Updating README * Updating package.json * Updating config * Updates * Package update * Fixing build * Fixing build * Adding commonjs * Fixing distribution * Finalising rc-3 * Formatting README
- Loading branch information
Showing
66 changed files
with
10,066 additions
and
6,410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Example: Get latest block | ||
|
||
## Quickstart: Use boilerplate project | ||
|
||
1. Make sure that the library was build. From the repository root go to | ||
`zilliqa/js`. Then run | ||
|
||
```sh | ||
pnpm i -r | ||
pnpm -r build | ||
``` | ||
|
||
2. Change directory to the `latest-block` directory and install the | ||
dependencies: | ||
|
||
```sh | ||
pnpm i | ||
``` | ||
|
||
3. Build and run the script: | ||
|
||
```sh | ||
npx tsc | ||
node dist/index.js | ||
``` | ||
|
||
## Project from scratch | ||
|
||
1. Create a new directory to work in | ||
|
||
```sh | ||
mkdir zilliqa-latest-block | ||
cd zilliqa-latest-block | ||
``` | ||
|
||
2. Initialise the directory with npm and typescript | ||
|
||
```sh | ||
npm init | ||
npm install --save-dev typescript @types/node | ||
npx tsc --init | ||
``` | ||
|
||
3. Update `tsconfig.json`. It should look like: | ||
|
||
```json | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"outDir": "dist", | ||
"strict": true, | ||
"esModuleInterop": true | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} | ||
``` | ||
|
||
4. Create the source directory and `index.ts`: | ||
|
||
```sh | ||
mkdir src | ||
touch src/index.ts | ||
``` | ||
|
||
5. Update `index.ts` with: | ||
|
||
```ts | ||
import { Zilliqa } from "@zilliqa-js/zilliqa"; | ||
|
||
async function main() { | ||
const provider = new Zilliqa("https://api.zilliqa.com/"); | ||
const latestBlock = await provider.blockchain.getLatestTxBlock(); | ||
console.log(latestBlock); | ||
} | ||
main(); | ||
``` | ||
|
||
6. Compile and run: | ||
|
||
```sh | ||
npx tsc | ||
node dist/index.js | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "latest-block", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@types/node": "^20.2.4", | ||
"typescript": "^5.0.4" | ||
}, | ||
"dependencies": { | ||
"@zilliqa-js/account": "workspace:*", | ||
"@zilliqa-js/blockchain": "workspace:*", | ||
"@zilliqa-js/contract": "workspace:*", | ||
"@zilliqa-js/core": "workspace:*", | ||
"@zilliqa-js/crypto": "workspace:*", | ||
"@zilliqa-js/util": "workspace:*", | ||
"@zilliqa-js/zilliqa": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Zilliqa } from "@zilliqa-js/zilliqa"; | ||
|
||
async function main() { | ||
const provider = new Zilliqa("https://api.zilliqa.com/"); | ||
const latestBlock = await provider.blockchain.getLatestTxBlock(); | ||
console.log(latestBlock); | ||
} | ||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"outDir": "dist", | ||
"strict": true, | ||
"esModuleInterop": true | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.