Skip to content

Commit e0746f9

Browse files
committed
Merge pull request #11 from jkazama/topic/6
パッケージ管理を npm に統一 fix #6
2 parents c020fd3 + 47acfe3 commit e0746f9

File tree

18 files changed

+71
-71
lines changed

18 files changed

+71
-71
lines changed

bower.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

gulpfile.babel.js

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ const paths = {
1818
css: `${root.dist}/css`,
1919
font: `${root.dist}/fonts`
2020
},
21-
bower: {
22-
component: `${__dirname}/bower_components`,
23-
file: `${__dirname}/bower.json`
21+
node: {
22+
modules: `${__dirname}/node_modules`
2423
}
2524
}
2625
const resource = {
@@ -32,16 +31,21 @@ const resource = {
3231
},
3332
sass: `${paths.src.css}/**/*.s+(a|c)ss`,
3433
static: `${paths.src.static}/**/*`,
35-
font: `${paths.bower.component}/fontawesome/fonts/**/*`
34+
},
35+
vendor: {
36+
js: {
37+
jquery: `${paths.node.modules}/jquery/dist/jquery.js`,
38+
bootstrap: `${paths.node.modules}/bootstrap-sass/assets/javascripts/bootstrap.js`,
39+
eventemitter: `${paths.node.modules}/wolfy87-eventemitter/EventEmitter.js`
40+
},
41+
fontawesome: `${paths.node.modules}/font-awesome/fonts/**/*`,
3642
}
3743
}
3844

3945
import gulp from 'gulp'
4046
import gulpLoaderPlugins from 'gulp-load-plugins'
4147
import del from 'del'
4248
import path from 'path'
43-
import bower from 'bower'
44-
import bowerFiles from 'main-bower-files'
4549
import webpack from 'webpack'
4650
import webpackStream from 'webpack-stream'
4751
import runSequence from 'run-sequence'
@@ -58,7 +62,7 @@ gulp.task('default', ['build', 'server'])
5862

5963
//## build for developer
6064
gulp.task('build', (callback) =>
61-
runSequence('clean', 'bower', ['build:jade', 'build:sass', 'build:webpack', 'build:static'], callback)
65+
runSequence('clean', ['build:jade', 'build:sass', 'build:webpack', 'build:static'], callback)
6266
)
6367

6468
//## build production
@@ -79,34 +83,10 @@ gulp.task('revision', (callback) =>
7983
runSequence('revision:clean', 'revision:append', 'clean', 'revision:copy', 'revision:clean', callback)
8084
)
8185

82-
// build Vendor UI Library (bower.json) [Load/Concat]
83-
gulp.task('bower', () => {
84-
bower.commands.install().on('end', () => {
85-
const filterCss = ['**/bootstrap-datepicker3.css']
86-
gulp.src(bowerFiles({filter: filterCss}))
87-
.pipe($.concat('vendor.css'))
88-
.pipe($.pleeease())
89-
.pipe(gulp.dest(paths.dist.css))
90-
gulp.src(resource.src.font) // for font-awesome
91-
.pipe(gulp.dest(paths.dist.font))
92-
const filterJs = (file) => { // for bootstrap-sass-official
93-
return /.*\.js/.test(file) && ($.slash(file).indexOf('/bootstrap/') == -1)
94-
}
95-
const appendJs = path.join(paths.bower.component, 'react/react-dom.js')
96-
gulp.src(bowerFiles({filter: filterJs}).concat(appendJs))
97-
.pipe($.concat('vendor.js'))
98-
.pipe($.if(production, $.uglify()))
99-
.pipe(gulp.dest(paths.dist.js))
100-
})
101-
})
102-
10386
// compile Webpack [ ES6(Babel) / Vue -> SPA(main.js) ]
10487
gulp.task('build:webpack', () => {
10588
process.env.NODE_ENV = (production == true) ? 'production' : 'development'
106-
let plugins = [
107-
new webpack.ResolverPlugin(new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main'])),
108-
new webpack.optimize.DedupePlugin()
109-
]
89+
let plugins = [ new webpack.optimize.DedupePlugin() ]
11090
if (production) plugins.push(new webpack.optimize.UglifyJsPlugin({compress: { warnings: false }}))
11191
gulp.src([resource.src.webpack.babel, resource.src.webpack.vue])
11292
.pipe($.plumber())
@@ -120,7 +100,7 @@ gulp.task('build:webpack', () => {
120100
]
121101
},
122102
resolve: {
123-
modulesDirectories: ['node_modules', 'bower_components', paths.src.js],
103+
modulesDirectories: ['node_modules', paths.src.js],
124104
extensions: ['', '.js', ".jsx", ".jade"]
125105
},
126106
plugins: plugins
@@ -141,13 +121,9 @@ gulp.task('build:jade', () => {
141121
})
142122

143123
// compile Sass -> CSS
144-
// check https://github.com/sasstools/sass-lint/pull/168
145124
gulp.task('build:sass', () => {
146125
gulp.src(resource.src.sass)
147126
.pipe($.plumber())
148-
// .pipe($.sassLint())
149-
// .pipe($.sassLint.format())
150-
// .pipe($.sassLint.failOnError())
151127
.pipe($.sass())
152128
.pipe($.concat('style.css'))
153129
.pipe($.pleeease())
@@ -157,6 +133,13 @@ gulp.task('build:sass', () => {
157133

158134
// copy Static Resource
159135
gulp.task('build:static', () => {
136+
const libs = resource.vendor.js
137+
gulp.src(Object.keys(libs).map((key) => libs[key]))
138+
.pipe($.concat("vendor.js"))
139+
.pipe($.if(production, $.uglify()))
140+
.pipe(gulp.dest(paths.dist.js))
141+
gulp.src(resource.vendor.fontawesome)
142+
.pipe(gulp.dest(paths.dist.font))
160143
gulp.src(resource.src.static)
161144
.pipe(gulp.dest(paths.dist.root))
162145
})
@@ -168,7 +151,6 @@ gulp.task('server', () => {
168151
notify: false
169152
})
170153
// watch for source
171-
gulp.watch(paths.bower.file, ['bower'])
172154
gulp.watch(resource.src.jade, ['build:jade'])
173155
gulp.watch(resource.src.sass, ['build:sass'])
174156
gulp.watch(resource.src.static, ['build:static'])

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"gulp-jade": "~1.1.0",
3030
"gulp-htmlhint": "~0.3.0",
3131
"gulp-sass": "~2.1.1",
32-
"gulp-sass-lint": "~1.1.0",
3332
"gulp-pleeease": "~2.0.2",
3433
"gulp-uglify": "~1.5.1",
3534
"gulp-rev-all": "~0.8.22",
@@ -48,12 +47,21 @@
4847
"babel-preset-es2015 ": "~6.6.0",
4948
"babel-preset-react ": "~6.5.0",
5049
"react-jade": "^2.5.0",
51-
"react": "^0.14.7",
5250
"browser-sync": "~2.11.0"
5351
},
5452
"dependencies": {
5553
"co": "~4.6.0",
5654
"superagent": "~1.7.2",
57-
"react-mixin": "~3.0.3"
55+
"react": "~0.14.7",
56+
"react-dom": "~0.14.7",
57+
"react-router": "~0.13.5",
58+
"react-mixin": "~3.0.3",
59+
"wolfy87-eventemitter": "~4.3.0",
60+
"flux": "~2.1.1",
61+
"lodash": "~4.6.0",
62+
"dateformat": "~1.0.12",
63+
"jquery": "~2.2.1",
64+
"bootstrap-sass": "~3.3.6",
65+
"font-awesome": "~4.5.0"
5866
}
5967
}

source/css/bootstrap.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ $panel-body-padding: .6em;
1414
$panel-heading-padding: .4em .6em;
1515
$panel-default-text: #666;
1616

17-
@import "../../bower_components/bootstrap-sass-official/assets/stylesheets/_bootstrap-sprockets";
18-
@import "../../bower_components/bootstrap-sass-official/assets/stylesheets/_bootstrap";
17+
@import "../../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap";
1918

2019
// ### basic ###
2120

source/css/fontawesome.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// FontAwesomeのscss拡張サポート
44
//----------------------------------
55

6-
@import '../../bower_components/fontawesome/scss/font-awesome';
6+
@import '../../node_modules/font-awesome/scss/font-awesome';

source/js/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
// React Router
2-
let RouteHandler = ReactRouter.RouteHandler
1+
import React from "react"
2+
import Router from "react-router"
33

44
import {Component} from "platform/react"
55
import Header from "components/header"
66

7+
const RouteHandler = Router.RouteHandler
8+
79
export default class App extends Component {
810
render() {
911
return(

source/js/components/asset.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import React from "react"
2+
13
import {Component} from "platform/react"
24
import {Message, Text, Label} from "platform/react-ui"
35
import {CashInOuts} from "stores/asset"
46
import ActionTypes from "constants/asset"
57
import ActionCreators from "actions/asset"
68

7-
const Link = ReactRouter.Link
9+
const Link = Component.routerLink()
810

911
// parent
1012
export default class Asset extends Component {

source/js/components/header.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
// Header
1+
import React from "react"
2+
23
import {Log} from "platform/plain"
34
import {Component} from "platform/react"
45
import {Logins} from "stores/master"
56
import ActionTypes from "constants/master"
67
import ActionCreators from "actions/master"
78

8-
const Link = ReactRouter.Link
9+
const Link = Component.routerLink()
910

1011
export default class Header extends Component {
1112
initialize() {

source/js/components/login.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from "react"
2+
13
import {Component} from "platform/react"
24
import {Message, Text} from "platform/react-ui"
35
import {Logins} from "stores/master"

source/js/components/timeout.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import React from "react"
2+
13
import {Component} from "platform/react"
24

5+
const Link = Component.routerLink()
6+
37
export default class Timeout extends Component {
48
render() {
5-
const Link = ReactRouter.Link
69
return (
710
<div className="col-xs-6 col-xs-offset-3">
811
<div className="panel panel-default">

0 commit comments

Comments
 (0)