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
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ CLI for the [Outline](https://www.getoutline.com) wiki/knowledge base API.

## Install

### From GitHub (recommended)

```sh
npm install -g github:Doist/outline-cli
```

### From source

```sh
git clone https://github.com/gnapse/outline-cli.git
git clone https://github.com/Doist/outline-cli.git
cd outline-cli
npm install
npm run build
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"format": "biome check --write",
"test": "vitest run",
"test:watch": "vitest",
"prepare": "lefthook install"
"prepare": "node scripts/prepare.js"
},
"keywords": [
"outline",
Expand Down
42 changes: 42 additions & 0 deletions scripts/prepare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env node

/**
* Safe prepare script that only runs lefthook for local development.
* Skips when installing globally or in CI environments.
*/

import { execSync } from "node:child_process";
import { existsSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const projectRoot = join(__dirname, "..");

// Skip if not in a git repo (e.g., npm global install)
const isGitRepo = existsSync(join(projectRoot, ".git"));

// Skip in CI environments
const isCI = !!process.env.CI;

if (!isGitRepo) {
console.log("Skipping git hooks setup (not a git repository)");
process.exit(0);
}

if (isCI) {
console.log("Skipping git hooks setup (CI environment)");
process.exit(0);
}

try {
execSync("lefthook install", { stdio: "inherit", cwd: projectRoot });
} catch {
console.warn("Warning: Failed to install git hooks (lefthook)");
console.warn(
'This is optional for development. You can run "npm run prepare" manually later.',
);
// Don't fail the install
process.exit(0);
}