upgrade to newest tsn
This commit is contained in:
@ -34,7 +34,7 @@ const depcheckOptions = {
|
||||
|
||||
let checkDependencies = (configArg) => {
|
||||
let done = plugins.Q.defer()
|
||||
let depcheckOptionsMerged = plugins.lodashObject.merge(depcheckOptions, {
|
||||
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
|
||||
ignoreDirs: [ // folder with these names will be ignored
|
||||
'test',
|
||||
'dist',
|
||||
@ -69,7 +69,7 @@ let checkDependencies = (configArg) => {
|
||||
|
||||
let checkDevDependencies = (configArg) => {
|
||||
let done = plugins.Q.defer()
|
||||
let depcheckOptionsMerged = plugins.lodashObject.merge(depcheckOptions, {
|
||||
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
|
||||
ignoreDirs: [ // folder with these names will be ignored
|
||||
'ts',
|
||||
'dist',
|
||||
|
@ -1,15 +0,0 @@
|
||||
import plugins = require('./npmts.plugins')
|
||||
import paths = require('./npmts.paths')
|
||||
|
||||
let outputPathIsDir = function (tsArrayArg,keyArg) {
|
||||
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, tsArrayArg[keyArg]))
|
||||
}
|
||||
|
||||
export let 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
|
||||
};
|
||||
}
|
@ -1,62 +1,17 @@
|
||||
import 'typings-global'
|
||||
import plugins = require('./npmts.plugins')
|
||||
import paths = require('./npmts.paths')
|
||||
import helpers = require('./npmts.compile.helpers')
|
||||
import {npmtsOra} from './npmts.promisechain'
|
||||
|
||||
let compileTs = (tsFileArrayArg: string[],tsOptionsArg = {}) => {
|
||||
let done = plugins.Q.defer()
|
||||
|
||||
let compilerOptionsDefault = {
|
||||
declaration: true,
|
||||
module: 'CommonJS',
|
||||
target: 'ES6'
|
||||
}
|
||||
|
||||
/**
|
||||
* merges default ts options with those found in npmts.json
|
||||
*/
|
||||
let compilerOptions = function (keyArg: string) {
|
||||
let tsOptionsCombined = plugins.lodashObject.merge(compilerOptionsDefault, tsOptionsArg)
|
||||
let compilerOptions: plugins.tsn.CompilerOptions = {
|
||||
declaration: tsOptionsCombined.declaration,
|
||||
module: plugins.tsn.ModuleKind[tsOptionsCombined.module],
|
||||
target: plugins.tsn.ScriptTarget[tsOptionsCombined.target],
|
||||
exclude: 'node_modules/**/*'
|
||||
}
|
||||
return compilerOptions
|
||||
}
|
||||
for (let keyArg in tsFileArrayArg) {
|
||||
plugins.beautylog.info(`TypeScript assignment: transpile from ${keyArg.blue} to ${tsFileArrayArg[keyArg].blue}`)
|
||||
if (helpers.checkOutputPath(tsFileArrayArg,keyArg)) {
|
||||
plugins.smartfile.fs.listFileTree(process.cwd(),keyArg)
|
||||
.then((filesToConvertArg: string[]) => {
|
||||
let filesToConvertAbsolute = plugins.smartpath.transform.toAbsolute(filesToConvertArg,process.cwd())
|
||||
let destDir = plugins.smartpath.transform.toAbsolute(tsFileArrayArg[keyArg],process.cwd())
|
||||
return plugins.tsn.compile(
|
||||
filesToConvertAbsolute,
|
||||
destDir,
|
||||
compilerOptions(keyArg)
|
||||
)
|
||||
})
|
||||
.then(() => {
|
||||
done.resolve()
|
||||
})
|
||||
}
|
||||
}
|
||||
return done.promise
|
||||
}
|
||||
|
||||
export let run = function (configArg) {
|
||||
let done = plugins.Q.defer()
|
||||
let config = configArg
|
||||
npmtsOra.text('now compiling ' + 'TypeScript'.yellow)
|
||||
|
||||
compileTs(config.ts,config.tsOptions)
|
||||
plugins.tsn.compileGlobStringObject(config.ts,config.tsOptions,paths.cwd)
|
||||
.then(() => {
|
||||
plugins.beautylog.ok('compiled main TypeScript!')
|
||||
plugins.beautylog.log('now compiling tests!')
|
||||
return compileTs(config.testTs)
|
||||
return plugins.tsn.compileGlobStringObject(config.testTs)
|
||||
})
|
||||
.then(function () {
|
||||
plugins.beautylog.ok('compiled all TypeScript!')
|
||||
|
@ -32,7 +32,7 @@ export var run = function (argvArg) {
|
||||
|
||||
// mix with configfile
|
||||
npmtsOra.text('looking for npmextra.json')
|
||||
let config: INpmtsConfig = plugins.npmextra.dataFor({
|
||||
let config: INpmtsConfig = plugins.npmextra.dataFor<INpmtsConfig>({
|
||||
toolName: 'npmts',
|
||||
defaultSettings: defaultConfig,
|
||||
cwd: paths.cwd
|
||||
|
@ -11,7 +11,7 @@ export let g = {
|
||||
sourcemaps: require('gulp-sourcemaps'),
|
||||
typedoc: require('gulp-typedoc')
|
||||
}
|
||||
export import lodashObject = require('lodash')
|
||||
export import lodash = require('lodash')
|
||||
export import npmextra = require('npmextra')
|
||||
export import projectinfo = require('projectinfo')
|
||||
export import path = require('path')
|
||||
|
Reference in New Issue
Block a user