-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
56 lines (47 loc) · 1.7 KB
/
gulpfile.js
File metadata and controls
56 lines (47 loc) · 1.7 KB
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
const fs = require('fs');
const path = require('path');
const gulp = require('gulp');
const merge = require('merge-stream');
const concat = require('gulp-concat');
const terser = require('gulp-terser');
const header = require('gulp-header');
const rename = require('gulp-rename');
const package = require('./package.json');
const settingsPath = path.join(__dirname, '.vscode', 'settings.json');
const banner = `/**
* JsWidthBreakpoints - A lightweight, vanilla JavaScript library for handling responsive breakpoints with dynamic CSS classes and visual rules.
* Version: ${package.version}
* Repository: https://github.com/marceloxp/JsWidthBreakpoints
* License: MIT
* Author: Marcelo XP
* Build Date: ${new Date().toISOString().split('T')[0]}
*/
`;
function build() {
const rawStream = gulp
.src('src/JsWidthBreakpoints.js')
.pipe(concat('JsWidthBreakpoints.js'))
.pipe(header(banner))
.pipe(gulp.dest('dist'));
const minStream = gulp
.src('src/JsWidthBreakpoints.js')
.pipe(concat('JsWidthBreakpoints.js'))
.pipe(terser())
.pipe(rename({ suffix: '.min' }))
.pipe(header(banner))
.pipe(gulp.dest('dist'));
return merge(rawStream, minStream);
}
async function updateStatusBar() {
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
const version = package.version;
settings.statusbartext = {
active: true,
text: `🏷️ JsWidthBreakpoints v${version}`
};
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 4));
console.log(`Status bar updated to version v${version}`);
await Promise.resolve();
}
exports.default = build;
exports.updateStatusBar = updateStatusBar;