Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emdaer

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emdaer - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

57

index.js

@@ -7,11 +7,13 @@ #! /usr/bin/env node

} = require('fs');
const yaml = require('js-yaml');
const { safeLoad } = require('js-yaml');
const inquirer = require('inquirer');
const questions = readFileSync(`${__dirname}/questions.yml`);
let packageJSON;
const defaults = {};
try {
const packageJSON = JSON.parse(readFileSync('package.json'));
defaults.title = packageJSON.name || '';
packageJSON = JSON.parse(readFileSync('package.json'));
defaults.title = packageJSON.name;
defaults.version = packageJSON.version;
defaults.description = packageJSON.description;
} catch (error) {

@@ -21,13 +23,46 @@ process.stdout.write('You might want to run npm init first!');

inquirer.prompt(yaml.safeLoad(questions, 'utf8').map(question => {
const questions = safeLoad(readFileSync(`${__dirname}/questions.yml`, 'utf8')).map(question => {
let result = question;
if (defaults[question.name]) {
return Object.assign(question, {
result = Object.assign(result, {
default: defaults[question.name],
});
}
return question;
})).then(answers => {
if (question.when) {
result = Object.assign(result, {
when: !!packageJSON[question.when],
});
}
return result;
});
const onComplete = answers => {
const output = [];
output.push(`# ${answers.title}`);
writeFileSync('README.md', output.join('\n'));
});
if (answers.title) {
output.push(`# ${answers.title}\n`);
}
if (answers.description) {
output.push(answers.description);
}
if (answers.bin) {
output.push('\n## CLI\n');
Object.keys(packageJSON.bin).forEach(id => {
output.push('```sh');
output.push(`$ npm install -g ${packageJSON.bin[id]}`);
output.push(`$ ${packageJSON.bin[id]}`);
output.push('```');
});
}
if (answers.scripts) {
output.push(`\n## Scripts\n`);
Object.keys(packageJSON.scripts).forEach(script => {
output.push(`### ${script}\n`);
output.push('```sh');
output.push(`$ npm run ${script}`);
output.push('```');
});
}
writeFileSync('README.md', `${output.join('\n')}\n`);
};
inquirer.prompt(questions).then(onComplete);

8

package.json
{
"name": "emdaer",
"version": "0.0.0",
"version": "0.0.1",
"description": "does a README.md",

@@ -10,2 +10,5 @@ "author": "Flip",

},
"scripts": {
"start": "node ."
},
"engines": {

@@ -16,3 +19,4 @@ "node": ">=6.0.0"

"inquirer": "^1.0.3",
"js-yaml": "^3.6.1"
"js-yaml": "^3.6.1",
"prompt": "^1.0.0"
},

@@ -19,0 +23,0 @@ "devDependencies": {

@@ -1,1 +0,18 @@

# emdaer
# emdaer
does a README.md
## CLI
```sh
$ npm install -g index.js
$ index.js
```
## Scripts
### start
```sh
$ npm run start
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc