### Install DotSlash on Windows Source: https://dotslash-cli.com/docs/installation Download and extract the DotSlash binary for Windows. Ensure YOUR_BIN_PATH is set to your desired installation directory. ```cmd cmd /c 'curl.exe -LSfs https://github.com/facebook/dotslash/releases/latest/download/dotslash-windows.tar.gz | tar fxz - -C YOUR_BIN_PATH' ``` -------------------------------- ### Hashing a File with b3sum Source: https://dotslash-cli.com/docs/flags Example of using the experimental 'b3sum' command to print the BLAKE3 hash of a specified file. This command is accessed via '--'. ```bash b3sum FILE ``` -------------------------------- ### Install DotSlash using Cargo Source: https://dotslash-cli.com/docs/installation Build and install DotSlash using the Rust package manager. Assumes .cargo/bin is on your PATH. ```bash cargo install dotslash ``` -------------------------------- ### Build DotSlash from Source with musl Source: https://dotslash-cli.com/docs/installation Clone the repository, set up the musl target, and build the release executable. Ensure `musl-gcc` is installed if `cargo build` fails. ```bash $ git clone https://github.com/facebook/dotslash $ cd dotslash $ rustup target add x86_64-unknown-linux-musl $ cargo build --release --target=x86_64-unknown-linux-musl $ target/x86_64-unknown-linux-musl/release/dotslash --help usage: dotslash DOTSLASH_FILE [OPTIONS] ... ``` -------------------------------- ### Hashing a File with sha256 Source: https://dotslash-cli.com/docs/flags Example of using the experimental 'sha256' command to print the SHA-256 hash of a specified file. This command is accessed via '--'. ```bash sha256 FILE ``` -------------------------------- ### Install DotSlash using GitHub Actions Source: https://dotslash-cli.com/docs/installation Use this action in your GitHub Actions workflow to install DotSlash. ```yaml name: test suite on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: facebook/install-dotslash@latest - run: ./some_dotslash_file ``` -------------------------------- ### Generated DotSlash File Example Source: https://dotslash-cli.com/docs/github An example of a generated DotSlash file for the 'hermes' executable, detailing platform-specific download URLs, sizes, hashes, and paths. ```json #!/usr/bin/env dotslash { "name": "hermes", "platforms": { "macos-x86_64": { "size": 10600817, "hash": "blake3", "digest": "25f984911f199f9229ca0327c52700fa9a8db9aefe95e84f91ba6be69902436a", "format": "tar.gz", "path": "hermes", "providers": [ { "url": "https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-darwin-v0.12.0.tar.gz" }, { "type": "github-release", "repo": "https://github.com/facebook/hermes", "tag": "v0.12.0", "name": "hermes-cli-darwin-v0.12.0.tar.gz" } ] }, "macos-aarch64": { "size": 10600817, "hash": "blake3", "digest": "25f984911f199f9229ca0327c52700fa9a8db9aefe95e84f91ba6be69902436a", "format": "tar.gz", "path": "hermes", "providers": [ { "url": "https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-darwin-v0.12.0.tar.gz" }, { "type": "github-release", "repo": "https://github.com/facebook/hermes", "tag": "v0.12.0", "name": "hermes-cli-darwin-v0.12.0.tar.gz" } ] }, "linux-x86_64": { "size": 47099598, "hash": "blake3", "digest": "8d2c1bcefc2ce6e278167495810c2437e8050780ebb4da567811f1d754ad198c", "format": "tar.gz", "path": "hermes", "providers": [ { "url": "https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-linux-v0.12.0.tar.gz" }, { "type": "github-release", "repo": "https://github.com/facebook/hermes", "tag": "v0.12.0", "name": "hermes-cli-linux-v0.12.0.tar.gz" } ] }, "windows-x86_64": { "size": 17456100, "hash": "blake3", "digest": "7efee4f92a05e34ccfa7c21c7a05f939d8b724bc802423d618db22efb83bfe1b", "format": "tar.gz", "path": "hermes.exe", "providers": [ { "url": "https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-windows-v0.12.0.tar.gz" }, { "type": "github-release", "repo": "https://github.com/facebook/hermes", "tag": "v0.12.0", ``` -------------------------------- ### Install DotSlash on macOS Source: https://dotslash-cli.com/docs/installation Download and extract the universal binary for macOS. Ensure YOUR_BIN_PATH is set to your desired installation directory. ```bash curl -LSfs https://github.com/facebook/dotslash/releases/latest/download/dotslash-macos.tar.gz | tar fxz - -C YOUR_BIN_PATH ``` -------------------------------- ### Install musl-gcc on Ubuntu/Debian Source: https://dotslash-cli.com/docs/installation If `cargo build` fails due to missing `musl-gcc`, install the `musl-tools` package on Ubuntu/Debian systems. ```bash sudo apt install musl-tools ``` -------------------------------- ### Install DotSlash as an npm Dependency Source: https://dotslash-cli.com/docs/installation Install DotSlash as a project dependency for Node.js projects. ```bash npm install --save fb-dotslash ``` -------------------------------- ### Install DotSlash on Linux (Ubuntu 22.04) Source: https://dotslash-cli.com/docs/installation Download and extract the DotSlash binary for Ubuntu 22.04. Ensure YOUR_BIN_PATH is set to your desired installation directory. ```bash curl -LSfs "https://github.com/facebook/dotslash/releases/latest/download/dotslash-ubuntu-22.04.$(uname -m).tar.gz" | tar fxz - -C YOUR_BIN_PATH ``` -------------------------------- ### Verify DotSlash Installation Source: https://dotslash-cli.com/docs/installation Check if DotSlash is installed and accessible on your system's PATH. ```bash /usr/bin/env dotslash --help ``` -------------------------------- ### DotSlash User-Agent Example Source: https://dotslash-cli.com/docs/dotslash-file This is an example of the custom user-agent string used by DotSlash when making curl requests. It helps identify DotSlash traffic. ```text Mozilla/5.0 (compatible; DotSlash/0.1.0; +https://dotslash-cli.com) ``` -------------------------------- ### Example DotSlash File for Hermes CLI Source: https://dotslash-cli.com/docs/dotslash-file This DotSlash file defines the hermes CLI for multiple platforms for release v0.12.0. Note that macOS entries are identical due to Universal Binary support. ```dotslash #!/usr/bin/env dotslash // This DotSlash file represents the hermes CLI across multiple platforms for // the v0.12.0 release of Hermes: https://github.com/facebook/hermes/releases/tag/v0.12.0 { "name": "hermes", "platforms": { "macos-x86_64": { "size": 10600817, "hash": "blake3", "digest": "25f984911f199f9229ca0327c52700fa9a8db9aefe95e84f91ba6be69902436a", "format": "tar.gz", "path": "hermes", "providers": [ { "url": "https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-darwin-v0.12.0.tar.gz" }, { "type": "github-release", "repo": "facebook/hermes", "tag": "v0.12.0", "name": "hermes-cli-darwin-v0.12.0.tar.gz" } ], }, "macos-aarch64": { "size": 10600817, "hash": "blake3", "digest": "25f984911f199f9229ca0327c52700fa9a8db9aefe95e84f91ba6be69902436a", "format": "tar.gz", "path": "hermes", "providers": [ { "url": "https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-darwin-v0.12.0.tar.gz" }, { "type": "github-release", "repo": "facebook/hermes", "tag": "v0.12.0", "name": "hermes-cli-darwin-v0.12.0.tar.gz" } ], }, "linux-x86_64": { "size": 47099598, "hash": "blake3", "digest": "8d2c1bcefc2ce6e278167495810c2437e8050780ebb4da567811f1d754ad198c", "format": "tar.gz", "path": "hermes", "providers": [ { "url": "https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-linux-v0.12.0.tar.gz" }, { "type": "github-release", "repo": "facebook/hermes", "tag": "v0.12.0", "name": "hermes-cli-linux-v0.12.0.tar.gz" } ], }, "windows-x86_64": { "size": 17456100, "hash": "blake3", "digest": "7efee4f92a05e34ccfa7c21c7a05f939d8b724bc802423d618db22efb83bfe1b", "format": "tar.gz", "path": "hermes.exe", "providers": [ { "url": "https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-windows-v0.12.0.tgz" }, { "type": "github-release", "repo": "facebook/hermes", "tag": "v0.12.0", "name": "hermes-cli-windows-v0.12.0.tgz" } ], } } } ``` -------------------------------- ### Configure DotSlash in Dev Container Source: https://dotslash-cli.com/docs/installation Add this feature to your devcontainer.json to automatically install the latest DotSlash version. ```json "features": { "ghcr.io/facebook/devcontainers/features/dotslash:latest": {} } ``` -------------------------------- ### Build Universal Binary for macOS from Source Source: https://dotslash-cli.com/docs/installation Build both ARM64 and x86_64 binaries for macOS and then combine them into a universal binary using lipo. ```bash git clone https://github.com/facebook/dotslash cd dotslash cargo build --release --target aarch64-apple-darwin cargo build --release --target x86_64-apple-darwin lipo -create -output dotslash target/aarch64-apple-darwin/release/dotslash target/x86_64-apple-darwin/release/dotslash ``` -------------------------------- ### Build DotSlash from Source (Git) Source: https://dotslash-cli.com/docs/installation Clone the DotSlash repository using Git and build the release binary. ```bash git clone https://github.com/facebook/dotslash cd dotslash cargo build --release ``` -------------------------------- ### Execute Node.js Wrapper Script Source: https://dotslash-cli.com/docs After setting up the DotSlash configuration and making the script executable, you can run the Node.js wrapper script from your terminal. The first execution may have a delay as DotSlash fetches and verifies the necessary files. ```bash $ ./scripts/node --version v18.19.0 ``` -------------------------------- ### Build DotSlash from Source (Sapling) Source: https://dotslash-cli.com/docs/installation Clone the DotSlash repository using Sapling and build the release binary. ```bash sl clone https://github.com/facebook/dotslash cd dotslash cargo build --release ``` -------------------------------- ### Download DotSlash Release with GitHub CLI Source: https://dotslash-cli.com/docs/installation Use `gh release download` to fetch release artifacts, specifying the repository, tag, and a pattern to match the desired platform's artifact. ```bash gh release download --repo facebook/dotslash TAG --pattern PATTERN ``` ```bash gh release download --repo facebook/dotslash v0.2.0 --pattern '*windows*' ``` -------------------------------- ### Creating a URL Entry Source: https://dotslash-cli.com/docs/flags Demonstrates the usage of the experimental 'create-url-entry' command to generate a DotSlash JSON snippet for an artifact located at a given URL. This command is accessed via '--'. ```bash create-url-entry URL ``` -------------------------------- ### Fetching a DotSlash Artifact Source: https://dotslash-cli.com/docs/flags Illustrates the usage of the experimental 'fetch' command to download a DotSlash artifact into the cache if it's not already present. This command is accessed via '--'. ```bash fetch DOTSLASH_FILE ``` -------------------------------- ### DotSlash Basic Usage Source: https://dotslash-cli.com/docs/flags Shows the general command line structure for DotSlash, indicating where DotSlash file and options are placed. ```bash dotslash DOTSLASH_FILE [OPTIONS] ``` -------------------------------- ### S3 Provider Fetch Command Source: https://dotslash-cli.com/docs/dotslash-file This command demonstrates how the S3 provider translates its configuration into an `aws s3 cp` command for fetching artifacts. The region is optional and defaults to the user's configured default region. ```bash aws s3 cp --region us-weset-2 s3://example/key TEMPFILE_IN_DOTSLASH_CACHE ``` -------------------------------- ### Generate URL Entry Boilerplate with DotSlash CLI Source: https://dotslash-cli.com/docs/dotslash-file Use the `create-url-entry` subcommand to generate boilerplate JSON for a DotSlash file based on a given artifact URL. This command computes the artifact's size and BLAKE3 hash. ```bash $ dotslash -- create-url-entry https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-linux-v0.12.0.tar.gz ``` ```json { "size": 47099598, "hash": "blake3", "digest": "8d2c1bcefc2ce6e278167495810c2437e8050780ebb4da567811f1d754ad198c", "format": "tar.gz", "path": "TODO: specify the appropriate `path` for this artifact", "providers": [ { "url": "https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-linux-v0.12.0.tar.gz" } ] } ``` -------------------------------- ### Compute BLAKE3 Hash with DotSlash CLI Source: https://dotslash-cli.com/docs/dotslash-file Use this command to compute the BLAKE3 hash of a file on disk when b3sum is not available. Ensure the file exists at the specified path. ```bash $ dotslash -- b3sum /tmp/dotslash-example.txt 824ecff042b9ac68a33ea5ee027379a09f3da1d5a47f29fc52072809a204db87 ``` -------------------------------- ### GitHub Release Provider for Enterprise Instance Source: https://dotslash-cli.com/docs/dotslash-file When using a GitHub Enterprise instance, include the instance domain in the 'repo' field. This ensures the GitHub CLI targets the correct repository. ```json { "type": "github-release", "repo": "example.com/facebook/hermes", "tag": "v0.12.0", "name": "hermes-cli-linux-v0.12.0.tar.gz" } ``` -------------------------------- ### Accessing DotSlash Cache Directory Source: https://dotslash-cli.com/docs/flags Demonstrates how to use the experimental 'cache-dir' command to display the DotSlash cache directory path. This command is hidden behind '--' and its output format is unstable. ```bash $ dotslash -- cache-dir /Users/mbolin/Library/Caches/dotslash ``` -------------------------------- ### GitHub Release Provider Configuration Source: https://dotslash-cli.com/docs/dotslash-file Configure the GitHub Release provider with 'repo', 'tag', and 'name' to fetch artifacts. This provider uses the GitHub CLI and can access private repositories if authenticated. ```json { "type": "github-release", "repo": "facebook/hermes", "tag": "v0.12.0", "name": "hermes-cli-linux-v0.12.0.tar.gz" } ``` -------------------------------- ### Run DotSlash File Directly on Windows Source: https://dotslash-cli.com/docs/windows Execute a DotSlash file by calling the `dotslash` interpreter directly with the file path as an argument. This method is cross-platform but can be verbose. ```bash C:\> dotslash path\to\dotslash_file ``` -------------------------------- ### Parsing a DotSlash File Source: https://dotslash-cli.com/docs/flags Shows how to use the experimental 'parse' command to process a DotSlash file and output its data as pure JSON to standard output. This command is accessed via '--'. ```bash parse DOTSLASH_FILE ``` -------------------------------- ### HTTP Provider Configuration Source: https://dotslash-cli.com/docs/dotslash-file The HTTP provider requires a 'url' field to specify where to fetch the artifact. Ensure the URL is publicly accessible. ```json { "url": "https://github.com/facebook/hermes/releases/download/v0.12.0/hermes-cli-linux-v0.12.0.tar.gz" } ``` -------------------------------- ### Configure Weighted Random Provider Order Source: https://dotslash-cli.com/docs/dotslash-file Configure artifact fetching to randomize provider order using weights. Higher weights increase the likelihood of a provider being tried earlier. Ensure weights are integers greater than or equal to 1. ```json { "format": "tar.gz", "path": "hermes", "providers": [ {"url": "https://primary.example.com/hermes.tar.gz", "weight": 3}, {"url": "https://mirror1.example.com/hermes.tar.gz", "weight": 1}, {"url": "https://mirror2.example.com/hermes.tar.gz", "weight": 1}, {"url": "https://mirror3.example.com/hermes.tar.gz", "weight": 1} ], "providers_order": "weighted-random" } ``` -------------------------------- ### View Accompanying Batch Script Content Source: https://dotslash-cli.com/docs/windows Display the content of a batch script created to accompany a DotSlash file. ```batch C:\> type path\to\node.bat @dotslash.exe "%~dpn0" %* ``` -------------------------------- ### Create a Sibling Batch Script for DotSlash Execution Source: https://dotslash-cli.com/docs/windows Accompany a DotSlash file with a batch script of the same name (e.g., `node.bat` for `node` DotSlash file) to enable direct execution. This leverages `cmd.exe`'s variable expansion for path and arguments. ```batch @dotslash.exe "%~dpn0" %* ``` -------------------------------- ### Configure Node.js Distribution with DotSlash Source: https://dotslash-cli.com/docs This DotSlash configuration file defines metadata for Node.js v18.19.0, including platform-specific executables, their sizes, hashes, and download URLs. Use this to vendor Node.js in your repository. ```dotslash #!/usr/bin/env dotslash // The URLs in this file were taken from https://nodejs.org/dist/v18.19.0/ { "name": "node-v18.19.0", "platforms": { "macos-aarch64": { "size": 40660307, "hash": "blake3", "digest": "6e2ca33951e586e7670016dd9e503d028454bf9249d5ff556347c3d98c34", "format": "tar.gz", "path": "node-v18.19.0-darwin-arm64/bin/node", "providers": [ { "url": "https://nodejs.org/dist/v18.19.0/node-v18.19.0-darwin-arm64.tar.gz" } ] }, "macos-x86_64": { "size": 42202872, "hash": "blake3", "digest": "37521058114e7f71e0de3fe8042c8fa7908305e9115488c6c29b514f9cd2a24c", "format": "tar.gz", "path": "node-v18.19.0-darwin-x64/bin/node", "providers": [ { "url": "https://nodejs.org/dist/v18.19.0/node-v18.19.0-darwin-x64.tar.gz" } ] }, "linux-x86_64": { "size": 44694523, "hash": "blake3", "digest": "72b81fc3a30b7bedc1a09a3fafc4478a1b02e5ebf0ad04ea15d23b3e9dc89212", "format": "tar.gz", "path": "node-v18.19.0-linux-x64/bin/node", "providers": [ { "url": "https://nodejs.org/dist/v18.19.0/node-v18.19.0-linux-x64.tar.gz" } ] } } } ``` -------------------------------- ### Shell Script for Vendored Node.js Source: https://dotslash-cli.com/docs This shell script is used in a traditional approach to vendoring Node.js. It determines the operating system and executes the appropriate Node.js binary from the local scripts directory. It requires manual management of OS-specific binaries. ```bash #!/bin/bash # Copied from https://stackoverflow.com/a/246128. DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" if [ "$(uname)" == "Darwin" ]; then # In this example, assume node-mac-v18.19.0 is a universal macOS binary. "$DIR/node-mac-v18.19.0" "$@" else "$DIR/node-linux-v18.19.0" "$@" fi exit $? ``` -------------------------------- ### JSON Configuration for GitHub Release Outputs Source: https://dotslash-cli.com/docs/github This JSON structure defines the outputs for a GitHub release, specifying platform-specific archive names. Each key in the 'outputs' map corresponds to a generated DotSlash file. ```json { "name": "hermes-cli-windows-v0.12.0.tar.gz" } ] } } } ``` -------------------------------- ### Configure GitHub Actions Workflow for DotSlash Generation Source: https://dotslash-cli.com/docs/github This workflow triggers after release artifact workflows complete successfully. It uses the `facebook/dotslash-publish-release` action to generate DotSlash files, requiring a GitHub token and a configuration file. ```yaml name: Generate DotSlash files on: workflow_run: # These must match the names of the workflows that publish # artifacts to your GitHub release. workflows: [linux-release, macos-release, windows-release] types: - completed jobs: generate-dotslash-files: name: Generating and uploading DotSlash files runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: facebook/dotslash-publish-release@v1 # This is necessary because the action uses # `gh release upload` to publish the generated DotSlash file(s) # as part of the release. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: # Additional file that lives in your repo that defines # how your DotSlash file(s) should be generated. config: .github/workflows/dotslash-config.json # Tag for the release to to target. tag: ${{ github.event.workflow_run.head_branch }} ``` -------------------------------- ### Compute SHA256 Hash with DotSlash CLI Source: https://dotslash-cli.com/docs/dotslash-file Use this command to compute the SHA256 hash of a file on disk when shasum is not available. Ensure the file exists at the specified path. ```bash $ echo 'DotSlash Rulez!' > /tmp/dotslash-example.txt $ dotslash -- sha256 /tmp/dotslash-example.txt 52aa28f4f276bdd9a103fcd7f74f97f2bffc52dd816b887952f791b39356b08e ``` -------------------------------- ### View DotSlash File Content Source: https://dotslash-cli.com/docs/windows Display the content of a DotSlash file using the `type` command. ```batch C:\> type path\to\node #!/usr/bin/env dotslash { "name": "node-v18.16.0", "platforms": { <<< snip >>> ``` -------------------------------- ### Basic DotSlash File Structure Source: https://dotslash-cli.com/docs/dotslash-file Defines the fundamental structure of a DotSlash file, including the required shebang and the main JSON payload with 'name' and 'platforms' properties. ```dotslash #!/usr/bin/env dotslash { "name": /* string */, "platforms": /* map */, } ``` -------------------------------- ### Run DotSlash from Node.js using fb-dotslash package Source: https://dotslash-cli.com/docs/installation Import and use the fb-dotslash package directly in your Node.js code to execute DotSlash binaries. ```javascript const dotslash = require('fb-dotslash'); const {spawnSync} = require('child_process'); spawnSync(dotslash, ['./some_dotslash_file'], {stdio: 'inherit'}); ``` -------------------------------- ### Remove macOS Quarantine Attribute Source: https://dotslash-cli.com/docs/installation Use this command if macOS security prevents you from running the downloaded DotSlash binary. Adjust the path to your downloaded file. ```bash xattr -r -d com.apple.quarantine ~/Downloads/dotslash-macos.*.tar.gz ``` -------------------------------- ### S3 Provider Configuration Source: https://dotslash-cli.com/docs/dotslash-file The S3 provider allows fetching artifacts from S3 buckets using the 'repo' (bucket name), 'key' (object path), and optional 'region'. Ensure the AWS CLI is configured for authentication. ```json { "type": "s3", "repo": "example", "key": "key", "region": "us-west-2" } ``` -------------------------------- ### DotSlash Generation Configuration JSON Source: https://dotslash-cli.com/docs/github This JSON file defines how DotSlash files should be generated, mapping platform-specific artifact details (regex, output path) to a common DotSlash configuration. ```json { "outputs": { "hermes": { "platforms": { "macos-x86_64": { "regex": "^hermes-cli-darwin-", "path": "hermes" }, "macos-aarch64": { "regex": "^hermes-cli-darwin-", "path": "hermes" }, "linux-x86_64": { "regex": "^hermes-cli-linux-", "path": "hermes" }, "windows-x86_64": { "regex": "^hermes-cli-windows-", "path": "hermes.exe" } } } } } ``` -------------------------------- ### DotSlash Platform Entry Schema Source: https://dotslash-cli.com/docs/dotslash-file Specifies the schema for a platform entry within the 'platforms' map, detailing artifact properties like size, hash, providers, format, and path. ```json { "size": /* size of the artifact in bytes (nonnegative integer) */, "hash": /* name of hash algorithm: either "sha256" or "blake3" */, "digest": /* artifact digest as a lowercase hex string */, "providers": /* array of providers */, "format": /* recognized format, such as "tar.gz"; see list below */, "path": /* filename or path within an archive */, "arg0": /* arg0 behavior, see below */, "readonly": /* `false` disables `chmod -R -w` on the unpacked artifact */ } ``` -------------------------------- ### Terminate DotSlash Processes on Windows Source: https://dotslash-cli.com/docs/windows Forcefully terminate all running `dotslash.exe` processes using the `taskkill` command. This is necessary for updating `dotslash.exe` when it's in use. ```powershell taskkill /f /im dotslash.exe ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.