Skip to content

Commit

Permalink
Added usage as class module
Browse files Browse the repository at this point in the history
  • Loading branch information
Nataniel López committed Oct 21, 2019
1 parent 0f9ffe8 commit f64c47b
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- usage as class module
- docs for class usage

### Removed
- unnecessary `lib/index.js` file

## [1.2.0] - 2019-07-17
### Changed
- When fails building throw an exit code.
Expand Down
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Build the exclusive files of each environment in the right config folder.

## Usage
## Usage (command line)

In the console

Expand All @@ -20,3 +20,29 @@ npx @janiscommerce/environment-builder [ENVIRONMENT]

The environments should be located in the folder `/root/environments/[ENVIRONMENT]`. It mustn't be empty.

## Usage (module)

```js
const EnvironmentBuilder = require('@janiscommerce/environment-builder');
```

## API

### **`new EnvironmentBuilder()`**
Constructs the EnvironmentBuilder instance.

### ***async*** **`execute(environment)`**
Builds the environment for the specified `environment [String]`.

## Examples
```js
const EnvironmentBuilder = require('@janiscommerce/environment-builder');

const environmentBuilder = new EnvironmentBuilder();

(async () => {

await environmentBuilder.execute('local');

})();
```
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

'use strict';

const { EnvironmentBuilder } = require('./lib');
const EnvironmentBuilder = require('./lib/environment-builder');

(async () => {
const envBuilder = new EnvironmentBuilder();
Expand Down
7 changes: 0 additions & 7 deletions lib/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@janiscommerce/environment-builder",
"version": "1.2.0",
"description": "Build the exclusive files of each environment in the right folder.",
"main": "index.js",
"main": "lib/environment-builder.js",
"bin": {
"environment-builder": "index.js"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/environment-builder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const chmod = util.promisify(fs.chmod);

const sandbox = require('sinon').createSandbox();

const { EnvironmentBuilder } = require('./../lib');
const EnvironmentBuilder = require('./../lib/environment-builder');

describe('Exists', () => {
let envBuilder;
Expand Down

0 comments on commit f64c47b

Please sign in to comment.