Skip to content

build: use just-native dependency resolution #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2025
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
46 changes: 10 additions & 36 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ format:
cd "{{justfile_directory()}}/packages"; yarn prettier -w .

# Build the WebAssembly for a specific target (usually either `web` or `bundler`)
build-wasm target:
cd "{{justfile_directory()}}/harper-wasm" && wasm-pack build --target {{target}}
build-wasm:
cd "{{justfile_directory()}}/harper-wasm" && wasm-pack build --target web

# Build `harper.js` with all size optimizations available.
build-harperjs:
build-harperjs: build-wasm
#! /bin/bash
set -eo pipefail
just build-wasm web

# Removes a duplicate copy of the WASM binary if Vite is left to its devices.
perl -pi -e 's/new URL\(.*\)/new URL()/g' "{{justfile_directory()}}/harper-wasm/pkg/harper_wasm.js"
Expand All @@ -23,10 +22,9 @@ build-harperjs:
# Generate API reference
./docs.sh

test-harperjs:
test-harperjs: build-harperjs
#!/bin/bash
set -eo pipefail
just build-harperjs

cd "{{justfile_directory()}}/packages/harper.js"
yarn install -f
Expand All @@ -50,22 +48,19 @@ dev-web:
yarn dev

# Build the Harper website.
build-web:
build-web: build-harperjs
#! /bin/bash
set -eo pipefail

just build-harperjs

cd "{{justfile_directory()}}/packages/web"
yarn install -f
yarn run build

# Build the Harper Obsidian plugin.
build-obsidian:
build-obsidian: build-harperjs
#! /bin/bash
set -eo pipefail

just build-harperjs
cd "{{justfile_directory()}}/packages/obsidian-plugin"

yarn install -f
Expand Down Expand Up @@ -169,51 +164,32 @@ check-rust:
cargo clippy -- -Dwarnings -D clippy::dbg_macro -D clippy::needless_raw_string_hashes

# Perform format and type checking.
check:
check: check-rust build-web
#! /bin/bash
set -eo pipefail

just check-rust

cd "{{justfile_directory()}}/packages"
yarn install
yarn prettier --check .
yarn eslint .

# Needed because Svelte has special linters
cd web
just build-web
yarn run check

# Populate build caches and install necessary local tooling (tools callable via `yarn run <tool>`).
setup:
#! /bin/bash
set -eo pipefail

cargo build
just build-harperjs
just build-obsidian
just test-vscode
just test-harperjs
just build-web
setup: build-harperjs build-obsidian test-vscode test-harperjs build-web

# Perform full format and type checking, build all projects and run all tests. Run this before pushing your code.
precommit:
precommit: check test build-harperjs build-obsidian build-web
#! /bin/bash
set -eo pipefail

just check
just test

cargo doc
cargo build
cargo build --release
cargo bench

just build-harperjs
just build-obsidian
just build-web

# Install `harper-cli` and `harper-ls` to your machine via `cargo`
install:
cargo install --path harper-ls
Expand All @@ -230,10 +206,8 @@ dogfood:
done

# Test everything.
test:
test: test-vscode test-harperjs
cargo test
just test-vscode
just test-harperjs

# Use `harper-cli` to parse a provided file and print out the resulting tokens.
parse file:
Expand Down
4 changes: 4 additions & 0 deletions packages/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ pnpm-lock.yaml
package-lock.json
yarn.lock
dist

markdown
temp
web/static/docs/harperjs/ref