Hosts plugin for
@devly. Assumes env uses apache proxy-server.
For more on hosts file see: https://en.wikipedia.org/wiki/Hosts_(file).
To add devly-hosts plugin to your project, first make sure your project is set-up to consume Devly plugins (see https://github.com/aorinevo/devly-example#introduction).
npm i @devly/devly-hosts
addHostsConfig action creator to update the hosts state in the devly-store. It is recommneded to place the initialState for hosts in a
manifests/hosts.js file and requiring that file within the file that dispatches the action.
// mainfests/hosts.jsmoduleexports =filePath: '/etc/hosts'projectPath: '/etc'hosts:ip: '127.0.0.1'dns: 'some.dns.example1.com'ip: '127.0.0.1'dns: 'some.dns.example2.com'ip: '127.0.0.1'dns: 'some.dns.example3.com';
It is recommended that the consumer create a
plugins/index.js barrel file for the devly plugins it consumes.
// plugins/index.js;// plugins/hosts.jsconst store = ;const addHostsConfig addHostsCommands = ;const dispatch = store;;;;
All devly plugins assume that the consumer has the following directory structure somewhere in their working directory:
├── cli.js ├── actions └── index.js ├── reducers └── index.js └── index.js
Dynamically add reducers to the store using devly's
const store reducerRegistry = ;reducerRegistry;
Actions and reducers are the same actions and reducers from redux. For more information on either, visit
const store = ;const yargs = ;const addHostsConfig addHostsCommands = ;const Hosts = ;store;store;moduleexports = yargs;