Skip to content

Commit

Permalink
fix: more AEM branding and deploy to @adobe/aem-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
tripodsan authored Sep 29, 2023
1 parent 3292cb1 commit a58fd43
Show file tree
Hide file tree
Showing 20 changed files with 134 additions and 126 deletions.
66 changes: 33 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Helix/AEM Command Line Interface (`hlx` or `aem`)
# Helix/AEM Command Line Interface (`aem`)

## Status

Expand All @@ -8,25 +8,24 @@
[![GitHub issues](https://img.shields.io/github/issues/adobe/helix-cli.svg)](https://github.com/adobe/helix-cli/issues)
[![LGTM Code Quality Grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/adobe/helix-cli.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/adobe/helix-cli)

The Helix Command Line Interface allows web developers to create, develop, and deploy digital experiences using Adobe Experience Manager Sites 'Edge Delivery Services' f.k.a 'Project Helix'
The AEM Command Line Interface allows web developers to create, develop, and deploy digital experiences using the Adobe Experience Manager Sites feature Edge Delivery Services. Some of this functionality was known as Franklin or Project Helix before.

## Installation

Install `hlx` or `aem` as a global command. You need Node 12.11 or newer.
Install `aem` as a global command. You need Node 12.11 or newer.

```bash
$ npm install -g @adobe/helix-cli
$ npm install -g @adobe/aem-cli
```

## Quick Start
You can interchange `hlx` and `aem` in the examples listed below.

```
$ hlx --help
Usage: hlx <command> [options]
$ aem --help
Usage: aem <command> [options]
Commands:
hlx up Run a Helix development server
aem up Run a AEM development server
Options:
--version Show version number [boolean]
Expand All @@ -47,7 +46,7 @@ for more information, find our manual at https://github.com/adobe/helix-cli

```
$ cd <my-cool-project>
$ hlx up
$ aem up
```

### automatically open the browser
Expand All @@ -66,23 +65,24 @@ $ openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out server.c

this will create 2 files: `server.crt` and `server.key`

2. start hlx with tls support
2. start aem with tls support

```
$ hlx up --tls-cert server.crt --tls-key server.key
____ __ ___ v14.21.4
/ __/______ ____ / /__ / (_)__
/ _// __/ _ `/ _ \/ '_// / / _ \
/_/ /_/ \_,_/_//_/_/\_\/_/_/_//_/
info: Starting Franklin dev server v14.21.4
info: Local Franklin dev server up and running: https://localhost:3000/
$ aem up --tls-cert server.crt --tls-key server.key
___ ______ ___ ____ __ ___ ___
/ _ | / __/ |/ / / __/__/ /__ ____ / _ \___ / (_) _____ ______ __
/ __ |/ _// /|_/ / / _// _ / _ `/ -_) // / -_) / / |/ / -_) __/ // /
/_/ |_/___/_/ /_/ /___/\_,_/\_, /\__/____/\__/_/_/|___/\__/_/ \_, /
/___/ v14.26.0 ___/
info: Starting AEM dev server v14.26.0
info: Local AEM dev server up and running: https://localhost:3000/
```

3. (optional) Add arguments to .env file:

```
$ echo -e "HLX_TLS_CERT=server.crt\nHLX_TLS_KEY=server.key" >> .env
$ echo -e "AEM_TLS_CERT=server.crt\nAEM_TLS_KEY=server.key" >> .env
```

### environment
Expand All @@ -94,9 +94,9 @@ example:

`.env`
```dotenv
HLX_OPEN=/products
HLX_PORT=8080
HLX_PAGES_URL=https://stage.myproject.com
AEM_OPEN=/products
AEM_PORT=8080
AEM_PAGES_URL=https://stage.myproject.com
```

#### HTTP Proxy
Expand All @@ -123,25 +123,25 @@ If present, `ALL_PROXY` is used as fallback if there is no other match.

| option | variable | default | description |
|--------|----------|---------|-------------|
| `--log-file` | `HLX_LOG_FILE` | `-` | Log file. use `-` to log to stdout |
| `--log-level` | `HLX_LOG_LEVEL` | `info` | Log level |
| `--log-file` | `AEM_LOG_FILE` | `-` | Log file. use `-` to log to stdout |
| `--log-level` | `AEM_LOG_LEVEL` | `info` | Log level |

#### Up command

| option | variable | default | description |
|-------------------|---------------------|-------------|-------------------------------------------------------------|
| `--port` | `HLX_PORT` | `3000` | Development server port |
| `--addr` | `HLX_ADDR` | `127.0.0.1` | Development server bind address |
| `--livereload` | `HLX_LIVERELOAD` | `true` | Enable automatic reloading of modified sources in browser. |
| `--no-livereload` | `HLX_NO_LIVERELOAD` | `false` | Disable live-reload. |
| `--open` | `HLX_OPEN` | `/` | Open a browser window at specified path after server start. |
| `--no-open` | `HLX_NO_OPEN` | `false` | Disable automatic opening of browser window. |
| `--tls-key` | `HLX_TLS_KEY` | undefined | Path to .key file (for enabling TLS) |
| `--tls-cert` | `HLX_TLS_CERT` | undefined | Path to .pem file (for enabling TLS) |
| `--port` | `AEM_PORT` | `3000` | Development server port |
| `--addr` | `AEM_ADDR` | `127.0.0.1` | Development server bind address |
| `--livereload` | `AEM_LIVERELOAD` | `true` | Enable automatic reloading of modified sources in browser. |
| `--no-livereload` | `AEM_NO_LIVERELOAD` | `false` | Disable live-reload. |
| `--open` | `AEM_OPEN` | `/` | Open a browser window at specified path after server start. |
| `--no-open` | `AEM_NO_OPEN` | `false` | Disable automatic opening of browser window. |
| `--tls-key` | `AEM_TLS_KEY` | undefined | Path to .key file (for enabling TLS) |
| `--tls-cert` | `AEM_TLS_CERT` | undefined | Path to .pem file (for enabling TLS) |

# Developing Helix CLI

## Testing

You can use `npm run check` to run the tests and check whether your code adheres
to the helix-cli coding style.
to the aem-cli coding style.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@adobe/helix-cli",
"name": "@adobe/aem-cli",
"version": "14.26.0",
"description": "Project Helix CLI",
"description": "AEM CLI",
"main": "index.js",
"type": "module",
"bin": {
Expand Down
17 changes: 13 additions & 4 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*/
import yargs from 'yargs';
import camelcase from 'camelcase';
import path from 'path';
import chalk from 'chalk-template';
import { resetContext } from './fetch-utils.js';

const MIN_MSG = 'You need at least one command.';
Expand All @@ -21,9 +23,13 @@ function envAwareStrict(args, aliases) {
const hlxEnv = {};
Object
.keys(process.env)
.filter((key) => key.startsWith('HLX_'))
.forEach((key) => {
hlxEnv[camelcase(key.substring(4))] = key;
if (key.startsWith('HLX_')) {
throw new Error(chalk`{red warning:} The environment prefix "HLX_" is not supported anymore. Please use "AEM_" instead.`);
}
if (key.startsWith('AEM_')) {
hlxEnv[camelcase(key.substring(4))] = key;
}
});

const unknown = [];
Expand All @@ -36,6 +42,9 @@ function envAwareStrict(args, aliases) {
if (unknown.length > 0) {
return unknown.length === 1 ? `Unknown argument: ${unknown[0]}` : `Unknown arguments: ${unknown.join(', ')}`;
}
if (path.basename(process.argv[1]) === 'hlx') {
return chalk`{red warning:} The "hlx" command is deprecated. Please use "aem" instead.`;
}
return true;
}

Expand Down Expand Up @@ -109,10 +118,10 @@ export default class CLI {

logArgs(argv)
.strictCommands(true)
.scriptName('hlx')
.scriptName('aem')
.usage('Usage: $0 <command> [options]')
.parserConfiguration({ 'camel-case-expansion': false })
.env('HLX')
.env('AEM')
.check((a) => envAwareStrict(a, argv.parsed.aliases))
.showHelpOnFail(true)
.fail(this._failFn)
Expand Down
2 changes: 1 addition & 1 deletion src/hack.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class HackCommand extends AbstractCommand {
await opn(url);
} else {
// eslint-disable-next-line no-console
this.log.info(chalk`Check out the Franklin Hackathon at {blue ${url}}`);
this.log.info(chalk`Check out the AEM Hackathon at {blue ${url}}`);
}
}
}
22 changes: 11 additions & 11 deletions src/import.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ export default class ImportCommand extends AbstractServerCommand {
await fse.ensureDir(importerFolder);
const uiProjectName = path.basename(this._uiRepo, '.git');
const uiFolder = path.join(importerFolder, uiProjectName);
const getUIVersion = async () => ((await fse.readJson(path.resolve(uiFolder, 'package.json'))).version);
const exists = await fse.pathExists(uiFolder);
if (!exists) {
this.log.info('Franklin Importer UI needs to be installed.');
this.log.info('AEM Importer UI needs to be installed.');
this.log.info(`Cloning ${this._uiRepo} in ${importerFolder}.`);
// clone the ui project
await git.clone({
Expand All @@ -52,9 +53,9 @@ export default class ImportCommand extends AbstractServerCommand {
depth: 1,
singleBranch: true,
});
this.log.info('Franklin Importer UI is ready.');
this.log.info(`AEM Importer UI is ready. v${await getUIVersion()}`);
} else {
this.log.info('Fetching latest version of the Franklin Import UI.');
this.log.info('Fetching latest version of the AEM Importer UI...');
// clone the ui project
await git.pull({
fs: fse,
Expand All @@ -67,7 +68,7 @@ export default class ImportCommand extends AbstractServerCommand {
name: 'hlx import',
},
});
this.log.info('Franklin Importer UI is now up-to-date.');
this.log.info(`AEM Importer UI is up-to-date. v${await getUIVersion()}`);
}
}

Expand All @@ -79,12 +80,11 @@ export default class ImportCommand extends AbstractServerCommand {
.withCwd(this.directory)
.withLogger(this._logger)
.withKill(this._kill);

this.log.info(chalk`{yellow ____ __ ___ ____ __}`);
this.log.info(chalk`{yellow / __/______ ____ / /__ / (_)__ / _/_ _ ___ ___ ____/ /_}`);
this.log.info(chalk`{yellow / _// __/ _ \`/ _ \\/ '_// / / _ \\_/ // ' \\/ _ \\/ _ \\/ __/ __/}`);
this.log.info(chalk`{yellow /_/ /_/ \\_,_/_//_/_/\\_\\/_/_/_//_/___/_/_/_/ .__/\\___/_/ \\__/}`);
this.log.info(chalk`{yellow /_/ v${pkgJson.version}}`);
this.log.info(chalk`{yellow ___ ______ ___ ____ __ }`);
this.log.info(chalk`{yellow / _ | / __/ |/ / / _/_ _ ___ ___ ____/ /____ ____}`);
this.log.info(chalk`{yellow / __ |/ _// /|_/ / _/ // ' \\/ _ \\/ _ \\/ __/ __/ -_) __/}`);
this.log.info(chalk`{yellow /_/ |_/___/_/ /_/ /___/_/_/_/ .__/\\___/_/ \\__/\\__/_/}`);
this.log.info(chalk`{yellow /_/ v${pkgJson.version}}`);
this.log.info('');

await this.initSeverOptions();
Expand All @@ -96,7 +96,7 @@ export default class ImportCommand extends AbstractServerCommand {
try {
await this._project.init();
} catch (e) {
throw Error(`Unable to start Franklin: ${e.message}`);
throw Error(`Unable to start AEM: ${e.message}`);
}
}
}
14 changes: 7 additions & 7 deletions src/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function up() {
executor = value;
},
command: 'import',
description: 'Run the Franklin import server',
description: 'Run the AEM import server',
builder: (yargs) => {
yargs
.option('open', {
Expand All @@ -29,13 +29,13 @@ export default function up() {
})
.option('ui-repo', {
alias: 'uiRepo',
describe: 'Git repository for the Franklin Importer UI',
describe: 'Git repository for the AEM Importer UI',
type: 'string',
default: 'https://github.com/adobe/helix-importer-ui',
})
.option('skip-ui', {
alias: 'skipUI',
describe: 'Do not install the Franklin Importer UI',
describe: 'Do not install the AEM Importer UI',
type: 'boolean',
default: false,
})
Expand All @@ -58,7 +58,7 @@ export default function up() {
})
.option('stop-other', {
alias: 'stopOther',
describe: 'Stop other Franklin CLI running on the above port',
describe: 'Stop other AEM CLI running on the above port',
type: 'boolean',
default: true,
})
Expand All @@ -79,7 +79,7 @@ export default function up() {
describe: 'Path to local folder to cache the responses',
type: 'string',
})
.group(['open', 'no-open', 'cache', 'ui-repo', 'skip-ui'], 'Franklin Import Options')
.group(['open', 'no-open', 'cache', 'ui-repo', 'skip-ui'], 'AEM Importer Options')

.help();
},
Expand All @@ -96,9 +96,9 @@ export default function up() {
await executor
.withHttpPort(argv.port)
.withBindAddr(argv.addr)
// only open browser window when executable is `hlx`
// only open browser window when executable is `aem`
// this prevents the window to be opened during integration tests
.withOpen(path.basename(argv.$0) === 'hlx' ? argv.open : false)
.withOpen(path.basename(argv.$0) === 'aem' ? argv.open : false)
.withTLS(argv.tlsKey, argv.tlsCert)
.withKill(argv.stopOther)
.withCache(argv.cache)
Expand Down
8 changes: 4 additions & 4 deletions src/server/BaseServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ export class BaseServer extends EventEmitter {
throw new Error(`Port ${this._port} already in use by another process.`);
}
}
log.info(`Starting Franklin dev server v${packageJson.version}`);
log.info(`Starting AEM dev server v${packageJson.version}`);
await new Promise((resolve, reject) => {
const listenCb = (err) => {
if (err) {
reject(new Error(`Error while starting ${this._scheme} server: ${err}`));
}
this._port = this._server.address().port;
this._addr = this._server.address().address;
log.info(`Local Franklin dev server up and running: ${this.scheme}://${this.hostname}:${this.port}/`);
log.info(`Local AEM dev server up and running: ${this.scheme}://${this.hostname}:${this.port}/`);
if (this._project.proxyUrl) {
log.info(`Enabled reverse proxy to ${this._project.proxyUrl}`);
}
Expand Down Expand Up @@ -186,7 +186,7 @@ export class BaseServer extends EventEmitter {
this._server = null;
this.emit('stopping');
await new Promise((resolve, reject) => {
this.log.debug('Stopping Franklin dev server..');
this.log.debug('Stopping AEM dev server..');
for (const socket of this._sockets) {
socket.destroy();
this._sockets.delete(socket);
Expand All @@ -195,7 +195,7 @@ export class BaseServer extends EventEmitter {
if (err) {
reject(new Error(`Error while stopping http server: ${err}`));
}
this.log.info('Franklin dev server stopped.');
this.log.info('AEM dev server stopped.');
resolve();
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/server/HelixImportProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export class HelixImportProject extends BaseProject {
}

async start() {
this.log.debug('Launching Franklin import server for importing content...');
this.log.debug('Launching AEM import server for importing content...');
await super.start();
return this;
}

async doStop() {
this.log.debug('Stopping Franklin import server..');
this.log.debug('Stopping AEM import server..');
await super.doStop();
}
}
4 changes: 2 additions & 2 deletions src/server/HelixImportServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ export class HelixImportServer extends BaseServer {
// codecov:ignore:start
/* c8 ignore start */
} catch (err) {
log.error(`Failed to proxy Franklin request ${ctx.path}: ${err.message}`);
res.status(502).send(`Failed to proxy Franklin request: ${err.message}`);
log.error(`Failed to proxy AEM request ${ctx.path}: ${err.message}`);
res.status(502).send(`Failed to proxy AEM request: ${err.message}`);
}
// codecov:ignore:end
/* c8 ignore end */
Expand Down
4 changes: 2 additions & 2 deletions src/server/HelixProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class HelixProject extends BaseProject {
}

async start() {
this.log.debug('Launching Franklin dev server...');
this.log.debug('Launching AEM dev server...');
await super.start();
await this.initHeadHtml();
await this.init404Html();
Expand All @@ -120,7 +120,7 @@ export class HelixProject extends BaseProject {
}

async doStop() {
this.log.debug('Stopping Franklin dev server...');
this.log.debug('Stopping AEM dev server...');
await super.doStop();
if (this._indexer) {
await this._indexer.close();
Expand Down
Loading

0 comments on commit a58fd43

Please sign in to comment.