### Install dev and Node.js with pkgm Source: https://github.com/pkgxdev/dev/blob/main/README.md This command demonstrates how to install `dev` and a specific version of Node.js (v22) using `pkgm`. This is the recommended approach for integrating `dev` with system-wide tools, ensuring they are available in `/usr/local/`. ```sh sudo pkgm install dev node@22 ``` -------------------------------- ### Demonstrate dev activation and version switching with pkgm Source: https://github.com/pkgxdev/dev/blob/main/README.md This sequence of commands illustrates how `dev` automatically switches Node.js versions based on `package.json` when navigating into a project directory. It shows the initial state, `pkgm` installation, `dev` activation, and the version changes upon directory entry and exit, highlighting `dev`'s dynamic environment management. ```sh $ cd my-project $ ls package.json $ node --version command not found: node $ sudo pkgm install dev node $ node --version && which node v23.11.0 /usr/local/bin/node $ cat package.json | jq .engines { "node": "^20" } $ dev . activated `~/my-project` (+node^20) $ node --version && which node v20.19.0 /usr/local/bin/node $ cd .. $ node --version && which node v23.11.0 /usr/local/bin/node $ cd - $ node --version && which node v20.19.0 /usr/local/bin/node ``` -------------------------------- ### Install dev via Homebrew and integrate shellcode Source: https://github.com/pkgxdev/dev/blob/main/README.md This snippet shows how to install `dev` on macOS or Linux using Homebrew, followed by integrating its shellcode. This provides a persistent `dev` installation combined with shell-based environment management. ```sh brew install pkgxdev/made/dev dev integrate ``` -------------------------------- ### Demonstrate dev shellcode usage for project-specific environments Source: https://github.com/pkgxdev/dev/blob/main/README.md This sequence shows how `dev`, when integrated via shellcode, automatically installs and activates project-specific tools like Node.js upon entering a directory. It also demonstrates how the environment is deactivated upon exiting the directory, maintaining a clean system. ```sh $ cd my-project my-project $ ls package.json my-project $ dev +nodejs.org # ^^ installs node to ~/.pkgx/nodejs.org/v22.12.0 if not already installed my-project $ node --version v22.12.0 $ which node ~/.pkgx/nodejs.org/v22.12.0/bin/node $ cd .. -nodejs.org $ node command not found: node ``` -------------------------------- ### GitHub Actions: Using pkgxdev/dev Action Source: https://github.com/pkgxdev/dev/blob/main/README.md This snippet demonstrates how to integrate the `pkgxdev/dev` GitHub Action into your workflow. It installs necessary packages using `pkgx` and configures the environment, mirroring the `dev` command's behavior in a terminal. ```yaml - uses: pkgxdev/dev@v1 ``` -------------------------------- ### Python Package Dependencies Source: https://github.com/pkgxdev/dev/blob/main/fixtures/requirements.txt Lists the exact versions of Python packages required for the project. These dependencies are typically installed via pip from a requirements.txt file, ensuring a consistent development and deployment environment. ```Python tensorflow==2.3.1 uvicorn==0.12.2 fastapi==0.63.0 ``` -------------------------------- ### Integrate dev using pkgx shellcode Source: https://github.com/pkgxdev/dev/blob/main/README.md This command integrates `dev` into the current shell environment by adding necessary hooks. This method is useful for temporary usage without system-wide installation, but is less compatible with editors and requires shell-specific setup. ```sh pkgx dev integrate ``` -------------------------------- ### pkgxdev Project Configuration Source: https://github.com/pkgxdev/dev/blob/main/fixtures/requirements.txt Defines project-specific dependencies and environment variables using pkgxdev's configuration syntax. This includes external library dependencies and custom environment variables for the project runtime. ```Configuration # --- # dependencies: # zlib.net: ^1.2 # env: # FOO: BAR # --- ``` -------------------------------- ### Perform a dry run of dev shellcode integration Source: https://github.com/pkgxdev/dev/blob/main/README.md This command allows users to preview the changes `dev integrate` would make to their shell configuration files without actually applying them. It's useful for verifying the integration process and understanding its impact before committing changes. ```sh pkgx dev integrate --dry-run ``` -------------------------------- ### Preview dev shellcode output Source: https://github.com/pkgxdev/dev/blob/main/README.md This command outputs the raw shellcode that `dev` uses for integration. It's helpful for users who want to inspect the shellcode before allowing `dev` to modify their shell configuration, ensuring transparency. ```sh pkgx dev --shellcode ``` -------------------------------- ### Specify pkgx dependencies tersely in TOML front matter Source: https://github.com/pkgxdev/dev/blob/main/README.md This TOML snippet demonstrates a more concise way to declare `pkgx` dependencies within front matter. It allows specifying multiple dependencies, including specific versions (`openssl.org@1.1.1n`), version ranges (`deno^2`), and tools without specific versions (`npm`). ```toml # --- # pkgx: # dependencies: openssl.org@1.1.1n deno^2 npm # --- ``` -------------------------------- ### Specify pkgx dependencies in TOML front matter (detailed) Source: https://github.com/pkgxdev/dev/blob/main/README.md This TOML snippet shows how to specify exact versions for `pkgx` dependencies using YAML-like front matter in any file. It allows precise control over the tools required for a project, in this case, `openssl.org` version `1.1.1n`. ```toml # --- # pkgx: # dependencies: # openssl.org: 1.1.1n # --- [package] name = "my cargo project" # snip… ``` -------------------------------- ### Temporarily activate dev environment with pkgx dev Source: https://github.com/pkgxdev/dev/blob/main/README.md This snippet demonstrates how to temporarily activate a `dev` environment for the current shell session using `eval "$(pkgx dev)"`. This is useful for quick testing or exploring new projects without modifying persistent shell configuration files. ```sh $ cd my-project $ eval "$(pkgx dev)" +deno^2 $ deno --version deno 2.1.1 ``` -------------------------------- ### Add custom environment variables via TOML front matter Source: https://github.com/pkgxdev/dev/blob/main/README.md This TOML snippet shows how to define custom environment variables within the `pkgx` front matter. This feature is only available when `dev` is used via the shellcode route and allows setting project-specific variables, though `direnv` is recommended for more robust solutions. ```toml # --- # pkgx: # dependencies: # openssl.org: 1.1.1n # env: # MY_VAR: my-value # --- ``` -------------------------------- ### Specify pkgx dependencies in JSON pkgx node Source: https://github.com/pkgxdev/dev/blob/main/README.md This JSON snippet illustrates how to define `pkgx` dependencies within a dedicated `pkgx` object, suitable for formats that don't support comments or front matter. It allows specifying exact versions, version ranges, and presence of tools. ```json { "pkgx": { "dependencies": { "openssl.org": "1.1.1n", "deno": "^2", "npm": null } } } ``` -------------------------------- ### Manually evaluate dev shellcode Source: https://github.com/pkgxdev/dev/blob/main/README.md This command manually evaluates the `dev` shellcode, typically added to `shell.rc` files. It activates `dev`'s environment management for the current shell session, providing a way to integrate without `dev integrate`. ```sh eval "$(dev --shellcode)" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.