Skip to content

Commit

Permalink
Merge pull request #786 from humanmade/444-documentation-linting-issues
Browse files Browse the repository at this point in the history
Reformat docs files after linting
  • Loading branch information
mikelittle authored Jul 15, 2024
2 parents 82d5e5c + 253abc8 commit 6485adb
Show file tree
Hide file tree
Showing 9 changed files with 542 additions and 352 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Import Travis configuration from dev-tools repo
version: ~> 1.0
import:
- source: humanmade/altis-dev-tools:travis/module.yml@4accc74
- source: humanmade/altis-dev-tools:travis/module.yml@0bfa112a
mode: deep_merge_append

# Add your custom config below, which will merge with the default module config from the section above.
Expand Down
49 changes: 25 additions & 24 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Developer Tools

![](./assets/banner-dev-tools.png)

Altis includes developer tools to allow you to debug and optimize your code. They provide you with an overview of how your page was rendered, as well as details on the various components.
![Dev tools banner](./assets/banner-dev-tools.png)

Altis includes developer tools to allow you to debug and optimize your code. They provide you with an overview of how your page was
rendered, as well as details on the various components.

The Altis developer tools are built on top of the [Query Monitor](https://querymonitor.com/) plugin.


## Getting started

The developer tools are active by default for all environment types except `production`. While logged in, a summary of the request's details will appear in the toolbar at the top of the page. Click this summary to open the developer tools.
The developer tools are active by default for all environment types except `production`. While logged in, a summary of the request's
details will appear in the toolbar at the top of the page. Click this summary to open the developer tools.

![Screenshot of the developer tools toolbar item](./assets/toolbar.png)

Expand All @@ -20,10 +20,10 @@ The developer tools will be displayed as a panel at the bottom of your page.

![Screenshot of the developer tools panel](./assets/qm-overview.png)


### Activating for other users

By default, only administrators have access to the developer tools. You can temporarily test with other users or while logged out by setting an activation cookie instead.
By default, only administrators have access to the developer tools. You can temporarily test with other users or while logged out by
setting an activation cookie instead.

To activate this cookie:

Expand All @@ -36,37 +36,38 @@ To activate this cookie:

You can also add the `view_query_monitor` capability to users to permanently grant them the ability to use the developer tools.


### Activating in other environments

You can enable this on other environments by setting the `altis.modules.dev-tools.enabled` configuration option to true. We recommend using [environment-specific configuration](docs://getting-started/configuration.md#environment-specific-configuration) to only enable it on environments where necessary, as it has a small performance cost.
You can enable this on other environments by setting the `altis.modules.dev-tools.enabled` configuration option to true. We
recommend using [environment-specific configuration](docs://getting-started/configuration.md#environment-specific-configuration) to
only enable it on environments where necessary, as it has a small performance cost.

By default, this module is enabled on all environments except `production`.

For example, to disable on staging:

```json
{
"extra": {
"altis": {
"environments": {
"staging": {
"modules": {
"dev-tools": {
"enabled": false
}
}
}
}
}
}
"extra": {
"altis": {
"environments": {
"staging": {
"modules": {
"dev-tools": {
"enabled": false
}
}
}
}
}
}
}
```


### Editor Stack Traces

Stack traces within the developer tools panel can be made into clickable links that open in your editor. Database queries will also be clickable so you can jump directly to the function that made them.
Stack traces within the developer tools panel can be made into clickable links that open in your editor. Database queries will also
be clickable so you can jump directly to the function that made them.

To activate clickable stack traces:

Expand Down
22 changes: 14 additions & 8 deletions docs/asset-loader.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
# Webpack Asset Loader

This feature makes it easy to detect and load assets generated by Webpack, including those served from local `webpack-dev-server` instances.
This feature makes it easy to detect and load assets generated by Webpack, including those served from local `webpack-dev-server`
instances.

## Usage

The Asset Loader library is designed to work in conjunction with a Webpack configuration (such as those created with the presets in [@humanmade/webpack-helpers](https://github.com/humanmade/webpack-helpers)) which generate an asset manifest file. This manifest associates asset bundle names with either URIs pointing to asset bundles on a running DevServer instance, or else local file paths on disk.
The Asset Loader library is designed to work in conjunction with a Webpack configuration (such as those created with the presets
in [@humanmade/webpack-helpers](https://github.com/humanmade/webpack-helpers)) which generate an asset manifest file. This manifest
associates asset bundle names with either URIs pointing to asset bundles on a running DevServer instance, or else local file paths
on disk.

### `Asset_Loader\register_asset()` and `Asset_Loader\enqueue_asset()`

`Asset_Loader` provides a set of functions for reading this manifest file and registering a specific resource within it to load within your website. The primary public interface provided by this plugin are the functions `Asset_Loader\register_asset()` and `Asset_Loader\enqueue_asset()`.
`Asset_Loader` provides a set of functions for reading this manifest file and registering a specific resource within it to load
within your website. The primary public interface provided by this plugin are the functions `Asset_Loader\register_asset()`
and `Asset_Loader\enqueue_asset()`.

To register a manifest asset call one of these functions inside actions like `wp_enqueue_scripts` or `enqueue_block_editor_assets`, in the same manner you would have called the standard WordPress `wp_register_script` or `wp_enqueue_style` functions.
To register a manifest asset call one of these functions inside actions like `wp_enqueue_scripts` or `enqueue_block_editor_assets`,
in the same manner you would have called the standard WordPress `wp_register_script` or `wp_enqueue_style` functions.

Both functions accept the following parameters:

- **`string $manifest_path`**: The path on disk to the generated manifest file.
- **`string $target_asset`**: The asset output name defined in the Webpack configuration.
- **`array $options`**: An array of options to control how the asset is registered and loaded.
- `bool 'in-footer'`: Whether to load the asset in the footer or of the page or the `<head>`. Default to `true`.
- `array 'dependencies`: An array of script or style handles this asset is dependent upon.
- `string 'handle'`: An optional custom handle to use for referring to the asset. Defaults to the value of `$target_asset`.

- `bool 'in-footer'`: Whether to load the asset in the footer or of the page or the `<head>`. Default to `true`.
- `array 'dependencies`: An array of script or style handles this asset is dependent upon.
- `string 'handle'`: An optional custom handle to use for referring to the asset. Defaults to the value of `$target_asset`.

To register an asset to be manually enqueued later, use `Asset_Loader\register_asset()` instead of `Asset_Loader\enqueue_asset()`.

Expand Down
44 changes: 31 additions & 13 deletions docs/cloud-dev-env.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,59 @@
# Cloud Development Environments

Altis has experimental built-in support for [GitHub Codespaces](https://github.com/features/codespaces), a Cloud-based development environment, that makes it possible to spin up a complete development environment in seconds within your browser, with a full editor based on Visual Studio Code, without having to install anything on your local machine.
Altis has experimental built-in support for [GitHub Codespaces](https://github.com/features/codespaces), a Cloud-based development
environment, that makes it possible to spin up a complete development environment in seconds within your browser, with a full editor
based on Visual Studio Code, without having to install anything on your local machine.

This is useful for many reasons:

- Bootstrap a full development environment in seconds.
- Zero local installation required.
- Standardized and highly configurable environment setup.
- Powerful and scalable development environment.
- Ability to share preview environments with colleagues.
- Bootstrap a full development environment in seconds.
- Zero local installation required.
- Standardized and highly configurable environment setup.
- Powerful and scalable development environment.
- Ability to share preview environments with colleagues.

## How to start

1. **Enable Codespaces support for your GitHub organization**

In order for Codespaces to become available to contributors of a specific repository, the GitHub organization administrator needs to enable support for Codespaces for such contributors. Refer to the official [Enabling Codespaces for your organization](https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/enabling-codespaces-for-your-organization) and [Managing billing for Codespaces in your organization](https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/managing-billing-for-codespaces-in-your-organization) guides for more information.
In order for Codespaces to become available to contributors of a specific repository, the GitHub organization administrator needs
to enable support for Codespaces for such contributors. Refer to the
official [Enabling Codespaces for your organization](https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/enabling-codespaces-for-your-organization)
and [Managing billing for Codespaces in your organization](https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/managing-billing-for-codespaces-in-your-organization)
guides for more information.

2. **Bootstrap the configuration**

After Codespaces is activated, you'll need to bootstrap the development container configuration using `composer dev-tools bootstrap codespaces`. See the [documentation on devcontainers](https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers) for ways to customize your container further.
After Codespaces is activated, you'll need to bootstrap the development container configuration
using `composer dev-tools bootstrap codespaces`. See
the [documentation on `devcontainers`](https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)
for ways to customize your container further.

3. **Start a new container**

Once the devcontainer configuration is committed, you'll be able to start a new Codespaces environment at https://github.com/codespaces/new , or from the "Codespaces" tab when you click on "Code" button where you typically get your repository checkout link. Note: we recommend configuring your codespace environment to use a machine type of '4-core'. Choose "Configure and create codespace" from the drop down menu on Github.
Once the `devcontainer` configuration is committed, you'll be able to start a new Codespaces environment
at [https://github.com/codespaces/new](https://github.com/codespaces/new) , or from the "Codespaces" tab when you click on "Code"
button where you typically get your repository checkout link. Note: we recommend configuring your codespace environment to use a
machine type of '4-core'. Choose " Configure and create codespace" from the drop down menu on GitHub.

4. **Start development!**

Once the codespace is started, you'll be able to use the editor-in-browser to manage the project code. You can use the terminal to start the integrated local server environment as you would if you installed it locally, using `composer server start`. You can also use it to pull and push code in a fully-featured Debian-based environment.
Once the codespace is started, you'll be able to use the editor-in-browser to manage the project code. You can use the terminal
to start the integrated local server environment as you would if you installed it locally, using `composer server start`. You can
also use it to pull and push code in a fully-featured Debian-based environment.

5. **Preview**

Once the local server is started, you'll be presented with the URL to the preview environment where you can view the project in your browser.
Once the local server is started, you'll be presented with the URL to the preview environment where you can view the project in
your browser.

6. **Sharing**

Codespaces preview environments are protected by your own GitHub login session, and are not publicly available by default. But you can explicitly choose specific ports to be public through the `Ports` panel within the editor, so you can share it publicly with others. Port 80 is typically what you'll need to expose publicly to allow access to your project.
Codespaces preview environments are protected by your own GitHub login session, and are not publicly available by default. But
you can explicitly choose specific ports to be public through the `Ports` panel within the editor, so you can share it publicly
with others. Port 80 is typically what you'll need to expose publicly to allow access to your project.

## Notes

GitHub Codespaces support is still experimental, so some hiccups can be expected. Typically, rebuilding the dev container fixes such hiccups.
GitHub Codespaces support is still experimental, so some hiccups can be expected. Typically, rebuilding the developer container
fixes such hiccups.
Loading

0 comments on commit 6485adb

Please sign in to comment.