Skip to content

Commit

Permalink
feat: convert to an npm module
Browse files Browse the repository at this point in the history
BREAKING CHANGE: now an npm module and not Bower compatible.

- Switch to Angular commit style
- Setup semantic release
- Convert to ES2015 with babel
  • Loading branch information
Tom Ashworth committed Nov 6, 2015
1 parent 591457a commit 5350262
Show file tree
Hide file tree
Showing 21 changed files with 260 additions and 246 deletions.
3 changes: 0 additions & 3 deletions .bowerrc

This file was deleted.

18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"parser": "babel-eslint",
"extends": [
"standard"
],
"env": {
"jasmine": true
},
"rules": {
// overrides of the standard style
"curly": [2, "all"],
"indent": [2, 4],
"max-len": [2, 100, 4],
"semi": [2, "always"],
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
"wrap-iife": [2, "outside"]
}
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bower_components
node_modules
dist/
36 changes: 0 additions & 36 deletions .jshintrc

This file was deleted.

23 changes: 17 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
sudo: false
language: node_js
cache:
directories:
- node_modules
notifications:
email: false
node_js:
- "0.10"
before_script:
- npm install -g bower
- bower install
- '4'
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- npm i -g npm@^2.0.0
before_script:
- npm prune
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
after_success:
- npm run semantic-release
branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ the developers managing and developing this open source project. In return,
they should reciprocate that respect in addressing your issue or assessing
patches and features.

By contributing to this repository, including using the issue tracker, you agree to adhere to Twitter's [Open Source Code of Conduct][coc].


## Using the issue tracker

Expand Down
24 changes: 0 additions & 24 deletions Gruntfile.js

This file was deleted.

22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ A [Flight](https://github.com/flightjs/flight) mixin which extends the [flight-w
## Installation

```bash
bower install --save flight-with-observable-state
npm install --save flight-with-observable-state
```

This module requires `flightjs`, `rx` and `flight-with-state` as a peer dependencies.

## Example

Here's an example component that uses `withObservableState`.
Expand Down Expand Up @@ -66,25 +68,13 @@ var ToggleButton = flight.component(

## Development

Development of this component requires [Bower](http://bower.io) to be globally
installed:
To develop this module, clone the repository and run:

```bash
npm install -g bower
```

Then install the Node.js and client-side dependencies by running the following
commands in the repo's root directory.

```bash
npm install & bower install
$ npm install && npm test
```

To continuously run the tests in Chrome during development, just run:

```bash
npm run watch-test
```
If the tests pass, you have a working environment. You shouldn't need any external dependencies.

## Contributing to this project

Expand Down
23 changes: 0 additions & 23 deletions bower.json

This file was deleted.

9 changes: 9 additions & 0 deletions config/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var path = require('path');

var ROOT_DIRECTORY = path.resolve(__dirname, '..');
var BUILD_DIRECTORY = path.resolve(ROOT_DIRECTORY, 'dist');

module.exports = {
ROOT_DIRECTORY: ROOT_DIRECTORY,
BUILD_DIRECTORY: BUILD_DIRECTORY
};
47 changes: 47 additions & 0 deletions config/karma.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
'use strict';

var constants = require('./constants');
var webpackConfig = require('./webpack.config.test');
// entry is determined by karma config 'files' array
webpackConfig.entry = {};

module.exports = function (config) {
config.set({
basePath: constants.ROOT_DIRECTORY,
browsers: [ process.env.TRAVIS ? 'Firefox' : 'Chrome' ],
browserNoActivityTimeout: 60000,
client: {
captureConsole: true,
useIframe: true
},
files: [
'node_modules/jquery/dist/jquery.min.js',
'src/specs.context.js'
],
frameworks: [
'jasmine'
],
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-sourcemap-loader',
'karma-webpack'
],
preprocessors: {
'src/specs.context.js': [ 'webpack', 'sourcemap' ]
},
reporters: [ 'dots' ],
singleRun: true,
webpack: webpackConfig,
webpackMiddleware: {
stats: {
assetsSort: 'name',
colors: true,
children: false,
chunks: false,
modules: false
}
}
});
};
46 changes: 46 additions & 0 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
var webpack = require('webpack');

var DedupePlugin = webpack.optimize.DedupePlugin;
var OccurenceOrderPlugin = webpack.optimize.OccurenceOrderPlugin;
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;

var plugins = [
new DedupePlugin(),
new OccurenceOrderPlugin()
];

if (process.env.NODE_ENV === 'publish') {
plugins.push(
new UglifyJsPlugin({
compress: {
dead_code: true,
drop_console: true,
screw_ie8: true,
warnings: true
}
})
);
}

module.exports = {
entry: './src',
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
resolve: {
alias: {
flight: 'flightjs'
}
},
output: {
path: './dist',
filename: 'flight-with-observable-state.js'
},
plugins: plugins
};
16 changes: 16 additions & 0 deletions config/webpack.config.publish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var constants = require('./constants');
var baseConfig = require('./webpack.config');

module.exports = Object.assign(baseConfig, {
output: {
library: 'withObservableState',
filename: 'flight-with-observable-state.js',
libraryTarget: 'umd',
path: constants.BUILD_DIRECTORY
},
externals: [
'rx',
'flight',
'flight-with-state'
]
});
5 changes: 5 additions & 0 deletions config/webpack.config.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var baseConfig = require('./webpack.config');

module.exports = Object.assign(baseConfig, {
devtool: 'inline-source-map'
});
59 changes: 0 additions & 59 deletions karma.conf.js

This file was deleted.

Loading

0 comments on commit 5350262

Please sign in to comment.