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

command runs "per-project" #42

Merged
merged 8 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ env:
NIGHTLY_DDEV_PR_URL: "https://nightly.link/ddev/ddev/actions/runs/1720215802/ddev-linux-amd64.zip"
# Allow ddev get to use a github token to prevent rate limiting by tests
DDEV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Allow `--HEAD` flag when running tests against HEAD
HOMEBREW_NO_INSTALL_FROM_API: 1

jobs:
tests:
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [Introduction](#introduction)
- [Getting Started](#getting-started)
- [Note](#note)
tyler36 marked this conversation as resolved.
Show resolved Hide resolved
- [What does this add-on do and add?](#what-does-this-add-on-do-and-add)
- [Other ways to use browsersync with this add-on](#other-ways-to-use-browsersync-with-this-add-on)
- [Basic usage](#basic-usage)
Expand Down Expand Up @@ -38,13 +39,26 @@ NOTE: The browsersync'd URL is ***HTTPS***, not HTTP. ddev-router redirects traf
EG.
"External: <http://d9.ddev.site:3000>" => Access on **<https://d9.ddev.site:3000>**

### Note
tyler36 marked this conversation as resolved.
Show resolved Hide resolved

From version `2.5.0`, this addon uses a "per-project" approach. This will not affect usage as project-level command have higher priority than global commands.
tyler36 marked this conversation as resolved.
Show resolved Hide resolved

When installing current versions, a warning is displayed if the global command (`~/.ddev/commands/web/browsersync`) is detected. You may safely delete his file.
tyler36 marked this conversation as resolved.
Show resolved Hide resolved

If you run `ddev browsersync` from multiple local projects and receive a `Error: unknown command "browsersync" for "ddev"`, run the following command to add the command to the project as needed.
tyler36 marked this conversation as resolved.
Show resolved Hide resolved

```shell
ddev get ddev/ddev-browsersync
```


## What does this add-on do and add?

1. Checks to make sure the DDEV version is adequate.
2. Adds `.ddev/web-build/Dockerfile.ddev-browsersync`, which installs browsersync using npm.
3. Adds a `browser-sync.js` to define the operation of the base setup.
4. Adds a `.ddev/docker-compose.browsersync.yaml`, which exposes and routes the ports necessary.
5. Adds a `ddev browsersync` shell command globally, which lets you easily start browsersync when you want it.
5. Adds a `ddev browsersync` shell command, which lets you easily start browsersync when you want it.

## Other ways to use browsersync with this add-on

Expand Down
12 changes: 7 additions & 5 deletions install.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: ddev-browsersync

pre_install_actions:
- |
- |
#ddev-nodisplay
#ddev-description:Check for minimum DDEV requirement (v1.19.3)
if ! ( ddev debug capabilities 2>/dev/null | grep multiple-dockerfiles >/dev/null 2>&1 ) ; then
Expand All @@ -12,11 +12,13 @@ project_files:
- docker-compose.browsersync.yaml
- web-build/Dockerfile.ddev-browsersync
- browser-sync.js


global_files:
- commands/web/browsersync


post_install_actions:

- |
#ddev-nodisplay
#ddev-description:Check for global 'browser-sync.js'
if ( test -f "$HOME/.ddev/commands/web/browsersync" ) ; then
echo "Note: '~/.ddev/commands/web/browsersync' is no longer required and can be safely removed." && exit 0
fi