prepare switch to tns

This commit is contained in:
Philipp Kunz 2016-06-30 03:17:24 +02:00
parent c4faa56d0d
commit 88cd04d0e2
5 changed files with 10 additions and 83 deletions

View File

@ -28,6 +28,7 @@
},
"homepage": "https://gitlab.com/pushrocks/npmts#readme",
"dependencies": {
"@types/q": "0.0.21-alpha",
"beautylog": "5.0.11",
"early": "^2.0.13",
"fs-extra": "^0.30.0",
@ -39,9 +40,6 @@
"gulp-jsdoc3": "^0.3.0",
"gulp-mocha": "^2.2.0",
"gulp-replace": "^0.5.4",
"gulp-sourcemaps": "^2.0.0-alpha",
"gulp-typescript": "2.13.6",
"gulp-typings": "2.0.0",
"lodash": "^4.13.1",
"merge2": "1.0.2",
"projectinfo": "1.0.3",

View File

@ -4,38 +4,8 @@ import paths = require("./npmts.paths");
import helpers = require("./npmts.compile.helpers");
import {npmtsOra} from "./npmts.promisechain";
/**
* handles definition to make them fit for modular use
*/
let definitionHandler = function(configArg){
npmtsOra.text("now making declaration files ready");
let done = plugins.Q.defer();
let configTsLenght = Object.keys(configArg.ts).length;
if(configTsLenght == 0) {
plugins.beautylog.warn("No TS file and thus no definitions found!");
done.resolve(configArg); //if there are no definition files, resolve...
}
let localCounter = 0;
for (let key in configArg.ts){
let distPath = configArg.ts[key];
let stream = plugins.gulp.src(plugins.path.join(distPath,"**/*.d.ts"))
.pipe(plugins.g.replace(plugins.smartstring.typescript.regexReferencePath,""))
.pipe(plugins.gulp.dest(distPath))
.pipe(plugins.g.gFunction(function(){
localCounter++
if(localCounter == configTsLenght){
plugins.beautylog.ok("made declaration files ready!");
done.resolve(configArg)
};
},"atEnd"));
}
return done.promise;
}
let compileTs = (tsFileArrayArg,tsOptionsArg = {}) => {
let done = plugins.Q.defer();
let moduleStream = plugins.merge2({ end: false });
let tsOptionsDefault = {
declaration: true,
@ -51,21 +21,9 @@ let compileTs = (tsFileArrayArg,tsOptionsArg = {}) => {
};
for (let keyArg in tsFileArrayArg) {
if (helpers.checkOutputPath(tsFileArrayArg,keyArg)) {
let tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"])
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
.pipe(plugins.g.typescript(tsOptions(keyArg)));
let jsStream = tsStream.js
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
.pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
let declarationStream = tsStream.dts
.pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
moduleStream.add(tsStream,jsStream,declarationStream);
let tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"]);
}
}
moduleStream.on("queueDrain",() => {
done.resolve();
})
return done.promise;
}
@ -81,14 +39,8 @@ export let run = function (configArg) {
})
.then(function () {
plugins.beautylog.ok("compiled TypeScript!");
definitionHandler(config)
.then(function(){
done.resolve(config);
});
done.resolve(config);
});
/*==================== END TS Compilation =====================*/
return done.promise;
};

View File

@ -1,21 +0,0 @@
import "typings-global";
import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths");
import {npmtsOra} from "./npmts.promisechain";
export var run = function(configArg){
var config = configArg;
var done = plugins.Q.defer();
/* -------------------------------------------------
* ----------- install typings ---------------
* ----------------------------------------------- */
npmtsOra.text("now installing " + "typings".yellow);
var absoluteTypingsArray = plugins.smartpath.transform.toAbsolute(config.typings,paths.cwd);
plugins.gulp.src(absoluteTypingsArray)
.pipe(plugins.g.typings())
.pipe(plugins.g.gFunction(function(){
plugins.beautylog.ok("typings installed!");
done.resolve(config);
},"atEnd"));
return done.promise;
};

View File

@ -1,6 +1,6 @@
import "typings-global";
export import beautylog = require("beautylog");
export let fs = require("fs-extra");
export import fs = require("fs-extra");
export let gulp = require("gulp");
export let g = {
gFunction: require("gulp-function"),
@ -16,12 +16,12 @@ export let g = {
export let lodashObject = require('lodash/fp/object');
export let merge2 = require("merge2");
export import projectinfo = require("projectinfo");
export let path = require("path");
export let Q = require("q");
export let shelljs = require("shelljs");
export let smartci = require("smartci");
export import path = require("path");
export import Q = require("q");
export import shelljs = require("shelljs");
export import smartci = require("smartci");
export import smartcli = require("smartcli");
export let smartcov = require("smartcov");
export import smartcov = require("smartcov");
export import smartenv = require("smartenv");
export import smartfile = require("smartfile");
export import smartpath = require("smartpath");

View File

@ -7,7 +7,6 @@ import NpmtsAssets = require("./npmts.assets");
import NpmtsClean = require("./npmts.clean");
import NpmtsCompile = require("./npmts.compile");
import NpmtsConfigFile = require("./npmts.configfile");
import NpmtsInstall = require("./npmts.install");
import NpmtsJsdoc = require("./npmts.jsdoc");
import NpmtsOptions = require("./npmts.options");
import NpmtsTests = require("./npmts.tests");
@ -18,7 +17,6 @@ export let promisechain = function(argvArg){
NpmtsConfigFile.run(argvArg)
.then(NpmtsOptions.run)
.then(NpmtsClean.run)
.then(NpmtsInstall.run)
.then(NpmtsCompile.run)
.then(NpmtsAssets.run)
.then(NpmtsJsdoc.run)