Skip to content

Commit 9b6bbf9

Browse files
committed
re-organizing layout and updating for npm publish:
before publishing to npm, the jsx-transform needs to be ran.
1 parent af1215a commit 9b6bbf9

16 files changed

+42
-25
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_ignore/
2+
lib/
3+
node_modules/
4+
.DS_Store
5+
.npm-debug.log
6+
.project

.gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[submodule "dist"]
2-
path = dist
1+
[submodule "demo/www"]
2+
path = demo/www
33
url = [email protected]:skratchdot/react-bootstrap-multiselect.git
44
branch = gh-pages

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.git*
22
_ignore/
33
demo/
4+
src/
45
test/
56
www/
67
.DS_Store
8+
.gitignore
79
.npm-debug.log
810
.project
911
.travis.yml

demo/AppContent.js

-2
This file was deleted.

demo/less/demo.less

-2
This file was deleted.

demo/App.js demo/src/App.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var Grid = require('react-bootstrap').Grid;
55
var Row = require('react-bootstrap').Row;
66
var Col = require('react-bootstrap').Col;
77
var Header = require('./Header');
8-
var Multiselect = require('../index.js');
8+
var Multiselect = require('../../src/index.js');
99
var fileContent = require('./AppContent').content;
1010

1111
var App = React.createClass({

demo/src/AppContent.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/Header.js demo/src/Header.js

File renamed without changes.
File renamed without changes.

demo/src/less/demo.less

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import "../../../node_modules/bootstrap/less/bootstrap.less";
2+
@import "bootstrap-multiselect.less";

demo/www

Submodule www added at f26855a

dist

-1
This file was deleted.

gulpfile.js

+21-14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var less = require('gulp-less');
66
var rename = require("gulp-rename");
77
var uglify = require('gulp-uglify');
88
var connect = require('gulp-connect');
9+
var react = require('gulp-react');
910
var fs = require('fs');
1011
var wrap = require("gulp-wrap");
1112

@@ -15,7 +16,7 @@ gulp.task('bootstrap-dropdown', function () {
1516
gulp.src('./node_modules/bootstrap/js/dropdown.js')
1617
.pipe(wrap('var jQuery = require("jquery");\nexports.init = function () {\n<%= contents %>};'))
1718
.pipe(rename('bootstrap-dropdown.js'))
18-
.pipe(gulp.dest('.'))
19+
.pipe(gulp.dest('./src'))
1920
});
2021

2122
gulp.task('lint', function () {
@@ -25,7 +26,7 @@ gulp.task('lint', function () {
2526
//'--show-non-errors',
2627
'--config',
2728
'./.jshint',
28-
'./index.js ./demo/*.js'
29+
'./index.js ./demo/src/*.js'
2930
].join(' '),
3031
function (err, stdout, stderr) {
3132
if (stdout) {
@@ -34,15 +35,21 @@ gulp.task('lint', function () {
3435
});
3536
});
3637

38+
gulp.task('prepublish', function () {
39+
gulp.src('./src/index.js')
40+
.pipe(react())
41+
.pipe(gulp.dest('./lib'));
42+
});
43+
3744
gulp.task('fonts', function () {
3845
gulp.src('./node_modules/bootstrap/dist/fonts/*')
39-
.pipe(gulp.dest('./dist/fonts/'));
46+
.pipe(gulp.dest('./demo/www/fonts/'));
4047
});
4148

4249
gulp.task('app-content', function () {
43-
var content = fs.readFileSync('./demo/App.js', 'utf-8');
50+
var content = fs.readFileSync('./demo/src/App.js', 'utf-8');
4451
fs.writeFileSync(
45-
'./demo/AppContent.js',
52+
'./demo/src/AppContent.js',
4653
[
4754
'/* autogenerated by gulpfile.js */',
4855
'exports.content = ' + JSON.stringify(content) + ';'
@@ -53,44 +60,44 @@ gulp.task('app-content', function () {
5360

5461
gulp.task('demo', function () {
5562
var buildStyles = function (name) {
56-
gulp.src('./demo/less/' + name + '.less')
63+
gulp.src('./demo/src/less/' + name + '.less')
5764
.pipe(less())
5865
.pipe(rename(name + '.debug.css'))
59-
.pipe(gulp.dest('./dist/css/'))
66+
.pipe(gulp.dest('./demo/www/css/'))
6067
.pipe(cssmin())
6168
.pipe(rename(name + '.min.css'))
62-
.pipe(gulp.dest('./dist/css/'));
69+
.pipe(gulp.dest('./demo/www/css/'));
6370
};
6471
// styles
6572
buildStyles('demo');
6673
buildStyles('bootstrap-multiselect');
6774

6875
// scripts
69-
gulp.src('./demo/App.js')
76+
gulp.src('./demo/src/App.js')
7077
.pipe(browserify({
7178
debug: true,
7279
transform: ['reactify']
7380
}))
7481
.pipe(rename('demo.debug.js'))
75-
.pipe(gulp.dest('./dist/js/'))
82+
.pipe(gulp.dest('./demo/www/js/'))
7683
.pipe(uglify())
7784
.pipe(rename('demo.min.js'))
78-
.pipe(gulp.dest('./dist/js/'));
85+
.pipe(gulp.dest('./demo/www/js/'));
7986
});
8087

8188
gulp.task('server', function() {
8289
connect.server({
83-
root: './dist',
90+
root: './demo/www',
8491
livereload: true,
8592
port: 8080
8693
});
8794
});
8895

8996
gulp.task('watch', function () {
90-
gulp.watch(['./index.js','./demo/**/*.js'], ['build']);
97+
gulp.watch(['./index.js','./demo/src/**/*.js'], ['build']);
9198
});
9299

93-
gulp.task('build', ['lint', 'fonts', 'app-content', 'demo']);
100+
gulp.task('build', ['lint', 'fonts', 'app-content', 'demo', 'prepublish']);
94101
gulp.task('default', ['bootstrap-dropdown', 'build', 'server', 'watch']);
95102

96103
//handle errors

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "react-bootstrap-multiselect",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "A multiselect component for react (with bootstrap). This is a react port of: https://github.com/davidstutz/bootstrap-multiselect",
5-
"main": "index.js",
5+
"main": "./lib/index.js",
66
"scripts": {
7+
"prepublish": "gulp prepublish",
78
"test": "echo \"Error: no test specified\" && exit 1"
89
},
910
"author": "skratchdot",
@@ -20,7 +21,7 @@
2021
],
2122
"dependencies": {
2223
"jquery": "^2.1.1",
23-
"react": "^0.11.0"
24+
"react": ">=0.10.0"
2425
},
2526
"devDependencies": {
2627
"bootstrap": "^3.2.0",
@@ -30,6 +31,7 @@
3031
"gulp-cssmin": "^0.1.6",
3132
"gulp-less": "^1.3.2",
3233
"gulp-nodemon": "^1.0.4",
34+
"gulp-react": "^0.5.0",
3335
"gulp-rename": "^1.2.0",
3436
"gulp-uglify": "^0.3.1",
3537
"gulp-wrap": "^0.3.0",
File renamed without changes.

index.js src/index.js

File renamed without changes.

0 commit comments

Comments
 (0)