microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
fd58bf7b504cdd21c394961fd3aecb677f36e02a

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

tools/compileTools.js

40lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4var buildConfig = require('./tsconfig.json');
5var path = require("path");
6
7function compileBuildScripts() {
8 console.log("Compiling tools...\n");
9 var gulp = require("gulp");
10 var ts = require('gulp-typescript');
11 var sourcemaps = require("gulp-sourcemaps");
12 gulp.src(["src/**/*.ts"])
13 .pipe(sourcemaps.init())
14 .pipe(ts(buildConfig.tsCompileOptions))
15 .on("error", function(error){
16 if (error) {
17 console.error("Failed: Compilation of tools failed.");
18 process.exit(1);
19 }
20 })
21 .pipe(sourcemaps.write("."))
22 .pipe(gulp.dest(path.resolve("out")))
23 .on("end", function(){
24 console.log(greenColorFunction("Success!!! To build the project, run 'gulp' from the root directory"));
25 });
26}
27
28function greenColorFunction(s) {
29 // https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes
30 // \u001b[3Xm == "set foreground colour to colour in slot X"
31 // Slot 2 defaults to green
32 // \u001b[39m == "reset foreground colour"
33 // \u001b[1m == "bold" which is interpreted differently by different terminals
34 // \u001b[22m == "stop being bold (or faint)"
35 return "\u001b[32m\u001b[1m" + s + "\u001b[22m\u001b[39m";
36}
37
38process.chdir("tools"); // Go to the tools folder
39
40compileBuildScripts();