Compare commits

...

4 Commits

Author SHA1 Message Date
851653a6ae 5.4.42 2016-09-29 16:19:59 +02:00
9229cd79dd fix tsn issue 2016-09-29 16:19:49 +02:00
86fb639c82 5.4.41 2016-09-29 00:19:56 +02:00
d536e6aa8c improve test compilation 2016-09-29 00:19:46 +02:00
16 changed files with 56 additions and 77 deletions

18
dist/npmts.clean.js vendored
View File

@ -3,10 +3,27 @@ require("typings-global");
const plugins = require("./npmts.plugins"); const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths"); const paths = require("./npmts.paths");
const npmts_promisechain_1 = require("./npmts.promisechain"); const npmts_promisechain_1 = require("./npmts.promisechain");
/**
* removes the dist directory which will be entirely rebuild
*/
let removeDist = function () { let removeDist = function () {
npmts_promisechain_1.npmtsOra.text('cleaning dist folder'); npmts_promisechain_1.npmtsOra.text('cleaning dist folder');
return plugins.smartfile.fs.remove(paths.distDir); return plugins.smartfile.fs.remove(paths.distDir);
}; };
/**
* remove .d.ts files from testDirctory
*/
let removeTestDeclarations = function () {
let done = plugins.q.defer();
plugins.smartfile.fs.listFileTree('./test/', '**/*.d.ts').then(fileArray => {
let fileArrayToRemove = plugins.smartpath.transform.toAbsolute(fileArray, process.cwd() + '//test/');
plugins.smartfile.fs.removeManySync(fileArrayToRemove);
done.resolve();
});
};
/**
* remove old pages
*/
let removePages = function () { let removePages = function () {
npmts_promisechain_1.npmtsOra.text('cleaning pages folder'); npmts_promisechain_1.npmtsOra.text('cleaning pages folder');
return plugins.smartfile.fs.remove(paths.pagesDir); return plugins.smartfile.fs.remove(paths.pagesDir);
@ -15,6 +32,7 @@ exports.run = function (configArg) {
npmts_promisechain_1.npmtsOra.text('cleaning up from previous builds...'); npmts_promisechain_1.npmtsOra.text('cleaning up from previous builds...');
let done = plugins.q.defer(); let done = plugins.q.defer();
removeDist() removeDist()
.then(removeTestDeclarations)
.then(removePages) .then(removePages)
.then(function () { .then(function () {
plugins.beautylog.ok('Cleaned up from previous builds!'); plugins.beautylog.ok('Cleaned up from previous builds!');

View File

@ -11,11 +11,11 @@ exports.run = function (configArg) {
.then(() => { .then(() => {
plugins.beautylog.ok('compiled main TypeScript!'); plugins.beautylog.ok('compiled main TypeScript!');
plugins.beautylog.log('now compiling tests!'); plugins.beautylog.log('now compiling tests!');
return plugins.tsn.compileGlobStringObject(config.testTs); return plugins.tsn.compileGlobStringObject(config.testTs, config.tsOptions, paths.cwd);
}) })
.then(function () { .then(function () {
plugins.beautylog.ok('compiled all TypeScript!'); plugins.beautylog.ok('compiled all TypeScript!');
done.resolve(config); done.resolve(config);
}); }).catch(err => { console.log(err); });
return done.promise; return done.promise;
}; };

View File

@ -38,10 +38,10 @@ exports.run = function (argvArg) {
// handle default mode // handle default mode
if (config.mode === 'default') { if (config.mode === 'default') {
config.ts = { config.ts = {
['./ts/**/*.ts']: './dist/' './ts/**/*.ts': './dist/'
}; };
config.testTs = { config.testTs = {
['./test/test.ts']: './test/' './test/**/*.ts': './test/'
}; };
} }
; ;

1
dist/npmts.tests.js vendored
View File

@ -39,7 +39,6 @@ let mocha = function (configArg) {
localSmartstream.run() localSmartstream.run()
.then(() => { done.resolve(configArg); }, (err) => { .then(() => { done.resolve(configArg); }, (err) => {
plugins.beautylog.error('Tests failed!'); plugins.beautylog.error('Tests failed!');
configArg.watch = true;
if (configArg.watch) { if (configArg.watch) {
done.resolve(configArg); done.resolve(configArg);
} }

View File

@ -1,15 +0,0 @@
{
"structure": {
"readme": "index.md"
},
"plugins": [
"tonic",
"edit-link"
],
"pluginsConfig": {
"edit-link": {
"base": "https://gitlab.com/pushrocks/npmts/edit/master/docs/",
"label": "Edit on GitLab"
}
}
}

View File

@ -1,42 +0,0 @@
# npmts
Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.
## Availabililty
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmts)
[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/npmts)
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/npmts)
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/npmts/gitbook)
## Status for master
[![build status](https://gitlab.com/pushrocks/npmts/badges/master/build.svg)](https://gitlab.com/pushrocks/npmts/commits/master)
[![coverage report](https://gitlab.com/pushrocks/npmts/badges/master/coverage.svg)](https://gitlab.com/pushrocks/npmts/commits/master)
[![Dependency Status](https://david-dm.org/pushrocks/npmts.svg)](https://david-dm.org/pushrocks/npmts)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/npmts/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/npmts/badges/code.svg)](https://www.bithound.io/github/pushrocks/npmts)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Introduction
NPMTS is your friend when writing, testing, publishing and documenting npm modules written in TypeScript.
npmts will
1. check your dependencies and package.json
1. transpile your code with tsc,
1. document your code with typedoc,
1. test your code with mocha
1. create coverage with istanbul
This works on your machine and in CI. There is a prebuild docker image available that includes npmts to make CI a breeze:
[hosttoday/ht-docker-node:npmts on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-node/)
For further information read the docs:
* [1. Intro](https://pushrocks.gitlab.io/npmts/gitbook/index.md)
* [2. Install](https://pushrocks.gitlab.io/npmts/gitbook/install.md)
* [3. Default Behaviour](https://pushrocks.gitlab.io/npmts/gitbook/default.md)
* [4. Configuration](https://pushrocks.gitlab.io/npmts/gitbook/config.md)
* [5. Examples](https://pushrocks.gitlab.io/npmts/gitbook/examples.md)
* [6. Info](https://pushrocks.gitlab.io/npmts/gitbook/info.md)
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)

View File

@ -1,6 +1,6 @@
{ {
"name": "npmts", "name": "npmts",
"version": "5.4.40", "version": "5.4.42",
"description": "Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.", "description": "Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {
@ -38,7 +38,7 @@
"@types/minimatch": "^2.0.29", "@types/minimatch": "^2.0.29",
"@types/q": "^0.x.x", "@types/q": "^0.x.x",
"@types/shelljs": "^0.3.31", "@types/shelljs": "^0.3.31",
"babel-preset-es2015": "^6.14.0", "babel-preset-es2015": "^6.16.0",
"beautylog": "5.0.23", "beautylog": "5.0.23",
"depcheck": "^0.6.4", "depcheck": "^0.6.4",
"early": "^2.0.35", "early": "^2.0.35",
@ -50,7 +50,7 @@
"gulp-mocha": "^3.0.1", "gulp-mocha": "^3.0.1",
"gulp-sourcemaps": "^1.6.0", "gulp-sourcemaps": "^1.6.0",
"gulp-typedoc": "^2.0.0", "gulp-typedoc": "^2.0.0",
"lodash": "^4.16.1", "lodash": "^4.16.2",
"npmextra": "^2.0.3", "npmextra": "^2.0.3",
"projectinfo": "1.0.3", "projectinfo": "1.0.3",
"q": "^1.4.1", "q": "^1.4.1",
@ -59,12 +59,12 @@
"smartcli": "1.0.9", "smartcli": "1.0.9",
"smartcov": "1.0.0", "smartcov": "1.0.0",
"smartenv": "1.2.5", "smartenv": "1.2.5",
"smartfile": "4.0.21", "smartfile": "4.0.22",
"smartpath": "3.2.2", "smartpath": "3.2.2",
"smartstream": "^1.0.5", "smartstream": "^1.0.5",
"smartstring": "^2.0.17", "smartstring": "^2.0.17",
"source-map-support": "^0.4.2", "source-map-support": "^0.4.3",
"tsn": "^2.0.3", "tsn": "^2.0.4",
"typedoc": "^0.4.5", "typedoc": "^0.4.5",
"typescript": "next", "typescript": "next",
"typings-global": "^1.0.14" "typings-global": "^1.0.14"

View File

@ -1,24 +1,43 @@
import 'typings-global' import 'typings-global'
import plugins = require('./npmts.plugins') import plugins = require('./npmts.plugins')
import paths = require('./npmts.paths') import paths = require('./npmts.paths')
import {npmtsOra} from './npmts.promisechain' import { npmtsOra } from './npmts.promisechain'
let removeDist = function(){ /**
* removes the dist directory which will be entirely rebuild
*/
let removeDist = function () {
npmtsOra.text('cleaning dist folder') npmtsOra.text('cleaning dist folder')
return plugins.smartfile.fs.remove(paths.distDir) return plugins.smartfile.fs.remove(paths.distDir)
} }
let removePages = function(){ /**
* remove .d.ts files from testDirctory
*/
let removeTestDeclarations = function () {
let done = plugins.q.defer()
plugins.smartfile.fs.listFileTree('./test/', '**/*.d.ts').then(fileArray => {
let fileArrayToRemove = plugins.smartpath.transform.toAbsolute(fileArray, process.cwd() + '//test/')
plugins.smartfile.fs.removeManySync(fileArrayToRemove)
done.resolve()
})
}
/**
* remove old pages
*/
let removePages = function () {
npmtsOra.text('cleaning pages folder') npmtsOra.text('cleaning pages folder')
return plugins.smartfile.fs.remove(paths.pagesDir) return plugins.smartfile.fs.remove(paths.pagesDir)
} }
export let run = function(configArg){ export let run = function (configArg) {
npmtsOra.text('cleaning up from previous builds...') npmtsOra.text('cleaning up from previous builds...')
let done = plugins.q.defer() let done = plugins.q.defer()
removeDist() removeDist()
.then(removeTestDeclarations)
.then(removePages) .then(removePages)
.then(function(){ .then(function () {
plugins.beautylog.ok('Cleaned up from previous builds!') plugins.beautylog.ok('Cleaned up from previous builds!')
done.resolve(configArg) done.resolve(configArg)
}) })

View File

@ -11,11 +11,11 @@ export let run = function (configArg) {
.then(() => { .then(() => {
plugins.beautylog.ok('compiled main TypeScript!') plugins.beautylog.ok('compiled main TypeScript!')
plugins.beautylog.log('now compiling tests!') plugins.beautylog.log('now compiling tests!')
return plugins.tsn.compileGlobStringObject(config.testTs) return plugins.tsn.compileGlobStringObject(config.testTs,config.tsOptions,paths.cwd)
}) })
.then(function () { .then(function () {
plugins.beautylog.ok('compiled all TypeScript!') plugins.beautylog.ok('compiled all TypeScript!')
done.resolve(config) done.resolve(config)
}) }).catch(err => { console.log(err) })
return done.promise return done.promise
} }

View File

@ -59,10 +59,10 @@ export var run = function (argvArg) {
// handle default mode // handle default mode
if (config.mode === 'default') { if (config.mode === 'default') {
config.ts = { config.ts = {
['./ts/**/*.ts']: './dist/' './ts/**/*.ts': './dist/'
} }
config.testTs = { config.testTs = {
['./test/test.ts']: './test/' './test/**/*.ts': './test/'
} }
}; };