From 9293864b9176df4c9e41c99d8fa338cec7b2720d Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Mon, 18 Sep 2023 12:37:00 -0700 Subject: [PATCH] docs: Add proto v0.18 blog post. (#1054) * Update docs. * Fix query. * Add blog post. * Comment out test. --- .yarn/versions/0a07c64e.yml | 9 ++++ Cargo.lock | 17 ++++--- crates/cli/tests/setup_teardown_test.rs | 66 ++++++++++++------------ nextgen/query/Cargo.toml | 4 +- nextgen/query/src/builder.rs | 1 + packages/cli/CHANGELOG.md | 6 +++ website/blog/2023-09-18_proto-v0.18.mdx | 67 +++++++++++++++++++++++++ website/docs/proto/commands/plugins.mdx | 3 +- website/docs/proto/commands/tools.mdx | 41 +++++++++++++++ website/docs/proto/config.mdx | 66 ++++++++++++++++++------ website/sidebars.js | 1 + 11 files changed, 221 insertions(+), 60 deletions(-) create mode 100644 .yarn/versions/0a07c64e.yml create mode 100644 website/blog/2023-09-18_proto-v0.18.mdx create mode 100644 website/docs/proto/commands/tools.mdx diff --git a/.yarn/versions/0a07c64e.yml b/.yarn/versions/0a07c64e.yml new file mode 100644 index 00000000000..1f2a5d9c201 --- /dev/null +++ b/.yarn/versions/0a07c64e.yml @@ -0,0 +1,9 @@ +releases: + "@moonrepo/cli": patch + "@moonrepo/core-linux-arm64-gnu": patch + "@moonrepo/core-linux-arm64-musl": patch + "@moonrepo/core-linux-x64-gnu": patch + "@moonrepo/core-linux-x64-musl": patch + "@moonrepo/core-macos-arm64": patch + "@moonrepo/core-macos-x64": patch + "@moonrepo/core-windows-x64-msvc": patch diff --git a/Cargo.lock b/Cargo.lock index 347334697e7..7d7610c0c2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4382,19 +4382,20 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" +checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" +checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a" dependencies = [ "pest", "pest_generator", @@ -4402,9 +4403,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" +checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141" dependencies = [ "pest", "pest_meta", @@ -4415,9 +4416,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" +checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" dependencies = [ "once_cell", "pest", diff --git a/crates/cli/tests/setup_teardown_test.rs b/crates/cli/tests/setup_teardown_test.rs index cf61967844e..ec383973d80 100644 --- a/crates/cli/tests/setup_teardown_test.rs +++ b/crates/cli/tests/setup_teardown_test.rs @@ -1,44 +1,44 @@ -use moon_test_utils::{create_sandbox_with_config, get_cases_fixture_configs}; -use moon_utils::is_ci; -use starbase_utils::dirs; +// use moon_test_utils::{create_sandbox_with_config, get_cases_fixture_configs}; +// use moon_utils::is_ci; +// use starbase_utils::dirs; -#[test] -fn sets_up_and_tears_down() { - // This is heavy so avoid in local tests for now - if !is_ci() { - return; - } +// #[test] +// fn sets_up_and_tears_down() { +// // This is heavy so avoid in local tests for now +// if !is_ci() { +// return; +// } - // We use a different Node.js version as to not conflict with other tests! - let node_version = "17.1.0"; - let home_dir = dirs::home_dir().unwrap(); - let moon_dir = home_dir.join(".proto"); - let node_dir = moon_dir.join("tools/node").join(node_version); +// // We use a different Node.js version as to not conflict with other tests! +// let node_version = "17.1.0"; +// let home_dir = dirs::home_dir().unwrap(); +// let moon_dir = home_dir.join(".proto"); +// let node_dir = moon_dir.join("tools/node").join(node_version); - assert!(!node_dir.exists()); +// assert!(!node_dir.exists()); - let (workspace_config, toolchain_config, tasks_config) = get_cases_fixture_configs(); +// let (workspace_config, toolchain_config, tasks_config) = get_cases_fixture_configs(); - let sandbox = create_sandbox_with_config( - "cases", - Some(workspace_config), - Some(toolchain_config), - Some(tasks_config), - ); +// let sandbox = create_sandbox_with_config( +// "cases", +// Some(workspace_config), +// Some(toolchain_config), +// Some(tasks_config), +// ); - let setup = sandbox.run_moon(|cmd| { - cmd.arg("setup").env("MOON_NODE_VERSION", node_version); - }); +// let setup = sandbox.run_moon(|cmd| { +// cmd.arg("setup").env("MOON_NODE_VERSION", node_version); +// }); - setup.success().code(0); +// setup.success().code(0); - assert!(node_dir.exists()); +// assert!(node_dir.exists()); - let teardown = sandbox.run_moon(|cmd| { - cmd.arg("teardown").env("MOON_NODE_VERSION", node_version); - }); +// let teardown = sandbox.run_moon(|cmd| { +// cmd.arg("teardown").env("MOON_NODE_VERSION", node_version); +// }); - teardown.success().code(0); +// teardown.success().code(0); - assert!(!node_dir.exists()); -} +// assert!(!node_dir.exists()); +// } diff --git a/nextgen/query/Cargo.toml b/nextgen/query/Cargo.toml index 97165360a65..ee70bb86985 100644 --- a/nextgen/query/Cargo.toml +++ b/nextgen/query/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/moonrepo/moon" moon_common = { version = "0.1.0", path = "../common" } moon_config = { version = "0.1.0", path = "../config" } miette = { workspace = true } -pest = "2.7.2" -pest_derive = "2.7.2" +pest = "2.7.3" +pest_derive = "2.7.3" starbase_utils = { workspace = true } thiserror = { workspace = true } diff --git a/nextgen/query/src/builder.rs b/nextgen/query/src/builder.rs index 3a0250aa593..ca091e2fc90 100644 --- a/nextgen/query/src/builder.rs +++ b/nextgen/query/src/builder.rs @@ -114,6 +114,7 @@ fn build_criteria(ast: Vec) -> miette::Result { } "project" => Field::Project(value), "projectAlias" => Field::ProjectAlias(value), + "projectName" => Field::ProjectName(value), "projectSource" => Field::ProjectSource(value), "projectType" => { Field::ProjectType(build_criteria_enum::(&field, &op, value)?) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 3ca5d7e9a76..e0d5f7c5c8f 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +#### 🐞 Fixes + +- Fixed an issue where the `projectName` query would not work correctly. + ## 1.13.4 #### ⚙️ Internal diff --git a/website/blog/2023-09-18_proto-v0.18.mdx b/website/blog/2023-09-18_proto-v0.18.mdx new file mode 100644 index 00000000000..8d76aeba604 --- /dev/null +++ b/website/blog/2023-09-18_proto-v0.18.mdx @@ -0,0 +1,67 @@ +--- +slug: proto-v0.18 +title: proto v0.18 - List installed tools and configure HTTP client +authors: [milesj] +tags: [proto, http] +# image: ./img/proto/v0.17.png +--- + +Today we've got a small release that includes some helpful features. + + + +## New `proto tools` command + +Are you curious what tools you have installed? And more specifically, which versions? What about +configured aliases? Until now, you had to manually check the `~/.proto/tools` directory for this +information, but now, you can simply run [`proto tools`](/docs/proto/commands/tools) to get a list +of all installed tools. + +This command will list all tools that have been installed, along with their installed versions, +relevant timestamps, available aliases, and store location. + +```shell +$ proto tools +go - Go + Store: ~/.proto/tools/go + Versions: + 1.20.0 - installed 08/24/23, last used 09/18/23 + 1.20.2 - installed 01/01/70, last used 09/18/23, default version + +node - Node.js + Store: ~/.proto/tools/node + Aliases: + ~20 = stable + Versions: + 18.0.0 - installed 09/03/23, last used 09/18/23, default version + 18.14.0 - installed 09/04/23, last used 09/04/23 + 18.17.1 - installed 09/04/23, last used 09/04/23 + 19.0.0 - installed 09/03/23 + 20.0.0 - installed 09/03/23 + 20.6.0 - installed 09/04/23, last used 09/18/23 +``` + +> This information can also be represented as JSON by passing the `--json` flag. + +## New `[http]` user settings + +Furthermore, we've added a new [`[http]` setting to `~/.proto/config.toml`](/docs/proto/config#http) +that allows you to configure aspects of the HTTP client, which is primarily used for downloading +tools. + +This may useful if you're behind a proxy, a VPN, or corporate network, and certain requests and +certificates are blocked. + +```toml title="~/.proto/config.toml" +[http] +proxies = ["http://intra.net/proxy"] +root-cert = "/path/to/root/cert.pem" +``` + +## Other changes + +View the [official release](https://github.com/moonrepo/proto/releases/tag/v0.18.0) for a full list +of changes. + +- For TOML plugins, we updated the schema internally to be represented as JSON instead of TOML, + which may cause breakages depending on a version mismatch between proto and the plugin. diff --git a/website/docs/proto/commands/plugins.mdx b/website/docs/proto/commands/plugins.mdx index af443a0b420..c01a8b5e3a5 100644 --- a/website/docs/proto/commands/plugins.mdx +++ b/website/docs/proto/commands/plugins.mdx @@ -8,8 +8,7 @@ The `proto plugins` command will list all available and configured plugins. Will ```shell $ proto plugins bun - Bun v1.2 - GitHub: moonrepo/bun-plugin - Tag: latest + Source: https://github.com/moonrepo/bun-plugin/releases/latest/download/bun_plugin.wasm deno - Deno v2.0 GitHub: moonrepo/deno-plugin diff --git a/website/docs/proto/commands/tools.mdx b/website/docs/proto/commands/tools.mdx new file mode 100644 index 00000000000..a54bd631056 --- /dev/null +++ b/website/docs/proto/commands/tools.mdx @@ -0,0 +1,41 @@ +--- +title: tools +--- + +The `proto tools` command will list all tools that have been installed, along with their installed +versions, relevant timestamps, available aliases, and store location. + +```shell +$ proto tools +go - Go + Store: ~/.proto/tools/go + Versions: + 1.20.0 - installed 08/24/23, last used 09/18/23 + 1.20.2 - installed 01/01/70, last used 09/18/23, default version + +node - Node.js + Store: ~/.proto/tools/node + Aliases: + ~20 = stable + Versions: + 18.0.0 - installed 09/03/23, last used 09/18/23, default version + 18.14.0 - installed 09/04/23, last used 09/04/23 + 18.17.1 - installed 09/04/23, last used 09/04/23 + 19.0.0 - installed 09/03/23 + 20.0.0 - installed 09/03/23 + 20.6.0 - installed 09/04/23, last used 09/18/23 +``` + +A list of tool IDs can be provided to filter the output list. + +```shell +$ proto tools node npm +``` + +### Arguments + +- `[id...]` - IDs of plugins. + +### Options + +- `--json` - Print the list in JSON format. diff --git a/website/docs/proto/config.mdx b/website/docs/proto/config.mdx index 644904152df..808e61571db 100644 --- a/website/docs/proto/config.mdx +++ b/website/docs/proto/config.mdx @@ -15,7 +15,7 @@ proto supports pinning versions of tools on a per-project or per-directory basis `.prototools` configuration file. This file takes precedence during [version detection](./detection) and can be created/updated with [`proto local`](./commands/local). -This configuration simply maps tools to fully-qualified semantic versions for the current directory. +This configuration simply maps tools to versions for the current directory. ```toml title=".prototools" node = "16.16.0" @@ -26,9 +26,10 @@ rust = "1.68.0" > The names of tools are the same used on the command line! -### Plugins +### `[plugins]` -[Plugins](./plugins) can also be configured on a per-project basis with the `[plugins]` section. +[Plugins](./plugins) can also be configured with the `[plugins]` section. +[Learn more about this syntax](./plugins#enabling-plugins). ```toml title=".prototools" [plugins] @@ -47,26 +48,61 @@ proto operates with sane defaults and accomplishes its goals very well. However, user choice and customization, and as such, support a user configuration file located at `~/.proto/config.toml`, which can be used to customize the behavior of proto. +Some of these settings (excluding plugins) can also be configured via environment variables. + +```shell +PROTO_AUTO_INSTALL=true proto run node +``` + +### `auto-install` + +When enabled, will automatically installing missing tools when [`proto run`](./commands/run) is run, +instead of erroring. Defaults to `false`. + ```toml title="~/.proto/config.toml" auto-install = true ``` -These settings (excluding plugins) can also be configured via environment variables. +### `auto-clean` -```shell -PROTO_AUTO_INSTALL=true proto run node +When enabled, will automatically clean up the proto cache when [`proto use`](./commands/use) is run. +Defaults to `false`. + +```toml title="~/.proto/config.toml" +auto-clean = true +``` + +### `node-intercept-globals` + +When enabled, will intercept global package installs for node/npm/pnpm/yarn and suggest using +[`proto install-global`](./commands/install-global) instead. Defaults to `true`. + +```toml title="~/.proto/config.toml" +node-intercept-globals = false +``` + +### `[http]` + +Can be used to customize the HTTP client used by proto and warpgate, primarily for requesting files +to download, available versions, and more. The following settings are available: + +- `allow-invalid-certs` - When enabled, will allow invalid certificates instead of failing. This is + an _escape hatch_ and should only be used if other settings have failed. Be sure you know what + you're doing! +- `proxies` - A list of proxy URLs to use for requests. +- `root-cert` - The path to a root certificate to use for requests. This is useful for overriding + the native certificate, or for using a self-signed certificate, especially when in a + corporate/internal environment. Supports `pem` and `der` files. + +```toml title="~/.proto/config.toml" +[http] +root-cert = "/path/to/root/cert.pem" ``` -### Settings +### `[plugins]` -- `auto-install` - When enabled, will automatically installing missing tools when - [`proto run`](./commands/run) is run, instead of erroring. Defaults to `false`. -- `auto-clean` - When enabled, will automatically clean up the proto cache when - [`proto use`](./commands/use) is run. Defaults to `false`. -- `node-intercept-globals` - When enabled, will intercept global package installs for npm/pnpm/yarn - and suggest using [`proto install-global`](./commands/install-global) instead. Defaults to `true`. -- `[plugins]` - A mapping of plugins available to the user. Refer to the [plugins](#plugins) section - above for more information. +A mapping of plugins available to the user, and not just a project/directory. Refer to the +[`[plugins]`](#plugins) section above for more information. ## GitHub Action diff --git a/website/sidebars.js b/website/sidebars.js index 22e5970461d..acd966885f4 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -291,6 +291,7 @@ const sidebars = { 'proto/commands/remove-plugin', 'proto/commands/run', 'proto/commands/setup', + 'proto/commands/tools', 'proto/commands/unalias', 'proto/commands/uninstall', 'proto/commands/uninstall-global',