@videinfra/static-website-builder 2.0.0-beta.2 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +11 -0
- package/README.md +2 -2
- package/bin/builder.js +17 -11
- package/eslint.config.js +39 -0
- package/gulpfile.js +63 -0
- package/init/default/config/config.js +18 -15
- package/init/default/src/html/data/global.js +1 -1
- package/init/default/src/javascripts/_entries.js +1 -1
- package/init/index.js +44 -37
- package/init/test/config/config.js +20 -16
- package/init/test/src/html/data/global.js +1 -1
- package/lib/camelize-file-name.js +1 -1
- package/lib/generate-gulp-tasks.js +12 -10
- package/lib/get-config.js +99 -52
- package/lib/get-file-names.js +3 -3
- package/lib/get-path.js +15 -22
- package/lib/globs-helper.js +22 -47
- package/lib/gulp/dynamic-task.js +1 -1
- package/lib/gulp/resolve-dynamic-task.js +1 -1
- package/lib/gulp/task-before-dest.js +2 -2
- package/lib/gulp/task-end.js +5 -5
- package/lib/gulp/task-start.js +3 -3
- package/lib/gulp/task-watch.js +10 -10
- package/lib/init/copy-folder.js +4 -4
- package/lib/init/folder-exists.js +2 -2
- package/lib/init/get-folder-list.js +3 -3
- package/lib/init/merge-package.js +8 -8
- package/lib/init/read-package.js +2 -2
- package/lib/log-error.js +3 -3
- package/lib/merge.js +3 -3
- package/lib/run-preprocess.js +2 -2
- package/lib/task-order.js +7 -13
- package/package.json +6 -4
- package/plugins/example/preprocess-config.js +1 -1
- package/plugins/example/task.js +13 -13
- package/plugins/example.js +8 -6
- package/plugins/sass-engine/preprocess-config.js +15 -19
- package/plugins/sass.js +5 -3
- package/plugins/twig/lodash-filters/filters.js +12 -10
- package/plugins/twig/lodash-filters.js +3 -3
- package/plugins/twig/symfony-filters/filters.js +18 -14
- package/plugins/twig/symfony-filters/preposition_nbsp.js +1 -1
- package/plugins/twig/symfony-filters.js +6 -6
- package/plugins/twig/symfony-functions/functions.js +2 -2
- package/plugins/twig/symfony-functions.js +6 -6
- package/plugins/twig-engine/preprocess-config.js +8 -8
- package/plugins/twig.js +11 -6
- package/tasks/browser-sync/config.js +9 -6
- package/tasks/browser-sync/preprocess-config.js +5 -7
- package/tasks/browser-sync/task.js +5 -5
- package/tasks/clean/config.js +8 -5
- package/tasks/clean/preprocess-config.js +5 -5
- package/tasks/clean/task.js +5 -5
- package/tasks/data/config.js +11 -13
- package/tasks/data/data-loader-js.js +11 -2
- package/tasks/data/data-loader-json.js +3 -3
- package/tasks/data/get-data.js +55 -52
- package/tasks/env/config.js +2 -2
- package/tasks/env/get-env.js +34 -19
- package/tasks/fonts/config.js +9 -10
- package/tasks/fonts/task.js +27 -27
- package/tasks/global/config.js +1 -1
- package/tasks/html/config.js +13 -15
- package/tasks/html/task.js +55 -54
- package/tasks/icons/config.js +17 -22
- package/tasks/icons/preprocess-config.js +4 -4
- package/tasks/icons/task.js +34 -35
- package/tasks/images/config.js +11 -14
- package/tasks/images/task.js +26 -26
- package/tasks/javascripts/config.js +12 -14
- package/tasks/javascripts/preprocess-config.js +45 -32
- package/tasks/javascripts/task.js +40 -43
- package/tasks/sitemap/config.js +12 -13
- package/tasks/sitemap/preprocess-config.js +2 -2
- package/tasks/sitemap/task.js +44 -38
- package/tasks/sizereport/config.js +5 -3
- package/tasks/sizereport/task.js +8 -8
- package/tasks/static/config.js +12 -15
- package/tasks/static/task.js +27 -28
- package/tasks/stylesheets/config.js +16 -19
- package/tasks/stylesheets/preprocess-config.js +5 -5
- package/tasks/stylesheets/task.js +28 -28
- package/tests/build/build.test.js +23 -22
- package/tests/camelize-file-name.test.js +1 -1
- package/tests/generate-gulp-tasks.test.js +11 -5
- package/tests/glob-helper.test.js +1 -1
- package/tests/merge.test.js +1 -1
- package/tests/preposition_nbsp.test.js +7 -6
- package/tests/run-preprocess.test.js +2 -1
- package/tests/sass-stringify.test.js +1 -1
- package/tests/sitemap.test.js +7 -6
- package/vendor/gulp-rolldown/index.js +24 -56
- package/vendor/gulp-rolldown/plugin-raw.js +17 -0
- package/vendor/gulp-rolldown/plugin-virtual-entry.js +30 -0
- package/vendor/gulp-sass/README.md +10 -19
- package/vendor/gulp-sass/index.js +129 -135
- package/vendor/gulp-sass/package.json +1 -0
- package/vendor/gulp-sass/sass-stringify.js +1 -1
- package/vendor/gulp-twig/index.js +32 -27
- package/vendor/gulp-twig/package.json +1 -0
- package/.eslintrc.js +0 -35
- package/gulpfile.js/index.js +0 -32
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// 2025-01-20, Kaspars Zuks: added "options.data" support for variables
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { Transform } from 'stream';
|
|
6
|
+
import picocolors from 'picocolors';
|
|
7
|
+
import PluginError from 'plugin-error';
|
|
8
|
+
import replaceExtension from 'replace-ext';
|
|
9
|
+
import stripAnsi from 'strip-ansi';
|
|
10
|
+
import clonedeep from 'lodash.clonedeep';
|
|
11
|
+
import applySourceMap from 'vinyl-sourcemaps-apply';
|
|
12
|
+
import sassStingify from './sass-stringify.js';
|
|
13
13
|
|
|
14
14
|
const PLUGIN_NAME = 'gulp-sass';
|
|
15
15
|
|
|
@@ -18,7 +18,9 @@ gulp-sass no longer has a default Sass compiler; please set one yourself.
|
|
|
18
18
|
Both the "sass" and "node-sass" packages are permitted.
|
|
19
19
|
For example, in your gulpfile:
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
import * as sass from 'sass';
|
|
22
|
+
import gulpSass from 'gulp-sass';
|
|
23
|
+
const instance = gulpSass(sass);
|
|
22
24
|
`;
|
|
23
25
|
|
|
24
26
|
const transfob = (transform) => new Transform({ transform, objectMode: true });
|
|
@@ -27,60 +29,56 @@ const transfob = (transform) => new Transform({ transform, objectMode: true });
|
|
|
27
29
|
* Handles returning the file to the stream
|
|
28
30
|
*/
|
|
29
31
|
const filePush = (file, sassObject, callback) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
? source
|
|
47
|
-
: path.join(sassFileSrcPath, source)
|
|
48
|
-
));
|
|
49
|
-
}
|
|
32
|
+
// Build Source Maps!
|
|
33
|
+
if (sassObject.map) {
|
|
34
|
+
// Transform map into JSON
|
|
35
|
+
const sassMap = JSON.parse(sassObject.map.toString());
|
|
36
|
+
// Grab the stdout and transform it into stdin
|
|
37
|
+
const sassMapFile = sassMap.file.replace(/^stdout$/, 'stdin');
|
|
38
|
+
// Grab the base filename that's being worked on
|
|
39
|
+
const sassFileSrc = file.relative;
|
|
40
|
+
// Grab the path portion of the file that's being worked on
|
|
41
|
+
const sassFileSrcPath = path.dirname(sassFileSrc);
|
|
42
|
+
|
|
43
|
+
if (sassFileSrcPath) {
|
|
44
|
+
const sourceFileIndex = sassMap.sources.indexOf(sassMapFile);
|
|
45
|
+
// Prepend the path to all files in the sources array except the file that's being worked on
|
|
46
|
+
sassMap.sources = sassMap.sources.map((source, index) => (index === sourceFileIndex ? source : path.join(sassFileSrcPath, source)));
|
|
47
|
+
}
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
// Remove 'stdin' from souces and replace with filenames!
|
|
50
|
+
sassMap.sources = sassMap.sources.filter((src) => src !== 'stdin' && src);
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
// Replace the map file with the original filename (but new extension)
|
|
53
|
+
sassMap.file = replaceExtension(sassFileSrc, '.css');
|
|
54
|
+
// Apply the map
|
|
55
|
+
applySourceMap(file, sassMap);
|
|
56
|
+
}
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
file.contents = sassObject.css;
|
|
59
|
+
file.path = replaceExtension(file.path, '.css');
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
if (file.stat) {
|
|
62
|
+
file.stat.atime = file.stat.mtime = file.stat.ctime = new Date();
|
|
63
|
+
}
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
callback(null, file);
|
|
68
66
|
};
|
|
69
67
|
|
|
70
68
|
/**
|
|
71
69
|
* Handles error message
|
|
72
70
|
*/
|
|
73
71
|
const handleError = (error, file, callback) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
const filePath = (error.file === 'stdin' ? file.path : error.file) || file.path;
|
|
73
|
+
const relativePath = path.relative(process.cwd(), filePath);
|
|
74
|
+
const message = `${picocolors.underline(relativePath)}\n${error.formatted}`;
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
error.messageFormatted = message;
|
|
77
|
+
error.messageOriginal = error.message;
|
|
78
|
+
error.message = stripAnsi(message);
|
|
79
|
+
error.relativePath = relativePath;
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
return callback(new PluginError(PLUGIN_NAME, error));
|
|
84
82
|
};
|
|
85
83
|
|
|
86
84
|
/**
|
|
@@ -93,9 +91,9 @@ const escapeSCSSVariable = (value) => {
|
|
|
93
91
|
return String(value);
|
|
94
92
|
} else {
|
|
95
93
|
// Convert to string
|
|
96
|
-
return "'" + value.toString().replace(/\\/g, '\\\\').replace(/'/g, '
|
|
94
|
+
return "'" + value.toString().replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/\n/g, '\\n') + "'";
|
|
97
95
|
}
|
|
98
|
-
}
|
|
96
|
+
};
|
|
99
97
|
|
|
100
98
|
/**
|
|
101
99
|
* Main Gulp Sass function
|
|
@@ -103,85 +101,85 @@ const escapeSCSSVariable = (value) => {
|
|
|
103
101
|
|
|
104
102
|
// eslint-disable-next-line arrow-body-style
|
|
105
103
|
const gulpSass = (options, sync) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (file.isStream()) {
|
|
113
|
-
callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
104
|
+
return transfob((file, encoding, callback) => {
|
|
105
|
+
if (file.isNull()) {
|
|
106
|
+
callback(null, file);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
116
109
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
if (file.isStream()) {
|
|
111
|
+
callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
121
114
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
115
|
+
if (path.basename(file.path).startsWith('_')) {
|
|
116
|
+
callback();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
127
119
|
|
|
128
|
-
|
|
129
|
-
|
|
120
|
+
if (!file.contents.length) {
|
|
121
|
+
file.path = replaceExtension(file.path, '.css');
|
|
122
|
+
callback(null, file);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
130
125
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
opts.data = sassStingify(options.data) + opts.data;
|
|
134
|
-
}
|
|
126
|
+
const opts = clonedeep(options || {});
|
|
127
|
+
opts.data = file.contents.toString();
|
|
135
128
|
|
|
136
|
-
|
|
137
|
-
|
|
129
|
+
// Stringiyfy variables
|
|
130
|
+
if (options.data) {
|
|
131
|
+
opts.data = sassStingify(options.data) + opts.data;
|
|
132
|
+
}
|
|
138
133
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
opts.indentedSyntax = true;
|
|
142
|
-
}
|
|
134
|
+
// We set the file path here so that libsass can correctly resolve import paths
|
|
135
|
+
opts.file = file.path;
|
|
143
136
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
} else {
|
|
150
|
-
opts.includePaths = [];
|
|
151
|
-
}
|
|
137
|
+
// Ensure `indentedSyntax` is true if a `.sass` file
|
|
138
|
+
if (path.extname(file.path) === '.sass') {
|
|
139
|
+
opts.indentedSyntax = true;
|
|
140
|
+
}
|
|
152
141
|
|
|
153
|
-
|
|
142
|
+
// Ensure file's parent directory in the include path
|
|
143
|
+
if (opts.includePaths) {
|
|
144
|
+
if (typeof opts.includePaths === 'string') {
|
|
145
|
+
opts.includePaths = [opts.includePaths];
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
opts.includePaths = [];
|
|
149
|
+
}
|
|
154
150
|
|
|
155
|
-
|
|
156
|
-
if (file.sourceMap) {
|
|
157
|
-
opts.sourceMap = file.path;
|
|
158
|
-
opts.omitSourceMapUrl = true;
|
|
159
|
-
opts.sourceMapContents = true;
|
|
160
|
-
}
|
|
151
|
+
opts.includePaths.unshift(path.dirname(file.path));
|
|
161
152
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (error) {
|
|
168
|
-
handleError(error, file, callback);
|
|
169
|
-
return;
|
|
153
|
+
// Generate Source Maps if the source-map plugin is present
|
|
154
|
+
if (file.sourceMap) {
|
|
155
|
+
opts.sourceMap = file.path;
|
|
156
|
+
opts.omitSourceMapUrl = true;
|
|
157
|
+
opts.sourceMapContents = true;
|
|
170
158
|
}
|
|
171
159
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
160
|
+
if (sync !== true) {
|
|
161
|
+
/**
|
|
162
|
+
* Async Sass render
|
|
163
|
+
*/
|
|
164
|
+
gulpSass.compiler.render(opts, (error, obj) => {
|
|
165
|
+
if (error) {
|
|
166
|
+
handleError(error, file, callback);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
filePush(file, obj, callback);
|
|
171
|
+
});
|
|
172
|
+
} else {
|
|
173
|
+
/**
|
|
174
|
+
* Sync Sass render
|
|
175
|
+
*/
|
|
176
|
+
try {
|
|
177
|
+
filePush(file, gulpSass.compiler.renderSync(opts), callback);
|
|
178
|
+
} catch (error) {
|
|
179
|
+
handleError(error, file, callback);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
185
183
|
};
|
|
186
184
|
|
|
187
185
|
/**
|
|
@@ -193,22 +191,18 @@ gulpSass.sync = (options) => gulpSass(options, true);
|
|
|
193
191
|
* Log errors nicely
|
|
194
192
|
*/
|
|
195
193
|
gulpSass.logError = function logError(error) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
const message = new PluginError('sass', error.messageFormatted).toString();
|
|
195
|
+
process.stderr.write(`${message}\n`);
|
|
196
|
+
this.emit('end');
|
|
199
197
|
};
|
|
200
198
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
).toString();
|
|
208
|
-
process.stderr.write(`${message}\n`);
|
|
209
|
-
process.exit(1);
|
|
210
|
-
}
|
|
199
|
+
export default (compiler) => {
|
|
200
|
+
if (!compiler || !compiler.render) {
|
|
201
|
+
const message = new PluginError(PLUGIN_NAME, MISSING_COMPILER_MESSAGE, { showProperties: false }).toString();
|
|
202
|
+
process.stderr.write(`${message}\n`);
|
|
203
|
+
process.exit(1);
|
|
204
|
+
}
|
|
211
205
|
|
|
212
|
-
|
|
213
|
-
|
|
206
|
+
gulpSass.compiler = compiler;
|
|
207
|
+
return gulpSass;
|
|
214
208
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export default function sassStingify (data, isDeep = false) {
|
|
2
2
|
if (data === null || data === undefined) {
|
|
3
3
|
return 'false';
|
|
4
4
|
} else if (data !== '' && (data === 'true' || data === 'false' || data === true || data === false || !isNaN(data))) {
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
// 2024-02-13, Kaspars Zuks: added "options.async" support
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import map from 'map-stream';
|
|
3
|
+
import rext from 'replace-ext';
|
|
4
|
+
import log from 'fancy-log';
|
|
5
|
+
import PluginError from 'plugin-error';
|
|
6
|
+
import Twig from 'twig';
|
|
6
7
|
|
|
7
8
|
const PLUGIN_NAME = 'gulp-twig';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
export default function (options) {
|
|
10
11
|
'use strict';
|
|
11
|
-
options = Object.assign(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
options = Object.assign(
|
|
13
|
+
{},
|
|
14
|
+
{
|
|
15
|
+
changeExt: true,
|
|
16
|
+
extname: '.html',
|
|
17
|
+
useFileContents: false,
|
|
18
|
+
async: true,
|
|
19
|
+
},
|
|
20
|
+
options || {},
|
|
21
|
+
);
|
|
17
22
|
|
|
18
23
|
function modifyContents(file, cb) {
|
|
19
24
|
var data = file.data || Object.assign({}, options.data);
|
|
@@ -26,21 +31,20 @@ module.exports = function (options) {
|
|
|
26
31
|
return cb(new PluginError(PLUGIN_NAME, 'Streaming not supported!'));
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
data._file
|
|
30
|
-
if(options.changeExt === false || options.extname === true){
|
|
34
|
+
data._file = file;
|
|
35
|
+
if (options.changeExt === false || options.extname === true) {
|
|
31
36
|
data._target = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}else{
|
|
37
|
+
path: file.path,
|
|
38
|
+
relative: file.relative,
|
|
39
|
+
};
|
|
40
|
+
} else {
|
|
36
41
|
data._target = {
|
|
37
42
|
path: rext(file.path, options.extname || ''),
|
|
38
|
-
relative: rext(file.relative, options.extname || '')
|
|
39
|
-
}
|
|
43
|
+
relative: rext(file.relative, options.extname || ''),
|
|
44
|
+
};
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
var
|
|
43
|
-
twig = Twig.twig,
|
|
47
|
+
var twig = Twig.twig,
|
|
44
48
|
twigOpts = {
|
|
45
49
|
path: file.path,
|
|
46
50
|
async: false,
|
|
@@ -78,20 +82,21 @@ module.exports = function (options) {
|
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
if(options.extend) {
|
|
85
|
+
if (options.extend) {
|
|
82
86
|
Twig.extend(options.extend);
|
|
83
87
|
delete options.extend;
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
if (options.useFileContents) {
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
var fileContents = file.contents.toString();
|
|
92
|
+
twigOpts.data = fileContents;
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
template = twig(twigOpts);
|
|
92
96
|
|
|
93
97
|
if (options.async) {
|
|
94
|
-
template
|
|
98
|
+
template
|
|
99
|
+
.renderAsync(data)
|
|
95
100
|
.then(function (output) {
|
|
96
101
|
file.contents = new Buffer(output);
|
|
97
102
|
file.path = data._target.path;
|
|
@@ -111,7 +116,7 @@ module.exports = function (options) {
|
|
|
111
116
|
} else {
|
|
112
117
|
try {
|
|
113
118
|
file.contents = new Buffer(template.render(data));
|
|
114
|
-
}catch(e){
|
|
119
|
+
} catch (e) {
|
|
115
120
|
if (options.errorLogToConsole) {
|
|
116
121
|
log(PLUGIN_NAME + ' ' + e);
|
|
117
122
|
return cb();
|
|
@@ -130,4 +135,4 @@ module.exports = function (options) {
|
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
return map(modifyContents);
|
|
133
|
-
}
|
|
138
|
+
}
|
package/.eslintrc.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"commonjs": true,
|
|
5
|
-
"es6": true,
|
|
6
|
-
"jquery": true
|
|
7
|
-
},
|
|
8
|
-
"extends": "eslint:recommended",
|
|
9
|
-
"parserOptions": {
|
|
10
|
-
"sourceType": "module"
|
|
11
|
-
},
|
|
12
|
-
"rules": {
|
|
13
|
-
"linebreak-style": [
|
|
14
|
-
"error",
|
|
15
|
-
"unix"
|
|
16
|
-
],
|
|
17
|
-
"quotes": [
|
|
18
|
-
"error",
|
|
19
|
-
"single"
|
|
20
|
-
],
|
|
21
|
-
"semi": [
|
|
22
|
-
"error",
|
|
23
|
-
"always"
|
|
24
|
-
],
|
|
25
|
-
"no-console": [
|
|
26
|
-
"warn", { "allow": ["warn", "error"] }
|
|
27
|
-
],
|
|
28
|
-
"no-debugger": [
|
|
29
|
-
"warn"
|
|
30
|
-
],
|
|
31
|
-
"no-unused-vars": [
|
|
32
|
-
"warn"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
};
|
package/gulpfile.js/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const getConfig = require('./../lib/get-config');
|
|
2
|
-
const generateGulpTasks = require('./../lib/generate-gulp-tasks');
|
|
3
|
-
|
|
4
|
-
// Set mode globally it can be used by tasks
|
|
5
|
-
let hasProductionArg = false;
|
|
6
|
-
|
|
7
|
-
for (let i = 0; i < process.argv.length; i++) {
|
|
8
|
-
const argValue = process.argv[i];
|
|
9
|
-
// If build task is 'build' or '...-build' then set production mode
|
|
10
|
-
if (argValue === 'build' || argValue.match(/^[a-z0-9-]+-build$/)) {
|
|
11
|
-
hasProductionArg = true;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
global.production = global.production || (hasProductionArg || process.env.NODE_ENV === 'production');
|
|
16
|
-
global.development = !global.production;
|
|
17
|
-
|
|
18
|
-
// Config file
|
|
19
|
-
let builderConfigFile = process.env.BUILDER_CONFIG_FILE || 'config/config.js';
|
|
20
|
-
|
|
21
|
-
if (process.argv.indexOf('--config') !== -1) {
|
|
22
|
-
builderConfigFile = process.argv[process.argv.indexOf('--config') + 1];
|
|
23
|
-
} else {
|
|
24
|
-
for (let i = 0; i < process.argv.length; i++) {
|
|
25
|
-
if (process.argv[i].indexOf('--config=') !== -1) {
|
|
26
|
-
builderConfigFile = process.argv[i].substr(9);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Load all config files and generate gulp tasks
|
|
32
|
-
module.exports = generateGulpTasks(getConfig.getConfig(builderConfigFile));
|