-
Notifications
You must be signed in to change notification settings - Fork 60
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
[WIP] Aegir@next #134
[WIP] Aegir@next #134
Changes from 35 commits
61ad82a
668f3ac
f37112c
c7ce0e6
23dde2e
00c1ddc
7a6f30c
df671ba
8e7a15f
fd0a6d8
97de4d1
1d0d837
261c213
9790a54
65843aa
a323017
c4a9924
f87d6d3
a4adb59
3757c2b
61ee9f4
36d231d
5468940
9d58062
ea6f53d
adbfa41
dce396c
489fbb3
13894a4
a9253b1
7c89411
bc20de1
4b1b258
07d3554
e0f716c
7b33fc0
5802b4d
847805d
d4b8c31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Only for testing |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
node_modules | ||
/coverage | ||
/dist | ||
/docs | ||
*.log |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_js: | |
|
||
script: | ||
- yarn lint | ||
- yarn coverage -- -u -p codecov coveralls |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,44 @@ | |
> Automated JavaScript project management. | ||
|
||
|
||
## Migration from `v11` | ||
|
||
There was a large refactor from `v11` to `v12`, so there is some migration needed. All features you need should still be there, but you might need to changes some things. | ||
|
||
### Custom Config | ||
|
||
The `aegir` section in `package.json` was not really useful anymore so it is not supported anymore. Any custom configuration you need can be done in `.aegir.js`. | ||
|
||
### Pre and Post Hooks | ||
|
||
As we are no longer using `gulp` the previous setup using a custom `gulpfile` will not work anymore. To setup hooks around your tests you can use a new configuration option `hooks` in `.aegir.js`. | ||
|
||
```js | ||
// .aegir.js | ||
module.exports = { | ||
hooks: { | ||
pre (callback) { | ||
console.log('I am called before node and browser tests') | ||
callback() | ||
}, | ||
post (callback) { | ||
console.log('I am called after node and browser tests') | ||
callback() | ||
} | ||
} | ||
} | ||
``` | ||
|
||
You can also specify `hooks.browser` and `hooks.node` if you have a different setup for browser and/or node based tests. | ||
|
||
### Renamed binaries | ||
|
||
`aegir` is now a single binary with subcommands. While something like `aegir-test` still works, we recommend to switch to the new `aegir test` syntax. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is going to be a major release, you might just want to clean all of that old code anyway :) |
||
|
||
### Switch from Mocha to Jest | ||
|
||
Because the mocha binary was the source of many pains tests in node are now run using [Jest](https://facebook.github.io/jest/). All important features should work as before, but if you were relying on a mocha specific feature it might break now. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
## Project Structure | ||
|
||
The project structure when using this is quite strict, to ease | ||
|
@@ -23,14 +61,14 @@ Your `package.json` should have the following entries. | |
```json | ||
"main": "src/index.js", | ||
"scripts": { | ||
"lint": "aegir-lint", | ||
"release": "aegir-release", | ||
"build": "aegir-build", | ||
"test": "aegir-test", | ||
"test:node": "aegir-test node", | ||
"test:browser": "aegir-test browser", | ||
"coverage": "aegir-coverage", | ||
"coverage-publish": "aegir-coverage publish" | ||
"lint": "aegir lint", | ||
"release": "aegir release", | ||
"build": "aegir build", | ||
"test": "aegir test", | ||
"test:node": "aegir test --target node", | ||
"test:browser": "aegir test --target browser", | ||
"coverage": "aegir coverage", | ||
"coverage-publish": "aegir coverage --upload" | ||
} | ||
``` | ||
|
||
|
@@ -39,46 +77,38 @@ Your `package.json` should have the following entries. | |
To bring you its many benefits, `aegir` requires | ||
|
||
- JS written in [Standard](https://github.com/feross/standard) style | ||
- Tests written in [Mocha](https://github.com/mochajs/mocha) | ||
- Tests written in [Mocha](https://github.com/mochajs/mocha) syntax, executed through [Jest](https://facebook.github.io/jest/) in node and karma in the browser. | ||
- [Karma](https://github.com/karma-runner/karma) for browser tests | ||
|
||
|
||
## Tasks | ||
|
||
### Linting | ||
|
||
Linting uses [eslint](http://eslint.org/) and [standard](https://github.com/feross/standard) | ||
with [some custom rules](config/eslintrc.yml) to enforce some more strictness. | ||
with [some custom rules](https://github.com/ipfs/eslint-config-aegir) to enforce some more strictness. | ||
|
||
You can run it using | ||
|
||
```bash | ||
$ aegir-lint | ||
# or as gulp task | ||
$ gulp lint | ||
$ aegir lint | ||
``` | ||
|
||
### Testing | ||
|
||
You can run it using | ||
|
||
```bash | ||
$ aegir-test | ||
# or as gulp task | ||
$ gulp test | ||
$ aegir test | ||
``` | ||
|
||
There are also browser and node specific tasks | ||
|
||
```bash | ||
$ aegir-test node | ||
$ gulp test:node | ||
$ aegir-test browser | ||
$ gulp test:browser | ||
$ aegir test --target node | ||
$ aegir test --target browser | ||
$ aegir test --target webworker | ||
``` | ||
|
||
If you want to run tests in a webworker you can also pass `--webworker` as a flag to enable that. | ||
|
||
If the needed environment variables are set, tests are also run on [Sauce Labs]. | ||
You will need | ||
|
||
|
@@ -138,20 +168,15 @@ module.exports = { | |
You can run it using | ||
|
||
```bash | ||
$ aegir-coverage | ||
# or as gulp task | ||
$ gulp coverage | ||
$ aegir coverage | ||
``` | ||
|
||
To auto publish coverage reports from Travis to Coveralls add this to | ||
your `.travis.yml` file. For more details see [node-coveralls](https://github.com/nickmerwin/node-coveralls). | ||
|
||
```yml | ||
script: | ||
- npm run coverage | ||
|
||
after_success: | ||
- npm run coverage-publish | ||
- npm run coverage -- -upload | ||
``` | ||
|
||
### Building | ||
|
@@ -166,9 +191,7 @@ https://unpkg.com/<module-name>/dist/index.min.js | |
You can run it using | ||
|
||
```bash | ||
$ aegir-build | ||
# or as gulp task | ||
$ gulp build | ||
$ aegir build | ||
``` | ||
|
||
**Specifying a custom entry file for Webpack** | ||
|
@@ -200,29 +223,21 @@ If `.aegir.js` file is not present in the project, webpack will use `src/index.j | |
|
||
```bash | ||
# Major release | ||
$ gulp release --type major | ||
$ aegir-release --type major | ||
$ aegir release --type major | ||
# Minor relase | ||
$ gulp release --type minor | ||
$ aegir-release --type minor | ||
$ aegir release --type minor | ||
# Patch release | ||
$ gulp release | ||
$ aegir-release | ||
$ aegir release | ||
``` | ||
|
||
You can also specify a `--env` for a release, which can be either | ||
`'node'`, `'browser'` or `'no-build'`. | ||
|
||
```bash | ||
$ aegir-release --env node | ||
$ gulp release --env node | ||
$ aegir release --node | ||
``` | ||
|
||
You can generate a changelog for all versions by using `--first` | ||
|
||
```bash | ||
$ aegir-release --first | ||
``` | ||
If no `CHANGELOG.md` is present, one is generated the first time a release is done. | ||
|
||
You can skip all changelog generation and the github release by passing | ||
in `--no-changelog`. | ||
|
@@ -236,16 +251,7 @@ You can use `aegir-docs` to generate documentation. This uses [documentation.js] | |
To publish the documentation automatically to the `gh-pages` branch you can run | ||
|
||
```bash | ||
$ aegir-docs --publish | ||
``` | ||
|
||
|
||
## Other Notes | ||
|
||
There is a badge. | ||
|
||
```markdown | ||
[![aegir](https://img.shields.io/badge/follows-aegir-blue.svg?style=flat-square)](https://github.com/ipfs/aegir) | ||
$ aegir docs --publish | ||
``` | ||
|
||
## License | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#! /usr/bin/env node | ||
|
||
'use strict' | ||
|
||
const updateNotifier = require('update-notifier') | ||
const pkg = require('./package.json') | ||
|
||
updateNotifier({ | ||
pkg: pkg, | ||
isGlobal: false | ||
}).notify() | ||
|
||
require('yargs') // eslint-disable-line | ||
.env('AEGIR') | ||
.commandDir('cmds') | ||
.demandCommand() | ||
.help() | ||
.argv |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict' | ||
|
||
const build = require('../src/build') | ||
const onError = require('../src/error-handler') | ||
|
||
module.exports = { | ||
command: 'build', | ||
desc: 'Build ready to release', | ||
builder: { | ||
browser: { | ||
alias: 'b', | ||
describe: 'Build for browser usage', | ||
default: true | ||
}, | ||
node: { | ||
alias: 'n', | ||
describe: 'Build for node usage', | ||
default: false | ||
} | ||
}, | ||
handler (argv) { | ||
build.run(argv).catch(onError) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about hooks.electron and hooks.cordova? Will it be easy to extend to support those runtimes as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we support running tests in them yes