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

[WIP] Aegir@next #134

Merged
merged 39 commits into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
61ad82a
feat(eslint): extract config into its own package
dignifiedquire Jul 2, 2017
668f3ac
feat(browser): use uglify-es instead of uglify-js
dignifiedquire Jul 2, 2017
f37112c
feat(deps): update chalk and webpack
dignifiedquire Jul 2, 2017
c7ce0e6
refactor(lint): new cli structure for lint command
dignifiedquire Jul 2, 2017
23dde2e
refactor(build): new cli structure
dignifiedquire Jul 2, 2017
00c1ddc
refactor(test): new cli setup
dignifiedquire Jul 2, 2017
7a6f30c
feat(build): add filesizes to output
dignifiedquire Jul 2, 2017
df671ba
refactor(coverage): implement new cli structure
dignifiedquire Jul 3, 2017
8e7a15f
refactor(release): first pass
dignifiedquire Jul 7, 2017
fd0a6d8
feat: add update-notifier
dignifiedquire Jul 7, 2017
97de4d1
chore: cleanup dependencies
dignifiedquire Jul 7, 2017
1d0d837
start writing tests using jest
dignifiedquire Jul 7, 2017
261c213
feat: coverage on travis
dignifiedquire Jul 7, 2017
9790a54
more tests
dignifiedquire Jul 7, 2017
65843aa
refactor(config): allow for better testability
dignifiedquire Jul 8, 2017
a323017
feat(coverage): allow for multiple provider publish
dignifiedquire Jul 8, 2017
c4a9924
feat: use different renderer on ci
dignifiedquire Jul 8, 2017
f87d6d3
chore: publish report to coveralls
dignifiedquire Jul 8, 2017
a4adb59
feat(webpack): include AEGIR_ prefixed env variables
dignifiedquire Jul 8, 2017
3757c2b
refactor(docs): move to new structure
dignifiedquire Jul 8, 2017
61ee9f4
fix(gitignore): add all source files
dignifiedquire Jul 8, 2017
36d231d
fix: improve package.json config
dignifiedquire Jul 8, 2017
5468940
feat(test): better interop and --files option
dignifiedquire Jul 8, 2017
9d58062
feat: support --files on coverage and release
dignifiedquire Jul 8, 2017
ea6f53d
docs(readme): migration guide and updates
dignifiedquire Jul 8, 2017
adbfa41
fix(test): handle various test states
dignifiedquire Jul 9, 2017
dce396c
feat(lint): allow lint config via eslintrc
dignifiedquire Jul 9, 2017
489fbb3
feat: reduce default timeout to 40s and enable it in node tests
dignifiedquire Jul 9, 2017
13894a4
feat: reduce timeout and monkeypatch this.timeout
dignifiedquire Jul 9, 2017
a9253b1
chore: cleanup unused file
dignifiedquire Jul 9, 2017
7c89411
test(browser): add test for fixtures
dignifiedquire Jul 9, 2017
bc20de1
test(lint): add basic test
dignifiedquire Jul 9, 2017
4b1b258
chore(fixtures): move implmentation into src folder
dignifiedquire Jul 9, 2017
07d3554
feat(release): include docs generation
dignifiedquire Jul 9, 2017
e0f716c
feat: implement hooks and fix some bugs
dignifiedquire Jul 11, 2017
7b33fc0
drop old binary refs
dignifiedquire Aug 16, 2017
5802b4d
no more sauce labs
dignifiedquire Aug 16, 2017
847805d
docs: update readme with better migration instructions
dignifiedquire Aug 16, 2017
d4b8c31
feat: better patch for this.timeout
dignifiedquire Aug 16, 2017
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
1 change: 1 addition & 0 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Only for testing
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules
/coverage
/dist
/docs
*.log
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_js:

script:
- yarn lint
- yarn coverage -- -u -p codecov coveralls
125 changes: 62 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

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?

Copy link
Member Author

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


### Renamed binaries

`aegir` is now a single binary with subcommands. You should rename `aegir-test` to `aegir test` in your scripts.

### 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.

## Project Structure

The project structure when using this is quite strict, to ease
Expand All @@ -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"
}
```

Expand All @@ -39,53 +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

- `$SAUCE=true`
- `SAUCE_USERNAME=<username>`
- `SAUCE_ACCESS_KEY=<access key>`

#### Fixtures

Loading fixture files in node and the browser can be painful, that's why aegir provides
Expand Down Expand Up @@ -138,20 +161,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
Expand All @@ -166,9 +184,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**
Expand Down Expand Up @@ -200,29 +216,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`.
Expand All @@ -236,16 +244,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
Expand Down
17 changes: 0 additions & 17 deletions bin/build

This file was deleted.

48 changes: 0 additions & 48 deletions bin/coverage

This file was deleted.

15 changes: 0 additions & 15 deletions bin/docs

This file was deleted.

10 changes: 0 additions & 10 deletions bin/lint

This file was deleted.

10 changes: 0 additions & 10 deletions bin/release

This file was deleted.

24 changes: 0 additions & 24 deletions bin/test

This file was deleted.

18 changes: 18 additions & 0 deletions cli.js
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
Loading