### Install and Run Harper.js Example Source: https://github.com/automattic/harper/blob/master/packages/harper.js/examples/commonjs-simple/README.md Instructions for setting up and executing the Harper.js CommonJS example. Ensure you have pnpm installed. ```bash pnpm install pnpm start ``` -------------------------------- ### Setup Harper LS with nvim-lspconfig Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/integrations/neovim/+page.md Add this to your init.lua to set up harper-ls using nvim-lspconfig. Ensure harper-ls is installed and in your PATH. ```lua require('lspconfig').harper_ls.setup {} ``` -------------------------------- ### Install Integration Test Dependencies (Ubuntu) Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/contributors/environment/+page.md Install libnss3 and libasound2 on Ubuntu systems to run integration tests. ```bash sudo apt-get install libnss3 ``` ```bash sudo apt-get install libasound2 ``` -------------------------------- ### Install Harper from GitHub Releases Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/integrations/language-server/+page.md Download portable pre-built binaries for Harper directly from the GitHub releases page if other installation methods are not suitable. ```bash https://github.com/Automattic/harper/releases ``` -------------------------------- ### Install Harper via Scoop (Windows) Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/integrations/language-server/+page.md Use this command to install the Harper package on Windows using Scoop. ```bash scoop install harper ``` -------------------------------- ### Simple CommonJS Example for Harper.js in Node.js Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/harperjs/node/+page.md This example demonstrates a basic setup for using Harper.js in a CommonJS environment within Node.js. It requires specific imports and configurations suitable for Node.js. ```javascript const { HarperDB } = require("harperdb"); const db = new HarperDB({ instance: "your-instance-name", username: "your-username", password: "your-password", // Optional: If you are using a custom domain, you can specify it here. // domain: "your-custom-domain.com" }); async function run() { // Example: Get all tables const tables = await db.listTables(); console.log("Tables:", tables); // Example: Create a table const createTableResponse = await db.createTable("my_new_table", [ { "name": "id", "dataType": "INT", "isPrimaryKey": true }, { "name": "name", "dataType": "VARCHAR" }, ]); console.log("Create Table Response:", createTableResponse); // Example: Insert a record const insertResponse = await db.insert("my_new_table", [ { "id": 1, "name": "Alice" }, { "id": 2, "name": "Bob" }, ]); console.log("Insert Response:", insertResponse); // Example: Query records const queryResponse = await db.query("SELECT * FROM my_new_table WHERE id = 1"); console.log("Query Response:", queryResponse); // Example: Update a record const updateResponse = await db.update("my_new_table", [ { "id": 1, "name": "Alice Smith" }, ]); console.log("Update Response:", updateResponse); // Example: Delete a record const deleteResponse = await db.delete("my_new_table", [1]); console.log("Delete Response:", deleteResponse); // Example: Drop a table const dropTableResponse = await db.dropTable("my_new_table"); console.log("Drop Table Response:", dropTableResponse); } run().catch(err => { console.error("Error:", err); }); ``` -------------------------------- ### Test File Example Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/contributors/author-a-rule/+page.md An example of how to structure a test file for your new rule. The content should demonstrate the error your rule is designed to catch. ```markdown This is an test of the `an_a` rule. Your test should look different. ``` -------------------------------- ### Install Harper via Pacman (Arch Linux Stable) Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/integrations/language-server/+page.md Install the latest stable release of Harper from the 'extra' repository on Arch Linux. ```bash sudo pacman -S harper ``` -------------------------------- ### Install harper-git via AUR Helper (Arch Linux Bleeding-Edge) Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/integrations/language-server/+page.md Install the bleeding-edge version of Harper from the Arch User Repository using an AUR helper. ```bash paru -S harper-git # or yay -S harper-git, etc. ``` -------------------------------- ### Enter Nix Development Shell Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/contributors/environment/+page.md Start a bash shell with all necessary build tools pre-configured for Harper development using Nix. ```bash nix develop ``` -------------------------------- ### Install and verify harper-ls language server Source: https://context7.com/automattic/harper/llms.txt Install the `harper-ls` language server using Cargo and verify the installation by checking its version. This server integrates with editors to provide diagnostics and configuration. ```sh # Install via Cargo cargo install harper-ls ``` ```sh # Verify installation harper-ls --version ``` -------------------------------- ### Install Harper via Nix Shell (Nixpkgs/NixOS) Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/integrations/language-server/+page.md Use this command to try Harper within an ephemeral shell on Nixpkgs/NixOS. ```bash nix-shell -p harper ``` -------------------------------- ### Install Harper via Homebrew (macOS/Linux) Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/integrations/language-server/+page.md Use this command to install the Harper package on macOS and Linux using Homebrew. ```bash brew install harper ``` -------------------------------- ### Basic Harper CDN Usage Example Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/harperjs/CDN/+page.md This HTML file demonstrates how to include and use Harper from a CDN. It sets up the necessary script tags to load the Harper library and then uses it. ```html
Check the browser console for output.
``` -------------------------------- ### List Available 'just' Commands Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/contributors/environment/+page.md View all available build and debug tools provided by the 'justfile' in the Harper repository. ```bash just --list ``` -------------------------------- ### Install Nightly Toolchain and Cargo-Fuzz Source: https://github.com/automattic/harper/blob/master/fuzz/README.md Install the necessary nightly Rust toolchain and the cargo-fuzz plugin using rustup and cargo. ```bash rustup install nightly ``` ```bash cargo install cargo-fuzz ``` -------------------------------- ### Weir Sequence Expression Example Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/weir/+page.md An example of a Weir sequence expression that matches the phrase 'gong to' and suggests correcting it to 'going to'. ```plaintext expr main (gong to) let message "Did you mean `going to`?" let description "Corrects `gong to` to the intended phrase `going to`." let kind "Typo" let becomes "going to" ``` ```plaintext expr main gong to ``` -------------------------------- ### Weirpack Manifest Example Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/weir/+page.md A sample `manifest.json` file for a Weirpack, including required fields like author, version, description, and license, along with optional metadata. ```json { "author": "Ada Lovelace", "version": "1.0.0", "description": "Rules for Victorian technical writing.", "license": "MIT", "keywords": ["victorian", "technical", "style"], "website": "https://example.com" } ``` -------------------------------- ### Install Harper VS Code Extension via CLI Source: https://github.com/automattic/harper/blob/master/packages/web/src/routes/docs/integrations/visual-studio-code/+page.md Use this command to install the Harper extension directly from the command line. ```bash code --install-extension elijah-potter.harper ```