forked from Automattic/jetpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
82 lines (72 loc) · 2.13 KB
/
gulpfile.babel.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
/**
* External dependencies
*/
import gulp from 'gulp';
import log from 'fancy-log';
import { spawn } from 'child_process';
/**
* Internal dependencies
*/
import frontendcss from './tools/builder/frontend-css';
import admincss from './tools/builder/admin-css';
import { watch as react_watch, build as react_build } from './tools/builder/react';
import {
watch as sass_watch,
build as sass_build,
watchPackages as sass_watch_packages,
} from './tools/builder/sass';
gulp.task( 'old-styles:watch', function () {
return gulp.watch( 'scss/**/*.scss', gulp.parallel( 'old-styles' ) );
} );
gulp.task( 'blocks:watch', function () {
const child = require( 'child_process' ).execFile( 'yarn', [ 'build-extensions', '--watch' ] );
child.stdout.on( 'data', function ( data ) {
log( data.toString() );
} );
} );
gulp.task( 'search:watch', function () {
const child = require( 'child_process' ).execFile( 'yarn', [
'build-search:scripts',
'--watch',
] );
child.stdout.on( 'data', function ( data ) {
log( data.toString() );
} );
} );
gulp.task( 'php:module-headings', function ( callback ) {
const process = spawn( 'php', [ 'tools/build-module-headings-translations.php' ] );
process.stderr.on( 'data', function ( data ) {
log( data.toString() );
} );
process.stdout.on( 'data', function ( data ) {
log( data.toString() );
} );
process.on( 'exit', function ( code ) {
if ( 0 !== code ) {
log( 'Failed building module headings translations: process exited with code ', code );
}
callback();
} );
} );
gulp.task( 'old-styles', gulp.parallel( frontendcss, admincss, 'sass:old', 'sass:packages' ) );
// Default task
gulp.task(
'default',
gulp.series( gulp.parallel( react_build, 'old-styles', 'php:module-headings' ), sass_build )
);
gulp.task(
'watch',
gulp.parallel(
react_watch,
sass_watch,
sass_watch_packages,
'old-styles:watch',
'blocks:watch',
'search:watch'
)
);
// Keeping explicit task names to allow for individual runs
gulp.task( 'sass:build', sass_build );
gulp.task( 'react:build', react_build );
gulp.task( 'sass:watch', gulp.parallel( sass_watch, sass_watch_packages ) );
gulp.task( 'react:watch', react_watch );