Skip to content

Commit

Permalink
[changed] Move built components to lib directory
Browse files Browse the repository at this point in the history
In the past this library has suffered from accidentally pushing this
repo directly to npm without the built components. There has been a
separate repo to which the built source has been pushed and later
deployed from. While the approach is feasible it prevents you from using
the `npm link` feature, for easy testing of changes in your own
application.  This should address concerns like react-bootstrap#325, react-bootstrap#218, and any
others like them that I have missed. In particular this is the fix for
an automated setup as mentioned in react-bootstrap#292.

If you are currently using components directly from this library, then
you will need to change your reference path. For example
`require('react-bootstrap/Alert')` should now be `require('react-bootstrap/lib/Alert')`.
`require('react-bootstrap').Alert` will still work. This applies to both
CommonJS and AMD usages.
  • Loading branch information
mtscout6 committed Feb 16, 2015
1 parent 3f1a679 commit 0193046
Show file tree
Hide file tree
Showing 44 changed files with 200 additions and 194 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ docs/*.html
docs/assets/bundle.js
cjs/*
amd/*
ie8/bundle.js
ie8/bundle.js
lib/*
12 changes: 6 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ module.exports = function (grunt) {
expand: true,
cwd: 'src/',
src: ['**/*.js'],
dest: 'amd/'
dest: 'amd/lib'
},
transpiled: {
expand: true,
cwd: 'transpiled/',
src: ['**/*.js'],
dest: 'amd/'
dest: 'amd/lib'
}
},

Expand All @@ -35,17 +35,17 @@ module.exports = function (grunt) {
expand: true,
cwd: 'transpiled/',
src: ['**/*.js'],
dest: 'cjs/'
dest: 'lib/'
},
{
expand: true,
cwd: 'src/',
src: ['**/*.js'],
dest: 'cjs/'
dest: 'lib/'
},
{
src: ['**/*'],
dest: 'cjs/',
dest: 'lib/',
cwd: 'tools/cjs',
expand: true
}
Expand Down Expand Up @@ -88,7 +88,7 @@ module.exports = function (grunt) {

clean: {
transpiled: ['transpiled'],
cjs: ['cjs'],
cjs: ['lib'],
amd: ['amd'],
test: ['test-built']
},
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "supervisor -w .,../cjs -i node_modules server.js",
"start": "supervisor -w .,../lib -i node_modules server.js",
"build": "node build.js && browserify client.js | uglifyjs -cm 2>/dev/null > ./assets/bundle.js",
"start-prod": "NODE_ENV=production node server.js"
},
Expand Down
8 changes: 4 additions & 4 deletions docs/src/ComponentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
var React = require('react');
var fs = require('fs');

var Affix = require('../../cjs/Affix');
var Nav = require('../../cjs/Nav');
var SubNav = require('../../cjs/SubNav');
var NavItem = require('../../cjs/NavItem');
var Affix = require('../../lib/Affix');
var Nav = require('../../lib/Nav');
var SubNav = require('../../lib/SubNav');
var NavItem = require('../../lib/NavItem');

var NavMain = require('./NavMain');
var PageHeader = require('./PageHeader');
Expand Down
4 changes: 2 additions & 2 deletions docs/src/GettingStartedPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var Page = React.createClass({
$ npm install react-bootstrap\n\
'}</code></pre>
<pre><code className="js">{'\
var Alert = require(\'react-bootstrap/Alert\');\n\
var Alert = require(\'react-bootstrap/lib/Alert\');\n\
// or\n\
var Alert = require(\'react-bootstrap\').Alert;\
'}</code></pre>
Expand All @@ -47,7 +47,7 @@ var Page = React.createClass({
$ bower install react-bootstrap\n\
'}</code></pre>
<pre><code className="js">{'\
var Alert = require(\'react-bootstrap/Alert\');\n\
var Alert = require(\'react-bootstrap/lib/Alert\');\n\
// or\n\
var Alert = require(\'react-bootstrap\').Alert;\
'}</code></pre>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/NavMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

var React = require('react');
var Router = require('react-router-component');
var Navbar = require('../../cjs/Navbar');
var Nav = require('../../cjs/Nav');
var Navbar = require('../../lib/Navbar');
var Nav = require('../../lib/Nav');

var InternalLink = Router.Link;

Expand Down
78 changes: 39 additions & 39 deletions docs/src/ReactPlayground.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,45 @@ var React = require('react');
var classSet = require('react/lib/cx');
var CodeMirror = global.CodeMirror;
var JSXTransformer = global.JSXTransformer;
var Accordion = require('../../cjs/Accordion');
var Alert = require('../../cjs/Alert');
var Badge = require('../../cjs/Badge');
var Button = require('../../cjs/Button');
var ButtonGroup = require('../../cjs/ButtonGroup');
var ButtonToolbar = require('../../cjs/ButtonToolbar');
var Carousel = require('../../cjs/Carousel');
var CarouselItem = require('../../cjs/CarouselItem');
var Col = require('../../cjs/Col');
var DropdownButton = require('../../cjs/DropdownButton');
var Glyphicon = require('../../cjs/Glyphicon');
var Grid = require('../../cjs/Grid');
var Input = require('../../cjs/Input');
var Jumbotron = require('../../cjs/Jumbotron');
var Label = require('../../cjs/Label');
var ListGroup = require('../../cjs/ListGroup');
var ListGroupItem = require('../../cjs/ListGroupItem');
var Nav = require('../../cjs/Nav');
var Navbar = require('../../cjs/Navbar');
var NavItem = require('../../cjs/NavItem');
var MenuItem = require('../../cjs/MenuItem');
var Modal = require('../../cjs/Modal');
var ModalTrigger = require('../../cjs/ModalTrigger');
var OverlayTrigger = require('../../cjs/OverlayTrigger');
var OverlayMixin = require('../../cjs/OverlayMixin');
var PageHeader = require('../../cjs/PageHeader');
var PageItem = require('../../cjs/PageItem');
var Pager = require('../../cjs/Pager');
var Panel = require('../../cjs/Panel');
var PanelGroup = require('../../cjs/PanelGroup');
var Popover = require('../../cjs/Popover');
var ProgressBar = require('../../cjs/ProgressBar');
var Row = require('../../cjs/Row');
var SplitButton = require('../../cjs/SplitButton');
var TabbedArea = require('../../cjs/TabbedArea');
var Table = require('../../cjs/Table');
var TabPane = require('../../cjs/TabPane');
var Tooltip = require('../../cjs/Tooltip');
var Well = require('../../cjs/Well');
var Accordion = require('../../lib/Accordion');
var Alert = require('../../lib/Alert');
var Badge = require('../../lib/Badge');
var Button = require('../../lib/Button');
var ButtonGroup = require('../../lib/ButtonGroup');
var ButtonToolbar = require('../../lib/ButtonToolbar');
var Carousel = require('../../lib/Carousel');
var CarouselItem = require('../../lib/CarouselItem');
var Col = require('../../lib/Col');
var DropdownButton = require('../../lib/DropdownButton');
var Glyphicon = require('../../lib/Glyphicon');
var Grid = require('../../lib/Grid');
var Input = require('../../lib/Input');
var Jumbotron = require('../../lib/Jumbotron');
var Label = require('../../lib/Label');
var ListGroup = require('../../lib/ListGroup');
var ListGroupItem = require('../../lib/ListGroupItem');
var Nav = require('../../lib/Nav');
var Navbar = require('../../lib/Navbar');
var NavItem = require('../../lib/NavItem');
var MenuItem = require('../../lib/MenuItem');
var Modal = require('../../lib/Modal');
var ModalTrigger = require('../../lib/ModalTrigger');
var OverlayTrigger = require('../../lib/OverlayTrigger');
var OverlayMixin = require('../../lib/OverlayMixin');
var PageHeader = require('../../lib/PageHeader');
var PageItem = require('../../lib/PageItem');
var Pager = require('../../lib/Pager');
var Panel = require('../../lib/Panel');
var PanelGroup = require('../../lib/PanelGroup');
var Popover = require('../../lib/Popover');
var ProgressBar = require('../../lib/ProgressBar');
var Row = require('../../lib/Row');
var SplitButton = require('../../lib/SplitButton');
var TabbedArea = require('../../lib/TabbedArea');
var Table = require('../../lib/Table');
var TabPane = require('../../lib/TabPane');
var Tooltip = require('../../lib/Tooltip');
var Well = require('../../lib/Well');

var IS_MOBILE = typeof navigator !== 'undefined' && (
navigator.userAgent.match(/Android/i)
Expand Down
32 changes: 16 additions & 16 deletions ie8/src.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/** @jsx React.DOM */
var React = require('react');
var Button = require('../cjs/Button');
var DropdownButton = require('../cjs/DropdownButton');
var MenuItem = require('../cjs/MenuItem');
var Accordion = require('../cjs/Accordion');
var Panel = require('../cjs/Panel');
var ButtonToolbar = require('../cjs/ButtonToolbar');
var OverlayTrigger = require('../cjs/OverlayTrigger');
var Tooltip = require('../cjs/Tooltip');
var Alert = require('../cjs/Alert');
var TabbedArea = require('../cjs/TabbedArea');
var TabPane = require('../cjs/TabPane');
var Modal = require('../cjs/Modal');
var OverlayMixin = require('../cjs/OverlayMixin');
var Popover = require('../cjs/Popover');
var Carousel = require('../cjs/Carousel');
var CarouselItem = require('../cjs/CarouselItem');
var Button = require('../lib/Button');
var DropdownButton = require('../lib/DropdownButton');
var MenuItem = require('../lib/MenuItem');
var Accordion = require('../lib/Accordion');
var Panel = require('../lib/Panel');
var ButtonToolbar = require('../lib/ButtonToolbar');
var OverlayTrigger = require('../lib/OverlayTrigger');
var Tooltip = require('../lib/Tooltip');
var Alert = require('../lib/Alert');
var TabbedArea = require('../lib/TabbedArea');
var TabPane = require('../lib/TabPane');
var Modal = require('../lib/Modal');
var OverlayMixin = require('../lib/OverlayMixin');
var Popover = require('../lib/Popover');
var Carousel = require('../lib/Carousel');
var CarouselItem = require('../lib/CarouselItem');

var dropdownInstance = (
<DropdownButton title="Dropdown">
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
"scripts": {
"build": "./node_modules/.bin/grunt build",
"test-watch": "./node_modules/.bin/grunt watch 2>&1 >/dev/null & ./node_modules/karma/bin/karma start karma.dev.js",
"test": "./node_modules/.bin/grunt build && ./node_modules/karma/bin/karma start karma.ci.js"
"test": "./node_modules/.bin/grunt build && ./node_modules/karma/bin/karma start karma.ci.js",
"prepublish": "./node_modules/.bin/grunt build"
},
"main": "lib/main.js",
"directories": {
"lib": "lib/"
},
"keywords": [
"react",
Expand Down
4 changes: 2 additions & 2 deletions test/AlertSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var React = require('react');
var ReactTestUtils = require('react/lib/ReactTestUtils');
var Alert = require('../cjs/Alert');
var Alert = require('../lib/Alert');

describe('Alert', function () {
it('Should output a alert with message', function () {
Expand Down Expand Up @@ -73,4 +73,4 @@ describe('Alert', function () {
);
assert.ok(instance.getDOMNode().className.match(/\balert-danger\b/));
});
});
});
2 changes: 1 addition & 1 deletion test/BadgeSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var React = require('react');
var ReactTestUtils = require('react/lib/ReactTestUtils');
var Badge = require('../cjs/Badge');
var Badge = require('../lib/Badge');

describe('Badge', function () {
it('Should output a badge with content', function () {
Expand Down
4 changes: 2 additions & 2 deletions test/BootstrapMixinSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var React = require('react');
var ReactTestUtils = require('react/lib/ReactTestUtils');
var BootstrapMixin = require('../cjs/BootstrapMixin');
var BootstrapMixin = require('../lib/BootstrapMixin');

var Component;

Expand Down Expand Up @@ -189,4 +189,4 @@ describe('BootstrapMixin', function () {
assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-xs': true});
});
});
});
});
6 changes: 3 additions & 3 deletions test/ButtonGroupSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

var React = require('react');
var ReactTestUtils = require('react/lib/ReactTestUtils');
var ButtonGroup = require('../cjs/ButtonGroup');
var Button = require('../cjs/Button');
var ButtonGroup = require('../lib/ButtonGroup');
var Button = require('../lib/Button');

describe('ButtonGroup', function () {
it('Should output a button group', function () {
Expand Down Expand Up @@ -50,4 +50,4 @@ describe('ButtonGroup', function () {
);
assert.ok(instance.getDOMNode().className.match(/\bbtn-group-justified\b/));
});
});
});
2 changes: 1 addition & 1 deletion test/ButtonSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var React = require('react');
var ReactTestUtils = require('react/lib/ReactTestUtils');
var Button = require('../cjs/Button');
var Button = require('../lib/Button');

describe('Button', function () {
it('Should output a button', function () {
Expand Down
8 changes: 4 additions & 4 deletions test/ButtonToolbarSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var React = require('react');
var ReactTestUtils = require('react/lib/ReactTestUtils');
var ButtonToolbar = require('../cjs/ButtonToolbar');
var ButtonGroup = require('../cjs/ButtonGroup');
var Button = require('../cjs/Button');
var ButtonToolbar = require('../lib/ButtonToolbar');
var ButtonGroup = require('../lib/ButtonGroup');
var Button = require('../lib/Button');

describe('ButtonToolbar', function () {
it('Should output a button toolbar', function () {
Expand All @@ -21,4 +21,4 @@ describe('ButtonToolbar', function () {
assert.ok(instance.getDOMNode().className.match(/\bbtn-toolbar\b/));
assert.equal(instance.getDOMNode().getAttribute('role'), 'toolbar');
});
});
});
6 changes: 3 additions & 3 deletions test/CarouselSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

var React = require('react');
var ReactTestUtils = require('react/lib/ReactTestUtils');
var Carousel = require('../cjs/Carousel');
var CarouselItem = require('../cjs/CarouselItem');
var Carousel = require('../lib/Carousel');
var CarouselItem = require('../lib/CarouselItem');

describe('Carousel', function () {
it('Should show the correct item', function () {
Expand Down Expand Up @@ -73,4 +73,4 @@ describe('Carousel', function () {
)[0]
);
});
});
});
2 changes: 1 addition & 1 deletion test/CustomPropTypesSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var React = require('react');
var ReactTestUtils = require('react/lib/ReactTestUtils');
var CustomPropTypes = require('../cjs/utils/CustomPropTypes');
var CustomPropTypes = require('../lib/utils/CustomPropTypes');

describe('CustomPropTypes', function () {

Expand Down
10 changes: 5 additions & 5 deletions test/DropdownButtonSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

var React = require('react');
var ReactTestUtils = require('react/lib/ReactTestUtils');
var DropdownButton = require('../cjs/DropdownButton');
var MenuItem = require('../cjs/MenuItem');
var DropdownMenu = require('../cjs/DropdownMenu');
var Button = require('../cjs/Button');
var DropdownButton = require('../lib/DropdownButton');
var MenuItem = require('../lib/MenuItem');
var DropdownMenu = require('../lib/DropdownMenu');
var Button = require('../lib/Button');

describe('DropdownButton', function () {
var instance;
Expand Down Expand Up @@ -203,4 +203,4 @@ describe('DropdownButton', function () {
var carets = button.getElementsByClassName('caret');
assert.equal(carets.length, 0);
});
});
});
6 changes: 3 additions & 3 deletions test/DropdownMenuSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

var React = require('react');
var ReactTestUtils = require('react/lib/ReactTestUtils');
var DropdownMenu = require('../cjs/DropdownMenu');
var MenuItem = require('../cjs/MenuItem');
var DropdownMenu = require('../lib/DropdownMenu');
var MenuItem = require('../lib/MenuItem');

describe('DropdownMenu', function () {
it('Should render menu correctly', function () {
Expand Down Expand Up @@ -100,4 +100,4 @@ describe('DropdownMenu', function () {
ReactTestUtils.findRenderedDOMComponentWithTag(menuItems[1], 'a').getDOMNode()
.dispatchEvent(evt);
});
});
});
Loading

0 comments on commit 0193046

Please sign in to comment.