Skip to content
Open
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
61 changes: 33 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,43 @@ name: Node.js CI

on:
push:
branches: [ master, develop ]
branches: [master, develop]
pull_request:
branches: [ master, develop ]
branches: [master, develop]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: nodejs/package-lock.json

- name: Install dependencies
working-directory: nodejs
run: npm ci

- name: Run lint
working-directory: nodejs
run: npm run lint

- name: Build
working-directory: nodejs
run: npm run build

- name: Run tests
working-directory: nodejs
env:
HACKMD_ACCESS_TOKEN: "test_token_123456789"
run: npm test
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10.33.2

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: "pnpm"
cache-dependency-path: nodejs/pnpm-lock.yaml

- name: Install dependencies
working-directory: nodejs
run: pnpm install --frozen-lockfile

- name: Run lint
working-directory: nodejs
run: pnpm lint

- name: Build
working-directory: nodejs
run: pnpm build

- name: Run tests
working-directory: nodejs
env:
HACKMD_ACCESS_TOKEN: "test_token_123456789"
run: pnpm test
15 changes: 10 additions & 5 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10.33.2

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: nodejs/package-lock.json
node-version: 24
cache: "pnpm"
cache-dependency-path: nodejs/pnpm-lock.yaml

- name: Install dependencies
working-directory: nodejs
run: npm ci
run: pnpm install --frozen-lockfile

- name: Run e2e tests
working-directory: nodejs
Expand All @@ -33,4 +38,4 @@ jobs:
echo "::error::Add repository secret HACKMD_E2E_ACCESS_TOKEN (a valid API token for the target environment)."
exit 1
fi
npm run test:e2e
pnpm test:e2e
40 changes: 25 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,30 @@ jobs:
steps:
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10.33.2

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: nodejs/package-lock.json
node-version: 24
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
cache-dependency-path: nodejs/pnpm-lock.yaml

- name: Install dependencies
working-directory: nodejs
run: npm ci
run: pnpm install --frozen-lockfile

- name: Build
working-directory: nodejs
run: npm run build
run: pnpm build

- name: Publish to NPM
working-directory: nodejs
run: npm publish --access public
run: pnpm publish --access public

- name: Extract version from tag
run: |
Expand All @@ -62,17 +67,22 @@ jobs:
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10.33.2

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: nodejs/package-lock.json
node-version: 24
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
cache-dependency-path: nodejs/pnpm-lock.yaml

- name: Install dependencies
working-directory: nodejs
run: npm ci
run: pnpm install --frozen-lockfile

- name: Configure Git
run: |
Expand All @@ -88,15 +98,15 @@ jobs:
PRE_RELEASE_VERSION="${CURRENT_VERSION}-beta.${TIMESTAMP}.${SHORT_SHA}"
echo "Pre-release version: $PRE_RELEASE_VERSION"
echo "PRE_RELEASE_VERSION=$PRE_RELEASE_VERSION" >> $GITHUB_ENV
npm version $PRE_RELEASE_VERSION --no-git-tag-version
pnpm version $PRE_RELEASE_VERSION --no-git-tag-version

- name: Build
working-directory: nodejs
run: npm run build
run: pnpm build

- name: Publish pre-release to NPM
working-directory: nodejs
run: npm publish --tag beta --access public
run: pnpm publish --tag beta --access public

- name: Create GitHub pre-release
env:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To run the Node.js example:
1. Navigate to the example directory: `cd examples/nodejs`
2. Follow the setup instructions in [examples/nodejs/README.md](./examples/nodejs/README.md)
3. Set your HackMD access token
4. Run `npm start`
4. Run `pnpm start`

The example includes detailed comments and demonstrates best practices for using the HackMD API client.

Expand All @@ -47,7 +47,7 @@ To run the book mode conference example:
2. Follow the setup instructions in [examples/book-mode-conference/README.md](./examples/book-mode-conference/README.md)
3. Customize the configuration constants and session data
4. Set your HackMD access token
5. Run `npm start`
5. Run `pnpm start`

This example demonstrates advanced usage patterns including bulk operations, team note management, and creating interconnected note structures for conferences or events.

Expand Down
5 changes: 4 additions & 1 deletion examples/book-mode-conference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ This example demonstrates how to create a "book mode" conference note system usi
## Setup

### 1. Install Dependencies

```bash
cd /path/to/api-client/examples/book-mode-conference
npm install
pnpm install
```

### 2. Configure Environment

```bash
cp .env.example .env
# Edit .env with your settings
```

Required `.env` settings:

```bash
HACKMD_ACCESS_TOKEN=your_access_token_here
HACKMD_API_ENDPOINT=https://api.hackmd.io/v1
Expand Down
Loading