deno.land / x / phonenumber@v3.4.0 / 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

const gulp = require( 'gulp' );
const child = require( 'child_process' );const fs = require( 'fs' );const rimraf = require( 'rmfr' );const mkdirp = require( 'mkdirp' );const replace = require( 'replace' );

const libphonenumberVersion = fs.readFileSync( 'libphonenumber.version', 'utf8' ).toString( ).trim( );
const rootDir = '.';const buildRoot = `${rootDir}/build`;const libphonenumberUrl = 'https://github.com/google/libphonenumber/';const closureLinterUrl = 'https://github.com/google/closure-linter';const pythonGflagsUrl = 'https://github.com/google/python-gflags.git';const antName = 'apache-ant-1.10.12';const antTar = `${antName}.tar.gz`;const antUrl = `https://downloads.apache.org/ant/binaries/${antName}-bin.tar.gz`;
const isDebug = process.env.DEBUG && process.env.DEBUG !== '0';
gulp.task( 'clean', ( ) => rimraf( buildRoot ));
gulp.task( 'make-build-dir', async ( ) => await mkdirp( buildRoot ));
gulp.task( 'clone-libphonenumber', gulp.series( 'make-build-dir', ( ) => gitClone( libphonenumberUrl, 'libphonenumber', libphonenumberVersion )) );
gulp.task( 'checkout-closure-linter', gulp.series( 'make-build-dir', ( ) => gitClone( closureLinterUrl, 'closure-linter' )) );
gulp.task( 'checkout-python-gflags', gulp.series( 'make-build-dir', ( ) => gitClone( pythonGflagsUrl, 'python-gflags' )) );
gulp.task( 'download-ant', gulp.series( 'make-build-dir', ( ) => runCommand( 'curl', [ '-L', '-o', antTar, antUrl ], { cwd: buildRoot } ), ( ) => runCommand( 'tar', [ 'zxf', antTar ], { cwd: buildRoot } )) );
gulp.task( 'download-deps', gulp.parallel( 'clone-libphonenumber', 'checkout-closure-linter', 'checkout-python-gflags', 'download-ant') );
gulp.task( 'build-deps', gulp.series( 'download-deps' ) );
gulp.task( 'build-libphonenumber', ( ) => runCommand( `${rootDir}/build.sh`, [ ], { cwd: rootDir } ));
gulp.task( 'build', gulp.series( 'build-deps', 'build-libphonenumber' ) );
gulp.task( 'update-readme', ( ) => updateReadme( ));
gulp.task( 'default', gulp.series( 'clean', 'build', 'update-readme' ) );
async function updateReadme( ){ replace( { regex: 'Uses libphonenumber ([A-Za-z.0-9]+)', replacement: `Uses libphonenumber ${libphonenumberVersion}`, paths: [ 'README.md' ], silent: true, } );}
function gitClone( url, name, branch ){ const args = [ '--depth=1' ]; if ( branch ) args.push( '--branch=' + branch );
return runCommand( 'git', [ 'clone', ...args, url, name ] );}
function runCommand( cmd, args, opts ){ opts = opts || { cwd : './build', stdio : [ null, null, isDebug ? process.stderr : null ] };
return new Promise( function( resolve, reject ) { var cp = child.spawn( cmd, args, opts ); cp.stdout.on( 'data', data => { if ( isDebug ) console.log( data.toString( ) ); } ); cp.on( 'close', code => { if ( code === 0 ) return resolve( ); reject( new Error( `${cmd} exited with exitcode ${code}. Args: ${args}` ) ); } ); cp.on( 'error', err => reject( err ) ); } );}
phonenumber

Version Info

Tagged at
a year ago