ready for primetime
This commit is contained in:
parent
fcd2616a3c
commit
b80c1f9090
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,13 +1,4 @@
|
||||
.idea/
|
||||
.c9/
|
||||
node_modules/
|
||||
test/assets/**/node_modules/
|
||||
test/assets/**/docs/
|
||||
test/assets/**/typings/
|
||||
test/assets/**/coverage/
|
||||
ts/*.js
|
||||
ts/*.js.map
|
||||
ts/typings/
|
||||
test/
|
||||
docs/
|
||||
|
||||
.DS_Store
|
@ -37,8 +37,7 @@ Then add it to your package.json's script section to trigger a build:
|
||||
1. Check config in ./npmts.json
|
||||
1. Clean up from any previous builds (old js files)
|
||||
1. Install typings
|
||||
1. Transpile TypeScript with inline sourcemaps
|
||||
1. Create Declaration Files
|
||||
1. Transpile TypeScript with **inline sourcemaps** and **declaration files**
|
||||
1. Create JsDoc Documentation
|
||||
1. Instrumentalize created JavaScript files with istanbul
|
||||
1. Run Tests
|
||||
|
@ -1 +0,0 @@
|
||||
#!/usr/bin/env node
|
2
dist/cli.js
vendored
Normal file
2
dist/cli.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
var index = require("./index.js");
|
26
dist/npmts.compile.js
vendored
26
dist/npmts.compile.js
vendored
@ -3,6 +3,7 @@ require("typings-global");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var helpers = require("./npmts.compile.helpers");
|
||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||
var promiseArray = [];
|
||||
var compileTs = function (tsFileArrayArg, tsOptionsArg) {
|
||||
if (tsOptionsArg === void 0) { tsOptionsArg = {}; }
|
||||
var done = plugins.Q.defer();
|
||||
@ -17,12 +18,25 @@ var compileTs = function (tsFileArrayArg, tsOptionsArg) {
|
||||
var tsOptions = function (keyArg) {
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg);
|
||||
};
|
||||
for (var keyArg in tsFileArrayArg) {
|
||||
var _loop_1 = function(keyArg) {
|
||||
plugins.beautylog.info("TypeScript assignment: transpile from " + keyArg.blue + " to " + tsFileArrayArg[keyArg].blue);
|
||||
if (helpers.checkOutputPath(tsFileArrayArg, keyArg)) {
|
||||
var filesToConvert = plugins.smartfile.fs.listFileTree(plugins.path.resolve(keyArg), "**/*.ts");
|
||||
plugins.tsn.compile(filesToConvert, tsFileArrayArg[keyArg]);
|
||||
var filesReadPromise = plugins.smartfile.fs.listFileTree(process.cwd(), keyArg)
|
||||
.then(function (filesToConvertArg) {
|
||||
var filesToConvertAbsolute = plugins.smartpath.transform.toAbsolute(filesToConvertArg, process.cwd());
|
||||
var destDir = plugins.smartpath.transform.toAbsolute(tsFileArrayArg[keyArg], process.cwd());
|
||||
var filesCompiledPromise = plugins.tsn.compile(filesToConvertAbsolute, destDir);
|
||||
promiseArray.push(filesCompiledPromise);
|
||||
});
|
||||
promiseArray.push(filesReadPromise);
|
||||
}
|
||||
};
|
||||
for (var keyArg in tsFileArrayArg) {
|
||||
_loop_1(keyArg);
|
||||
}
|
||||
;
|
||||
plugins.Q.all(promiseArray)
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
@ -31,10 +45,12 @@ exports.run = function (configArg) {
|
||||
npmts_promisechain_1.npmtsOra.text("now compiling " + "TypeScript".yellow);
|
||||
compileTs(config.ts, config.tsOptions)
|
||||
.then(function () {
|
||||
compileTs(config.testTs);
|
||||
plugins.beautylog.ok("compiled main TypeScript!");
|
||||
plugins.beautylog.log("now compiling tests!");
|
||||
return compileTs(config.testTs);
|
||||
})
|
||||
.then(function () {
|
||||
plugins.beautylog.ok("compiled TypeScript!");
|
||||
plugins.beautylog.ok("compiled all TypeScript!");
|
||||
done.resolve(config);
|
||||
});
|
||||
return done.promise;
|
||||
|
14
package.json
14
package.json
@ -7,11 +7,13 @@
|
||||
"npmts": "dist/cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(npm run compile && npm run check && npm run checkVersion && npm run checkNoTest)",
|
||||
"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": "(tsc)"
|
||||
"test": "(npm run compile && npm run setupCheck && npm run check && npm run checkVersion && npm run checkNoTest)",
|
||||
"compile": "(rm -rf test/ && rm -r dist/ && mkdir dist/ && tsc && cp assets/cli.js dist/ )",
|
||||
"setupCheck":"(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)",
|
||||
"check": "(cd test && node ../dist/index.js)",
|
||||
"checkVersion": "(cd test/ && node ../dist/index.js -v)",
|
||||
"checkNoTest": "(cd test && node ../dist/index.js --notest)",
|
||||
"install":"(mkdir test/)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -54,7 +56,7 @@
|
||||
"smartpath": "3.2.2",
|
||||
"smartstring": "^2.0.10",
|
||||
"source-map-support": "^0.4.1",
|
||||
"tsn": "^1.0.1",
|
||||
"tsn": "^1.0.3",
|
||||
"typescript": "^2.0.0-dev.20160630",
|
||||
"typings-global": "*"
|
||||
},
|
||||
|
@ -4,7 +4,8 @@ import paths = require("./npmts.paths");
|
||||
import helpers = require("./npmts.compile.helpers");
|
||||
import {npmtsOra} from "./npmts.promisechain";
|
||||
|
||||
let compileTs = (tsFileArrayArg,tsOptionsArg = {}) => {
|
||||
let promiseArray = [];
|
||||
let compileTs = (tsFileArrayArg:string[],tsOptionsArg = {}) => {
|
||||
let done = plugins.Q.defer();
|
||||
|
||||
let tsOptionsDefault = {
|
||||
@ -20,11 +21,23 @@ let compileTs = (tsFileArrayArg,tsOptionsArg = {}) => {
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg)
|
||||
};
|
||||
for (let keyArg in tsFileArrayArg) {
|
||||
plugins.beautylog.info(`TypeScript assignment: transpile from ${keyArg.blue} to ${tsFileArrayArg[keyArg].blue}`);
|
||||
if (helpers.checkOutputPath(tsFileArrayArg,keyArg)) {
|
||||
let filesToConvert = plugins.smartfile.fs.listFileTree(plugins.path.resolve(keyArg),"**/*.ts");
|
||||
plugins.tsn.compile(filesToConvert,tsFileArrayArg[keyArg]);
|
||||
}
|
||||
let filesReadPromise = plugins.smartfile.fs.listFileTree(process.cwd(),keyArg)
|
||||
.then((filesToConvertArg) => {
|
||||
let filesToConvertAbsolute = plugins.smartpath.transform.toAbsolute(filesToConvertArg,process.cwd());
|
||||
let destDir = plugins.smartpath.transform.toAbsolute(tsFileArrayArg[keyArg],process.cwd());
|
||||
let filesCompiledPromise = plugins.tsn.compile(
|
||||
filesToConvertAbsolute,
|
||||
destDir
|
||||
);
|
||||
promiseArray.push(filesCompiledPromise);
|
||||
});
|
||||
promiseArray.push(filesReadPromise);
|
||||
}
|
||||
};
|
||||
plugins.Q.all(promiseArray)
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
@ -36,12 +49,13 @@ export let run = function (configArg) {
|
||||
|
||||
compileTs(config.ts,config.tsOptions)
|
||||
.then(() => {
|
||||
compileTs(config.testTs);
|
||||
plugins.beautylog.ok("compiled main TypeScript!");
|
||||
plugins.beautylog.log("now compiling tests!");
|
||||
return compileTs(config.testTs);
|
||||
})
|
||||
.then(function () {
|
||||
plugins.beautylog.ok("compiled TypeScript!");
|
||||
plugins.beautylog.ok("compiled all TypeScript!");
|
||||
done.resolve(config);
|
||||
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user