Skip to content
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

docs: Add proto v0.18 blog post. #1054

Merged
merged 4 commits into from
Sep 18, 2023
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
9 changes: 9 additions & 0 deletions .yarn/versions/0a07c64e.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 9 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 33 additions & 33 deletions crates/cli/tests/setup_teardown_test.rs
Original file line number Diff line number Diff line change
@@ -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());
// }
4 changes: 2 additions & 2 deletions nextgen/query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
1 change: 1 addition & 0 deletions nextgen/query/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ fn build_criteria(ast: Vec<AstNode>) -> miette::Result<Criteria> {
}
"project" => Field::Project(value),
"projectAlias" => Field::ProjectAlias(value),
"projectName" => Field::ProjectName(value),
"projectSource" => Field::ProjectSource(value),
"projectType" => {
Field::ProjectType(build_criteria_enum::<ProjectType>(&field, &op, value)?)
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

#### 🐞 Fixes

- Fixed an issue where the `projectName` query would not work correctly.

## 1.13.4

#### ⚙️ Internal
Expand Down
67 changes: 67 additions & 0 deletions website/blog/2023-09-18_proto-v0.18.mdx
Original file line number Diff line number Diff line change
@@ -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.

<!--truncate-->

## 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.
3 changes: 1 addition & 2 deletions website/docs/proto/commands/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 41 additions & 0 deletions website/docs/proto/commands/tools.mdx
Original file line number Diff line number Diff line change
@@ -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.
66 changes: 51 additions & 15 deletions website/docs/proto/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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]
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading