Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Malte W committed Aug 7, 2015
1 parent fef1414 commit 5b7af0a
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 137 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 library-boilerplate-author
Copyright (c) 2015 react-custom-scrollbars

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
17 changes: 1 addition & 16 deletions README.md
@@ -1,17 +1,2 @@
library-boilerplate
react-custom-scrollbars
=========================

An opinionated setup I plan to use for my libraries.

It has CommonJS and UMD builds via Babel and Webpack, ESLint, and Mocha.
It also has React-friendly examples folder with library code mapped to the sources.

If you use this, make sure to grep for “library-boilerplate” and replace every occurrence.
See `package.json` in the root and the example folder for the list of the available commands.

Note that this is an *opinionated* boilerplate. You might want to:

* Set `stage` to `2` in `.babelrc` so you don’t depend on language features that might be gone tomorrow;
* Remove `loose: ["all"]` from `.babelrc` so the behavior is spec-compliant.

You have been warned.
10 changes: 5 additions & 5 deletions examples/simple/components/App.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions examples/simple/index.html
@@ -1,10 +1,9 @@
<html>
<head>
<title>library-boilerplate-example-title</title>
</head>
<body>
<div id="root">
</div>
<script src="/static/bundle.js"></script>
</body>
<head>
<title>react-custom-scrollbars simple example</title>
</head>
<body>
<div id="root"></div>
<script src="/static/bundle.js"></script>
</body>
</html>
5 changes: 1 addition & 4 deletions examples/simple/index.js
Expand Up @@ -2,7 +2,4 @@ import React from 'react';
import { render } from 'react-dom';
import App from './components/App';

render(
<App />,
document.getElementById('root')
);
render(<App />, document.getElementById('root'));
17 changes: 10 additions & 7 deletions examples/simple/package.json
@@ -1,23 +1,26 @@
{
"name": "library-boilerplate-example",
"version": "1.0.0",
"description": "library-boilerplate-example-description",
"name": "react-custom-scrollbars-example",
"version": "0.1.0",
"description": "Simple example",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"repository": {
"type": "git",
"url": "https://github.com/library-boilerplate-author/library-boilerplate.git"
"url": "https://github.com/malte-wessel/react-custom-scrollbars.git"
},
"keywords": [
"library-boilerplate-keywords"
"scroll",
"scroller",
"scrollbars",
"react"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/library-boilerplate-author/library-boilerplate/issues"
"url": "https://github.com/malte-wessel/react-custom-scrollbars/issues"
},
"homepage": "https://github.com/library-boilerplate-author/library-boilerplate",
"homepage": "https://github.com/malte-wessel/react-custom-scrollbars",
"dependencies": {},
"devDependencies": {
"babel-core": "^5.6.18",
Expand Down
19 changes: 8 additions & 11 deletions examples/simple/server.js
Expand Up @@ -3,16 +3,13 @@ var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');

new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
stats: {
colors: true
}
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
stats: {
colors: true
}
}).listen(3000, 'localhost', function (err) {
if (err) {
console.log(err);
}

console.log('Listening at localhost:3000');
if (err) console.log(err);
console.log('Listening at localhost:3000');
});
64 changes: 32 additions & 32 deletions examples/simple/webpack.config.js
Expand Up @@ -2,37 +2,37 @@ var path = require('path');
var webpack = require('webpack');

module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
resolve: {
alias: {
'react-scroller': path.join(__dirname, '..', '..', 'src')
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
extensions: ['', '.js']
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['react-hot', 'babel'],
exclude: /node_modules/,
include: __dirname
}, {
test: /\.js$/,
loaders: ['babel'],
include: path.join(__dirname, '..', '..', 'src')
}]
}
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
resolve: {
alias: {
'react-custom-scrollbars': path.join(__dirname, '..', '..', 'src')
},
extensions: ['', '.js']
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['react-hot', 'babel'],
exclude: /node_modules/,
include: __dirname
}, {
test: /\.js$/,
loaders: ['babel'],
include: path.join(__dirname, '..', '..', 'src')
}]
}
};
30 changes: 18 additions & 12 deletions package.json
@@ -1,12 +1,12 @@
{
"name": "library-boilerplate",
"version": "1.0.0",
"description": "library-boilerplate-description",
"name": "react-custom-scrollbars",
"version": "0.1.0",
"description": "React scrollbars component",
"main": "lib/index.js",
"scripts": {
"clean": "rimraf lib dist",
"build": "babel src --out-dir lib",
"build:umd": "webpack src/index.js dist/library-boilerplate.js && NODE_ENV=production webpack src/index.js dist/library-boilerplate.min.js",
"build:umd": "webpack src/index.js dist/react-custom-scrollbars.js && NODE_ENV=production webpack src/index.js dist/react-custom-scrollbars.min.js",
"lint": "eslint src test examples",
"test": "NODE_ENV=test mocha --compilers js:babel/register --recursive",
"test:watch": "NODE_ENV=test mocha --compilers js:babel/register --recursive --watch",
Expand All @@ -15,17 +15,21 @@
},
"repository": {
"type": "git",
"url": "https://github.com/library-boilerplate-author/library-boilerplate.git"
"url": "https://github.com/malte-wessel/react-custom-scrollbars.git"
},
"keywords": [
"library-boilerplate-keywords"
"scroll",
"scroller",
"scrollbars",
"react",
"custom"
],
"author": "library-boilerplate-author",
"author": "Malte Wessel",
"license": "MIT",
"bugs": {
"url": "https://github.com/library-boilerplate-author/library-boilerplate/issues"
"url": "https://github.com/malte-wessel/react-custom-scrollbars/issues"
},
"homepage": "https://github.com/library-boilerplate-author/library-boilerplate",
"homepage": "https://github.com/malte-wessel/react-custom-scrollbars",
"devDependencies": {
"babel": "^5.5.8",
"babel-core": "^5.6.18",
Expand All @@ -43,7 +47,9 @@
"webpack": "^1.9.6",
"webpack-dev-server": "^1.8.2"
},
"dependencies": {
"invariant": "^2.0.0"
}
"peerDependencies": {
"react": "^0.14.0-beta3",
"react-dom": "^0.14.0-beta3"
},
"dependencies": {}
}
9 changes: 4 additions & 5 deletions src/Scroller.js → src/Scrollbars.js
@@ -1,4 +1,4 @@
import React, { isValidElement, Component, PropTypes, cloneElement } from 'react';
import React, { Component, PropTypes, cloneElement } from 'react';
import { findDOMNode } from 'react-dom';
import addClass from './utils/addClass';
import removeClass from './utils/removeClass';
Expand All @@ -9,8 +9,8 @@ import returnFalse from './utils/returnFalse';
let SCROLLBAR_WIDTH = false;

const classnames = {
testScrollbar: 'react-scroller-test-scrollbar',
disableSelection: 'react-scroller-disable-selection'
testScrollbar: 'react-custom-scrollbars-test-scrollbar',
disableSelection: 'react-custom-scrollbars-disable-selection'
};

const stylesheet = [
Expand Down Expand Up @@ -80,7 +80,7 @@ function getDefaultView({ style, ...props }) {
return <div style={finalStyle} {...props} />;
}

export default class Scroller extends Component {
export default class Scrollbars extends Component {

static propTypes = {
scrollbarHorizontal: PropTypes.func,
Expand Down Expand Up @@ -380,5 +380,4 @@ export default class Scroller extends Component {
</div>
);
}

}
4 changes: 2 additions & 2 deletions src/index.js
@@ -1,2 +1,2 @@
import Scroller from './Scroller';
export { Scroller };
import Scrollbars from './Scrollbars';
export { Scrollbars };
4 changes: 2 additions & 2 deletions src/utils/addStylesheet.js
@@ -1,8 +1,8 @@
export default function addStyleSheet(styles) {
if (document.getElementById('react-scroller-styles')) return;
if (document.getElementById('react-custom-scrollbars-styles')) return;
const style = document.createElement('style');
style.type = 'text/css';
style.id = 'react-scroller-styles';
style.id = 'react-custom-scrollbars-styles';
style.innerHTML = styles;
document.body.appendChild(style);
}
9 changes: 4 additions & 5 deletions test/index.spec.js
@@ -1,8 +1,7 @@
import expect from 'expect';
import { add } from '../src';

describe('add', () => {
it('should add 2 and 2', () => {
expect(add(2, 2)).toBe(4);
});
describe('Scrollbars', () => {
it('works', () => {
expect(true).toBe(true);
});
});

0 comments on commit 5b7af0a

Please sign in to comment.