Skip to content

Commit

Permalink
Update @sandbox-start preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanblock committed Feb 3, 2024
1 parent cbda737 commit 4a2938c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/shared/redirect-map.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const permanentRedirects = {
'/docs/en/reference/prefs.arc/env': '/docs/en/reference/configuration/local-preferences#@env',
'/docs/en/reference/prefs.arc/.env': '/docs/en/reference/configuration/local-preferences#@env',
'/docs/en/reference/prefs.arc/sandbox': '/docs/en/reference/configuration/local-preferences#@sandbox',
'/docs/en/reference/prefs.arc/sandbox-startup': '/docs/en/reference/configuration/local-preferences#@sandbox-startup',
'/docs/en/reference/prefs.arc/sandbox-startup': '/docs/en/reference/configuration/local-preferences#@sandbox-start',

// Reference > CLI
// round 1: Q1 2021
Expand Down
2 changes: 1 addition & 1 deletion src/views/docs/en/guides/plugins/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: '<code>sandbox</code> lifecycle hook plugins'

Run arbitrary operations during Sandbox startup. At the time of `sandbox.start` execution, all core Sandbox services are guaranteed to be running.

> This method is similar to [`@sandbox-startup` scripts](/docs/en/reference/configuration/local-preferences#%40sandbox-startup), but authored in JS, and controlled entirely via plugin. If in doubt, we suggest using `sandbox.start` over [`@sandbox-startup` scripts.
> This method is similar to [`@sandbox-start` scripts](/docs/en/reference/configuration/local-preferences#%40sandbox-start), but authored in JS, and controlled entirely via plugin. If in doubt, we suggest using `sandbox.start` over [`@sandbox-start` scripts.
`sandbox.start` plugins are either async or synchronous functions, and receive a single argument, which is an object containing the following properties:

Expand Down
6 changes: 3 additions & 3 deletions src/views/docs/en/reference/cli/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ no-hydrate true
\* These advanced options should be used with care since they will allow local development code to interact with live AWS resources.


### `@sandbox-startup`
### `@sandbox-start`

Additionally, Sandbox can run shell commands on startup by setting [`@sandbox-startup`](../configuration/local-preferences#%40sandbox-startup) in [local preferences](../configuration/local-preferences).
Additionally, Sandbox can run shell commands on startup by setting [`@sandbox-start`](../configuration/local-preferences#%40sandbox-start) in [local preferences](../configuration/local-preferences) like so:

```arc
@sandbox-startup
@sandbox-start
node scripts/seed_db.js
echo 'hello'
```
Expand Down
13 changes: 8 additions & 5 deletions src/views/docs/en/reference/configuration/local-preferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ sections:
- '@create'
- '@env'
- '@sandbox'
- '@sandbox-startup'
- '@sandbox-start'
---

> Architect preferences (`preferences.arc`, or `prefs.arc`) defines settings for local Architect workflows. This file is intended to be added to `.gitignore`.
- [`@create`](#%40create) - Preferences for resource creation with `arc init`
- [`@env`](#%40env) - Configure environment variables
- [`@sandbox`](#%40sandbox) - Define Sandbox preferences
- [`@sandbox-startup`](#%40sandbox-startup) - Hook into Sandbox's startup
- [`@sandbox-start`](#%40sandbox-start) - Hook into Sandbox's startup

## `@create`

Expand Down Expand Up @@ -136,14 +136,17 @@ Disables hydration
no-hydrate true
```

## `@sandbox-startup`
## `@sandbox-start`

Hook up CLI commands into [Sandbox](../cli/sandbox) startup. Helpful for repetitive tasks like seeding a database or starting up additional services for local development. Each command should be a separate unindented line under the `@sandbox-start` pragma.

Hook up CLI commands into [Sandbox](../cli/sandbox) startup. Helpful for repetitive tasks like seeding a database or starting up additional services for local development. Each command should be a separate unindented line under the `@sandbox-startup` pragma.

### Example

```arc
@sandbox-startup
@sandbox-start
node scripts/seed_db.js
echo 'hello'
```

> Note: the older alias `@sandbox-startup` still works, but will be deprecated in a future release. Please use `@sandbox-start`

0 comments on commit 4a2938c

Please sign in to comment.