Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve documentation #213

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ bun add -d poku
</td>
<td width="400">

```ts
import { poku } from 'npm:poku';
```bash
deno add npm:poku
```

</td>
Expand All @@ -124,7 +124,7 @@ import { poku } from 'npm:poku';
<table>
<tr>
<td>
<em><code>test/file.test.js</code></em>
<em><code>test/file.test.mjs</code></em>
</td>
</tr>
<tr>
Expand All @@ -140,7 +140,8 @@ assert(true, 'Poku will describe it 🐷');
</tr>
</table>

> Note that these examples use [**ESM**](https://poku.io/docs/examples/cjs-esm), but you can use [**CJS**](https://poku.io/docs/examples/cjs-esm) as well.
- Change from `.mjs` to `.js` by defining `"type": "module"` in your _package.json_.
- Note that these examples use [**ESM**](https://poku.io/docs/examples/cjs-esm), but you can use [**CJS**](https://poku.io/docs/examples/cjs-esm) as well.

### Run it 🚀

Expand Down
22 changes: 4 additions & 18 deletions website/docs/documentation/assert/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,10 @@ It supports both [**Bun**][bun-version-url] and [**Deno**][deno-version-url].

_But only if you want to, of course._

<Tabs>
<TabItem default value='Node.js, TypeScript (Node.js) and Bun'>

```diff
- import assert from 'node:assert';
+ import { assert } from 'poku';
```

</TabItem>
<TabItem value='Deno'>

```diff
- import assert from 'node:assert';
+ import { assert } from 'npm:poku';
```

</TabItem>
</Tabs>
```diff
- import assert from 'node:assert';
+ import { assert } from 'poku';
```

```ts
assert(true, "It's true 🧪");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Since `test` is completely optional on **Poku**, you can use `beforeEach`, `afte

:::info

- Although `beforeEach` and `afterEach` accepts local variables changes, it's strongly encouraged ([_you can use a mock instead_](/docs/category/mock)).
- Although `beforeEach` and `afterEach` accepts local variables changes, it's discouraged ([_you can use a mock instead_](/docs/category/mock)).

See why (_note the `immediate` option_):

Expand Down Expand Up @@ -206,7 +206,7 @@ You can overwriting both `beforeEach` and `afterEach` by declaring them again an

:::info

- Although `beforeEach` and `afterEach` accepts local variables changes, it's strongly encouraged ([_you can use a mock instead_](/docs/category/mock)).
- Although `beforeEach` and `afterEach` accepts local variables changes, it's discouraged ([_you can use a mock instead_](/docs/category/mock)).

See why (_note the `immediate` option_):

Expand Down
2 changes: 1 addition & 1 deletion website/docs/documentation/startScript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ By defining a timeout, you avert indefinite processes that conclude neither in s
You don't necessarily have to end your service running in the background as the last line of the test, if it's no longer used.

```ts
import { startScript } from 'poku'; // 'npm:poku' for Deno
import { startScript } from 'poku';

const server = await startScript('start', {
/**
Expand Down
2 changes: 1 addition & 1 deletion website/docs/documentation/startService.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ By defining a timeout, you avert indefinite processes that conclude neither in s
You don't necessarily have to end your service running in the background as the last line of the test, if it's no longer used.

```ts
import { startService } from 'poku'; // 'npm:poku' for Deno
import { startService } from 'poku';

const server = await startService('server.js', {
/**
Expand Down
2 changes: 1 addition & 1 deletion website/docs/examples/local-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ And now, test it:
<TabItem default value='test/server.test.js'>

```js
import { assert, startService } from 'poku'; // 'npm:poku' for Deno
import { assert, startService } from 'poku';

const server = await startService('server.js', {
// Wait for the "ready" console output
Expand Down
24 changes: 5 additions & 19 deletions website/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,8 @@ bun add -d poku
</TabItem>
<TabItem value='Deno'>

```ts
import { poku } from 'npm:poku';
```

You can also use **Poku** with [**esm.sh**](https://esm.sh):

```ts
import { poku } from 'https://esm.sh/poku';
```bash
deno add npm:poku
```

</TabItem>
Expand All @@ -145,27 +139,19 @@ import { poku } from 'https://esm.sh/poku';
### **Test it** 🔬

<Tabs>
<TabItem default value='test/file.test.js'>
<TabItem default value='test/file.test.mjs'>

```ts
import { assert } from 'poku';

assert(true, 'Poku will describe it 🐷');
```

</TabItem>
<TabItem default value='test/file.test.ts (Deno)'>

```ts
import { assert } from 'npm:poku';

assert(true, 'Poku will describe it 🐷');
```

</TabItem>
</Tabs>

> Note that these examples use [**ESM**](/docs/examples/cjs-esm), but you can use [**CJS**](/docs/examples/cjs-esm) as well.
- Change from `.mjs` to `.js` by defining `"type": "module"` in your _package.json_.
- Note that these examples use [**ESM**](/docs/examples/cjs-esm), but you can use [**CJS**](/docs/examples/cjs-esm) as well.

### **Run it** 🚀

Expand Down
3 changes: 1 addition & 2 deletions website/docs/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import ASSERT_NODE from '@site/static/img/assert-node.png';
> Compatible with **Node.js**, **Bun** and **Deno**.
```ts
import { assert } from 'poku'; // Node and Bun
import { assert } from 'npm:poku'; // Deno
import { assert } from 'poku';

const actual = '1';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,8 @@ bun add -d poku
</TabItem>
<TabItem value='Deno'>

```ts
import { poku } from 'npm:poku';
```

Você também pode usar o **Poku** via [**esm.sh**](https://esm.sh):

```ts
import { poku } from 'https://esm.sh/poku';
```bash
deno add npm:poku
```

</TabItem>
Expand All @@ -144,7 +138,7 @@ import { poku } from 'https://esm.sh/poku';
### **Teste** 🔬

<Tabs>
<TabItem default value='test/file.test.js'>
<TabItem default value='test/file.test.mjs'>

```ts
import { assert } from 'poku';
Expand All @@ -155,7 +149,8 @@ assert(true, 'Poku irá descrever isso 🐷');
</TabItem>
</Tabs>

> Note que os exemplos são baseados em [**ESM**](/docs/examples/cjs-esm), mas você pode usar [**CJS**](/docs/examples/cjs-esm) normalmente.
- Troque a extensão de `.mjs` para `.js` ao definir `"type": "module"` em seu _package.json_.
- Note que os exemplos são baseados em [**ESM**](/docs/examples/cjs-esm), mas você pode usar [**CJS**](/docs/examples/cjs-esm) normalmente.

### **Execute** 🚀

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ O **Poku** também inclui o método `assert`, mantendo tudo como sempre foi, mas
> Compatível com **Node.js**, **Bun** e **Deno**.

```ts
import { assert } from 'poku'; // Node e Bun
import { assert } from 'npm:poku'; // Deno
import { assert } from 'poku';

const actual = '1';

Expand Down
Loading