Skip to content

Commit

Permalink
feat: rename utility to edgly
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkli committed Jan 21, 2025
1 parent 790c34d commit 3ea7acf
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 55 deletions.
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## @adobe/fastly-dev
## @adobe/edgly

> Command line tool to boost Fastly VCL service development
---
Expand All @@ -24,23 +24,23 @@ Fastly is a service and trademark by [Fastly, Inc.](https://www.fastly.com)
## Installation

```sh
npm install -g @adobe/fastly-dev
npm install -g @adobe/edgly
```

## Usage

```
__ _ _ _
/ _| __ _ ___| |_| |_ _ __| | _____ __
| |_ / _` / __| __| | | | |_____ / _` |/ _ \ \ / /
| _| (_| \__ \ |_| | |_| |_____| (_| | __/\ V /
|_| \__,_|___/\__|_|\__, | \__,_|\___| \_/
|___/
_ _
___ __| | __ _| |_ _
/ _ \/ _` |/ _` | | | | |
| __/ (_| | (_| | | |_| |
\___|\__,_|\__, |_|\__, |
|___/ |___/
https://github.com/adobe/fastly-dev
https://github.com/adobe/edgly
USAGE
fastly-dev <command> [flags]
edgly <command> [options]
Boost Fastly™️ VCL service development
Expand All @@ -51,13 +51,13 @@ COMMANDS
version Show version info
shell-completion Print completion script for .bashrc or .zshrc
GLOBAL FLAGS
-c, --config Configuration file [string] [default: "fastly-dev.yaml"]
GLOBAL OPTIONS
-c, --config Configuration file [string] [default: "edgly.yaml"]
-v, --verbose Verbose output [boolean]
-h, --help Show help [boolean]
Flags can be provided as environment variables prefixed with FASTLY_DEV_
Example: --api-token becomes FASTLY_DEV_API_TOKEN.
Options can also be set as environment variables prefixed with EDGLY_.
Example: --api-token becomes EDGLY_API_TOKEN.
```

### Initial setup for a Fastly service
Expand All @@ -67,7 +67,7 @@ GLOBAL FLAGS
3. Inside a git repo (one repo per Fastly service recommended)
4. Fetch the service configuration
```sh
fastly-dev service get <service-id>
edgly service get <service-id>
```
5. Review for any secrets detected
6. Commit the newly added files
Expand All @@ -77,7 +77,7 @@ GLOBAL FLAGS

A stage environment allows to safely test changes in Fastly before deploying to the production service.

1. Add stage environment to `fastly-dev.yaml` and map the domain names to the ones to be used for stage:
1. Add stage environment to `edgly.yaml` and map the domain names to the ones to be used for stage:
```yaml
env:
stage:
Expand All @@ -86,38 +86,38 @@ A stage environment allows to safely test changes in Fastly before deploying to
```
2. Create stage service:
```sh
fastly-dev service create --env stage
edgly service create --env stage
```
3. This will store the new service id in `fastly-dev.yaml`. Commit this file.
3. This will store the new service id in `edgly.yaml`. Commit this file.

### Develop changes using Fiddles

Developing with [Fastly Fiddles](https://fiddle.fastly.dev) is helpful as it allows to debug request handling in Fastly in depth. Note this will not work if the service uses entire VCL files, it only works with VCL snippets.

1. Create a new fiddle:
```sh
fastly-dev fiddle create
edgly fiddle create
```
2. Click the printed link to open the Fiddle
3. Develop the VCL code in the Fiddle
4. Copy any tests needed for the work into the Fiddle
5. When done, pull the changes from the Fiddle:
```sh
fastly-dev fiddle get <fiddle-url>
edgly fiddle get <fiddle-url>
```
6. Review the changes and commit

### Test changes in stage then deploy to production

1. Deploy to stage:
```sh
fastly-dev service update --env stage --activate
edgly service update --env stage --activate
```
3. Wait for Fastly changes to rollout, usually less than 30 seconds
2. Run any tests against stage
3. If successful, deploy to production:
```sh
fastly-dev service update --activate
edgly service update --activate
```
4. If something goes wrong, revert to old version using the Fastly UI

Expand Down Expand Up @@ -194,23 +194,23 @@ clientFetch.status is 200

Run tests against production:
```
fastly-dev test
edgly test
```

Custom host:
```
HOST=https://thumbnails.findmy.media fastly-dev test
HOST=https://thumbnails.findmy.media edgly test
```

Run specific test file:
```
fastly-dev test tests/image.http
edgly test tests/image.http
```

Run individual test:
```
# :5 = line number where test starts, the ### line
fastly-dev test tests/image.http:5
edgly test tests/image.http:5
```

### Visual Studio Code test support
Expand All @@ -222,7 +222,7 @@ The [tepi VS Code extension](https://marketplace.visualstudio.com/items?itemName
1. Add a file named `tepi` in the root of your VS Code workspace
```sh
#!/bin/sh
fastly-dev test "$@"
edgly test "$@"
```
2. Ensure the file is executable
```sh
Expand Down Expand Up @@ -252,7 +252,7 @@ Inside VS Code you can now run tests individually:

## Configuration

The tool uses a `fastly-dev.yaml` file in the current directory to store environment specific settings. The file is expected to be version controlled and shared with the team.
The tool uses a `edgly.yaml` file in the current directory to store environment specific settings. The file is expected to be version controlled and shared with the team.

Full configuration file example:

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@adobe/fastly-dev",
"name": "@adobe/edgly",
"version": "0.0.1",
"description": "Command line tool to boost Fastly VCL service development",
"main": "src/index.js",
"type": "module",
"bin": {
"fastly-dev": "src/index.js"
"edgly": "src/index.js"
},
"scripts": {
"test": "c8 mocha",
Expand Down Expand Up @@ -58,10 +58,10 @@
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/adobe/fastly-dev"
"url": "https://github.com/adobe/edgly"
},
"bugs": {
"url": "https://github.com/adobe/fastly-dev/issues"
"url": "https://github.com/adobe/edgly/issues"
},
"homepage": "https://github.com/adobe/fastly-dev#readme"
"homepage": "https://github.com/adobe/edgly#readme"
}
2 changes: 1 addition & 1 deletion src/commands/service/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
}

const name = argv.name || `${service.name} (${env})`;
const comment = `Created by fastly-dev. Copy of ${service.service_id}`;
const comment = `Created by edgly. Copy of ${service.service_id}`;

if (argv.dryRun) {
console.log('\nDry run. Not making changes. Would otherwise:');
Expand Down
4 changes: 2 additions & 2 deletions src/commands/service/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default {

if (!id) {
console.error(`Error: No service ID found for environment '${env}' in configuration file.`);
console.error(" Use 'fastly-dev service create' to create a new service or environment.");
console.error(" Use 'edgly service create' to create a new service or environment.");
process.exit(1);
}
}
Expand All @@ -89,7 +89,7 @@ export default {
service.comment =
argv.comment ||
getLastGitCommit() ||
`Added by ${os.userInfo().username} via fastly-dev at ${new Date().toLocaleString('en-US')}`;
`Added by ${os.userInfo().username} via edgly at ${new Date().toLocaleString('en-US')}`;

if (argv.dryRun) {
console.log('\nDry run. Not making changes. Would otherwise:');
Expand Down
2 changes: 1 addition & 1 deletion src/fastly/service-mgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export class FastlyServiceManager {
}
if (unsupported.length > 0) {
console.warn('\nWarning: Unsupported features found:', unsupported.join(', '));
console.warn(' These are not fully handled by fastly-dev.');
console.warn(' These are not fully handled by edgly.');
}
}
}
24 changes: 12 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ await yargs
.recommendCommands()
.strict()
.options(GLOBAL_OPTS)
.env('FASTLY_DEV')
// ascii font from https://patorjk.com/software/taag/#p=display&f=Standard&t=fastly-dev
.env('EDGLY')
// ascii font from https://patorjk.com/software/taag/#p=display&f=Standard&t=edgly
.prologue('')
.prologue(' __ _ _ _ ')
.prologue(' / _| __ _ ___| |_| |_ _ __| | _____ __')
.prologue(' | |_ / _` / __| __| | | | |_____ / _` |/ _ \\ \\ / /')
.prologue(' | _| (_| \\__ \\ |_| | |_| |_____| (_| | __/\\ V / ')
.prologue(' |_| \\__,_|___/\\__|_|\\__, | \\__,_|\\___| \\_/ ')
.prologue(' |___/ ')
.prologue(' _ _ ')
.prologue(' ___ __| | __ _| |_ _ ')
.prologue(' / _ \\/ _` |/ _` | | | | |')
.prologue(' | __/ (_| | (_| | | |_| |')
.prologue(' \\___|\\__,_|\\__, |_|\\__, |')
.prologue(' |___/ |___/ ')
.prologue('')
.prologue(' https://github.com/adobe/fastly-dev')
.prologue(' https://github.com/adobe/edgly')
.prologue('')
.usage('$0 <command> [flags]')
.usage('$0 <command> [options]')
.usage('')
.usage('Boost Fastly™️ VCL service development')
.epilogue(' Flags can be provided as environment variables prefixed with FASTLY_DEV_')
.epilogue(' Example: --api-token becomes FASTLY_DEV_API_TOKEN.')
.epilogue(' Options can also be set as environment variables prefixed with EDGLY_.')
.epilogue(' Example: --api-token becomes EDGLY_API_TOKEN.')
.epilogue('')
.epilogue(`Version: ${version.getVersion()}`)
.run();
Expand Down
4 changes: 2 additions & 2 deletions src/opts.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import { Config } from './config.js';

const DEFAULT_CONFIG_FILE = 'fastly-dev.yaml';
const DEFAULT_CONFIG_FILE = 'edgly.yaml';

// turn off console.debug by default
// and only turn it on below if -v/--verbose is set
Expand Down Expand Up @@ -52,7 +52,7 @@ export const SHARED_OPTS = {
alias: 't',
type: 'string',
describe: 'Fastly API Token',
demandOption: 'Set Fastly API Token using --api-token or FASTLY_DEV_API_TOKEN environment variable.',
demandOption: 'Set Fastly API Token using --api-token or EDGLY_API_TOKEN environment variable.',
},
},
env: {
Expand Down
2 changes: 1 addition & 1 deletion src/yargs-ahoy.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export default function yargsAhoy(processArgs, cwd, parentRequire) {
return yargs
.updateStrings({
'Commands:': COMMANDS,
'Options:': chalk.bold('GLOBAL FLAGS'),
'Options:': chalk.bold('GLOBAL OPTIONS'),
'Positionals:': chalk.bold('ARGUMENTS'),
})
.fail(onFail)
Expand Down

0 comments on commit 3ea7acf

Please sign in to comment.