-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
45 lines (39 loc) · 1.36 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
43
44
45
'use strict';
// IMPORTS
// ================================================================================================
const gulp = require('gulp');
const del = require('del');
const exec = require('child_process').exec;
// TASKS
// ================================================================================================
function clean(cb) {
del(['bin']).then(() => { cb(); });
}
function compile(cb) {
exec('tsc -p .', function (err, stdout, stderr) {
if (stdout.length > 0) console.log(stdout);
if (stderr.length > 0) console.error(stderr);
cb(err);
});
}
function copyFiles(cb) {
gulp.src('./package.json').pipe(gulp.dest('./bin'));
gulp.src('./package-lock.json').pipe(gulp.dest('./bin'));
gulp.src('./nova-ai-logger.d.ts').pipe(gulp.dest('./bin'));
gulp.src('./.npmignore').pipe(gulp.dest('./bin'));
gulp.src('./README.md').pipe(gulp.dest('./bin'));
cb();
}
function publish(cb) {
exec('npm publish bin --access=public', function (err, stdout, stderr) {
if (stdout.length > 0) console.log(stdout);
if (stderr.length > 0) console.error(stderr);
cb(err);
});
}
const build = gulp.series(clean, compile, copyFiles);
// EXPORTS
// ================================================================================================
exports.build = build;
exports.publish = gulp.series(build, publish);
exports.default = build;