Skip to content

Commit

Permalink
[WIP] build locally
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed Oct 29, 2024
1 parent 162d636 commit dd19b70
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,55 @@ run-fluid:
set -euxo pipefail
cd fixtures/fluid-framework
RUST_BACKTRACE=1 cargo run -- lint --format --versions
RUST_BACKTRACE=1 cat .syncpackrc.json | jq -cM | cargo run -- lint

# Run the release rust binary against a clone of microsoft/FluidFramework
run-fluid-prod:
#!/usr/bin/env bash
set -euxo pipefail
cd fixtures/fluid-framework
../../target/release/syncpack lint --versions --source 'package.json' --source 'packages/**/package.json'
../../target/release/syncpack lint

# Watch lint output during dev
watch-fluid:
#!/usr/bin/env bash
tput rmam && cargo watch --clear --shell 'cd fixtures/fluid-framework && RUST_BACKTRACE=1 cargo run -- lint --versions --format'
tput rmam && cargo watch --clear --shell 'cd fixtures/fluid-framework && RUST_BACKTRACE=1 cargo run -- lint'
# ==============================================================================
# Build
# ==============================================================================

# Build the npm package and rust binary package for mac
build-local:
#!/usr/bin/env bash
set -euxo pipefail
rm -rf npm/packages
cargo build --release --locked --target x86_64-apple-darwin
just --dotenv-filename .env.darwin-x64 create-npm-binary-package
just --dotenv-filename .env.darwin-x64 create-npm-root-package
just patch-local
cd npm/packages/syncpack
npm install

# Modify the local package.json file to only have a mac optionalDependency
patch-local:
#!/usr/bin/env node
const fs = require("fs");
const path = require("path");
const srcPath = path.resolve("npm/packages/syncpack/package.json");
const pkg = require(srcPath);
const nextPkg = {
...pkg,
optionalDependencies: {
"syncpack-darwin-x64": "file:../syncpack-darwin-x64"
}
};
const json = JSON.stringify(nextPkg, null, 2);
console.log(json);
fs.writeFileSync(srcPath, json);
# Build a rust binary and corresponding npm package for a specific target
build-binary-package:
just create-rust-binary
Expand Down Expand Up @@ -164,6 +194,7 @@ create-npm-binary-package-json:
...pkg,
name: process.env.NODE_PKG_NAME,
bin: undefined,
dependencies: undefined,
optionalDependencies: undefined,
os: [process.env.NODE_OS],
cpu: [process.env.NODE_ARCH],
Expand Down

0 comments on commit dd19b70

Please sign in to comment.