change npmts package name to being @gitzone scoped
This commit is contained in:
@ -2,26 +2,26 @@
|
||||
* This module compiles the module's TypeScript files
|
||||
* Note: Test files are only compiled in memory
|
||||
* -------------------------------------------- */
|
||||
import * as q from 'smartq'
|
||||
import * as q from 'smartq';
|
||||
|
||||
import { INpmtsConfig } from '../npmts.config'
|
||||
import { INpmtsConfig } from '../npmts.config';
|
||||
|
||||
import * as plugins from './mod.plugins'
|
||||
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'
|
||||
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')
|
||||
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
|
||||
}
|
||||
.then(function() {
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -1,24 +1,26 @@
|
||||
import * as q from 'smartq'
|
||||
import * as q from 'smartq';
|
||||
|
||||
import paths = require('../npmts.paths')
|
||||
import paths = require('../npmts.paths');
|
||||
|
||||
import plugins = require('./mod.plugins')
|
||||
import { projectInfo } from '../mod_compile/mod.check'
|
||||
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')
|
||||
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)
|
||||
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)
|
||||
plugins.beautylog.ok('No additional assets required!');
|
||||
done.resolve(config);
|
||||
}
|
||||
return done.promise
|
||||
}
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -1,132 +1,139 @@
|
||||
import * as q from 'smartq'
|
||||
import { ProjectinfoNpm } from 'projectinfo'
|
||||
import * as q from 'smartq';
|
||||
import { ProjectinfoNpm } from 'projectinfo';
|
||||
|
||||
// interfaces
|
||||
import { INpmtsConfig } from '../npmts.config'
|
||||
import { INpmtsConfig } from '../npmts.config';
|
||||
|
||||
import * as paths from '../npmts.paths'
|
||||
import * as paths from '../npmts.paths';
|
||||
|
||||
import * as plugins from './mod.plugins'
|
||||
import * as plugins from './mod.plugins';
|
||||
|
||||
export let projectInfo: ProjectinfoNpm
|
||||
export let projectInfo: ProjectinfoNpm;
|
||||
|
||||
let checkProjectTypings = (configArg: INpmtsConfig) => {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('Check Module: Check Project Typings...')
|
||||
projectInfo = new ProjectinfoNpm(paths.cwd)
|
||||
let done = q.defer<INpmtsConfig>();
|
||||
plugins.beautylog.ora.text('Check Module: Check Project Typings...');
|
||||
projectInfo = new ProjectinfoNpm(paths.cwd);
|
||||
if (typeof projectInfo.packageJson.typings === 'undefined') {
|
||||
plugins.beautylog.error(`please add typings field to package.json`)
|
||||
process.exit(1)
|
||||
plugins.beautylog.error(`please add typings field to package.json`);
|
||||
process.exit(1);
|
||||
}
|
||||
done.resolve(configArg)
|
||||
return done.promise
|
||||
}
|
||||
done.resolve(configArg);
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
const depcheckOptions = {
|
||||
ignoreBinPackage: false, // ignore the packages with bin entry
|
||||
parsers: { // the target parsers
|
||||
parsers: {
|
||||
// the target parsers
|
||||
'*.ts': plugins.depcheck.parser.typescript
|
||||
},
|
||||
detectors: [ // the target detectors
|
||||
detectors: [
|
||||
// the target detectors
|
||||
plugins.depcheck.detector.requireCallExpression,
|
||||
plugins.depcheck.detector.importDeclaration
|
||||
],
|
||||
specials: [ // the target special parsers
|
||||
specials: [
|
||||
// the target special parsers
|
||||
plugins.depcheck.special.eslint,
|
||||
plugins.depcheck.special.webpack
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
let checkDependencies = (configArg: INpmtsConfig) => {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('Check Module: Check Dependencies...')
|
||||
let done = q.defer<INpmtsConfig>();
|
||||
plugins.beautylog.ora.text('Check Module: Check Dependencies...');
|
||||
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
|
||||
ignoreDirs: [ // folder with these names will be ignored
|
||||
ignoreDirs: [
|
||||
// folder with these names will be ignored
|
||||
'test',
|
||||
'dist',
|
||||
'bower_components'
|
||||
],
|
||||
ignoreMatches: [ // ignore dependencies that matches these globs
|
||||
ignoreMatches: [
|
||||
// ignore dependencies that matches these globs
|
||||
'@types/*',
|
||||
'babel-preset-*'
|
||||
]
|
||||
})
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, (unused) => {
|
||||
});
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, unused => {
|
||||
for (let item of unused.dependencies) {
|
||||
plugins.beautylog.warn(`Watch out: unused dependency "${item}"`)
|
||||
plugins.beautylog.warn(`Watch out: unused dependency "${item}"`);
|
||||
}
|
||||
for (let item in unused.missing) {
|
||||
plugins.beautylog.error(`missing dependency "${item}" in package.json`)
|
||||
plugins.beautylog.error(`missing dependency "${item}" in package.json`);
|
||||
}
|
||||
if (unused.missing.length > 0) {
|
||||
plugins.beautylog.info('exiting due to missing dependencies in package.json')
|
||||
process.exit(1)
|
||||
plugins.beautylog.info('exiting due to missing dependencies in package.json');
|
||||
process.exit(1);
|
||||
}
|
||||
for (let item in unused.invalidFiles) {
|
||||
plugins.beautylog.warn(`Watch out: could not parse file ${item}`)
|
||||
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}`)
|
||||
plugins.beautylog.warn(`Watch out: could not parse directory ${item}`);
|
||||
}
|
||||
done.resolve(configArg)
|
||||
})
|
||||
return done.promise
|
||||
}
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
let checkDevDependencies = (configArg: INpmtsConfig) => {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('Check Module: Check devDependencies...')
|
||||
let done = q.defer<INpmtsConfig>();
|
||||
plugins.beautylog.ora.text('Check Module: Check devDependencies...');
|
||||
let depcheckOptionsMerged = plugins.lodash.merge(depcheckOptions, {
|
||||
ignoreDirs: [ // folder with these names will be ignored
|
||||
ignoreDirs: [
|
||||
// folder with these names will be ignored
|
||||
'ts',
|
||||
'dist',
|
||||
'bower_components'
|
||||
],
|
||||
ignoreMatches: [ // ignore dependencies that matches these globs
|
||||
ignoreMatches: [
|
||||
// ignore dependencies that matches these globs
|
||||
'@types/*',
|
||||
'babel-preset-*'
|
||||
]
|
||||
})
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, (unused) => {
|
||||
});
|
||||
plugins.depcheck(paths.cwd, depcheckOptionsMerged, unused => {
|
||||
for (let item of unused.devDependencies) {
|
||||
plugins.beautylog.log(`unused devDependency ${item}`)
|
||||
plugins.beautylog.log(`unused devDependency ${item}`);
|
||||
}
|
||||
for (let item in unused.missing) {
|
||||
plugins.beautylog.error(`missing devDependency ${item}`)
|
||||
plugins.beautylog.error(`missing devDependency ${item}`);
|
||||
}
|
||||
if (unused.missing.length > 0) {
|
||||
plugins.beautylog.info('exiting due to missing dependencies in package.json')
|
||||
process.exit(1)
|
||||
plugins.beautylog.info('exiting due to missing dependencies in package.json');
|
||||
process.exit(1);
|
||||
}
|
||||
for (let item in unused.invalidFiles) {
|
||||
plugins.beautylog.warn(`Watch out: could not parse file ${item}`)
|
||||
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}`)
|
||||
plugins.beautylog.warn(`Watch out: could not parse directory ${item}`);
|
||||
}
|
||||
done.resolve(configArg)
|
||||
})
|
||||
return done.promise
|
||||
}
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
let checkNodeVersion = (configArg: INpmtsConfig) => {
|
||||
let done = q.defer<INpmtsConfig>()
|
||||
plugins.beautylog.ora.text('checking node version')
|
||||
done.resolve(configArg)
|
||||
return done.promise
|
||||
}
|
||||
let done = q.defer<INpmtsConfig>();
|
||||
plugins.beautylog.ora.text('checking node version');
|
||||
done.resolve(configArg);
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
export let run = async (configArg: INpmtsConfig) => {
|
||||
plugins.beautylog.ora.text('Check Module: ...')
|
||||
plugins.beautylog.ora.text('Check Module: ...');
|
||||
|
||||
if (configArg.checkDependencies) {
|
||||
configArg = await checkProjectTypings(configArg)
|
||||
configArg = await checkDependencies(configArg)
|
||||
configArg = await checkDevDependencies(configArg)
|
||||
configArg = await checkNodeVersion(configArg)
|
||||
return configArg
|
||||
configArg = await checkProjectTypings(configArg);
|
||||
configArg = await checkDependencies(configArg);
|
||||
configArg = await checkDevDependencies(configArg);
|
||||
configArg = await checkNodeVersion(configArg);
|
||||
return configArg;
|
||||
} else {
|
||||
configArg = await checkProjectTypings(configArg)
|
||||
return configArg
|
||||
configArg = await checkProjectTypings(configArg);
|
||||
return configArg;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,32 +1,32 @@
|
||||
import * as q from 'smartq'
|
||||
import paths = require('../npmts.paths')
|
||||
import * as q from 'smartq';
|
||||
import paths = require('../npmts.paths');
|
||||
|
||||
import plugins = require('./mod.plugins')
|
||||
import plugins = require('./mod.plugins');
|
||||
|
||||
/**
|
||||
* removes the dist directory which will be entirely rebuild
|
||||
*/
|
||||
let removeDist = function () {
|
||||
plugins.beautylog.ora.text('cleaning dist folder')
|
||||
return plugins.smartfile.fs.remove(paths.distDir)
|
||||
}
|
||||
let removeDist = function() {
|
||||
plugins.beautylog.ora.text('cleaning dist folder');
|
||||
return plugins.smartfile.fs.remove(paths.distDir);
|
||||
};
|
||||
|
||||
/**
|
||||
* remove old pages
|
||||
*/
|
||||
let removePages = function () {
|
||||
plugins.beautylog.ora.text('cleaning pages folder')
|
||||
return plugins.smartfile.fs.remove(paths.pagesDir)
|
||||
}
|
||||
let removePages = function() {
|
||||
plugins.beautylog.ora.text('cleaning pages folder');
|
||||
return plugins.smartfile.fs.remove(paths.pagesDir);
|
||||
};
|
||||
|
||||
export let run = function (configArg) {
|
||||
plugins.beautylog.ora.text('cleaning up from previous builds...')
|
||||
let done = q.defer()
|
||||
export let run = function(configArg) {
|
||||
plugins.beautylog.ora.text('cleaning up from previous builds...');
|
||||
let done = q.defer();
|
||||
removeDist()
|
||||
.then(removePages)
|
||||
.then(function () {
|
||||
plugins.beautylog.ok('Cleaned up from previous builds!')
|
||||
done.resolve(configArg)
|
||||
})
|
||||
return done.promise
|
||||
}
|
||||
.then(function() {
|
||||
plugins.beautylog.ok('Cleaned up from previous builds!');
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -1,17 +1,21 @@
|
||||
import * as q from 'smartq'
|
||||
import * as q from 'smartq';
|
||||
|
||||
import * as paths from '../npmts.paths'
|
||||
import * as paths from '../npmts.paths';
|
||||
|
||||
import * as plugins from './mod.plugins'
|
||||
import * as plugins from './mod.plugins';
|
||||
|
||||
export let run = function (configArg) {
|
||||
let done = q.defer()
|
||||
let config = configArg
|
||||
plugins.beautylog.ora.text('now compiling ' + 'TypeScript')
|
||||
plugins.tsn.compileGlobStringObject(config.ts, config.tsOptions, paths.cwd)
|
||||
export let run = function(configArg) {
|
||||
let done = q.defer();
|
||||
let config = configArg;
|
||||
plugins.beautylog.ora.text('now compiling ' + 'TypeScript');
|
||||
plugins.tsn
|
||||
.compileGlobStringObject(config.ts, config.tsOptions, paths.cwd)
|
||||
.then(() => {
|
||||
plugins.beautylog.ok(`compiled the module's TypeScript!`)
|
||||
done.resolve(config)
|
||||
}).catch(err => { console.log(err) })
|
||||
return done.promise
|
||||
}
|
||||
plugins.beautylog.ok(`compiled the module's TypeScript!`);
|
||||
done.resolve(config);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
@ -1,11 +1,7 @@
|
||||
export * from '../npmts.plugins'
|
||||
export * from '../npmts.plugins';
|
||||
|
||||
import * as tsn from 'tsn'
|
||||
import * as smartchok from 'smartchok'
|
||||
import * as smartstream from 'smartstream'
|
||||
import * as tsn from 'tsn';
|
||||
import * as smartchok from 'smartchok';
|
||||
import * as smartstream from 'smartstream';
|
||||
|
||||
export {
|
||||
tsn,
|
||||
smartchok,
|
||||
smartstream
|
||||
}
|
||||
export { tsn, smartchok, smartstream };
|
||||
|
Reference in New Issue
Block a user