Socket
Socket
Sign inDemoInstall

makeconf

Package Overview
Dependencies
102
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.3.0

1

index.js
'use strict';
const prompt = require('prompt');
const clc = require('cli-color');
const cwd = require('./lib/cwd');

@@ -6,0 +5,0 @@ const load = require('./lib/load');

4

lib/compilers/env.js
'use strict';
const fs = require('fs');
const _ = require('lodash');
const envfile = require('envfile');
const cwd = require('../cwd');

@@ -33,3 +31,3 @@ module.exports = {

compile(config, file) {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
file = file || '.env';

@@ -36,0 +34,0 @@

'use strict';
const _ = require('lodash');
const Handlebars = require('handlebars');
const handlebars = require('handlebars');
Handlebars.registerHelper('isString', function(value, options) {
if (isNaN(value) && !_.includes(['true', 'false', 'null'], value)) {
return options.fn(this);
}
return options.inverse(this);
handlebars.registerHelper('isString', function(value, options) {
return isNaN(value) && !_.includes(['true', 'false', 'null'], value) ? options.fn(this) : options.inverse(this);
});

@@ -17,9 +13,13 @@

{{#if @last}}
{{#isString this}}
{{#isString this}}
{{@key}}: '{{this}}'
{{else}}
{{else}}
{{@key}}: {{this}}
{{/isString}}
{{/isString}}
{{else}}
{{#isString this}}
{{@key}}: '{{this}}',
{{else}}
{{@key}}: {{this}},
{{/isString}}
{{/if}}

@@ -54,5 +54,6 @@ {{/each}}

compile(config) {
return new Promise((resolve, reject) => {
const template = Handlebars.compile(source);
return new Promise((resolve) => {
const template = handlebars.compile(source);
const configAsString = template({config});
return resolve(configAsString);

@@ -59,0 +60,0 @@ });

@@ -5,3 +5,3 @@ 'use strict';

const getCompiler = require('./get-compiler');
const write = require('./write')
const write = require('./write');

@@ -11,3 +11,3 @@ /**

* @param {Object} config
* @param {string} type
* @param {string} format
* @param {string} file

@@ -18,8 +18,8 @@ * @return {Promise}

return new Promise((resolve, reject) => {
const type = _.get(makeconfjson, 'type');
const format = _.get(makeconfjson, 'format');
const file = _.get(makeconfjson, 'file');
const compiler = getCompiler(type);
const compiler = getCompiler(format);
if (!compiler) {
return reject(`No compiler found for config type: ${type}`);
return reject(`No compiler found for config format: ${format}`);
}

@@ -33,3 +33,3 @@

}, (err) => {
return reject();
return reject(err);
});

@@ -36,0 +36,0 @@ }, (err) => {

@@ -6,7 +6,7 @@ 'use strict';

/**
* Returns a compiler by type.
* @param {string} type
* Returns a compiler by format.
* @param {string} format
* @return {Object}
*/
module.exports = (type) => {
module.exports = (format) => {
const compilers = {

@@ -17,3 +17,3 @@ '.env': require('./compilers/env'),

return _.get(compilers, type, null);
return _.get(compilers, format, null);
};

@@ -16,3 +16,3 @@ 'use strict';

const file = _.get(makeconfjson, 'file');
const type = _.get(makeconfjson, 'type');
const format = _.get(makeconfjson, 'format');
const config = _.get(makeconfjson, 'config');

@@ -26,3 +26,3 @@

.then(() => {
return loadConfig(file, type);
return loadConfig(file, format);
}, () => {

@@ -71,11 +71,11 @@ _.forEach(config, (item, name) => {

* @param {string} file
* @param {string} type
* @param {string} format
* @return {Promise}
*/
function loadConfig(file, type) {
function loadConfig(file, format) {
return new Promise((resolve, reject) => {
const compiler = getCompiler(type);
const compiler = getCompiler(format);
if (!compiler) {
return reject(`No compiler found for config type: ${type}`);
return reject(`No compiler found for config format: ${format}`);
}

@@ -82,0 +82,0 @@

'use strict';
const fs = require('fs');
const _ = require('lodash');
const cwd = require('./cwd');

@@ -6,0 +5,0 @@

{
"name": "makeconf",
"version": "1.2.1",
"description": "An interactive local config generator.",
"version": "1.3.0",
"description": "An interactive local config generator for better team coordination.",
"main": "index.js",

@@ -12,3 +12,4 @@ "engine": "node 4.0.0",

"scripts": {
"test": "mocha"
"lint": "node node_modules/eslint/bin/eslint.js index.js lib",
"prepublish": "npm run lint"
},

@@ -15,0 +16,0 @@ "keywords": [

@@ -8,4 +8,4 @@ makeconf

*An interactive local config generator that makes it easy to collaboratively
maintain configuration files.*
*An interactive local config generator that makes it easier to coordinate
configuration files within a team.*

@@ -18,2 +18,7 @@ ![makeconf][gif]

## Supported config formats
- `.env`
- `module.exports` (the ubiquitous Node module object containing key-value pairs)
## Setup

@@ -31,4 +36,2 @@

and run `node_modules/makeconf/bin/makeconf` locally.
## Usage

@@ -38,7 +41,5 @@

Available types: `.env`, `module.exports`
```
{
"type": ".env",
"format": ".env",
"file": ".env",

@@ -62,3 +63,3 @@ "config": {

In your project directory, run:
Then generate your config file by running:

@@ -69,2 +70,10 @@ ```

or
```
$ node_modules/makeconf/bin/makeconf
```
if you installed makeconf locally.
## License

@@ -71,0 +80,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc