-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
151 lines (141 loc) · 4.67 KB
/
index.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
module.exports = function( gulp ) {
var fs = require( 'fs' )
, merge = require( 'merge' )
, package = require( process.cwd() + '/package.json' )
, argv = require( 'yargs' ).argv
, config
;
config = {
_package: package,
build: {
custom: [],
},
docs: {
package: package.name,
src: './docs/',
},
package_name: 'LifterLMS', // This is confusing?
pot: {
bugReport: 'https://lifterlms.com/my-account/my-tickets',
domain: package.name,
dest: 'i18n/',
js: true,
jsClassname: 'LLMS_l10n',
jsFilename: 'class-llms-l10n.php',
jsSince: '1.0.0',
jsSrc: [],
lastTranslator: 'Team LifterLMS <[email protected]>',
team: 'Team LifterLMS <[email protected]>',
package: package.name,
phpSrc: [ './*.php', './**/*.php', '!vendor/**', '!tmp/**', '!tests/**' ],
},
publish: {
github: {
branch: 'trunk',
org: 'gocodebox',
repo: package.name,
url: package.repository.url,
},
img: 'https://cdn2.lifterlms.com/brand-assets/lifterlms-logo-alt_color-on-ffffff.png',
slug: package.name,
slack: {
channel: '#general',
},
svn: {
base: 'http://svn.wp-plugins.org/',
slug: package.name,
},
lifterlms: {
make: {
cats: [ 5 ],
tags: [],
},
pot: true,
slug: package.name,
},
privacy: 'private',
title: package.name,
},
scripts: {
// Whether or not to build a ".dist" version (useful when using includes).
dist: false,
dest: 'assets/js/',
// Define the settings passed to `gulp-include`.
include: {
includePaths: [
// look for includes in the lib-tasks node_modules directory.
__dirname + '/node_modules',
// look for includes in the project node_modules directory.
process.cwd() + '/node_modules',
],
extra: [],
},
src: [ 'assets/js/**/*.js', '!assets/js/**/*.min.js', '!assets/js/**/*.js.map' ],
watch: [ 'assets/js/**/*.js', '!assets/js/**/*.min.js', '!assets/js/**/*.js.map' ],
},
styles: {
autoprefixer: 'last 2 versions',
dest: 'assets/css/',
src: [ 'assets/scss/**/*.scss', '!assets/scss/**/_*.scss' ],
watch: [ 'assets/scss/**/*.scss' ],
},
slush: {
includes_dir: './includes/',
package_main: package.name,
shortname: '',
},
versioner: {
custom: [],
main: [ package.name + '.php', 'class-' + package.name + '.php' ],
scripts: true,
src: [ './*.php', './inc/**/*.php', './includes/**/*.php', './templates/**/*.php', './tests/**/*.php' ],
},
watch: {
custom: [],
},
zip: {
composer: false,
dest: 'dist/',
name: package.name,
src: {
// Default glob.
default: [
'./**/*.*',
'!./assets/scss/**',
'!./deploy/**', '!./dist/**', '!./tmp/**', '!./gulpfile.js/**', '!./gulpfile.js/**/*.*', '!./node_modules/**', '!./tests/**',
'!./**/*.yml',
'!./**/composer.json', '!./**/composer.lock',
'!./**/package.json', '!./**/package-lock.json',
'!./*.xml', '!./*.xml.dist',
'!./README.md',
],
// Add extra files to the glob, useful when wanting to add something withouth having to overwrite the entire default.
custom: [],
},
}
};
if ( fs.existsSync( './.llmsconfig' ) ) {
var file = JSON.parse( fs.readFileSync( './.llmsconfig', 'utf8' ) );
config = merge.recursive( config, file );
}
if ( ! config.pot.jsSrc.length ) {
config.pot.jsSrc = config.scripts.src;
}
// add defaults for distribution suffixes.
if ( false !== config.scripts.dist ) {
// if "true" use default ".dist".
config.scripts.dist = true === config.scripts.dist ? '.dist' : config.scripts.dist;
// ignore the dist versions for building and watching.
config.scripts.src.push( '!assets/js/**/*' + config.scripts.dist + '.js' );
config.scripts.watch.push( '!assets/js/**/*' + config.scripts.dist + '.js' );
}
require( __dirname + '/tasks/pot-php' )( gulp, config, argv );
require( __dirname + '/tasks/pot-js' )( gulp, config, argv );
require( __dirname + '/tasks/pot' )( gulp, config, argv );
require( __dirname + '/tasks/scripts' )( gulp, config, argv );
require( __dirname + '/tasks/styles' )( gulp, config, argv );
require( __dirname + '/tasks/styles-rtl' )( gulp, config, argv );
require( __dirname + '/tasks/textdomain' )( gulp, config, argv );
require( __dirname + '/tasks/watch' )( gulp, config, argv );
require( __dirname + '/tasks/build' )( gulp, config, argv );
};