-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
211 lines (192 loc) · 6.08 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
let fsx = require('fs-extra');
let gulp = require('gulp');
let sass = require('gulp-sass');//CSSコンパイラ
let plumber = require("gulp-plumber");//コンパイルエラーが起きても watch を抜けないようになる
let concat = require('gulp-concat');//ファイルの結合ツール
let rename = require("gulp-rename");//ファイル名の置き換えを行う
let browserify = require("gulp-browserify");//NodeJSのコードをブラウザ向けコードに変換
let webpack = require('webpack');
let webpackStream = require('webpack-stream');
let packageJson = require(__dirname+'/package.json');
// client-libs (frontend) を処理
gulp.task("client-libs:broccoli-html-editor", function() {
return gulp.src(["node_modules/broccoli-html-editor/client/dist/**/*"])
.pipe(gulp.dest( './app/common/broccoli-html-editor/client/dist/' ))
;
});
gulp.task("client-libs:broccoli-field-table", function() {
return gulp.src(["node_modules/broccoli-field-table/dist/**/*"])
.pipe(gulp.dest( './app/common/broccoli-field-table/dist/' ))
;
});
gulp.task("client-libs:pickles2-contents-editor", function() {
return gulp.src(["node_modules/pickles2-contents-editor/dist/**/*"])
.pipe(gulp.dest( './app/common/pickles2-contents-editor/dist/' ))
;
});
gulp.task("client-libs:pickles2-module-editor", function() {
return gulp.src(["node_modules/pickles2-module-editor/dist/**/*"])
.pipe(gulp.dest( './app/common/pickles2-module-editor/dist/' ))
;
});
gulp.task("client-libs:px2style", function() {
return gulp.src(["node_modules/px2style/dist/**/*"])
.pipe(gulp.dest( './app/common/px2style/dist/' ))
;
});
gulp.task("client-libs:cmd-queue", function() {
return gulp.src(["node_modules/cmd-queue/dist/**/*"])
.pipe(gulp.dest( './app/common/cmd-queue/dist/' ))
;
});
gulp.task("client-libs:remote-finder", function() {
return gulp.src(["node_modules/remote-finder/dist/**/*"])
.pipe(gulp.dest( './app/common/remote-finder/dist/' ))
;
});
gulp.task("client-libs:gitui79.js", function() {
return gulp.src(["submodules/gitui79.js/dist/**/*"])
.pipe(gulp.dest( './app/common/gitui79/dist/' ))
;
});
gulp.task("client-libs:node-git-parser", function() {
return gulp.src(["submodules/node-git-parser/dist/**/*"])
.pipe(gulp.dest( './app/common/gitparse79/dist/' ))
;
});
gulp.task("client-libs:pickles2-code-search", function() {
return gulp.src(["submodules/pickles2-code-search/dist/**/*"])
.pipe(gulp.dest( './app/common/pickles2-code-search/dist/' ))
;
});
gulp.task("client-libs:ace-builds", function() {
return gulp.src(["submodules/ace-builds/src-noconflict/**/*"])
.pipe(gulp.dest( './app/common/ace-builds/src-noconflict/' ))
;
});
// src 中の *.html を処理
gulp.task('.html', function(){
return gulp.src(["src/**/*.html","!src/**/*.ignore*","!src/**/*.ignore*/*"])
.pipe(plumber())
.pipe(gulp.dest( './app/' ))
;
});
// src 中の *.js を処理
gulp.task('.js', function(){
return gulp.src(["src/**/*.js","!src/**/*.ignore*","!src/**/*.ignore*/*","!src/**/*.webpack.js"])
.pipe(plumber())
.pipe(browserify({}))
.pipe(gulp.dest( './app/' ))
;
});
// Webpack: common/styles/contents.js を処理
gulp.task("webpack:common/styles/contents.js", function() {
return webpackStream({
mode: 'production',
entry: "./src/common/styles/contents.webpack.js",
output: {
filename: "contents.js"
},
module:{
rules:[
{
test:/\.html$/,
use:['html-loader']
},
{
test: /\.(jpg|png)$/,
use: ['url-loader']
}
]
}
}, webpack)
.pipe(plumber())
.pipe(gulp.dest( './app/common/styles/' ))
.pipe(concat('contents.js'))
;
});
// Webpack: home を処理
gulp.task("webpack:home", function() {
return webpackStream({
mode: 'production',
entry: "./src/fncs/home/index_files/app.webpack.js",
output: {
filename: "app.js"
},
module:{
rules:[
{
test:/\.html$/,
use:['html-loader']
},
{
test: /\.(jpg|png)$/,
use: ['url-loader']
}
]
}
}, webpack)
.pipe(plumber())
.pipe(gulp.dest( './app/fncs/home/index_files/' ))
.pipe(concat('app.js'))
;
});
// src 中の *.css.scss を処理
gulp.task('.css.scss', function(){
return gulp.src(["src/**/*.css.scss","!src/**/*.ignore*","!src/**/*.ignore*/*"])
.pipe(plumber())
.pipe(sass())
.pipe(rename({extname: ''}))
.pipe(gulp.dest( './app/' ))
;
});
// src 中の *.css を処理
gulp.task('.css', function(){
return gulp.src(["src/**/*.css","!src/**/*.ignore*","!src/**/*.ignore*/*"])
.pipe(plumber())
.pipe(gulp.dest( './app/' ))
;
});
// 【暫定対応】
gulp.task("provisional", function(callback) {
// nw-builderがビルドに失敗するようになったので
// 暫定的に、ビルドが通っていたときのライブラリのバックアップから復元する。
// gulp.src(["_libs/**/*"])
// .pipe(gulp.dest( './node_modules/' ))
// ;
// Windows版ビルドが正常起動しなくなったため追加。
// broccoli-html-editor に導入した sass のディレクトリ階層が深すぎたのが原因か?
// fsx.removeSync(__dirname+'/node_modules/broccoli-html-editor/submodules/');
// fsx.removeSync(__dirname+'/node_modules/broccoli-html-editor/tests/');
// fsx.removeSync(__dirname+'/node_modules/broccoli-field-table/submodules/');
// fsx.removeSync(__dirname+'/node_modules/broccoli-field-table/tests/');
// fsx.removeSync(__dirname+'/node_modules/broccoli-html-editor/node_modules/node-sass/');
callback();
return;
});
let _tasks = gulp.parallel(
'provisional',
"client-libs:broccoli-html-editor",
"client-libs:broccoli-field-table",
"client-libs:pickles2-contents-editor",
"client-libs:pickles2-module-editor",
"client-libs:px2style",
"client-libs:cmd-queue",
"client-libs:remote-finder",
"client-libs:gitui79.js",
"client-libs:node-git-parser",
"client-libs:pickles2-code-search",
"client-libs:ace-builds",
'.html',
'.js',
'webpack:common/styles/contents.js',
'webpack:home',
'.css',
'.css.scss'
);
// src 中のすべての拡張子を監視して処理
gulp.task("watch", function() {
return gulp.watch(["src/**/*"], _tasks);
});
// src 中のすべての拡張子を処理(default)
gulp.task("default", _tasks);