Skip to content
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
11 changes: 9 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
HMD_API_ENDPOINT_URL=
HMD_API_ACCESS_TOKEN=
# HackMD CLI Integration Test Configuration
# Copy this file to .env and fill in your test values

# HackMD API endpoint URL (defaults to localhost:3000)
# For local HackMD server, use: http://localhost:3000/api/openAPI/v1
HMD_API_ENDPOINT_URL=http://localhost:3000/api/openAPI/v1

# Access token for testing (required for integration tests)
HMD_API_ACCESS_TOKEN=your_access_token_here
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

6 changes: 0 additions & 6 deletions .eslintrc

This file was deleted.

22 changes: 16 additions & 6 deletions .github/workflows/config-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,26 @@ jobs:

strategy:
matrix:
node-version: ['18']
node-version: ['24']

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.28.0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: npm install
- run: npm run test
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm run test

61 changes: 61 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test

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

jobs:
unit-test:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.28.0

- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run unit tests
run: pnpm run test:unit

smoke-test:
name: Smoke Tests
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.28.0

- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build project
run: pnpm run build

- name: Run smoke tests
run: pnpm exec mocha --forbid-only "test/smoke/**/*.test.ts"
143 changes: 142 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,150 @@
/.nyc_output
/dist
/lib
/package-lock.json
/tmp
node_modules
oclif.manifest.json

.env

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.*
!.env.example

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist
.output

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Sveltekit cache directory
.svelte-kit/

# vitepress build output
**/.vitepress/dist

# vitepress cache directory
**/.vitepress/cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Firebase cache directory
.firebase/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Vite files
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.vite/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
24
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<!-- usage -->
```sh-session
$ npm install -g @hackmd/hackmd-cli
# or using pnpm
$ pnpm add -g @hackmd/hackmd-cli
$ hackmd-cli COMMAND
running command...
$ hackmd-cli (--version|-v)
Expand Down
17 changes: 17 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import oclifConfig from 'eslint-config-oclif';

export default [
...oclifConfig,
{
ignores: ['**/dist/**', '**/lib/**', '**/node_modules/**'],
},
{
files: ['test/**/*.ts', 'test/**/*.js'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
'n/no-extraneous-require': 'off',
'n/no-missing-require': 'off',
'unicorn/prefer-module': 'off',
},
},
];
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": "https://github.com/hackmdio/hackmd-cli/issues",
"dependencies": {
"@hackmd/api": "^2.0.0",
"@hackmd/api": "^2.5.0",
"@hackmd/oclif-plugin-autocomplete": "^2.1.9-fish",
"@oclif/core": "2.8.2",
"@oclif/plugin-help": "5.2.9",
Expand All @@ -24,26 +24,24 @@
"@types/fs-extra": "^8.0.1",
"@types/lodash.defaults": "^4.2.6",
"@types/mocha": "^10.0.1",
"@types/node": "^18.16.2",
"@types/node": "^24.0.0",
"chai": "^4.2.0",
"dotenv": "^8.2.0",
"eslint": "7",
"eslint-config-oclif": "^4.0.0",
"eslint-config-oclif-typescript": "^1.0.3",
"eslint": "^9.39.2",
"eslint-config-oclif": "^6.0.130",
"mocha": "^10.2.0",
"nyc": "^13.3.0",
"shx": "^0.3.4",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
"typescript": "^5.6.0"
},
"engines": {
"node": ">=12.0.0"
"node": ">=24.0.0"
},
"files": [
"/bin",
"/lib",
"/dist",
"/npm-shrinkwrap.json",
"/oclif.manifest.json"
],
"homepage": "https://github.com/hackmdio/hackmd-cli",
Expand All @@ -69,13 +67,16 @@
]
},
"repository": "hackmdio/hackmd-cli",
"packageManager": "pnpm@10.28.0",
"scripts": {
"build": "shx rm -rf dist && tsc -b",
"lint": "eslint . --ext .ts --config .eslintrc",
"lint": "eslint .",
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "yarn lint",
"prepack": "yarn build && oclif manifest && oclif readme",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
"posttest": "pnpm run lint",
"prepack": "pnpm run build && oclif manifest && oclif readme",
"test": "mocha --forbid-only \"test/**/*.test.ts\" --exclude \"test/smoke/**/*\"",
"test:unit": "mocha --forbid-only \"test/**/*.test.ts\" --exclude \"test/integration/**/*\" --exclude \"test/smoke/**/*\"",
"test:smoke": "pnpm run build && mocha --forbid-only \"test/smoke/**/*.test.ts\"",
"version": "oclif readme && git add README.md"
},
"types": "dist/index.d.ts"
Expand Down
Loading