-
Notifications
You must be signed in to change notification settings - Fork 319
/
Copy pathbuild_hilo.js
65 lines (57 loc) · 1.51 KB
/
build_hilo.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
/**
* build hilo
*/
'use strict';
const path = require('path');
const async = require('async');
const semver = require('semver');
const copy = require('copy');
const debug = require('debug');
const BuildBase = require('./build_base');
class BuildHilo extends BuildBase {
constructor (config) {
super(config);
this.debug = debug('dragonbones:hilo');
}
/**
* check the version
* @return {Boolean} the version is valid or not
*/
get checkVersion () {
return semver.satisfies(this.version, '1.0.0 - 1');
}
/**
* get the src files's copy path
* @returns {[String]} the glob path
*/
get copySrcPath () {
const majorVer = semver.major(this.version);
return [
path.join(__dirname, `../Hilo/${ majorVer }.x/*/**`),
path.join(__dirname, `../Hilo/${ majorVer }.x/*`)
];
}
/**
* get the lib's download url
* @returns {String} the download url
*/
get downloadUrl () {
return `https://github.com/hiloteam/Hilo/archive/v${ this.version }.tar.gz`;
}
/**
* copy the .d.ts
* @param {Function} callback - callback function
*/
copyDeclear (callback) {
return callback();
copy(
[
path.join(this.cacheFolder, `Hilo-${ this.version }/d.ts/hilo.d.ts`)
],
path.join(this.cacheSourceFolder, 'libs'),
{ flatten: true },
callback
);
}
}
module.exports = BuildHilo;