diff --git a/README.md b/README.md index 57c4c9c..9ac3dd5 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ __A React webapp scaffolding tool with best practice enforcement, automated test Scaffolding for automation of basic tooling and tasks typically required by React projects, including: - CommonJS module bundling via [Browserify](http://browserify.org/) -- ES2015 syntax support and transpilation via [Babel](https://babeljs.io/) +- ES2015+ (ES6+) syntax support and transpilation via [Babel](https://babeljs.io/) - Code quality assessment & style enforcement via [ESLint](http://eslint.org/) - [Stylus](http://stylus-lang.com/) CSS preprocessing & automatic vendor prefix management via [Autoprefixer](https://github.com/postcss/autoprefixer#autoprefixer-) - Unit testing via the [Jest](https://facebook.github.io/jest/) framework and [Jasmine2](http://jasmine.github.io/2.0/introduction.html) test runner @@ -61,7 +61,7 @@ Once you've set up your app, check out the targets available in `package.json`. The [Jasmine 2](http://jasmine.github.io/2.0/introduction.html) test runner is included by default, as a part of the [Jest](https://facebook.github.io/jest/) unit testing framework. -Jest's [automocking functionality](https://facebook.github.io/jest/docs/automatic-mocking.html) is disabled via the `"jest": {"automock": false}` `package.json` field. We've found this dramatically reduces the complexity of writing tests, but you can choose to enable it if desired. +Jest supports a broad spectrum of matchers and test-writing styles, so check out their documentation to customize things to your liking! [back to top](#generator-enigma) diff --git a/generators/app/index.js b/generators/app/index.js index 27895d5..50d5f43 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -74,7 +74,7 @@ module.exports = yeoman.Base.extend({ message: formatPrompt(chalk.bold.white('Would you like routing to be set up? (via react-router)')), }]; - this.prompt(prompts, function(answers) { + this.prompt(prompts).then(function(answers) { this.answers = answers; this.answers.appName = _.kebabCase(this.answers.appName); @@ -91,7 +91,7 @@ module.exports = yeoman.Base.extend({ mkdirp('public/assets'); mkdirp('scripts'); - mkdirp('src/example/__tests__'); + mkdirp('src/example'); mkdirp('src/static/assets/images'); copier([ @@ -102,8 +102,8 @@ module.exports = yeoman.Base.extend({ 'scripts/budo.js', 'scripts/parallelize.sh', 'src/example/index.js', + 'src/example/index.spec.js', 'src/example/style.styl', - 'src/example/__tests__/index.js', 'src/style.styl', ]); diff --git a/generators/app/templates/_eslintrc b/generators/app/templates/_eslintrc index 77ae4ea..865ed00 100644 --- a/generators/app/templates/_eslintrc +++ b/generators/app/templates/_eslintrc @@ -7,15 +7,17 @@ "env": { "browser": true, - "node": true + "node": true, + "jasmine": true }, "globals": { - "expect": true + "expect": true, + "jest": true }, "parserOptions": { - "ecmaVersion": 6, + "ecmaVersion": 7, "ecmaFeatures": { "jsx": true }, @@ -139,12 +141,12 @@ "react/jsx-sort-prop-types": 0, "react/jsx-uses-react": 2, "react/jsx-uses-vars": 2, + "react/jsx-wrap-multilines": 2, "react/no-did-mount-set-state": 0, "react/no-did-update-set-state": 2, - "react/no-multi-comp": 2, + "react/no-multi-comp": 0, "react/no-unknown-property": 2, "react/prop-types": 1, - "react/self-closing-comp": 2, - "react/wrap-multilines": 2 + "react/self-closing-comp": 2 } } diff --git a/generators/app/templates/package.json b/generators/app/templates/package.json index 1d7c18d..8a155d7 100644 --- a/generators/app/templates/package.json +++ b/generators/app/templates/package.json @@ -9,14 +9,14 @@ "email": "<%= authorEmail %>" }, "dependencies": { - "react": "^15.0.0", + "react": "^15.3.0", <% if (include_routing) { %>"react-router": "^2.0.0",<% } %> - "react-dom": "^15.0.0" + "react-dom": "^15.3.0" }, "devDependencies": { "autoprefixer-stylus": "^0.9.2", "babel-eslint": "^6.0.0", - "babel-jest": "^12.0.2", + "babel-jest": "^15.0.0", "babel-plugin-transform-class-properties": "^6.6.0", "babel-preset-es2015": "^6.6.0", "babel-preset-react": "^6.5.0", @@ -24,9 +24,9 @@ "babelify": "^7.2.0", "browserify": "^13.0.0", "budo": "^8.1.0", - "eslint": "^2.7.0", - "eslint-plugin-react": "^4.2.3", - "jest-cli": "^12.0.2", + "eslint": "^3.0.0", + "eslint-plugin-react": "^6.0.0", + "jest-cli": "^15.1.0", "mkdirp": "latest", "stylus": "^0.54.2", "uglify-js": "^2.6.2", @@ -47,9 +47,6 @@ "babelify" ] }, - "jest": { - "automock": false - }, "scripts": { "postinstall": "mkdirp public/assets", "js": "browserify src/index.js --debug > public/assets/bundle.js", diff --git a/generators/app/templates/scripts/budo.js b/generators/app/templates/scripts/budo.js index a19224e..936061f 100644 --- a/generators/app/templates/scripts/budo.js +++ b/generators/app/templates/scripts/budo.js @@ -13,6 +13,6 @@ require('budo')('src/index.js', { stream: process.stdout, watchGlob: [ - '{public,src}/**/*.{html,css,json}' - ] + '{public,src}/**/*.{html,css,json}', + ], }); diff --git a/generators/app/templates/src/example/__tests__/index.js b/generators/app/templates/src/example/index.spec.js similarity index 96% rename from generators/app/templates/src/example/__tests__/index.js rename to generators/app/templates/src/example/index.spec.js index 1c2b618..722d547 100644 --- a/generators/app/templates/src/example/__tests__/index.js +++ b/generators/app/templates/src/example/index.spec.js @@ -2,7 +2,7 @@ import React from 'react'; import {render, unmountComponentAtNode as cleanup} from 'react-dom'; -import Example from '../index'; +import Example from './index'; describe('Example', () => { const testingRootNode = document.body.appendChild(document.createElement('div')); diff --git a/package.json b/package.json index 527c32a..b2eaf57 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,15 @@ "stylus" ], "dependencies": { - "yeoman-generator": "^0.22.0", + "yeoman-generator": "^0.24.0", "chalk": "^1.0.0", "yosay": "^1.0.2", "lodash": "^4.0.0", "mkdirp": "^0.5.1" }, + "peerDependencies": { + "yo": ">= 1.8" + }, "engines": { "node": ">= 4" },