Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.0.0 #240

Merged
merged 29 commits into from
Dec 30, 2015
Merged

6.0.0 #240

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
07d12c6
Add lint npm script; emphasize npm scripts in README.
jamesplease Oct 9, 2015
d2f4ae3
Ensure tests fail when there are leaks.
jamesplease Oct 9, 2015
1360dd0
Ensure source maps are added for the browser tests.
jamesplease Oct 9, 2015
fce92b0
Prevents the browser tests from reloading on first build.
jamesplease Oct 9, 2015
ef9213c
Log message when browser tests are ready.
jamesplease Oct 9, 2015
5112f76
Log using gulp-util instead of console.
jamesplease Oct 10, 2015
f1d130b
Fixes a bug where the watch task could crash.
jamesplease Oct 10, 2015
9c16f7f
Gets rid of runSequence.
jamesplease Oct 10, 2015
614941b
Lint the Gulpfile. Add single lint task.
jamesplease Oct 10, 2015
e08a966
Fix JSCS rules to be more lenient.
jamesplease Oct 10, 2015
e2237f2
Removes Esperanto.
jamesplease Oct 10, 2015
27ea6ac
Update README regarding Babel feature support.
jamesplease Oct 10, 2015
da3a252
Fix bug in clean-tmp
jamesplease Oct 10, 2015
cb8fd41
Run clean-tmp before running browser tests.
jamesplease Oct 10, 2015
29048ec
Remove Browserify; switch to Webpack for browser tests.
jamesplease Oct 10, 2015
5eaf647
Fix bugs in Webpack builds
jamesplease Oct 10, 2015
778eafc
Make all features of sinon sandbox available on global namespace in t…
jamesplease Oct 10, 2015
372b90f
Fix issue where coverage was not working.
jamesplease Oct 10, 2015
f50a719
Beep instead of notify.
jamesplease Oct 10, 2015
a95d810
Simplifies copying of files.
jamesplease Oct 10, 2015
340493b
Export library as UMD.
jamesplease Oct 10, 2015
84fdcc3
Resolve issue where file names weren't copied correctly.
jamesplease Oct 11, 2015
b2b9e8b
Fix issue where browser tests would not livereload.
jamesplease Oct 11, 2015
eb37a17
Add .editorconfig to generator root directory
jamesplease Dec 30, 2015
02387c5
Create centralized globals.json for test globals
paulfalgout Nov 13, 2015
556b771
Only import isparta once
jamesplease Dec 30, 2015
6edbb20
Remove accidental + sign in browser setup file
jamesplease Dec 30, 2015
1f77cb8
Fix bug where `npm test` would not register mocha globals
jamesplease Dec 30, 2015
296bba1
Update version of webpack-stream
jamesplease Dec 30, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
3 changes: 2 additions & 1 deletion .jscsrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"preset": "google",
"maximumLineLength": null,
"esnext": true
"esnext": true,
"disallowSpacesInsideObjectBrackets": null
}
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ Install `yo` and this generator globally.

### Using Yeoman

Yeoman is a breeze to use. Simply navigate to the directory you'd like to use for your project,
then run `yo babel-boilerplate`.
Navigate to the directory you'd like to use for your project, then run `yo babel-boilerplate`.

Answer a few questions, and your project will be scaffolded.

Expand All @@ -30,23 +29,25 @@ Answer a few questions, and your project will be scaffolded.
Write your code in `src`. The entry file is what you named the project in kebab case ([although the filename
can be changed](https://github.com/babel/generator-babel-boilerplate#i-want-to-change-the-primary-source-file)).

Run `gulp build` to compile the source into a distributable format.
Run `npm run build` to compile the source into a distributable format.

Put your unit tests in `test/unit`. The `gulp` command runs the tests using Node. If your library / tests uses features of the DOM, see the `test/setup/node.js` file.
Put your unit tests in `test/unit`. The `npm test` command runs the tests using Node. If your library / tests uses features of the DOM, see the `test/setup/node.js` file.

### Gulp tasks
### npm Scripts

- `gulp` - Lint the library and tests, then run the unit tests
- `gulp build` - Lint then build the library
- `gulp watch` - Continuously run the unit tests as you make changes to the source
- `npm test` - Lint the library and tests, then run the unit tests
- `npm run lint` - Lint the source and unit tests
- `npm run watch` - Continuously run the unit tests as you make changes to the source
and test files themselves
- `gulp test-browser` - Build the library for use with the browser spec runner.
- `npm run test-browser` - Build the library for use with the browser spec runner.
Changes to the source will cause the runner to automatically refresh.
- `npm run build` - Lint then build the library
- `npm run coverage` - Generate a coverage report

### Browser Tests

The [browser spec runner](https://github.com/babel/generator-babel-boilerplate/blob/master/test/runner.html)
can be opened in a browser to run your tests. For it to work, you must first run `gulp test-browser`. This
can be opened in a browser to run your tests. For it to work, you must first run `npm run test-browser`. This
will set up a watch task that will automatically refresh the tests when your scripts, or the tests, change.

### Code Climate
Expand Down Expand Up @@ -79,14 +80,16 @@ and your tests.

#### What Babel features are supported?

This boilerplate is limited by the ECMAScript features that [Acorn](https://github.com/marijnh/acorn) has
implemented. This is because Acorn is used by the tool that performs the bundling in this boilerplate,
[Esperanto](https://github.com/esperantojs/esperanto). As of September 2015, Acorn does not support numerous
proposed ES2016 features, such as async functions.
Nearly all Babel features *should* be supported by this boilerplate. If you find a feature that is throwing an error
when you use it, follow these steps:

There's [ongoing research](https://github.com/babel/generator-babel-boilerplate/issues/230) to find an alternative
system that allows for all of Babel's feature. If you have an idea, feel free
[to suggest it in the issue!](https://github.com/babel/generator-babel-boilerplate/issues/230)
1. Double check to make sure that you're not typoing the new syntax ;)
2. Determine what task is failing (for instance, is it JSCS?)
3. Check that project's issue tracker to see if it is a known issue
4. If it isn't, then open an issue here

Because of the fact that dependencies of this boilerplate, such as JSCS, are maintained by a team separate from Babel, there
may be a delay between when a new feature is added to Babel and when those other libraries add support for it.

#### When should I consider using this boilerplate?

Expand Down Expand Up @@ -141,7 +144,7 @@ these steps:

#### I don't want to export a variable

This is unsupported at this time. Ref https://github.com/esperantojs/esperanto/issues/96
When prompted for the name of the library's main variable, leave the response empty.

#### My library depends on an external module

Expand All @@ -151,6 +154,4 @@ If you want to access the module itself in your unit test files, you will need t
test environment to support the module. To do this:

1. Load the module in the [test setup file](https://github.com/babel/generator-babel-boilerplate/blob/master/test/setup/setup.js).
Attach any exported variables to global object if you'll be using them in your tests.
2. Add those same global variables to the `mochaGlobals` array in `package.json` under
`babelBoilerplateOptions`
2. Add any exported variables to globals object in the [test globals json](https://github.com/babel/generator-babel-boilerplate/blob/master/test/setup/.globals.js).
41 changes: 20 additions & 21 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
'use strict';
var file = require('file');
var path = require('path');
var generators = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
Expand Down Expand Up @@ -61,7 +63,7 @@ module.exports = generators.Base.extend({
}, {
type: 'input',
name: 'variable',
message: 'What is the name of this project\'s main variable?',
message: 'If there is one, what is the name of this project\'s main variable?',
default: camelcase(this.appname)
}];

Expand All @@ -77,27 +79,24 @@ module.exports = generators.Base.extend({

writing: {
app: function() {
this.template('babelrc', '.babelrc');
this.template('jscsrc', '.jscsrc');
this.template('travis.yml', '.travis.yml');
this.template('eslintrc', '.eslintrc');
this.template('editorconfig', '.editorconfig');
this.template('_package.json', 'package.json');
this.template('LICENSE', 'LICENSE');
this.template('README.md', 'README.md');
this.template('CHANGELOG.md', 'CHANGELOG.md');
this.template('gitignore', '.gitignore');
this.template('gulpfile.babel.js', 'gulpfile.babel.js');
mkdirp.sync('src');
var src = this.sourceRoot();
var self = this;
file.walkSync(src, function(dirPath, dirs, files) {
var relativeDir = path.relative(src, dirPath);
files.forEach(function(filename) {
var target;
// Only copy the files that we don't want to rename. We do that after this loop.
// The files we don't want to rename are both "index.js", and one of them is in
// "test/unit," and the other is in "src"
var ignoreDir = relativeDir === 'test/unit' || relativeDir === 'src';
var shouldCopy = !ignoreDir && !/index.js$/.test(filename);
if (shouldCopy) {
target = path.join(relativeDir, filename);
self.template(target, target);
}
});
});
this.template('src/index.js', 'src/' + this.repo + '.js');
mkdirp.sync('test');
this.template('test/eslintrc', 'test/.eslintrc');
this.template('test/runner.html', 'test/runner.html');
mkdirp.sync('test/setup');
this.template('test/setup/browserify.js', 'test/setup/browserify.js');
this.template('test/setup/node.js', 'test/setup/node.js');
this.template('test/setup/setup.js', 'test/setup/setup.js');
mkdirp.sync('test/unit');
this.template('test/unit/index.js', 'test/unit/' + this.repo + '.js');
}
},
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions app/templates/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true;

[*]
# Ensure there's no lingering whitespace
trim_trailing_whitespace = true
# Ensure a newline at the end of each file
insert_final_newline = true

[*.js]
# Unix-style newlines
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = 2
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions app/templates/.jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"preset": "google",
"maximumLineLength": null,
"esnext": true,
"disallowSpacesInsideObjectBrackets": null
}
File renamed without changes.
Loading