diff --git a/compile/compile.js b/compile/compile.js deleted file mode 100644 index 306ef6a..0000000 --- a/compile/compile.js +++ /dev/null @@ -1,49 +0,0 @@ -// import gulp -var plugins = { - beautylog: require("beautylog"), - gulp: require("gulp"), - g:{ - typescript: require("gulp-typescript"), - typings:require("gulp-typings") - }, - mergeStream: require("merge2"), - path: require("path") -}; - -paths = { - packageBase: plugins.path.resolve( - plugins.path.join(__dirname,"../") - ) -}; - -plugins.beautylog.log('now compiling NPMTS'); - -plugins.gulp.task("typings",function(){ - var stream = plugins.gulp.src(plugins.path.join(paths.packageBase,"ts/typings.json")) - .pipe(plugins.g.typings()); - return stream; -}); - -plugins.gulp.task("TS",["typings"], function() { - var stream = plugins.gulp.src([ - plugins.path.join(paths.packageBase,'ts/**/*.ts'), - "!" + plugins.path.join(paths.packageBase,'ts/typings/**/*.d.ts') - ]) - .pipe(plugins.g.typescript({ - target:"ES5", - module:"commonjs" - })) - .pipe(plugins.gulp.dest(plugins.path.join(paths.packageBase, 'dist/'))); - return stream; -}); - -plugins.gulp.task("CLI",function(){ - var stream = plugins.gulp.src(plugins.path.join(paths.packageBase,"assets/cli.js")) - .pipe(plugins.gulp.dest(plugins.path.join(paths.packageBase, 'dist/'))) -}); - -plugins.gulp.task('default',['TS',"CLI"], function() { - plugins.beautylog.success('Typescript compiled'); -}); - -plugins.gulp.start.apply(plugins.gulp, ['default']); \ No newline at end of file diff --git a/dist/cli.js b/dist/cli.js deleted file mode 100644 index 9ab44a7..0000000 --- a/dist/cli.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -var index = require("./index.js"); \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..62d7805 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1 @@ +import "typings-global"; diff --git a/dist/npmts.assets.d.ts b/dist/npmts.assets.d.ts new file mode 100644 index 0000000..f32981b --- /dev/null +++ b/dist/npmts.assets.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare var run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/npmts.assets.js b/dist/npmts.assets.js index 68aec77..ee0a504 100644 --- a/dist/npmts.assets.js +++ b/dist/npmts.assets.js @@ -8,7 +8,7 @@ exports.run = function (configArg) { var config = configArg; npmts_promisechain_1.npmtsOra.text("now looking at " + "required assets".yellow); if (config.cli == true) { - plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir); + plugins.smartfile.fs.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir); plugins.beautylog.ok("installed CLI assets!"); done.resolve(config); } diff --git a/dist/npmts.clean.d.ts b/dist/npmts.clean.d.ts new file mode 100644 index 0000000..cc7c7a9 --- /dev/null +++ b/dist/npmts.clean.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare let run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/npmts.clean.js b/dist/npmts.clean.js index c542206..fd71627 100644 --- a/dist/npmts.clean.js +++ b/dist/npmts.clean.js @@ -5,7 +5,7 @@ var paths = require("./npmts.paths"); var npmts_promisechain_1 = require("./npmts.promisechain"); var removeDist = function () { npmts_promisechain_1.npmtsOra.text("cleaning " + "dist".yellow + " folder"); - return plugins.smartfile.fsaction.remove(paths.distDir); + return plugins.smartfile.fs.remove(paths.distDir); }; var removeTypings = function () { var done = plugins.Q.defer(); diff --git a/dist/npmts.cli.d.ts b/dist/npmts.cli.d.ts new file mode 100644 index 0000000..62d7805 --- /dev/null +++ b/dist/npmts.cli.d.ts @@ -0,0 +1 @@ +import "typings-global"; diff --git a/dist/npmts.compile.d.ts b/dist/npmts.compile.d.ts new file mode 100644 index 0000000..cc7c7a9 --- /dev/null +++ b/dist/npmts.compile.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare let run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/npmts.compile.helpers.d.ts b/dist/npmts.compile.helpers.d.ts new file mode 100644 index 0000000..176e31f --- /dev/null +++ b/dist/npmts.compile.helpers.d.ts @@ -0,0 +1 @@ +export declare let checkOutputPath: (tsArrayArg: any, keyArg: any) => boolean; diff --git a/dist/npmts.compile.js b/dist/npmts.compile.js index 1da61de..e72dfbc 100644 --- a/dist/npmts.compile.js +++ b/dist/npmts.compile.js @@ -4,38 +4,9 @@ var plugins = require("./npmts.plugins"); var paths = require("./npmts.paths"); var helpers = require("./npmts.compile.helpers"); var npmts_promisechain_1 = require("./npmts.promisechain"); -/** - * handles definition to make them fit for modular use - */ -var definitionHandler = function (configArg) { - npmts_promisechain_1.npmtsOra.text("now making declaration files ready"); - var done = plugins.Q.defer(); - var 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... - } - var localCounter = 0; - for (var key in configArg.ts) { - var distPath = configArg.ts[key]; - var 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; -}; var compileTs = function (tsFileArrayArg, tsOptionsArg) { if (tsOptionsArg === void 0) { tsOptionsArg = {}; } var done = plugins.Q.defer(); - var moduleStream = plugins.merge2({ end: false }); var tsOptionsDefault = { declaration: true, target: "ES5", @@ -49,20 +20,9 @@ var compileTs = function (tsFileArrayArg, tsOptionsArg) { }; for (var keyArg in tsFileArrayArg) { if (helpers.checkOutputPath(tsFileArrayArg, keyArg)) { - var 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))); - var jsStream = tsStream.js - .pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file - .pipe(plugins.gulp.dest(tsFileArrayArg[keyArg])); - var declarationStream = tsStream.dts - .pipe(plugins.gulp.dest(tsFileArrayArg[keyArg])); - moduleStream.add(tsStream, jsStream, declarationStream); + var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"]); } } - moduleStream.on("queueDrain", function () { - done.resolve(); - }); return done.promise; }; exports.run = function (configArg) { @@ -75,11 +35,7 @@ exports.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; }; diff --git a/dist/npmts.configfile.d.ts b/dist/npmts.configfile.d.ts new file mode 100644 index 0000000..1b6f363 --- /dev/null +++ b/dist/npmts.configfile.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare var run: (argvArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/npmts.configfile.js b/dist/npmts.configfile.js index be0ea8f..7e5fa03 100644 --- a/dist/npmts.configfile.js +++ b/dist/npmts.configfile.js @@ -9,9 +9,9 @@ exports.run = function (argvArg) { if (argvArg.notest) { config.notest = true; } - if (plugins.smartfile.checks.fileExistsSync(configPath)) { + if (plugins.smartfile.fs.fileExistsSync(configPath)) { plugins.beautylog.info("npmts.json".blue + " config file found!"); - config = plugins.lodashObject.assign(config, plugins.smartfile.local.toObjectSync(configPath)); + config = plugins.lodashObject.assign(config, plugins.smartfile.fs.toObjectSync(configPath)); switch (config.mode) { case "default": case "custom": diff --git a/dist/npmts.install.js b/dist/npmts.install.js deleted file mode 100644 index 496e1e3..0000000 --- a/dist/npmts.install.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -require("typings-global"); -var plugins = require("./npmts.plugins"); -var paths = require("./npmts.paths"); -var npmts_promisechain_1 = require("./npmts.promisechain"); -exports.run = function (configArg) { - var config = configArg; - var done = plugins.Q.defer(); - /* ------------------------------------------------- - * ----------- install typings --------------- - * ----------------------------------------------- */ - npmts_promisechain_1.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; -}; diff --git a/dist/npmts.jsdoc.d.ts b/dist/npmts.jsdoc.d.ts new file mode 100644 index 0000000..cc7c7a9 --- /dev/null +++ b/dist/npmts.jsdoc.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare let run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/npmts.options.d.ts b/dist/npmts.options.d.ts new file mode 100644 index 0000000..c5fdcc7 --- /dev/null +++ b/dist/npmts.options.d.ts @@ -0,0 +1,5 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare let isCi: () => any; +export declare var run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/npmts.paths.d.ts b/dist/npmts.paths.d.ts new file mode 100644 index 0000000..74d2da3 --- /dev/null +++ b/dist/npmts.paths.d.ts @@ -0,0 +1,12 @@ +import "typings-global"; +export declare let npmtsPackageRoot: string; +export declare let cwd: string; +export declare let tsDir: string; +export declare let distDir: string; +export declare let docsDir: string; +export declare let testDir: string; +export declare let typingsDir: string; +export declare let coverageDir: string; +export declare let npmtsAssetsDir: string; +export declare let indexTS: string; +export declare let testTS: string; diff --git a/dist/npmts.plugins.d.ts b/dist/npmts.plugins.d.ts new file mode 100644 index 0000000..10dfe91 --- /dev/null +++ b/dist/npmts.plugins.d.ts @@ -0,0 +1,27 @@ +import "typings-global"; +export import beautylog = require("beautylog"); +export declare let gulp: any; +export declare let g: { + gFunction: any; + istanbul: any; + jsdoc3: any; + mocha: any; + replace: any; + sourcemaps: any; + typescript: any; + typings: any; +}; +export declare let lodashObject: any; +export declare let merge2: any; +export import projectinfo = require("projectinfo"); +export import path = require("path"); +export import Q = require("q"); +export import shelljs = require("shelljs"); +export declare let smartci: any; +export import smartcli = require("smartcli"); +export declare let smartcov: any; +export import smartenv = require("smartenv"); +export import smartfile = require("smartfile"); +export import smartpath = require("smartpath"); +export import smartstring = require("smartstring"); +export declare let sourceMapSupport: any; diff --git a/dist/npmts.plugins.js b/dist/npmts.plugins.js index 09fdf52..231260a 100644 --- a/dist/npmts.plugins.js +++ b/dist/npmts.plugins.js @@ -1,7 +1,6 @@ "use strict"; require("typings-global"); exports.beautylog = require("beautylog"); -exports.fs = require("fs-extra"); exports.gulp = require("gulp"); exports.g = { gFunction: require("gulp-function"), diff --git a/dist/npmts.promisechain.d.ts b/dist/npmts.promisechain.d.ts new file mode 100644 index 0000000..e47d2ee --- /dev/null +++ b/dist/npmts.promisechain.d.ts @@ -0,0 +1,6 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +import { Ora } from "beautylog"; +export declare let npmtsOra: Ora; +export declare let promisechain: (argvArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/npmts.promisechain.js b/dist/npmts.promisechain.js index f6c72a0..c26f714 100644 --- a/dist/npmts.promisechain.js +++ b/dist/npmts.promisechain.js @@ -6,7 +6,6 @@ var NpmtsAssets = require("./npmts.assets"); var NpmtsClean = require("./npmts.clean"); var NpmtsCompile = require("./npmts.compile"); var NpmtsConfigFile = require("./npmts.configfile"); -var NpmtsInstall = require("./npmts.install"); var NpmtsJsdoc = require("./npmts.jsdoc"); var NpmtsOptions = require("./npmts.options"); var NpmtsTests = require("./npmts.tests"); @@ -16,7 +15,6 @@ exports.promisechain = function (argvArg) { NpmtsConfigFile.run(argvArg) .then(NpmtsOptions.run) .then(NpmtsClean.run) - .then(NpmtsInstall.run) .then(NpmtsCompile.run) .then(NpmtsAssets.run) .then(NpmtsJsdoc.run) diff --git a/dist/npmts.publish.js b/dist/npmts.publish.js deleted file mode 100644 index 7fd7892..0000000 --- a/dist/npmts.publish.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -require("typings-global"); -var plugins = require("./npmts.plugins"); -exports.run = function (configArg) { - var done = plugins.Q.defer(); - var config = configArg; - done.resolve(); - return done.promise; -}; diff --git a/dist/npmts.tests.d.ts b/dist/npmts.tests.d.ts new file mode 100644 index 0000000..cc7c7a9 --- /dev/null +++ b/dist/npmts.tests.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare let run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/test/assets/customdir/custom.d.ts b/dist/test/assets/customdir/custom.d.ts new file mode 100644 index 0000000..d8c1b2d --- /dev/null +++ b/dist/test/assets/customdir/custom.d.ts @@ -0,0 +1 @@ +declare var hello: string; diff --git a/dist/test/assets/customdir/custom.js b/dist/test/assets/customdir/custom.js new file mode 100644 index 0000000..ea15f04 --- /dev/null +++ b/dist/test/assets/customdir/custom.js @@ -0,0 +1 @@ +var hello = "hello"; diff --git a/dist/test/assets/customdir/tsfile1.d.ts b/dist/test/assets/customdir/tsfile1.d.ts new file mode 100644 index 0000000..0cd9444 --- /dev/null +++ b/dist/test/assets/customdir/tsfile1.d.ts @@ -0,0 +1 @@ +declare var something: string; diff --git a/dist/test/assets/customdir/tsfile1.js b/dist/test/assets/customdir/tsfile1.js new file mode 100644 index 0000000..4400885 --- /dev/null +++ b/dist/test/assets/customdir/tsfile1.js @@ -0,0 +1 @@ +var something = "something"; diff --git a/dist/test/assets/test/test.d.ts b/dist/test/assets/test/test.d.ts new file mode 100644 index 0000000..c408306 --- /dev/null +++ b/dist/test/assets/test/test.d.ts @@ -0,0 +1 @@ +declare var testplugin: any; diff --git a/dist/test/assets/test/test.js b/dist/test/assets/test/test.js new file mode 100644 index 0000000..b0c7804 --- /dev/null +++ b/dist/test/assets/test/test.js @@ -0,0 +1,8 @@ +var testplugin = require("../dist/index.js"); +describe("testplugins", function () { + describe(".logSomething", function () { + it("should log something", function () { + testplugin.logSomething(); + }); + }); +}); diff --git a/test/assets/dist/index.d.ts b/dist/test/assets/ts/index.d.ts similarity index 73% rename from test/assets/dist/index.d.ts rename to dist/test/assets/ts/index.d.ts index 2ca7215..6fc0276 100644 --- a/test/assets/dist/index.d.ts +++ b/dist/test/assets/ts/index.d.ts @@ -1,3 +1,4 @@ declare let testplugin: { logSomething: () => void; }; +export = testplugin; diff --git a/dist/test/assets/ts/index.js b/dist/test/assets/ts/index.js new file mode 100644 index 0000000..8e34d40 --- /dev/null +++ b/dist/test/assets/ts/index.js @@ -0,0 +1,7 @@ +"use strict"; +var testplugin = { + logSomething: function () { + console.log("only function executed"); + } +}; +module.exports = testplugin; diff --git a/dist/ts/index.d.ts b/dist/ts/index.d.ts new file mode 100644 index 0000000..62d7805 --- /dev/null +++ b/dist/ts/index.d.ts @@ -0,0 +1 @@ +import "typings-global"; diff --git a/dist/ts/index.js b/dist/ts/index.js new file mode 100644 index 0000000..c23259d --- /dev/null +++ b/dist/ts/index.js @@ -0,0 +1,28 @@ +"use strict"; +require("typings-global"); +/* ================================================== * + Starting NPMTS main process. + * ================================================== */ +var early = require("early"); +early.start("NPMTS"); +var plugins = require("./npmts.plugins"); +var paths = require("./npmts.paths"); +var npmts_promisechain_1 = require("./npmts.promisechain"); +early.stop() + .then(function () { + var npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot); + var npmtsCli = new plugins.smartcli.Smartcli(); + npmtsCli.standardTask() + .then(function (argvArg) { + plugins.beautylog.figletSync("NPMTS"); + plugins.beautylog.info("npmts version: " + npmtsProjectInfo.version); + try { + npmts_promisechain_1.promisechain(argvArg); + } + catch (err) { + console.log(err); + } + }); + npmtsCli.addVersion(npmtsProjectInfo.version); + npmtsCli.startParse(); +}); diff --git a/dist/ts/npmts.assets.d.ts b/dist/ts/npmts.assets.d.ts new file mode 100644 index 0000000..f32981b --- /dev/null +++ b/dist/ts/npmts.assets.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare var run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/ts/npmts.assets.js b/dist/ts/npmts.assets.js new file mode 100644 index 0000000..68aec77 --- /dev/null +++ b/dist/ts/npmts.assets.js @@ -0,0 +1,19 @@ +"use strict"; +require("typings-global"); +var plugins = require("./npmts.plugins"); +var paths = require("./npmts.paths"); +var npmts_promisechain_1 = require("./npmts.promisechain"); +exports.run = function (configArg) { + var done = plugins.Q.defer(); + var config = configArg; + npmts_promisechain_1.npmtsOra.text("now looking at " + "required assets".yellow); + if (config.cli == true) { + plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir); + plugins.beautylog.ok("installed CLI assets!"); + done.resolve(config); + } + else { + done.resolve(config); + } + return done.promise; +}; diff --git a/dist/ts/npmts.clean.d.ts b/dist/ts/npmts.clean.d.ts new file mode 100644 index 0000000..cc7c7a9 --- /dev/null +++ b/dist/ts/npmts.clean.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare let run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/ts/npmts.clean.js b/dist/ts/npmts.clean.js new file mode 100644 index 0000000..c542206 --- /dev/null +++ b/dist/ts/npmts.clean.js @@ -0,0 +1,30 @@ +"use strict"; +require("typings-global"); +var plugins = require("./npmts.plugins"); +var paths = require("./npmts.paths"); +var npmts_promisechain_1 = require("./npmts.promisechain"); +var removeDist = function () { + npmts_promisechain_1.npmtsOra.text("cleaning " + "dist".yellow + " folder"); + return plugins.smartfile.fsaction.remove(paths.distDir); +}; +var removeTypings = function () { + var done = plugins.Q.defer(); + npmts_promisechain_1.npmtsOra.text("cleaning " + "typings".yellow + " folder"); + if (false) { + } + else { + done.resolve(); + } + return done.promise; +}; +exports.run = function (configArg) { + npmts_promisechain_1.npmtsOra.text("cleaning up from previous builds..."); + var done = plugins.Q.defer(); + removeDist() + .then(removeTypings) + .then(function () { + plugins.beautylog.ok("Cleaned up from previous builds!"); + done.resolve(configArg); + }); + return done.promise; +}; diff --git a/dist/ts/npmts.cli.d.ts b/dist/ts/npmts.cli.d.ts new file mode 100644 index 0000000..62d7805 --- /dev/null +++ b/dist/ts/npmts.cli.d.ts @@ -0,0 +1 @@ +import "typings-global"; diff --git a/dist/ts/npmts.cli.js b/dist/ts/npmts.cli.js new file mode 100644 index 0000000..d9b688b --- /dev/null +++ b/dist/ts/npmts.cli.js @@ -0,0 +1,2 @@ +"use strict"; +require("typings-global"); diff --git a/dist/ts/npmts.compile.d.ts b/dist/ts/npmts.compile.d.ts new file mode 100644 index 0000000..cc7c7a9 --- /dev/null +++ b/dist/ts/npmts.compile.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare let run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/ts/npmts.compile.helpers.d.ts b/dist/ts/npmts.compile.helpers.d.ts new file mode 100644 index 0000000..176e31f --- /dev/null +++ b/dist/ts/npmts.compile.helpers.d.ts @@ -0,0 +1 @@ +export declare let checkOutputPath: (tsArrayArg: any, keyArg: any) => boolean; diff --git a/dist/ts/npmts.compile.helpers.js b/dist/ts/npmts.compile.helpers.js new file mode 100644 index 0000000..b47eb29 --- /dev/null +++ b/dist/ts/npmts.compile.helpers.js @@ -0,0 +1,16 @@ +"use strict"; +var plugins = require("./npmts.plugins"); +var paths = require("./npmts.paths"); +var outputPathIsDir = function (tsArrayArg, keyArg) { + return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, tsArrayArg[keyArg])); +}; +exports.checkOutputPath = function (tsArrayArg, keyArg) { + if (!outputPathIsDir(tsArrayArg, keyArg)) { + plugins.beautylog.warn("Skipping " + keyArg + " because " + tsArrayArg[keyArg] + " it is no directory!"); + return false; + } + else { + return true; + } + ; +}; diff --git a/dist/ts/npmts.compile.js b/dist/ts/npmts.compile.js new file mode 100644 index 0000000..e72dfbc --- /dev/null +++ b/dist/ts/npmts.compile.js @@ -0,0 +1,41 @@ +"use strict"; +require("typings-global"); +var plugins = require("./npmts.plugins"); +var paths = require("./npmts.paths"); +var helpers = require("./npmts.compile.helpers"); +var npmts_promisechain_1 = require("./npmts.promisechain"); +var compileTs = function (tsFileArrayArg, tsOptionsArg) { + if (tsOptionsArg === void 0) { tsOptionsArg = {}; } + var done = plugins.Q.defer(); + var tsOptionsDefault = { + declaration: true, + target: "ES5", + module: "commonjs" + }; + /** + * merges default ts options with those found in npmts.json + */ + var tsOptions = function (keyArg) { + return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg); + }; + for (var keyArg in tsFileArrayArg) { + if (helpers.checkOutputPath(tsFileArrayArg, keyArg)) { + var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"]); + } + } + return done.promise; +}; +exports.run = function (configArg) { + var done = plugins.Q.defer(); + var config = configArg; + npmts_promisechain_1.npmtsOra.text("now compiling " + "TypeScript".yellow); + compileTs(config.ts, config.tsOptions) + .then(function () { + compileTs(config.testTs); + }) + .then(function () { + plugins.beautylog.ok("compiled TypeScript!"); + done.resolve(config); + }); + return done.promise; +}; diff --git a/dist/ts/npmts.configfile.d.ts b/dist/ts/npmts.configfile.d.ts new file mode 100644 index 0000000..1b6f363 --- /dev/null +++ b/dist/ts/npmts.configfile.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare var run: (argvArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/ts/npmts.configfile.js b/dist/ts/npmts.configfile.js new file mode 100644 index 0000000..be0ea8f --- /dev/null +++ b/dist/ts/npmts.configfile.js @@ -0,0 +1,34 @@ +"use strict"; +require("typings-global"); +var plugins = require("./npmts.plugins"); +var paths = require("./npmts.paths"); +exports.run = function (argvArg) { + var done = plugins.Q.defer(); + var config = {}; + var configPath = plugins.path.join(paths.cwd, "npmts.json"); + if (argvArg.notest) { + config.notest = true; + } + if (plugins.smartfile.checks.fileExistsSync(configPath)) { + plugins.beautylog.info("npmts.json".blue + " config file found!"); + config = plugins.lodashObject.assign(config, plugins.smartfile.local.toObjectSync(configPath)); + switch (config.mode) { + case "default": + case "custom": + plugins.beautylog.ok("mode is " + config.mode.yellow); + done.resolve(config); + break; + default: + plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red); + process.exit(1); + } + ; + } + else { + plugins.beautylog.log("no config file found: so mode is " + "default".yellow); + config.mode = "default"; + done.resolve(config); + } + ; + return done.promise; +}; diff --git a/dist/ts/npmts.jsdoc.d.ts b/dist/ts/npmts.jsdoc.d.ts new file mode 100644 index 0000000..cc7c7a9 --- /dev/null +++ b/dist/ts/npmts.jsdoc.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare let run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/ts/npmts.jsdoc.js b/dist/ts/npmts.jsdoc.js new file mode 100644 index 0000000..1e3278c --- /dev/null +++ b/dist/ts/npmts.jsdoc.js @@ -0,0 +1,28 @@ +"use strict"; +require("typings-global"); +var plugins = require("./npmts.plugins"); +var paths = require("./npmts.paths"); +var npmts_promisechain_1 = require("./npmts.promisechain"); +var genJsdoc = function (configArg) { + var done = plugins.Q.defer(); + npmts_promisechain_1.npmtsOra.text("now generating " + "JsDoc documentation".yellow); + plugins.gulp.src([ + plugins.path.join(paths.cwd, "README.md"), + plugins.path.join(paths.distDir, "**/*.js") + ]) + .pipe(plugins.g.jsdoc3({ + opts: { + destination: paths.docsDir + } + }, function () { + plugins.beautylog.ok("JsDoc documentation has been generated!"); + done.resolve(configArg); + })); + return done.promise; +}; +exports.run = function (configArg) { + var done = plugins.Q.defer(); + genJsdoc(configArg) + .then(done.resolve); + return done.promise; +}; diff --git a/dist/ts/npmts.options.d.ts b/dist/ts/npmts.options.d.ts new file mode 100644 index 0000000..c5fdcc7 --- /dev/null +++ b/dist/ts/npmts.options.d.ts @@ -0,0 +1,5 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare let isCi: () => any; +export declare var run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/ts/npmts.options.js b/dist/ts/npmts.options.js new file mode 100644 index 0000000..57e0825 --- /dev/null +++ b/dist/ts/npmts.options.js @@ -0,0 +1,36 @@ +"use strict"; +require("typings-global"); +var plugins = require("./npmts.plugins"); +var npmts_promisechain_1 = require("./npmts.promisechain"); +exports.isCi = function () { + return plugins.smartci.check.isCi(); +}; +exports.run = function (configArg) { + var done = plugins.Q.defer(); + var config = configArg; + npmts_promisechain_1.npmtsOra.text("now determining build options..."); + //handle default mode + if (config.mode == "default") { + config.typings = [ + "./ts/typings.json" + ]; + config.ts = (_a = {}, + _a["./ts/**/*.ts"] = "./dist/", + _a + ); + config.testTs = (_b = {}, + _b["./test/test.ts"] = "./test/", + _b + ); + config.test = ["./index.js"]; + } + //check if config.tsOptions is available + config.tsOptions ? void (0) : config.tsOptions = {}; + config.coverageTreshold ? void (0) : config.coverageTreshold = 70; + // handle docs + config.docs ? void (0) : config.docs = {}; + plugins.beautylog.ok("build options are ready!"); + done.resolve(config); + return done.promise; + var _a, _b; +}; diff --git a/dist/ts/npmts.paths.d.ts b/dist/ts/npmts.paths.d.ts new file mode 100644 index 0000000..74d2da3 --- /dev/null +++ b/dist/ts/npmts.paths.d.ts @@ -0,0 +1,12 @@ +import "typings-global"; +export declare let npmtsPackageRoot: string; +export declare let cwd: string; +export declare let tsDir: string; +export declare let distDir: string; +export declare let docsDir: string; +export declare let testDir: string; +export declare let typingsDir: string; +export declare let coverageDir: string; +export declare let npmtsAssetsDir: string; +export declare let indexTS: string; +export declare let testTS: string; diff --git a/dist/ts/npmts.paths.js b/dist/ts/npmts.paths.js new file mode 100644 index 0000000..0b81540 --- /dev/null +++ b/dist/ts/npmts.paths.js @@ -0,0 +1,18 @@ +"use strict"; +require("typings-global"); +var plugins = require("./npmts.plugins"); +//Npmts Paths +exports.npmtsPackageRoot = plugins.path.join(__dirname, "../"); +//Project paths +exports.cwd = process.cwd(); +//Directories +exports.tsDir = plugins.path.join(exports.cwd, "ts/"); +exports.distDir = plugins.path.join(exports.cwd, "dist/"); +exports.docsDir = plugins.path.join(exports.cwd, "docs/"); +exports.testDir = plugins.path.join(exports.cwd, "test/"); +exports.typingsDir = plugins.path.join(exports.cwd, "ts/typings/"); +exports.coverageDir = plugins.path.join(exports.cwd, "coverage/"); +exports.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/"); +//Files +exports.indexTS = plugins.path.join(exports.cwd, "ts/index.ts"); +exports.testTS = plugins.path.join(exports.cwd, "ts/test.ts"); diff --git a/dist/ts/npmts.plugins.d.ts b/dist/ts/npmts.plugins.d.ts new file mode 100644 index 0000000..ab789fc --- /dev/null +++ b/dist/ts/npmts.plugins.d.ts @@ -0,0 +1,28 @@ +import "typings-global"; +export import beautylog = require("beautylog"); +export import fs = require("fs-extra"); +export declare let gulp: any; +export declare let g: { + gFunction: any; + istanbul: any; + jsdoc3: any; + mocha: any; + replace: any; + sourcemaps: any; + typescript: any; + typings: any; +}; +export declare let lodashObject: any; +export declare let merge2: any; +export import projectinfo = require("projectinfo"); +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 import smartcov = require("smartcov"); +export import smartenv = require("smartenv"); +export import smartfile = require("smartfile"); +export import smartpath = require("smartpath"); +export import smartstring = require("smartstring"); +export declare let sourceMapSupport: any; diff --git a/dist/ts/npmts.plugins.js b/dist/ts/npmts.plugins.js new file mode 100644 index 0000000..09fdf52 --- /dev/null +++ b/dist/ts/npmts.plugins.js @@ -0,0 +1,29 @@ +"use strict"; +require("typings-global"); +exports.beautylog = require("beautylog"); +exports.fs = require("fs-extra"); +exports.gulp = require("gulp"); +exports.g = { + gFunction: require("gulp-function"), + istanbul: require("gulp-istanbul"), + jsdoc3: require("gulp-jsdoc3"), + mocha: require("gulp-mocha"), + replace: require("gulp-replace"), + sourcemaps: require("gulp-sourcemaps"), + typescript: require("gulp-typescript"), + typings: require("gulp-typings") +}; +exports.lodashObject = require('lodash/fp/object'); +exports.merge2 = require("merge2"); +exports.projectinfo = require("projectinfo"); +exports.path = require("path"); +exports.Q = require("q"); +exports.shelljs = require("shelljs"); +exports.smartci = require("smartci"); +exports.smartcli = require("smartcli"); +exports.smartcov = require("smartcov"); +exports.smartenv = require("smartenv"); +exports.smartfile = require("smartfile"); +exports.smartpath = require("smartpath"); +exports.smartstring = require("smartstring"); +exports.sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing diff --git a/dist/ts/npmts.promisechain.js b/dist/ts/npmts.promisechain.js new file mode 100644 index 0000000..c26f714 --- /dev/null +++ b/dist/ts/npmts.promisechain.js @@ -0,0 +1,47 @@ +"use strict"; +require("typings-global"); +var plugins = require("./npmts.plugins"); +exports.npmtsOra = new plugins.beautylog.Ora("setting up TaskChain", "cyan"); +var NpmtsAssets = require("./npmts.assets"); +var NpmtsClean = require("./npmts.clean"); +var NpmtsCompile = require("./npmts.compile"); +var NpmtsConfigFile = require("./npmts.configfile"); +var NpmtsJsdoc = require("./npmts.jsdoc"); +var NpmtsOptions = require("./npmts.options"); +var NpmtsTests = require("./npmts.tests"); +exports.promisechain = function (argvArg) { + var done = plugins.Q.defer(); + exports.npmtsOra.start(); + NpmtsConfigFile.run(argvArg) + .then(NpmtsOptions.run) + .then(NpmtsClean.run) + .then(NpmtsCompile.run) + .then(NpmtsAssets.run) + .then(NpmtsJsdoc.run) + .then(NpmtsTests.run) + .then(function (configArg) { + var shipString = "" + + "\n" + + "\n" + + " # # ( )\n" + + " ___#_#___|__\n" + + " _ |____________| _\n" + + " _=====| | | | | |==== _\n" + + " =====| |.---------------------------. | |====\n" + + " <--------------------' . . . . . . . . '--------------/\n" + + " \\ /\n" + + " \\___________________________________________________________/\n" + + " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" + + " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" + + " wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n"; + if (process.env.CI) { + console.log(shipString); + plugins.beautylog.success("READY TO SHIP!"); + } + else { + plugins.beautylog.success("Done!"); + } + done.resolve(); + }); + return done.promise; +}; diff --git a/dist/ts/npmts.tests.d.ts b/dist/ts/npmts.tests.d.ts new file mode 100644 index 0000000..cc7c7a9 --- /dev/null +++ b/dist/ts/npmts.tests.d.ts @@ -0,0 +1,4 @@ +/// +import "typings-global"; +import plugins = require("./npmts.plugins"); +export declare let run: (configArg: any) => plugins.Q.Promise<{}>; diff --git a/dist/ts/npmts.tests.js b/dist/ts/npmts.tests.js new file mode 100644 index 0000000..c13542a --- /dev/null +++ b/dist/ts/npmts.tests.js @@ -0,0 +1,76 @@ +"use strict"; +require("typings-global"); +var plugins = require("./npmts.plugins"); +var paths = require("./npmts.paths"); +var npmts_promisechain_1 = require("./npmts.promisechain"); +/** + * + * @returns {*} + */ +var istanbul = function (configArg) { + npmts_promisechain_1.npmtsOra.text("Instrumentalizing transpiled JS..."); + var done = plugins.Q.defer(); + var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")]) + .pipe(plugins.g.istanbul()) // Covering files + .pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files + .pipe(plugins.g.gFunction(function () { + plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!"); + done.resolve(configArg); + }, "atEnd")); + return done.promise; +}; +/** + * + * @returns {*} + */ +var mocha = function (configArg) { + var done = plugins.Q.defer(); + npmts_promisechain_1.npmtsOra.end(); // end npmtsOra for tests. + var stream = plugins.gulp.src(["./test/test.js"]) + .pipe(plugins.g.mocha()) + .pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran + .pipe(plugins.g.gFunction(function () { + plugins.beautylog.ok("Tests have passed!"); + done.resolve(configArg); + }, "atEnd")); + return done.promise; +}; +var coverage = function (configArg) { + var done = plugins.Q.defer(); + plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, "lcov.info")) + .then(function (percentageArg) { + if (percentageArg >= configArg.coverageTreshold) { + plugins.beautylog.ok("your coverage of " + percentageArg.toString().blue + "% ".blue + "exceeds your treshold of " + + configArg.coverageTreshold.toString().blue + "%".blue); + } + else { + plugins.beautylog.warn("your coverage of " + percentageArg + "% " + "fails your treshold of " + + configArg.coverageTreshold + "%"); + plugins.beautylog.error("exiting due to coverage failure"); + process.exit(1); + } + done.resolve(configArg); + }); + return done.promise; +}; +exports.run = function (configArg) { + var done = plugins.Q.defer(); + var config = configArg; + if (config.notest != true) { + npmts_promisechain_1.npmtsOra.text("now starting tests"); + plugins.beautylog.log("-------------------------------------------------------\n" + + "*************************** TESTS: ***************************\n" + + "--------------------------------------------------------------"); + istanbul(config) + .then(mocha) + .then(coverage) + .then(function () { + done.resolve(config); + }); + } + else { + npmts_promisechain_1.npmtsOra.end(); + done.resolve(config); + } + return done.promise; +}; diff --git a/package.json b/package.json index cf626fd..a2afdfe 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "check": "(cd ./test/assets && node ../../dist/index.js)", "checkVersion": "cd ./test/assets && node ../../dist/index.js -v", "checkNoTest": "cd ./test/assets && node ../../dist/index.js --notest", - "compile": "(cd compile && node compile.js)" + "compile": "(tsc)" }, "repository": { "type": "git", @@ -28,10 +28,11 @@ }, "homepage": "https://gitlab.com/pushrocks/npmts#readme", "dependencies": { + "@types/minimatch": "^2.0.22-alpha", "@types/q": "0.0.21-alpha", - "beautylog": "5.0.11", + "@types/shelljs": "^0.3.21-alpha", + "beautylog": "5.0.12", "early": "^2.0.13", - "fs-extra": "^0.30.0", "gulp": "3.9.1", "gulp-concat": "^2.6.0", "gulp-function": "^1.3.6", @@ -46,13 +47,15 @@ "q": "^1.4.1", "shelljs": "^0.7.0", "smartci": "0.0.1", - "smartcli": "1.0.2", + "smartcli": "1.0.4", "smartcov": "0.0.6", "smartenv": "1.2.5", - "smartfile": "3.0.10", + "smartfile": "4.0.9", "smartpath": "3.2.2", - "smartstring": "^2.0.6", - "source-map-support": "^0.4.0", + "smartstring": "^2.0.10", + "source-map-support": "^0.4.1", + "tsn": "^1.0.1", + "typescript": "^2.0.0-dev.20160630", "typings-global": "*" }, "devDependencies": {} diff --git a/test/assets/custom.js b/test/assets/custom.js deleted file mode 100644 index 0c1d4b1..0000000 --- a/test/assets/custom.js +++ /dev/null @@ -1,3 +0,0 @@ -var hello = "hello"; - -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1c3RvbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxJQUFJLEtBQUssR0FBRyxPQUFPLENBQUMiLCJmaWxlIjoiY3VzdG9tLmpzIiwic291cmNlc0NvbnRlbnQiOlsidmFyIGhlbGxvID0gXCJoZWxsb1wiOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ== diff --git a/test/assets/customdir/custom.js b/test/assets/customdir/custom.js deleted file mode 100644 index 5c546bf..0000000 --- a/test/assets/customdir/custom.js +++ /dev/null @@ -1,2 +0,0 @@ -var hello = "hello"; -//# sourceMappingURL=custom.js.map \ No newline at end of file diff --git a/test/assets/customdir/custom.js.map b/test/assets/customdir/custom.js.map deleted file mode 100644 index 4fd50d4..0000000 --- a/test/assets/customdir/custom.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"custom.js","sourceRoot":"","sources":["custom.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,OAAO,CAAC"} \ No newline at end of file diff --git a/test/assets/customdir/custom.ts b/test/assets/customdir/custom.ts deleted file mode 100644 index 1f87661..0000000 --- a/test/assets/customdir/custom.ts +++ /dev/null @@ -1 +0,0 @@ -var hello = "hello"; \ No newline at end of file diff --git a/test/assets/customdir/tsfile1.js b/test/assets/customdir/tsfile1.js deleted file mode 100644 index bc470e4..0000000 --- a/test/assets/customdir/tsfile1.js +++ /dev/null @@ -1,2 +0,0 @@ -var something = "something"; -//# sourceMappingURL=tsfile1.js.map \ No newline at end of file diff --git a/test/assets/customdir/tsfile1.js.map b/test/assets/customdir/tsfile1.js.map deleted file mode 100644 index 09c3513..0000000 --- a/test/assets/customdir/tsfile1.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tsfile1.js","sourceRoot":"","sources":["tsfile1.ts"],"names":[],"mappings":"AAAA,IAAI,SAAS,GAAG,WAAW,CAAC"} \ No newline at end of file diff --git a/test/assets/customdir/tsfile1.ts b/test/assets/customdir/tsfile1.ts deleted file mode 100644 index 148c545..0000000 --- a/test/assets/customdir/tsfile1.ts +++ /dev/null @@ -1 +0,0 @@ -var something = "something"; \ No newline at end of file diff --git a/test/assets/customdir/typings.json b/test/assets/customdir/typings.json deleted file mode 100644 index fd6d68d..0000000 --- a/test/assets/customdir/typings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ambientDependencies": { - "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777", - "colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d", - "vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777" - } -} diff --git a/test/assets/dist/index.js b/test/assets/dist/index.js deleted file mode 100644 index d61be91..0000000 --- a/test/assets/dist/index.js +++ /dev/null @@ -1,9 +0,0 @@ -/// -var testplugin = { - logSomething: function () { - console.log("only function executed"); - } -}; -module.exports = testplugin; - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZDQUE2QztBQUM3QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9pbmRleC5kLnRzXCIgLz5cbmxldCB0ZXN0cGx1Z2luID0ge1xuICAgIGxvZ1NvbWV0aGluZzogZnVuY3Rpb24oKXtcbiAgICAgICAgY29uc29sZS5sb2coXCJvbmx5IGZ1bmN0aW9uIGV4ZWN1dGVkXCIpO1xuICAgIH1cbn07XG5tb2R1bGUuZXhwb3J0cyA9IHRlc3RwbHVnaW47Il19 diff --git a/test/assets/npmts.json b/test/assets/npmts.json deleted file mode 100644 index fc3a41b..0000000 --- a/test/assets/npmts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "mode":"default", - "ts":{ - "./customdir/*.ts":"./" - }, - "tsOptions":{ - "target":"ES5" - }, - "typings":[ - "./ts/typings.json", - "./subts1/typings.json", - "./subts2/typings.json", - "./customdir/typings.json" - ], - "docs": { - "publish":true - }, - "cli":true -} \ No newline at end of file diff --git a/test/assets/package.json b/test/assets/package.json deleted file mode 100644 index f15f90c..0000000 --- a/test/assets/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "testpackage", - "version": "2.0.0", - "description": "", - "main": "index.js", - "repository": { - "type": "git", - "url": "git+https://github.com/pushrocks/npmts.git" - }, - "scripts": { - "test": "(npmts)" - }, - "author": "", - "license": "ISC", - "dependencies": {} -} diff --git a/test/assets/subts1/typings.json b/test/assets/subts1/typings.json deleted file mode 100644 index fd6d68d..0000000 --- a/test/assets/subts1/typings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ambientDependencies": { - "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777", - "colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d", - "vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777" - } -} diff --git a/test/assets/test/.DS_Store b/test/assets/test/.DS_Store deleted file mode 100644 index e6a4138..0000000 Binary files a/test/assets/test/.DS_Store and /dev/null differ diff --git a/test/assets/test/test.d.ts b/test/assets/test/test.d.ts deleted file mode 100644 index 44f78f9..0000000 --- a/test/assets/test/test.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -declare var testplugin: any; diff --git a/test/assets/test/test.js b/test/assets/test/test.js deleted file mode 100644 index 9844262..0000000 --- a/test/assets/test/test.js +++ /dev/null @@ -1,11 +0,0 @@ -/// -var testplugin = require("../dist/index.js"); -describe("testplugins", function () { - describe(".logSomething", function () { - it("should log something", function () { - testplugin.logSomething(); - }); - }); -}); - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsaURBQWlEO0FBQ2pELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvaW5kZXguZC50c1wiIC8+XG52YXIgdGVzdHBsdWdpbiA9IHJlcXVpcmUoXCIuLi9kaXN0L2luZGV4LmpzXCIpO1xuZGVzY3JpYmUoXCJ0ZXN0cGx1Z2luc1wiLGZ1bmN0aW9uKCl7XG4gICAgZGVzY3JpYmUoXCIubG9nU29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgaXQoXCJzaG91bGQgbG9nIHNvbWV0aGluZ1wiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICB0ZXN0cGx1Z2luLmxvZ1NvbWV0aGluZygpXG4gICAgICAgIH0pO1xuICAgIH0pO1xufSk7Il19 diff --git a/test/assets/test/test.ts b/test/assets/test/test.ts deleted file mode 100644 index 6960cd4..0000000 --- a/test/assets/test/test.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -var testplugin = require("../dist/index.js"); -describe("testplugins",function(){ - describe(".logSomething",function(){ - it("should log something",function(){ - testplugin.logSomething() - }); - }); -}); \ No newline at end of file diff --git a/test/assets/test/typings.json b/test/assets/test/typings.json deleted file mode 100644 index 0b06944..0000000 --- a/test/assets/test/typings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "ambientDependencies": { - "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777", - - "colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d", - "vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777" - } -} diff --git a/test/assets/ts/index.ts b/test/assets/ts/index.ts deleted file mode 100644 index 71a4f99..0000000 --- a/test/assets/ts/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -let testplugin = { - logSomething: function(){ - console.log("only function executed"); - } -}; -module.exports = testplugin; \ No newline at end of file diff --git a/test/assets/ts/typings.json b/test/assets/ts/typings.json deleted file mode 100644 index 4c1dd63..0000000 --- a/test/assets/ts/typings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "globalDependencies": { - "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts", - "mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts", - "colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts", - "vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts" - } -} diff --git a/test/assets/tsfile1.js b/test/assets/tsfile1.js deleted file mode 100644 index d618d8f..0000000 --- a/test/assets/tsfile1.js +++ /dev/null @@ -1,3 +0,0 @@ -var something = "something"; - -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRzZmlsZTEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBSSxTQUFTLEdBQUcsV0FBVyxDQUFDIiwiZmlsZSI6InRzZmlsZTEuanMiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgc29tZXRoaW5nID0gXCJzb21ldGhpbmdcIjsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0= diff --git a/ts/npmts.assets.ts b/ts/npmts.assets.ts index 79b53bc..9010578 100644 --- a/ts/npmts.assets.ts +++ b/ts/npmts.assets.ts @@ -8,7 +8,7 @@ export var run = function(configArg){ let config = configArg; npmtsOra.text("now looking at " + "required assets".yellow); if(config.cli == true){ - plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir); + plugins.smartfile.fs.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir); plugins.beautylog.ok("installed CLI assets!"); done.resolve(config); } else { diff --git a/ts/npmts.clean.ts b/ts/npmts.clean.ts index f1d63bb..62b2f4a 100644 --- a/ts/npmts.clean.ts +++ b/ts/npmts.clean.ts @@ -5,7 +5,7 @@ import {npmtsOra} from "./npmts.promisechain"; let removeDist = function(){ npmtsOra.text("cleaning " + "dist".yellow + " folder"); - return plugins.smartfile.fsaction.remove(paths.distDir); + return plugins.smartfile.fs.remove(paths.distDir); }; let removeTypings = function(){ diff --git a/ts/npmts.compile.ts b/ts/npmts.compile.ts index 87fad49..d1955b2 100644 --- a/ts/npmts.compile.ts +++ b/ts/npmts.compile.ts @@ -21,7 +21,8 @@ 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/**"]); + let filesToConvert = plugins.smartfile.fs.listFileTree(plugins.path.resolve(keyArg),"**/*.ts"); + plugins.tsn.compile(filesToConvert,tsFileArrayArg[keyArg]); } } return done.promise; diff --git a/ts/npmts.configfile.ts b/ts/npmts.configfile.ts index 4dff988..a396481 100644 --- a/ts/npmts.configfile.ts +++ b/ts/npmts.configfile.ts @@ -8,11 +8,11 @@ export var run = function(argvArg){ if(argvArg.notest){ config.notest = true; } - if(plugins.smartfile.checks.fileExistsSync(configPath)){ + if(plugins.smartfile.fs.fileExistsSync(configPath)){ plugins.beautylog.info("npmts.json".blue + " config file found!"); config = plugins.lodashObject.assign( config, - plugins.smartfile.local.toObjectSync(configPath) + plugins.smartfile.fs.toObjectSync(configPath) ); switch (config.mode){ case "default": diff --git a/ts/npmts.plugins.ts b/ts/npmts.plugins.ts index bef3eb9..8d42322 100644 --- a/ts/npmts.plugins.ts +++ b/ts/npmts.plugins.ts @@ -1,17 +1,12 @@ import "typings-global"; export import beautylog = require("beautylog"); -export import fs = require("fs-extra"); export let gulp = require("gulp"); export let g = { gFunction: require("gulp-function"), istanbul: require("gulp-istanbul"), jsdoc3: require("gulp-jsdoc3"), mocha: require("gulp-mocha"), - replace: require("gulp-replace"), - sourcemaps: require("gulp-sourcemaps"), - typescript: require("gulp-typescript"), - typings: require("gulp-typings") - + replace: require("gulp-replace") }; export let lodashObject = require('lodash/fp/object'); export let merge2 = require("merge2"); @@ -19,11 +14,12 @@ export import projectinfo = require("projectinfo"); export import path = require("path"); export import Q = require("q"); export import shelljs = require("shelljs"); -export import smartci = require("smartci"); +export let smartci = require("smartci"); export import smartcli = require("smartcli"); -export import smartcov = require("smartcov"); +export let smartcov = require("smartcov"); export import smartenv = require("smartenv"); export import smartfile = require("smartfile"); export import smartpath = require("smartpath"); export import smartstring = require("smartstring"); -export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing \ No newline at end of file +export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing +export import tsn = require("tsn"); \ No newline at end of file diff --git a/ts/npmts.promisechain.ts b/ts/npmts.promisechain.ts index b6df9d6..0042208 100644 --- a/ts/npmts.promisechain.ts +++ b/ts/npmts.promisechain.ts @@ -1,5 +1,6 @@ import "typings-global"; import plugins = require("./npmts.plugins"); +import {Ora} from "beautylog" export let npmtsOra = new plugins.beautylog.Ora("setting up TaskChain","cyan"); diff --git a/ts/typings.json b/ts/typings.json deleted file mode 100644 index bdef787..0000000 --- a/ts/typings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "globalDependencies": { - "colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d", - "istanbul": "registry:dt/istanbul#0.4.0+20160316155526", - "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777", - "vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777" - } -} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..43e1781 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "declaration": true, + "module": "commonjs", + "target": "ES5", + "outDir": "./dist/" + } +} \ No newline at end of file