Skip to content

Commit

Permalink
Fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Restrepo committed Jan 4, 2024
1 parent 1fb1437 commit 04d7d1f
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 92 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
- uses: stateful/runme-action@v2
with:
workflows: |
install
build
test
nodejs/install
nodejs/build
nodejs/test
40 changes: 4 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,8 @@ Instead of calling commands and scripts directly as part of your CI step, link e

The action is powered by [Runme](https://runme.dev) which is a tool that helps you supercharge your markdown files.

## Node.js example
## Examples

A simple HTTP API, with the following available commands:

- install
- build
- test

---

## runme:
id: 01HJ6HRR8N3W4ZDXHWRQAW0CDR
version: v2.0

# Basic HTTP Api example

## Install dependencies

```sh {"id":"01HJW094MYMBQS4E7525NWWK5K","name":"echo"}
echo test
```

```sh {"id":"01HJW05Z7S4PVXVV8JK83CK0C2","name":"install"}
npm i
```

## Build TypeScript

```sh {"id":"01HJW05Z7S4PVXVV8JK8E8D3ZV","name":"build"}
npm run build
```

## Run tests

```sh {"id":"01HJW05Z7S4PVXVV8JK8W3QFKE","name":"test"}
npm test
```
| Name | Runbook | GitHub Workflow |
| --------------- | --------------- | --------------- |
| Basic Node.js Http Api example | [README.md](nodejs/README.md) | [nodejs.yml](.github/workflows/nodejs.yml) |
32 changes: 32 additions & 0 deletions nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@
"homepage": "https://github.com/stateful/runme-action-examples#readme",
"dependencies": {
"fastify": "^4.25.1"
},
"devDependencies": {
"@types/node": "^20.10.6",
"typescript": "^5.3.3"
}
}
12 changes: 6 additions & 6 deletions nodejs/src/server.test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { describe, it } from "node:test";
import * as assert from 'node:assert'
import * as assert from "node:assert";

import buildFastify from './server'
import buildFastify from "./server";

describe("Http API Test suite", async () => {
it("Get / route", () => {
const fastify = buildFastify();
const fastify = buildFastify();

fastify.inject(
{
method: "GET",
url: "/",
},
(err, response) => {
assert.strictEqual(err, null)
assert.strictEqual(response.statusCode, 200)
assert.strictEqual(response.statusMessage, 'OK')
assert.strictEqual(err, null);
assert.strictEqual(response.statusCode, 200);
assert.strictEqual(response.statusMessage, "OK");
}
);
});
Expand Down
41 changes: 0 additions & 41 deletions package-lock.json

This file was deleted.

6 changes: 0 additions & 6 deletions package.json

This file was deleted.

0 comments on commit 04d7d1f

Please sign in to comment.