Code Monkey home page Code Monkey logo

generator-node's Introduction

Node Generator Build Status Gitter OpenCollective

generator-node creates a base template to start a new Node.js module.

It is also easily composed into your own generators so you can only target your efforts at your generator's specific features.

Install

$ npm install --global generator-node

Usage

$ yo node

Note that this template will generate files in the current directory, so be sure to change to a new directory first if you don't want to overwrite existing files.

That'll generate a project with all the common tools setup. This includes:

  • Filled package.json file
  • jest unit test and code coverage (optionally tracked on Coveralls)
  • ESLint linting and code style checking
  • Travis CI continuous integration (optional)
  • License

Running tests

Once the project is scaffolded, inside the project folder run:

$ npm test

You can also directly use jest to run test on single files:

$ npm -g install jest-cli
$ jest --watch

Publishing your code

Once your tests are passing (ideally with a Travis CI green run), you might be ready to publish your code to npm. We recommend you using npm version to tag release correctly.

$ npm version major
$ git push --follow-tags
# ATTENTION: There is no turning back here.
$ npm publish

Extend this generator

First of all, make sure you're comfortable with Yeoman composability feature. Then in your own generator:

var Generator = require('yeoman-generator');

module.exports = class extends Generator({
  default() {
    this.composeWith(require.resolve('generator-node/generators/app'), {
      /* provide the options you want */
    });
  }
});

Options

Here's a list of our supported options:

  • boilerplate (Boolean, default true) include or not the boilerplate files (lib/index.js, test/index.js).
  • cli (Boolean, default false) include or not a lib/cli.js file.
  • editorconfig (Boolean, default true) include or not a .editorconfig file.
  • git (Boolean, default true) include or not the git files (.gitattributes, .gitignore).
  • license (Boolean, default true) include or not a LICENSE file.
  • travis (Boolean, default true) include or not a .travis.yml file.
  • githubAccount (String) Account name for GitHub repo location.
  • readme (String) content of the README.md file. Given this option, generator-node will still generate the title (with badges) and the license section.

Sub generators

If you don't need all the features provided by the main generator, you can still use a limited set of features by composing with our sub generators directly.

Remember you can see the options of each sub generators by running yo node:sub --help.

  • node:boilerplate
  • node:cli
  • node:editorconfig
  • node:eslint
  • node:git
  • node:readme

Backers

Love Yeoman work and community? Help us keep it alive by donating funds to cover project expenses!
[Become a backer]

License

MIT © Yeoman team (http://yeoman.io)

generator-node's People

Contributors

aardmark avatar addyosmani avatar alekseyleshko avatar amitport avatar arthurvr avatar danielchatfield avatar eddiemonge avatar frank-dspeed avatar greenkeeper[bot] avatar hemanth avatar hueitan avatar iamstarkov avatar jory avatar jriquelme avatar kevva avatar melonmanchan avatar mieszko4 avatar mischah avatar myhlamaeus avatar nfriedly avatar oblongmana avatar passy avatar rhettl avatar sboudrias avatar seriema avatar shama avatar sindresorhus avatar stefanbuck avatar stevemao avatar tjwebb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generator-node's Issues

Module name prompt does not allow for choosing another name.

While the current implementation will catch the case where a name is already used on NPM, it does not allow the user to re-enter a new name. Instead, the user chooses Y/n and, regardless of the answer, the generator moves to the next prompt.

Validation of user input should utilize the Inquirer.js validate option. This forces the user to enter a new name which is then validated before progressing to the next prompt.

Get repository info from .git if it exists

Currently generator-node populates the repository field in package.json using the username which is prompted for and the package name. Often the github repo name and the npm package name are different. I think it would be better to check whether the target directory is a git repo and then get the repo url from either .git/config or .git/FETCH_HEAD. If it isn't a git repository then fall back to asking the user for their username and guessing repo name.

newline normalization

When Windows users start to contribute to a software project, the issue of DOS-style vs. Unix-style newlines invariably raises it ugly head.
I therefore propose that this generator should set grunt.util.linefeed = '\n'; and generate an appropriate .gitattributesfile (similar to https://github.com/twbs/bootlint/blob/master/.gitattributes) so as to standardize newlines in a project right from the get-go.

Boolean options are being ignored

Both cli.js and browserify options are being ignored if the user types "no".

If a user writes "no" (or anything else) when asked if they want to include cli.js and/or browserify support, the choice always gets ignored and both scripts get inserted.

It seems that the values are being read as strings but interpreted as boolean (as they should).

wrong repo links, when commiting to a github organization

When the new node module has a repo in a github organization the README.md links and package.json 'repository' property, contain the github username instead of the organization name.

Is it possible to add another prompt for 'GitHub organization name (if applicable)'?

Thanks!
(related to #13)

Should tests fail first?

This is more of a discussion topic.

I'm one of the last people to force TDD down anyone's throat, but what do people think of the generator scaffolding a test that fails first off?

I only say this as I've seen a few modules with the default test left in, and I've been guilty myself of quickly publishing one without writing tests and then going back to implement some.
An initial failing test may remind or prompt people to fix it/amend it to suit their module.

README.md is not compiled

When visiting generator-node/app/templates on Github, README.md hasn't been compiled, breaking it's output.

Babel is missing in the README

Sorry for bothering you again but Babel is missing in the README. There might be other stuff missing as well but I haven't checked.

A hyphen in the module name will cause lots of errors

You are prompted to name your module like so:
Module Name: (yo-node)

However, if you actually include a hyphen in your module name ('best-module-evar'),and then try to run the grunt build, you get lots of errors.

Minor issue for sure, but bit me, so wanted to mention in.

Code coverage integration?

Any chance of adding code coverage tool (e.g. Istanbul or jscoverage) integration to the generated modules?

Unclear how to use options (or they're broken)

Was going to start a new project, but updated my generator and spent an hour Googling for this before giving up. I used to be prompted for things like a CLI, but now it is always created. The "Options" section of the documentation makes it sound like it is possible to disable this, but I can't seem to figure out how to actually use the option. I've tried all kinds of different ways to specify it:

  • yo node --cli=false
  • yo node --cli="false"
  • yo node --cli=no
  • yo node --cli false
  • yo node --cli
  • yo node cli=false

None of these work, and I always end up with a lib/cli.js file. How am I supposed to specify this option? Is it just broken, or is there a syntax I haven't guessed yet?

Add main to package.json

I can't see why main isn't added to the package.json file since the entry point file is created in /lib/[module].js

npm test fails on scaffolded project

When I run npm test in the freshly scaffolded project directory, I get the following error:

λ npm test

> [email protected] test C:\Projects\test-module
> gulp

[12:13:42] Using gulpfile C:\Projects\test-module\gulpfile.js
[12:13:42] Starting 'static'...
[12:13:42] Starting 'pre-test'...

C:\Projects\test-module\gulpfile.js
  line 2  col 5  'path' is defined but never used.

  ‼  1 warning

[12:13:43] Finished 'pre-test' after 216 ms
[12:13:43] Starting 'test'...

C:\Projects\test-module\test\index.js
  line 5  col 3  Missing "use strict" statement.
  line 2  col 8  'testModule' is defined but never used.

  ×  1 error
  ‼  1 warnings


events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: JSHint failed for: C:\Projects\test-module\gulpfile.js, C:\Projects\test-module\test\index.js
npm ERR! Test failed.  See above for more details.

Can someone please take a look this? Thanks.

"yo node" fails with parsing errors

running yo node and not entering anything to the questions seems to result into a broken package.json -there are comas inside the quotes, for example:
"description": "The best module ever.,"
"homepage": "https://github.com//nodegen,"

fixing the errors and running it again (without overwriting package.json) fixes the problem.

Error: Cannot find module 'babel/register'

I did a yo node with v1.2.0 and then ran gulp in the output directory with the flowing result:

$ gulp
[11:09:09] Using gulpfile ~/running-average/gulpfile.js
[11:09:09] Starting 'static'...
[11:09:09] Starting 'pre-test'...
[11:09:09] Finished 'pre-test' after 109 ms
[11:09:09] Starting 'test'...
[11:09:09] 'test' errored after 5.69 ms
[11:09:09] Error: Cannot find module 'babel/register'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Array.forEach (native)
    at module.exports (/Users/nfriedly/running-average/node_modules/gulp-mocha/index.js:27:16)
    at Gulp.<anonymous> (/Users/nfriedly/running-average/gulpfile.js:41:11)
    at module.exports (/Users/nfriedly/running-average/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/nfriedly/running-average/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/nfriedly/running-average/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
    at /Users/nfriedly/running-average/node_modules/gulp/node_modules/orchestrator/index.js:279:18
    at finish (/Users/nfriedly/running-average/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
    at /Users/nfriedly/running-average/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:52:4
    at f (/Users/nfriedly/running-average/node_modules/gulp/node_modules/orchestrator/node_modules/end-of-stream/node_modules/once/once.js:17:25)
    at DestroyableTransform.onend (/Users/nfriedly/running-average/node_modules/gulp/node_modules/orchestrator/node_modules/end-of-stream/index.js:31:18)
    at DestroyableTransform.emit (events.js:129:20)
    at /Users/nfriedly/running-average/node_modules/gulp-istanbul/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:965:16
    at process._tickDomainCallback (node.js:381:11)

/Users/nfriedly/running-average/test/index.js
  line 3  col 8  'runningAverage' is defined but never used.

  ⚠  1 warning


events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: JSHint failed for: /Users/nfriedly/running-average/test/index.js

That looks like a gulp-mocha issue, but if you dig in, it's just loading the dependencies that the generated gulp.js config tells it to:

gulp.task('test', ['pre-test'], function (cb) {
  var mochaErr;

  gulp.src('test/**/*.js')
    .pipe(plumber())
    .pipe(mocha({reporter: 'spec', require: ['babel/register']}))
    //...

However, babel is not directly required by the generated package.json:

{
//...
  "devDependencies": {
    "gulp": "^3.6.0",
    "gulp-babel": "^5.1.0",
    "gulp-coveralls": "^0.1.0",
    "gulp-istanbul": "^0.8.1",
    "gulp-jscs": "^1.1.0",
    "gulp-jshint": "^1.5.3",
    "gulp-mocha": "^2.0.0",
    "gulp-plumber": "^1.0.0",
    "jshint-stylish": "^1.0.0"
  },
//...
}

(Presumably it's there in gulp-babel's node_modules folder, but that isn't good enough for npm 2.x and I don't think it would be correct to skip it even after npm 3.x goes live.)

(node) warning: possible EventEmitter memory leak detected. When Babel is selected

Sorry I didn't raise this issue because I thought it might be just my local environment (I've been debugging and symlinking the project) but I got this by running yo node.

$ yo node
? Module Name: n
? Description:
? Project homepage url: n
? GitHub username or organization: n
? Author's Name: n
? Author's Email: n
? Author's Homepage: n
? Key your keywords (comma to split) n
? Send coverage reports to coveralls: No
(node) warning: possible EventEmitter memory leak detected. 11 end listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Queue.addListener (events.js:179:15)
    at Queue.once (events.js:204:8)
    at run (/usr/local/lib/node_modules/generator-node/node_modules/yeoman-generator/lib/base.js:396:20)
    at composeWith (/usr/local/lib/node_modules/generator-node/node_modules/yeoman-generator/lib/base.js:625:15)
    at module.exports.generators.Base.extend [as default] (/usr/local/lib/node_modules/generator-node/generators/app/index.js:213:12)
    at /usr/local/lib/node_modules/generator-node/node_modules/yeoman-generator/lib/base.js:428:16
    at processImmediate [as _immediateCallback] (timers.js:358:17)
(node) warning: possible EventEmitter memory leak detected. 11 change listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at addListener (events.js:179:15)
    at run (/usr/local/lib/node_modules/generator-node/node_modules/yeoman-generator/lib/base.js:473:21)
    at composeWith (/usr/local/lib/node_modules/generator-node/node_modules/yeoman-generator/lib/base.js:625:15)
    at module.exports.generators.Base.extend [as default] (/usr/local/lib/node_modules/generator-node/generators/app/index.js:213:12)
    at /usr/local/lib/node_modules/generator-node/node_modules/yeoman-generator/lib/base.js:428:16
    at processImmediate [as _immediateCallback] (timers.js:358:17)
? Which license do you want to use? Apache 2.0

It works fine nevertheless

I tried

$ yo node --no-babel

and I don't get this warning anymore so I thought it might not just be my local env

Can you confirm? I'm not sure how this would happen. Many thanks.

When installed with CLI, bin points to non-existent path

I just noticed that when I scaffold a new module with CLI by using yo node --cli, in package.json bin points to non-existent path ("dist/cli.js").

As an example, I tried to link my new module with following result:

C:\Projects\testapp-node-cli
λ npm link
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "link"
npm ERR! node v0.12.5
npm ERR! npm  v2.11.2
npm ERR! path C:\Users\<user>\AppData\Roaming\npm\node_modules\testapp-node-cli\dist\cli.js
npm ERR! code ENOENT
npm ERR! errno -4058

And real dir structure:

...
├───lib
│       cli.js
│       index.js
│       
├───node_modules
├───test

However, if I run yo node:cli this issue doesn't happen. Not sure about the specifics, but I think it originates from here https://github.com/yeoman/generator-node/blob/master/generators/cli/index.js#L14

FR : new tasks in grunt.

Will it be useful for the Gruntfile to have tasks for npm adduser and npm publish ?

Also will be useful if we go a step further and make a publish task that would not only publish to npmjs repo but also push to the remote origin.

Add JSCS?

We use jshint to detect errors and potential problems so why not adding jscs to check code style? indent option is deprecated (this was the main reason I personally start using jshint). http://jshint.com/docs/options/#indent

This feature request applies to all other generators.

Support for mocha and other test frameworks.

Currently, generator-node only allows using nodeunit as the test framework. Albeit, it can be changed later in package.json but it will be nice to have an option, --test <name-of-the-desired-test-framework> (maybe?) to allow working with other test frameworks such as mocha, expresso etc.

Update repo desc for mocha

"Create a Node.js module with yo, including Nodeunit unit tests."

-->

"Create a Node.js module with yo, including Mocha unit tests."

Change README.md

I've just installed and it has failed with yo node then I've search some information and I've found the #53 so I've installed the generator by using npm i [email protected] -g and it works.

I'm suggesting to add this information in the README.md or change the stable version to 0.4.2

Moving towards yeoman core features

A couple days ago we started talking about consolidating the yeoman core build system in a reusable module yeoman/yeoman#1440 - This module obviously is generator-node.

All the features contained in https://github.com/yeoman/generator will be added or updated to match our internal style.

To make a short list:

  • Code coverage
  • Coveralls integration
  • Unit test (mocha)
  • Travis.CI integrtion
  • jshint (we also have eslint on yeoman-generator, but we'll make a cut and probably keep only one)
  • node-jscs (code style checker)
  • jsdoc
  • Benchmarks (matcha)
  • Security linting (nsp)

Default build will use gulp, but we intend to provide the choice between:

  • Gulp
  • Grunt
  • Simpler raw npm build config (only jshint and mocha)

Any requests or comments is welcome! (Help marking this happens is also welcome!)

Can't generate with a simple "yo node"

Here's what I get:

The name of your project shouldn't contain "node" or "js" and
should be a unique ID not already in use at search.npmjs.org.
[?] Module Name: (dir-name)
events.js:74ter a valid value
        throw TypeError('Uncaught, unspecified "error" event.');
              ^
TypeError: Uncaught, unspecified "error" event.
    at TypeError (<anonymous>)
    at emit (events.js:74:15)
    at done (C:\Users\tom\AppData\Roaming\npm\node_modules\generator-node\node_modules\yeo
man-generator\lib\base.js:375:23)
    at onResponse (C:\Users\tom\AppData\Roaming\npm\node_modules\generator-node\app\index.
js:38:17)
    at C:\Users\tom\AppData\Roaming\npm\node_modules\generator-node\node_modules\npm-name\
index.js:8:11
    at ClientRequest.<anonymous> (C:\Users\tom\AppData\Roaming\npm\node_modules\generator-
node\node_modules\npm-name\node_modules\got\index.js:47:5)
    at ClientRequest.g (events.js:180:16)
    at ClientRequest.emit (events.js:95:17)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1688:21)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)

cli.js is not added to files array in package.json, causes npm install errors

Hi, I'm admittedly a newb to yo, but I just used this generator to create a node package with a cli. It was a great boost to getting started, and getting the module working. But, after I published it to npm, I tried to add it as a dependency in another project but the install kept failing with this error:

$ npm install --save approximate-number
npm ERR! Error: ENOENT, chmod 'c:\Users\IBM_ADMIN\service-dashboard\node_modules\approximate-number\cli.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files (x86)\\nodejs\\node.exe" "c:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "approximate-number"
npm ERR! cwd c:\Users\IBM_ADMIN\service-dashboard
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! path c:\Users\IBM_ADMIN\service-dashboard\node_modules\approximate-number\cli.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     c:\Users\IBM_ADMIN\service-dashboard\npm-debug.log
npm ERR! not ok code 0

It took me a while, but eventually I figured out that the generator had add a "files": ["lib/"] entry in my package.json, and that instructs npm to skip everything else, including the cli.js file that the generator put in the project root.

npmName check bug: True/False behaviours are reversed

When a name is taken in npm, you will NOT be re-prompted to choose a new name (npmName(answers.name) === false)
When a name is available in npm, you will be re-prompted to choose a new name (npmName(answers.name) === true)

This is happening in a fresh install of node, npm, yeoman, and generator-node, on OSX 10.10.3

In line 72 of index.js, done(...) is directly provided the result of the call to npmName(answers.name). So the done(...) function is given true when a name is available - but true being provided to done(...) indicates the question should be asked again - so the solution is just flipping this boolean.

Will have an incredibly brief PR submitted shortly!

Hopefully I'm not missing something obvious or seeing atypical behaviour (wrong version of something, or something), feel free to let me know here or in the PR if I am!

DOS file under unix

Under ubuntu 13.10

Linux FC-lab 3.11.0-13-generic #20-Ubuntu SMP Wed Oct 23 17:26:33 UTC 2013 i686 i686 i686 GNU/Linux

When I generate a project with yo node, all the files are in DOS format with \r\n as line ending, e.g. package.json, Gruntfile.js and etc.

I tried other generator such as generator-chrome-extension but didn't meet the same issue.

When I open the original template files under ~/.nvm/v0.10.22/lib/node_modules/generator-node, they are in DOS format. But the templates in other node modules are unix format.

Any hint?

(Error: Cannot find module 'grunt-prompts')

Just got this one trying to start a project today:

JayAir:site_api jdivock$ yo node
Unable to register generator-node/app/index.js (Error: Cannot find module 'grunt-prompts')
Error node

Bad or missing dependancy?

edit: looks like async is missing as well

Missing package name in CLI submodule

I scaffolded a new node package and after adding a CLI submodule (yo node:cli or yo node:cli customname) I get cli.js with missing stuff (see var = require('./') and help string).

#!/usr/bin/env node
'use strict';
var meow = require('meow');
var = require('./');
var pkg = require('../');

var cli = meow({
  pkg: pkg,
  help: [
    'Usage',
    '  $  [input]',
    '',
    'Examples',
    '  $ ',
    '  unicorns',
    '',
    '  $  rainbows',
    '  unicorns & rainbows',
    '',
    'Options',
    ' --foo Lorem ipsum. Default: false'
  ]
});

I found a solution, see my PR #132

slugname may contain characters not suited for a variable name

to whom it may concern,
by default generator-node proposes yeoman-express as module name (the slugname)

unfortunately this slugname is used in many places, even defining variable names.

Variable names can't contain dashes '-' which generates an error while running grunt if the user accepted all the default values

the incorrect code

the filetest/yeoman-express_test.jscontains the following mistaken piece of code

'use strict';

var yeoman-express = require('../lib/yeoman-express.js');
...
test.equal(yeoman-express.awesome(), 'awesome', 'should be awesome.');
...

the solution?

update the file generator-node / app / templates / test / name_test.js

  1. either do not use the slugname but a hard coded variable e.g. yeomanExpress (camelcase)
  2. or convert the slugname entered by the user to match variable naming constraints

Source Folder

why not create a structure with sources folder?

.
├── Gruntfile.js
├── index.js
├── package.json
├── README.md
├── src
│   └── index.js
└── test
    └── test.js

/index.js -> exporting require src/index
/Gruntfile.js

js: {
    src: ['src/**/*.js']
},

JSCS + ES2015

Our current JSCS setup doesn't work well with ES2015 (and thus not with the babel option). If you choose to include babel it fails and reports syntax errors.

Also, if you the dist directory is present it lints that directory too.

Enhancing generator-node.

Below are the few potential candidates for enhancement:

  • Ask for keywords for package.json
  • Ask for bower and component.
  • Ask if they need to browserify.
  • Ask if it's a CLI app and do the rest.
  • Address #13
  • Address #20
  • Address #38
  • Add an example dir, with basic example template.
  • Migrate to mocha.

/cc @addyosmani @sindresorhus

Shouldn't lint dist and coverage files

Currently they're linted and most of the time will raise jshint issue.

Let's make sure they're removed from our linting target.

I think the smartest thing to do here is to consume the .gitignore file content and exclude these files from the linting process. That way we only have a single place to define them.

props or just variable

In the template file

for example

{
  "name": "<%= slugname %>",
  "version": "0.0.0",
  "main": "lib/<%= slugname %>.js",
  "description": "<%= props.description %>",<% if (props.homepage) { %>
  "homepage": "<%= props.homepage %>",<%}%>
  "bugs": "<%= repoUrl %>/issues",
  "author": {
    "name": "<%= props.authorName %>",
    "email": "<%= props.authorEmail %>"<% if (props.authorUrl) { %>,
    "url": "<%= props.authorUrl %>"<% } %>
  }
}

In this case we have variable slugname props.homepage

Can we select just one type

  1. all using props
    or
  2. all using variable (assign all props to a variable, let props.authorName => authorName)

Easier for maintenance.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.