update plugin to use nmpts

This commit is contained in:
2016-03-12 08:24:05 +01:00
parent 222bfb42cd
commit 48f44ee937
15 changed files with 104 additions and 2127 deletions

View File

@ -1,2 +0,0 @@
nvm use v0.12.7
gulp

View File

@ -1,16 +0,0 @@
// import gulp
var gulp = require("gulp"),
gulpTypescript = require("gulp-typescript");
gulp.task('compileTS', function() {
var stream = gulp.src('../index.ts')
.pipe(gulpTypescript({
out: "index.js"
}))
.pipe(gulp.dest("../../"));
return stream;
});
gulp.task('default',['compileTS'], function() {
console.log('Typescript compiled');
});

View File

@ -1,2 +0,0 @@
# How to compile.
Make sure gulp and gulp-taypescript from npm are available. Then run the gulpfile in this directory.

View File

@ -1,21 +1,14 @@
/// <reference path="typings/tsd.d.ts" />
/// <reference path="typings/main.d.ts" />
import plugins = require("./smartpath.plugins");
import SmartpathAbsolute = require("./smartpath.absolute");
var path = require("path");
var bl = require("beautylog");
/**
*
* @type {{getPath: (function(any): undefined)}}
*/
var smartpath:any = {
getAbsPath: function(varPath,logBool = false) {
var absPath = path.resolve(varPath);
if (logBool == true) {
bl.log('varPath is' + varPath);
bl.log('absPath is' + absPath);
}
return absPath;
}
let smartpath = {
};

31
ts/smartpath.absolute.ts Normal file
View File

@ -0,0 +1,31 @@
/// <reference path="typings/main.d.ts" />
import plugins = require("./smartpath.plugins");
var makeAbsolute = function(localPathArg:string, baseArg?:string):string {
let absolutePath:string;
if(baseArg){
absolutePath = plugins.path.join(baseArg,localPathArg);
} else {
absolutePath = plugins.path.resolve(localPathArg);
}
return absolutePath;
};
var absolute = function(relativeArg:any, baseArg?:string):any {
if(typeof relativeArg === "string"){
return makeAbsolute(relativeArg);
} else if(Array.isArray(relativeArg)){
let relativeArray = relativeArg
let absoluteArray:string[];
for (let key in relativeArray){
absoluteArray.push(makeAbsolute(relativeArray[key]));
};
return absoluteArray;
} else {
plugins.beautylog.error("smartpath.absolute() could not make sense of the input. " +
"Input is neither String nor Array");
return false;
}
};
export = absolute;

3
ts/smartpath.plugins.ts Normal file
View File

@ -0,0 +1,3 @@
/// <reference path="./typings/main.d.ts" />
export var beautylog = require ("beautylog");
export var path = require("path");

View File

@ -1,12 +0,0 @@
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"node/node.d.ts": {
"commit": "efa0c1196d7280640e624ac1e7fa604502e7bd63"
}
}
}

5
ts/typings.json Normal file
View File

@ -0,0 +1,5 @@
{
"ambientDependencies": {
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#efa0c1196d7280640e624ac1e7fa604502e7bd63"
}
}

File diff suppressed because it is too large Load Diff

1
ts/typings/tsd.d.ts vendored
View File

@ -1 +0,0 @@
/// <reference path="node/node.d.ts" />