Skip to content

Commit

Permalink
✨ Start CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
thiamsantos committed Apr 2, 2017
1 parent aafaa9c commit 20f2559
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 1 deletion.
105 changes: 105 additions & 0 deletions bin/seotopper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/usr/bin/env node

const inquirer = require('inquirer')
const seotopper = require('../lib/seotopper')

const questions = [
{
type: 'input',
name: 'title',
message: 'What\'s the title of your page (required)',
validate: value => {
if (value === '') {
return 'Please enter a title'
}
if (value.length > 57) {
return 'Please enter a title with less than 57 characters'
}
return true
}
},
{
type: 'input',
name: 'description',
message: 'What\'s the description of your page',
validate: value => {
if (value === '') {
return 'Please enter a description'
}
if (value.length > 160) {
return 'Please enter a description with less than 160 characters'
}
return true
}
},
{
type: 'input',
name: 'author',
message: 'Who\'s the author',
validate: value => {
if (value === '') {
return 'Please enter an author\'s name'
}
return true
}
},
{
type: 'input',
name: 'image',
message: 'What\'s the image of your page',
validate: value => {
if (value === '') {
return 'Please enter an image'
}
return true
}
},
{
type: 'input',
name: 'canonical',
message: 'What\'s the canonical url of your page',
validate: value => {
if (value === '') {
return 'Please enter a canonical url'
}
return true
}
},
{
type: 'list',
name: 'robots',
message: 'What you wanna tell to the robots',
choices: [
'index/follow',
'noindex/follow',
'index/nofollow',
'noarchive',
'nosnippet',
'noodp',
'notranslate',
'noimageindex',
'none'
]
},
{
type: 'input',
name: 'base',
message: 'What\'s the base url of your page'
},
{
type: 'input',
name: 'sitemap',
message: 'What\'s the sitemap of your page'
},
{
type: 'input',
name: 'themeColor',
message: 'What\'s the theme-color of your page'
}
]

inquirer.prompt(questions).then(answers => {
const generatedSEO = seotopper(answers)
// Process.stdout.write(generatedSEO)
console.log(generatedSEO)
})
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"author": "Gustavo Quinalha",
"keywords": [],
"license": "MIT",
"bin": {
"seotopper": "bin/seotopper.js"
},
"main": "lib/seotopper.js",
"scripts": {
"precommit": "npm test",
Expand All @@ -31,7 +34,10 @@
"husky": "^0.13.3",
"xo": "^0.18.1"
},
"engines" : {
"engines": {
"node": ">=4"
},
"dependencies": {
"inquirer": "^3.0.6"
}
}

0 comments on commit 20f2559

Please sign in to comment.