Cleaned off unncessary js files and added prepProject script

This commit is contained in:
Leo Lee (DEVDIV) 2015-01-22 21:59:52 -08:00
Родитель 6631033120
Коммит c6ea68841f
9 изменённых файлов: 66 добавлений и 305 удалений

Просмотреть файл

@ -1,13 +0,0 @@
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="./lib/compile/gulpfile.ts" />
var gulp = require("gulp");
require("./lib/compile/gulpfile");
var styleCopUtil = require("../utility/styleCopUtil");
/* Project wide tasks. */
gulp.task("default", ["compilerDefault", "styleCop"]);
/* Runs style cop on the utilities. */
gulp.task("styleCop", ["compilerStyleCop"], function (cb) {
var styleCop = new styleCopUtil.CordovaTools.StyleCopUtil();
styleCop.runCop("../utility", "../../internal/TSStyleCop/TSStyleCop.js", cb);
});
module.exports = gulp;

Просмотреть файл

@ -1,43 +0,0 @@
/// <reference path="../../../typings/node/node.d.ts" />
/// <reference path="../../../typings/gulp/gulp.d.ts" />
var gulp = require("gulp");
var path = require("path");
var typescriptUtil = require("../../../utility/typescriptUtil");
var styleCopUtil = require("../../../utility/styleCopUtil");
var eventStream = require("event-stream");
var concat = require("gulp-concat");
var del = require("del");
/* Source path declarations for all the projects. Add a new path variable for each project & customize it as needed. */
var compilerPath = {
src: ".",
bin: "./bin",
binSrc: "./bin/taco-cli/templates/typescript_hook",
binUtil: "./bin/utility",
templatesSrc: "./templates/typescript_hook"
};
/* Default task for compiler - runs clean, compile, combine. */
gulp.task("compilerDefault", ["compilerClean", "compilerCompile", "compilerMerge", "compilerStyleCop"]);
/* Compiles the typescript files in the project. */
gulp.task("compilerCompile", ["compilerClean"], function (cb) {
var tsUtil = new typescriptUtil.CordovaTools.TypescriptServices();
console.log("compilerPath.src: " + path.resolve(compilerPath.src));
console.log("compilerPath.bin: " + path.resolve(compilerPath.bin));
tsUtil.compileDirectory(compilerPath.src, compilerPath.bin, cb);
});
/* Merges certain files after compilation. You can add to this task any post-compilation processing needed for your scenario. */
gulp.task("compilerMerge", ["compilerCompile"], function () {
gulp.src([compilerPath.templatesSrc + "/nodeEnv.js", compilerPath.binUtil + "/typescriptUtil.js", compilerPath.binSrc + "/compileTypescript.js"]).pipe(concat("compileTypescriptNode.js")).pipe(gulp.dest(compilerPath.binSrc));
gulp.src([compilerPath.templatesSrc + "/nodeEnv.js", compilerPath.binSrc + "/main.js"]).pipe(concat("taco-compile")).pipe(gulp.dest(compilerPath.binSrc));
gulp.src(compilerPath.templatesSrc + "compileTypescriptConfig.json").pipe(gulp.dest(compilerPath.binSrc));
});
/* Cleans up the bin location. */
gulp.task("compilerClean", function (cb) {
del([compilerPath.bin + "**"], cb);
});
/* Runs style cop on the sources. */
gulp.task("compilerStyleCop", function (cb) {
var styleCop = new styleCopUtil.CordovaTools.StyleCopUtil();
console.log(path.resolve(compilerPath.src));
styleCop.runCop(compilerPath.src, "../../Internal/TSStyleCop/TSStyleCop.js", cb);
});
module.exports = gulp;

Просмотреть файл

@ -55,7 +55,6 @@ gulp.task("compilerClean", function (cb: Function): void {
/* Runs style cop on the sources. */
gulp.task("compilerStyleCop", /*["compilerMerge"],*/ function (cb: Function): void {
var styleCop = new styleCopUtil.CordovaTools.StyleCopUtil();
console.log(path.resolve(compilerPath.src));
styleCop.runCop(compilerPath.src, "../../Internal/TSStyleCop/TSStyleCop.js", cb);
});

Просмотреть файл

@ -0,0 +1,38 @@
//boostrap project
var exec = require("child_process").exec,
path = require('path');
var installGlobalPackage = function (packageName) {
packageCommand = "npm ls -g " + packageName;
var result = exec(packageCommand, function (error, stdout, stderr) {
if (stdout.indexOf(packageName) > -1) {
console.log("---found gulp installed globally");
} else {
console.log("---did not find " + packageName + " installed globally, installing.....")
exec("npm install -g " + packageName);
}
});
};
//install global packages
installGlobalPackage("typescript");
installGlobalPackage("gulp");
////npm install on relevant folders
var foldersToPrep = [".",
"../utility"
];
foldersToPrep.forEach(function (folder) {
console.log("---NPM install on folder: " + path.resolve(folder));
var npmProcess = exec("npm install", { cwd: folder });
});
//compile root gulptfile.ts
console.log("compiling gulpfile.ts");
var compileTSOutput = exec("tsc gulpfile.ts --module", { cwd: "." }).output;
console.log("\n\nDone, run 'gulp' to build the project");

Просмотреть файл

@ -1,104 +1,3 @@
{
"EnsuringCorrectInstallation": "------ Ensuring correct global installation of package from source package directory: {0}",
"InvalidInstallSourceDirectory": "------ Invalid installation source directory. No package.json found.",
"NameOfPackage": "------ Name from source package.json: {0}",
"VersionOfPackage": "------ Version from source package.json: {0}",
"InstalledVersion": "------ Current globally installed version: {0}",
"InstalledVersionDifferent": "------ Current globally installed version different from package version. Will install from source package.",
"NotYetInstalled": "------ Package not currently installed globally.",
"InstalledVersionSame": "------ Package already installed globally at correct version.",
"InstallingGlobally": "------ Installing globally from source package. This could take a few minutes...",
"NpmInstallError": "------ npm install error: {0}",
"NpmInstallFailed": "------ npm install failed. Exit code: {0}",
"NpmInstallCompleted": "------ npm install of {0} from {1} completed.",
"ConfigXmlInvalidNameElement": "Validation failed for config.xml. Invalid name element: '{0}'.",
"UnsupportedPlatform": "------ Unsupported platform type {0}.",
"UnsupportedBuildCommand": "------ Unsupported build command {0}. Currently, build or prepare are supported.",
"CopyingIconsAndSplashscreens": "------ Copying Icons and Splashscreens for {0}",
"CreatingApp": "------ Creating app at {0}",
"AppDirAlreadyExists": "------ App dir {0} already exists",
"CopyingAppFilesToWww": "------ Copying app files to www",
"DoneCopyingAppFilesToWww": "------ Done copying app files to www",
"CopyingResFiles": "------ Copying res files",
"DoneCopyingResFiles": "------ Done copying res files",
"NoResFilesToCopy": "------ Source directory {0} does not exist, no res files to copy",
"PreparingRippleForiOS": "------ Preparing Ripple for iOS on a Windows device. Using Android for platform directory since iOS cannot be built on Windows.",
"AddingPlatform": "------ Adding platform: {0}",
"PlatformAlreadyExists": "------ Platform {0} already exists",
"UpdatingPlugins": "------ Updating plugins",
"DependentPluginNotRemoved": "------ Plugin was not removed because other plugin(s) depend on it: {0}",
"PluginAlreadyRemoved": "------ Plugin was already removed",
"UnexpectedPluginRemovalError": "ERROR: Please rebuild the solution. An unexpected plugin removal error occured: {0}",
"CurrentInstalledPlugins": "------ Currently installed plugins: {0}",
"CurrentDependentPlugins": "------ Currently installed dependent plugins: {0}",
"CurrentConfiguredPlugins": "------ Currently configured plugins: {0}",
"RemovingPlugin": "------ Removing plugin: {0}",
"AddingPlugin": "------ Adding plugin: {0}",
"CopyingPlatformMergeFiles": "------ Copying platform merge files from {0} to {1}",
"DoneCopyingPlatformMergeFiles": "------ Done copying platform merge files to {0}",
"CopyingNativeFiles": "------ Copying native files from {0} to {1}",
"DoneCopyingNativeFiles": "------ Done copying native files to {0}",
"BuildingPlatform": "------ Building platform: {0}",
"BuildConfigurationOptions": "------ Build configuration options: {0}",
"RemoteBuildServerNotConfigured": "A remote iOS build agent has not been configured. Configure one in Tools > Options > Tools for Apache Cordova > Remote Agent Configuration. For details and alternatives see http://go.microsoft.com/fwlink/?LinkID=511904",
"PreparingPlatform": "------ Preparing platform: {0}",
"CopyingBackToProject": "------ Copying back to project: {0}",
"CopyingPkgInfoTextFile": "------ Copying generated _pkginfo.txt file",
"WritingFromTo": "------ Writing {0} to {1}",
"DoneCopyingCompiledFiles": "------ Done copying compiled files: {0}",
"CheckingFor": "------ Checking for: {0}",
"RenamingFromTo": "------ Renaming {0} to {1}",
"CopyingAppxFiles": "------ Copying appx packages to output location",
"NoAppxPackageOutputPath": "------ No packageOutputPath is specified for the project. Nothing to copy.",
"CopyingAppxFilesFromTo": "------ Copying appx packages from {0} to {1}",
"DoneCopyingAppxFiles": "------ Done copying appx packages to output location",
"UpdatingAppxManifest": "------ Updating package.appxmanifest with platform specific values.",
"FailedToAddWindowsBOM": "------ Failed to add BOM: {0}",
"UninstallingProjectPlugin": "------ Uninstalling project directory plugin: {0}",
"AddingProjectPlugin": "------ Adding project directory plugin: {0}",
"CreatingDirectory": "------ Creating directory: {0}",
"NoSourceDirectoryForCopy": "------ Source directory did not exist for copy: {0}",
"SourceAssetDoesNotExist": "------ Source asset does not exist: {0}",
"RemovingTargetAsset": "------ Removing mapped target asset: {0}",
"CopiedFromTo": "------ Copied {0} to {1}",
"CopyFailedFileNotFound": "------ Failed to copy - file not found: {0}",
"ErrorCopyingFromTo": "------ Error copying {0} to {1}: {2}",
"MaxPathErrorCopyingFromTo": "------ Unable to copy file {0} to {1} The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters",
"InvalidRemoteBuildUrl": "The remote build server Url {0} is invalid. It should specify http or https.",
"RemoteBuildClientCertMissing": "The remote build client certificate is missing. To build your project, you must generate and configure a security PIN. See http://go.microsoft.com/fwlink/?LinkID=511904.",
"IncrementalBuild": "------ Incremental Build: {0}",
"SubmittingRemoteBuild": "------ Submitting new build request to: {0}",
"ErrorUploadingRemoteBuild": "An error occurred uploading to the build server {0}: {1}",
"InvalidRemoteBuildClientCert": "The remote build server denied the build request, because the client certificate is invalid or has expired. To build your project, you must generate and configure a security PIN. See http://go.microsoft.com/fwlink/?LinkID=511904",
"NewRemoteBuildInfo": "------ New Build information: {0}",
"CheckingRemoteBuildStatus": "------ {0} Checking on build status from {1} [Attempt {2}]",
"RemoteBuildLogFollows": "------ Remote build log follows",
"RemoteBuildError": "Remote build error from the build server {0}: {1}",
"RemoteBuildSslConnectionReset": "Secure connection to {0} could not be established. Verify that the build server is running in secure mode.",
"RemoteBuildNonSslConnectionReset": "Non-secure connection to {0} could not be established. Verify that the build server is not running in secure mode.",
"RemoteBuildHostNotFound": "Host unreachable for build server {0}.",
"RemoteBuildNoConnection": "Remote build server {0} connection failed. Verify that the server is running.",
"InvalidRemoteBuild": "Invalid remote build: {0}",
"DownloadingRemoteBuild": "------ Downloading completed build files from {0} to {1}",
"DownloadedRemoteBuild": "------ Done downloading the build outputs to {0}",
"ErrorDownloadingRemoteBuild": "Error from downloading build outputs to {0}: {1}",
"ExtractingRemoteBuild": "------ Extracting the build outputs to {0}",
"DoneExtractingRemoteBuild": "------ Done extracting the build outputs to {0}",
"FailedToDeleteRemoteZip": "------ Failed to delete downloaded zip file {0}. This did not prevent a successful build.",
"RequestingRemoteiOSEmulate": "Requesting emulate on iOS Simulator for buildNumber {0} on server {1}...",
"RequestingRemoteiOSDeploy": "Requesting deploy on remote iOS device for buildNumber {0} on server {1}...",
"RequestingRemoteiOSLaunch": "Requesting launch on remote iOS device for buildNumber {0} on server {1}...",
"RequestingRemoteiOSDebug": "Requesting debug on remote iOS device for buildNumber {0} on server {1}...",
"FailedRemoteiOSEmulate": "Failed to launch iOS remote for build {0} to {1} for deploy target {2}:\n{3}",
"FailedRemoteiOSDeploy": "Failed to deploy iOS remote for build {0} to {1} :\n{2}",
"FailedRemoteiOSLaunch": "Failed to launch iOS remote for build {0} to {1} :\n{2}",
"FailedRemoteiOSDebug": "Failed to Debug iOS remote for build {0} to {1} :\n{2}",
"BuildError": "A build error occurred: {0}",
"PerformanceSummary": "------ vs-mda Performance Summary"
"a": ""
}

26
TACO/utility/package.json Normal file
Просмотреть файл

@ -0,0 +1,26 @@
{
"name": "taco-cli-utility",
"author": {
"name": "Microsoft Corp."
},
"description": "strictly internal use to enable require in utility folder",
"homepage": "",
"version": "0.0.1",
"repository": {
"type": "git",
"url": "https://xxxxxxxxxxgithub.com/Microsoft/taco-cli.git"
},
"keywords": [
"Cordova",
"Microsoft",
"taco",
"Apache",
"cross-platform"
],
"dependencies" : {
"typescript": ">=1.4.1"
},
"devDependencies": {
}
}

Просмотреть файл

@ -1,9 +1,4 @@
/********************************************************
* *
* Copyright (C) Microsoft. All rights reserved. *
* *
********************************************************/
"use strict";
"use strict";
import fs = require ("fs");
import path = require ("path");

Просмотреть файл

@ -1,61 +0,0 @@
var child_process = require("child_process");
var fs = require("fs");
var path = require("path");
var CordovaTools;
(function (CordovaTools) {
/**
* Utility for launching TS style cop as a child process.
*/
var StyleCopUtil = (function () {
function StyleCopUtil() {
this._errorMessage = "Style cop validation failed.";
}
StyleCopUtil.prototype.runCop = function (srcPath, copPath, cb) {
var _this = this;
var childProcessCallback = function (error, stdout, stderr) {
if (stdout) {
console.log(stdout);
cb(_this._errorMessage);
}
if (stderr) {
console.error(stderr);
cb(_this._errorMessage);
}
if (error) {
console.error(error);
cb(_this._errorMessage);
}
if (!stdout && !stderr && !error) {
cb();
}
};
var excludedFiles = this.getProjectTypescriptDefinitionFiles(srcPath, []);
var styleCopCommand = "node " + copPath + " -analyze " + srcPath + (excludedFiles ? " -exclude " + excludedFiles.join(" ") : "");
child_process.exec(styleCopCommand, childProcessCallback);
};
/**
* Recursively finds all the typescript files under the filesRoot path.
*/
StyleCopUtil.prototype.getProjectTypescriptDefinitionFiles = function (filesRoot, result) {
if (fs.existsSync(filesRoot)) {
var files = fs.readdirSync(filesRoot);
for (var i = 0; i < files.length; i++) {
var currentPath = path.join(filesRoot, files[i]);
if (!fs.statSync(currentPath).isDirectory()) {
/* push the typescript files */
if (currentPath.match("d.ts$")) {
result.push(path.basename(currentPath));
}
}
else {
/* call the function recursively for subdirectories */
this.getProjectTypescriptDefinitionFiles(currentPath, result);
}
}
}
return result;
};
return StyleCopUtil;
})();
CordovaTools.StyleCopUtil = StyleCopUtil;
})(CordovaTools = exports.CordovaTools || (exports.CordovaTools = {}));

Просмотреть файл

@ -1,79 +0,0 @@
/// <reference path="../typings/typescript/typescript.d.ts" />
var ts = require("typescript");
var fs = require("fs");
var path = require("path");
var CordovaTools;
(function (CordovaTools) {
var TypescriptServices = (function () {
function TypescriptServices() {
}
/**
* Compiles typescript files based on the provided compiler options.
*/
TypescriptServices.prototype.compileTypescript = function (options, filenames, cb) {
var _this = this;
var host = ts.createCompilerHost(options);
var program = ts.createProgram(filenames, options, host);
var checker = ts.createTypeChecker(program, true);
var result = checker.emitFiles();
var allDiagnostics = program.getDiagnostics().concat(checker.getDiagnostics()).concat(result.diagnostics);
allDiagnostics.forEach(function (diagnostic) { return _this.logDiagnosticMessage(diagnostic); });
if (result.emitResultStatus !== 0) {
/* compilation failed */
if (cb) {
cb(TypescriptServices.FailureMessage);
}
}
else {
/* compilation succeeded */
cb();
}
};
/**
* Recursively finds all the typescript files under the filesRoot path.
*/
TypescriptServices.prototype.getProjectTypescriptFiles = function (filesRoot, result) {
if (fs.existsSync(filesRoot)) {
var files = fs.readdirSync(filesRoot);
for (var i = 0; i < files.length; i++) {
var currentPath = path.join(filesRoot, files[i]);
if (!fs.statSync(currentPath).isDirectory()) {
/* push the typescript files */
if (path.extname(currentPath) === ".ts" && !currentPath.match("d.ts$") && !currentPath.match("gulpfile.ts")) {
result.push(currentPath);
}
}
else {
/* call the function recursively for subdirectories */
this.getProjectTypescriptFiles(currentPath, result);
}
}
}
return result;
};
/**
* Compiles a diectory using the default settings, and the given source and destination location.
*/
TypescriptServices.prototype.compileDirectory = function (sourceDirectory, outputDirectory, cb) {
var sourceFiles = this.getProjectTypescriptFiles(sourceDirectory, []);
this.compileTypescript({
noImplicitAny: true,
noEmitOnError: true,
target: 1 /* ES5 */,
module: 1 /* CommonJS */,
outDir: outputDirectory
}, sourceFiles, cb);
};
/**
* Pretty-prints a diagnostic message to the console.
*/
TypescriptServices.prototype.logDiagnosticMessage = function (diagnostic) {
var sourceFile = diagnostic.file;
var lineAndCharacter = sourceFile.getLineAndCharacterFromPosition(diagnostic.start);
console.warn(sourceFile.filename + "(" + lineAndCharacter.line + "," + lineAndCharacter.character + "): " + diagnostic.messageText);
};
TypescriptServices.FailureMessage = "Typescript compilation failed.";
return TypescriptServices;
})();
CordovaTools.TypescriptServices = TypescriptServices;
})(CordovaTools = exports.CordovaTools || (exports.CordovaTools = {}));