npm package: @nvon/nexus
Description: The NWON nexus facilitates working with a remote WordPress environment and a local Docker Setup
Author: NWON
Latest version: 0.5.0

# NWON nexus

The **nwon-nexus** is a nodeJs powered tool for synchronizing a local docker based WordPress instance and remote environments. On top you have a shortcut for using some [WP-CLI](https://wp-cli.org/de/) commands.

## Installation

The `nwon-nexus` is distributed as a [npm-package](https://www.npmjs.com/package/nwon-nexus). You can install it by typing

`npm install @nvon/nwon-nexus`

## Usage

The package provides a number of options that can be accessed using an inquirer based command line interface. The main entry point is.

**ESM-package** `nodejs --es-module-specifier-resolution=node node_modules/nwon-nexus/dist/index.js`.

**CJS-package** `nodejs node_modules/nwon-nexus/dist/index.js`.

## Configuration

You configure the Nexus by providing a `nexus.json` ([example file](./nexus.json)) in your project root (same as the package.json).

The json should be valid for the following interfaces:

- [NexusConfiguration](./src/interfaces/configuration/NexusConfiguration.ts)
  - [DbDumpReplacementMethod](./src/interfaces/configuration/DbDumpReplacementMethod.ts)
  - [RemoteServerConfiguration](./src/interfaces/configuration/RemoteServerConfiguration.ts)
  - [DockerConfiguration](./src/interfaces/configuration/DockerConfiguration.ts)

A complete [JSON](./nexus.json) is for example this:

```json
{
  "localPaths": {
    "backup": "./backup-path",
    "wordPressContent": "./wp-content"
  },
  "environments": [
    {
      "name": "some-environment-name",
      "host": "some.host.com",
      "liveSystem": true,
      "usesHttps": true,
      "paths": {
        "wordpress": "/home/wp/disk/wordpress",
        "sqlDump": "/home/wp/disk/wordpress/wp-content/sql_dumps"
      },
      "ssh": {
        "user": "userName",
        "host": "some.host.com",
        "port": 2021
      },
      "database": {
        "host": "localhost",
        "databaseName": "databaseName",
        "user": "databaseUser",
        "password": "databasePassword"
      },
      "databaseDumpDomainReplacementMethod": "WpCli",
      "wpCliCommand": "wp-whatever"
    }
  ],
  "docker": {
    "host": "127.0.0.1",
    "database": {
      "dockerUser": "docker",
      "containerName": "database",
      "databaseName": "wordpress",
      "user": "test",
      "password": "test"
    },
    "wordPress": {
      "dockerUser": "docker",
      "containerName": "wordpress",
      "usesHttps": true,
      "port": 8001
    },
    "databaseDumpDomainReplacementMethod": "WpCli",
    "wpCliCommand": "wp-whatever"
  }
}
```

## Information for development

The `nwon-nexus` is a TypeScript based application. All changes should be done to the files in `src`. In order to compile the package run `npm run compile`. This will compile a esm and a cjs version of the package.

You can tweak these versions by editing `scripts/subPackageConfiguration.ts`.

If you want to deploy a new version of the package use the provided script `node scripts/dist/publish-to-npm.js [versionChange]`. It takes the desired version change as argument (patch, minor or major).