Skip to content

Commit

Permalink
command runs "per-project" (#42)
Browse files Browse the repository at this point in the history
* command runs "per-project"

* add note if global command is detected

* Add env for running tests against HEAD

* Update README.md

Co-authored-by: Matt Stein <m@ttste.in>

* Update README.md

Co-authored-by: Matt Stein <m@ttste.in>

* Update README.md

Co-authored-by: Matt Stein <m@ttste.in>

* Update README.md

Co-authored-by: Matt Stein <m@ttste.in>

* Update README.md

Co-authored-by: Matt Stein <m@ttste.in>

---------

Co-authored-by: tyler36 <7234392+tyler36@users.noreply.github.com>
Co-authored-by: Matt Stein <m@ttste.in>
  • Loading branch information
3 people committed Feb 7, 2023
1 parent c8fb31d commit b24e8e8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
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
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,24 @@ 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>**


> :bulb: This add-on moves to a per-project approach in v2.5.0+. You can safely delete the global `~/.ddev/commands/web/browsersync` once you’re on v2.5.0 or higher—this will not affect usage.

If you run `ddev browsersync` from a local project and get `Error: unknown command "browsersync" for "ddev"`, run the following to add the command to the project:

```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

0 comments on commit b24e8e8

Please sign in to comment.