refactor
This commit is contained in:
@ -1,27 +0,0 @@
|
||||
/* ------------------------------------------
|
||||
* This module compiles the module's TypeScript files
|
||||
* Note: Test files are only compiled in memory
|
||||
* -------------------------------------------- */
|
||||
import * as q from 'smartq'
|
||||
|
||||
import { INpmtsConfig } from '../npmts.config'
|
||||
|
||||
import * as plugins from './mod00.plugins'
|
||||
|
||||
import * as NpmtsAssets from './mod00.assets'
|
||||
import * as NpmtsCheck from './mod00.check'
|
||||
import * as NpmtsClean from './mod00.clean'
|
||||
import * as NpmtsCompile from './mod00.compile'
|
||||
|
||||
export let run = function(configArg: INpmtsConfig): Promise<INpmtsConfig> {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('starting TypeScript Compilation')
|
||||
NpmtsClean.run(configArg)
|
||||
.then(NpmtsCheck.run)
|
||||
.then(NpmtsCompile.run)
|
||||
.then(NpmtsAssets.run)
|
||||
.then(function(){
|
||||
done.resolve(configArg)
|
||||
})
|
||||
return done.promise
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
import * as q from 'smartq'
|
||||
|
||||
import paths = require('../npmts.paths')
|
||||
|
||||
import plugins = require('./mod00.plugins')
|
||||
import { projectInfo } from '../mod00/mod00.check'
|
||||
|
||||
export let run = function(configArg){
|
||||
let done = q.defer()
|
||||
let config = configArg
|
||||
plugins.beautylog.ora.text('now looking at ' + 'required assets')
|
||||
if (config.cli === true) {
|
||||
let mainJsPath = projectInfo.packageJson.main
|
||||
let cliJsString: string = plugins.smartfile.fs.toStringSync(plugins.path.join(paths.npmtsAssetsDir,'cli.js'))
|
||||
cliJsString = cliJsString.replace('{{pathToIndex}}',mainJsPath)
|
||||
plugins.smartfile.memory.toFsSync(cliJsString, plugins.path.join(paths.distDir,'cli.js'))
|
||||
plugins.beautylog.ok('installed CLI assets!')
|
||||
done.resolve(config)
|
||||
} else {
|
||||
plugins.beautylog.ok('No additional assets required!')
|
||||
done.resolve(config)
|
||||
}
|
||||
return done.promise
|
||||
}
|
27
ts/mod_compile/index.ts
Normal file
27
ts/mod_compile/index.ts
Normal file
@ -0,0 +1,27 @@
|
||||
/* ------------------------------------------
|
||||
* This module compiles the module's TypeScript files
|
||||
* Note: Test files are only compiled in memory
|
||||
* -------------------------------------------- */
|
||||
import * as q from 'smartq'
|
||||
|
||||
import { INpmtsConfig } from '../npmts.config'
|
||||
|
||||
import * as plugins from './mod.plugins'
|
||||
|
||||
import * as NpmtsAssets from './mod.assets'
|
||||
import * as NpmtsCheck from './mod.check'
|
||||
import * as NpmtsClean from './mod.clean'
|
||||
import * as NpmtsCompile from './mod.compile'
|
||||
|
||||
export let run = function (configArg: INpmtsConfig): Promise<INpmtsConfig> {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('starting TypeScript Compilation')
|
||||
NpmtsClean.run(configArg)
|
||||
.then(NpmtsCheck.run)
|
||||
.then(NpmtsCompile.run)
|
||||
.then(NpmtsAssets.run)
|
||||
.then(function () {
|
||||
done.resolve(configArg)
|
||||
})
|
||||
return done.promise
|
||||
}
|
24
ts/mod_compile/mod.assets.ts
Normal file
24
ts/mod_compile/mod.assets.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import * as q from 'smartq'
|
||||
|
||||
import paths = require('../npmts.paths')
|
||||
|
||||
import plugins = require('./mod.plugins')
|
||||
import { projectInfo } from '../mod_compile/mod.check'
|
||||
|
||||
export let run = function (configArg) {
|
||||
let done = q.defer()
|
||||
let config = configArg
|
||||
plugins.beautylog.ora.text('now looking at ' + 'required assets')
|
||||
if (config.cli === true) {
|
||||
let mainJsPath = projectInfo.packageJson.main
|
||||
let cliJsString: string = plugins.smartfile.fs.toStringSync(plugins.path.join(paths.npmtsAssetsDir, 'cli.js'))
|
||||
cliJsString = cliJsString.replace('{{pathToIndex}}', mainJsPath)
|
||||
plugins.smartfile.memory.toFsSync(cliJsString, plugins.path.join(paths.distDir, 'cli.js'))
|
||||
plugins.beautylog.ok('installed CLI assets!')
|
||||
done.resolve(config)
|
||||
} else {
|
||||
plugins.beautylog.ok('No additional assets required!')
|
||||
done.resolve(config)
|
||||
}
|
||||
return done.promise
|
||||
}
|
@ -6,7 +6,7 @@ import { INpmtsConfig } from '../npmts.config'
|
||||
|
||||
import * as paths from '../npmts.paths'
|
||||
|
||||
import * as plugins from './mod00.plugins'
|
||||
import * as plugins from './mod.plugins'
|
||||
|
||||
export let projectInfo: ProjectinfoNpm
|
||||
|
||||
@ -17,7 +17,7 @@ let checkProjectTypings = (configArg: INpmtsConfig) => {
|
||||
if (typeof projectInfo.packageJson.typings === 'undefined') {
|
||||
plugins.beautylog.error(`please add typings field to package.json`)
|
||||
process.exit(1)
|
||||
};
|
||||
}
|
||||
done.resolve(configArg)
|
||||
return done.promise
|
||||
}
|
||||
@ -64,7 +64,7 @@ let checkDependencies = (configArg: INpmtsConfig) => {
|
||||
}
|
||||
for (let item in unused.invalidFiles) {
|
||||
plugins.beautylog.warn(`Watch out: could not parse file ${item}`)
|
||||
};
|
||||
}
|
||||
for (let item in unused.invalidDirs) {
|
||||
plugins.beautylog.warn(`Watch out: could not parse directory ${item}`)
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import * as q from 'smartq'
|
||||
import paths = require('../npmts.paths')
|
||||
|
||||
import plugins = require('./mod00.plugins')
|
||||
import plugins = require('./mod.plugins')
|
||||
|
||||
/**
|
||||
* removes the dist directory which will be entirely rebuild
|
@ -2,7 +2,7 @@ import * as q from 'smartq'
|
||||
|
||||
import * as paths from '../npmts.paths'
|
||||
|
||||
import * as plugins from './mod00.plugins'
|
||||
import * as plugins from './mod.plugins'
|
||||
|
||||
export let run = function (configArg) {
|
||||
let done = q.defer()
|
@ -6,10 +6,10 @@ import * as q from 'smartq'
|
||||
import * as paths from '../npmts.paths'
|
||||
import { INpmtsConfig } from '../npmts.config'
|
||||
|
||||
import * as plugins from './mod01.plugins'
|
||||
import * as plugins from './mod.plugins'
|
||||
|
||||
export let run = function (configArg: INpmtsConfig) {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
done.resolve(configArg)
|
||||
return done.promise
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
done.resolve(configArg)
|
||||
return done.promise
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/* ------------------------------------------
|
||||
* This module tests the compiled TypeScript files
|
||||
* -------------------------------------------- */
|
||||
import plugins = require('./mod02.plugins')
|
||||
import plugins = require('./mod.plugins')
|
||||
import paths = require('../npmts.paths')
|
||||
|
||||
import * as q from 'smartq'
|
@ -53,15 +53,15 @@ export let run = async () => {
|
||||
.then((configArg: NpmtsConfig.INpmtsConfig) => {
|
||||
let done = q.defer()
|
||||
plugins.beautylog.ora.start('loading additional modules...')
|
||||
NpmtsMods.mod00.load()
|
||||
.then((mod00) => {
|
||||
return mod00.run(configArg)
|
||||
NpmtsMods.modCompile.load()
|
||||
.then((modCompile) => {
|
||||
return modCompile.run(configArg)
|
||||
})
|
||||
.then(configArg => {
|
||||
let done = q.defer<NpmtsConfig.INpmtsConfig>()
|
||||
NpmtsMods.mod01.load()
|
||||
.then(mod01 => {
|
||||
return mod01.run(configArg)
|
||||
NpmtsMods.modDocs.load()
|
||||
.then(modDocs => {
|
||||
return modDocs.run(configArg)
|
||||
})
|
||||
.then(configArg => {
|
||||
done.resolve(configArg)
|
||||
@ -70,9 +70,9 @@ export let run = async () => {
|
||||
})
|
||||
.then(configArg => {
|
||||
let done = q.defer<NpmtsConfig.INpmtsConfig>()
|
||||
NpmtsMods.mod02.load()
|
||||
.then(mod02 => {
|
||||
return mod02.run(configArg)
|
||||
NpmtsMods.modTest.load()
|
||||
.then(modTest => {
|
||||
return modTest.run(configArg)
|
||||
})
|
||||
.then(configArg => {
|
||||
done.resolve(configArg)
|
||||
|
@ -2,10 +2,10 @@ import * as plugins from './npmts.plugins'
|
||||
|
||||
import { LazyModule } from 'smartsystem'
|
||||
|
||||
import * as _mod00 from './mod00/index'
|
||||
import * as _mod01 from './mod01/index'
|
||||
import * as _mod02 from './mod02/index'
|
||||
import * as _modCompile from './mod_compile/index'
|
||||
import * as _modDocs from './mod_docs/index'
|
||||
import * as _modTest from './mod_test/index'
|
||||
|
||||
export let mod00 = new LazyModule<typeof _mod00>('./mod00/index',__dirname)
|
||||
export let mod01 = new LazyModule<typeof _mod01>('./mod01/index',__dirname)
|
||||
export let mod02 = new LazyModule<typeof _mod02>('./mod02/index',__dirname)
|
||||
export let modCompile = new LazyModule<typeof _modCompile>('./mod_compile/index',__dirname)
|
||||
export let modDocs = new LazyModule<typeof _modDocs>('./mod_docs/index',__dirname)
|
||||
export let modTest = new LazyModule<typeof _modTest>('./mod_test/index',__dirname)
|
||||
|
Reference in New Issue
Block a user