docs: add guide how to install beta version

This commit is contained in:
Timofey Gelazoniya 2025-06-16 03:39:21 +03:00
parent 3c2c049c19
commit 51b4771305
Signed by: zeldon
GPG Key ID: D99707D1FF69FAB0

View File

@ -16,13 +16,16 @@ To install `mineping`, simply run the following command:
npm i @minescope/mineping npm i @minescope/mineping
``` ```
> To install _beta_ version (if available), run: `npm i @minescope/mineping@next`
## Loading and configuration the module ## Loading and configuration the module
### ES Modules (ESM) ### ES Modules (ESM)
If you are using ES Modules, you can import the library like this: If you are using ES Modules, you can import the library like this:
```js ```js
import { pingJava, pingBedrock } from '@minescope/mineping'; import { pingJava, pingBedrock } from "@minescope/mineping";
``` ```
### CommonJS ### CommonJS
@ -31,8 +34,10 @@ import { pingJava, pingBedrock } from '@minescope/mineping';
If you cannot switch to ESM, you can use the async `import()` function from CommonJS to load `mineping` asynchronously: If you cannot switch to ESM, you can use the async `import()` function from CommonJS to load `mineping` asynchronously:
```js ```js
const pingJava = (...args) => import('@minescope/mineping').then(module => module.pingJava(...args)); const pingJava = (...args) =>
const pingBedrock = (...args) => import('@minescope/mineping').then(module => module.pingBedrock(...args)); import("@minescope/mineping").then((module) => module.pingJava(...args));
const pingBedrock = (...args) =>
import("@minescope/mineping").then((module) => module.pingBedrock(...args));
``` ```
## Usage ## Usage
@ -40,20 +45,20 @@ const pingBedrock = (...args) => import('@minescope/mineping').then(module => mo
Ping a Java server with default options: Ping a Java server with default options:
```js ```js
import { pingJava } from '@minescope/mineping'; import { pingJava } from "@minescope/mineping";
const data = await pingJava('mc.hypixel.net'); const data = await pingJava("mc.hypixel.net");
console.log(data); console.log(data);
``` ```
Ping a Bedrock server with custom options: Ping a Bedrock server with custom options:
```js ```js
import { pingBedrock } from '@minescope/mineping'; import { pingBedrock } from "@minescope/mineping";
const data = await pingBedrock('mco.mineplex.com', { const data = await pingBedrock("mco.mineplex.com", {
port: 19132, port: 19132,
timeout: 500 timeout: 500,
}); });
console.log(data); console.log(data);
``` ```