-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (38 loc) · 1.13 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
const { dest, src, series } = require("gulp");
const replace = require("gulp-replace");
require("dotenv").config();
/**
* Replaces the text in given file
* @param {string} filePath file path
* @param {string | RegExp} pattern search pattern
* @param {string} replacement replacement string
* @param {string} destination copy destination path
*/
function replaceTextInFile(filePath, pattern, replacement, destination) {
return src(filePath)
.pipe(replace(pattern, replacement))
.pipe(dest(destination));
}
/**
* Sets core library version
*/
function setCoreLibraryVersion() {
return replaceTextInFile(
"./package.json",
/(?<="version": )(.+)(?=,)/,
`"${process.env.LIBRARY_VERSION}"`,
"./"
);
}
/**
* Sets react library version
*/
function setReactLibraryVersion() {
return replaceTextInFile(
"./bindings/react/package.json",
/(?<="@one-for-all-ui\/core": |"version": )(.+)(?=")/g,
`"${process.env.LIBRARY_VERSION}`,
"./bindings/react/"
);
}
exports.setLibraryVersion = exports.default = series(setCoreLibraryVersion, setReactLibraryVersion);