update plugin to use nmpts
This commit is contained in:
@ -1,2 +0,0 @@
|
||||
nvm use v0.12.7
|
||||
gulp
|
@ -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');
|
||||
});
|
@ -1,2 +0,0 @@
|
||||
# How to compile.
|
||||
Make sure gulp and gulp-taypescript from npm are available. Then run the gulpfile in this directory.
|
17
ts/index.ts
17
ts/index.ts
@ -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
31
ts/smartpath.absolute.ts
Normal 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
3
ts/smartpath.plugins.ts
Normal file
@ -0,0 +1,3 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
export var beautylog = require ("beautylog");
|
||||
export var path = require("path");
|
12
ts/tsd.json
12
ts/tsd.json
@ -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
5
ts/typings.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#efa0c1196d7280640e624ac1e7fa604502e7bd63"
|
||||
}
|
||||
}
|
2079
ts/typings/node/node.d.ts
vendored
2079
ts/typings/node/node.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1
ts/typings/tsd.d.ts
vendored
1
ts/typings/tsd.d.ts
vendored
@ -1 +0,0 @@
|
||||
/// <reference path="node/node.d.ts" />
|
Reference in New Issue
Block a user