Gathering detailed insights and metrics for development-core
Gathering detailed insights and metrics for development-core
Gathering detailed insights and metrics for development-core
Gathering detailed insights and metrics for development-core
@aws-cdk/core
AWS Cloud Development Kit Core Library
@modern-js/core
A Progressive React Framework for modern web development.
@modern-js/server-core
A Progressive React Framework for modern web development.
@modern-js/bff-core
A Progressive React Framework for modern web development.
For Web Front end and nodejs development. It is a module bundler. It's main purpose is to bundle JavaScript files for usage in a browser or nodejs, yet it is also capable of transforming, bundling, or packaging just about any resource or asset. generate gulp tasks, gulp task manager, run tasks in sequence via Promise. useful gulp task util: zipSequence, runSequence, runTaskSequence, toSequence, flattenSequence.
npm install development-core
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
2 Stars
195 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Dec 19, 2023
Latest Version
2.1.6
Package Id
development-core@2.1.6
Size
67.06 kB
NPM Version
5.5.1
Node Version
8.9.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
15
This repo is for distribution on npm
. The source for this module is in the
main repo.
Please file issues and pull requests against that repo.
This package use to develop kit for project development via gulp tasks.
development-core
, generate gulp tasks, gulp task manager, run tasks in sequence via Promise. useful gulp task util: zipSequence, runSequence, runTaskSequence, toSequence, flattenSequence.
core of development-tool
.
You can install this package either with npm
.
1 2npm install development-core 3
You can import
modules:
1import * as gulp from 'gulp'; 2import { generateTask, runTaskSequence, runSequence } from 'development-core'; 3
1 2 runSequence('taskA', ['taskb','taskc'], 'taskd'); 3
1 2 let context = createContext({ 3 env: env, 4 option: { src: 'src', dist: 'lib', buildDist: 'build' } 5 }); 6 7 // console.log(context); 8 9 context.runDynamic([ 10 { 11 name: 'test', src: 'test/**/*spec.ts', 12 oper: Operation.test | Operation.default, 13 pipes: [mocha], 14 output: null 15 }, 16 { 17 name: 'tscompile', src: 'src/**/*.ts', dist: 'lib', 18 oper: Operation.build, 19 pipes: [ 20 () => cache('typescript'), 21 sourcemaps.init, 22 (config) => { 23 let transform = tsProject(); 24 transform.transformSourcePipe = (source) => source.pipe(transform)['js']; 25 return transform; 26 }, 27 (config) => sourcemaps.write('./sourcemaps') 28 ] 29 }, 30 { 31 name: 'tscompile', src: 'src/**/*.ts', dist: 'lib', 32 oper: Operation.release | Operation.deploy, 33 pipes: [ 34 () => cache('typescript'), 35 sourcemaps.init, 36 (config) => tsProject() 37 ], 38 output: [ 39 (tsmap, config, dt, gulp) => tsmap.dts.pipe(gulp.dest(config.getDist(dt))), 40 (tsmap, config, dt, gulp) => tsmap.js 41 .pipe(uglify()).pipe(sourcemaps.write('./sourcemaps')) 42 .pipe(gulp.dest(config.getDist(dt))) 43 ] 44 }, 45 { src: 'src/**/*.ts', name: 'watch', watchTasks: ['tscompile'] }, 46 { name: 'clean', order: 0, src: 'src', dist: 'lib', task: (config) => del(config.getDist()) } 47 ]); 48
1@dynamicTask() 2export class TestDynamicTask implements IDynamicTasks { 3 tasks(): IDynamicTaskOption[] { 4 return [ 5 { 6 name: 'test-tscompile', src: 'src/**/*.ts', dist: 'lib', 7 shell:'docker-compose down & docker-compose build' 8 }, 9 { 10 name: 'test-test', src: 'test/**/*spec.ts', order: total => 1 / total, //second. 11 shell:['docker tag xxx xxxx', 'docker tag xxx xxxx'] 12 }, 13 { 14 name: 'test-test', src: 'test/**/*spec.ts', order: total => 1 / total, //second. 15 shell:(ctx)=>{ 16 return '' 17 } 18 } 19 ]; 20 } 21}
1 2@dynamicTask() 3export class TestDynamicTask implements IDynamicTasks { 4 tasks(): IDynamicTaskOption[] { 5 return [ 6 { 7 name: 'test-tscompile', src: 'src/**/*.ts', dist: 'lib', 8 execFiles:'./a/task.ts' 9 }, 10 { 11 name: 'test-test', src: 'test/**/*task.ts', order: total => 1 / total, //second. 12 execFiles:(ctx)=>{ 13 return ctx.fileFilter(ctx.getSrc()); 14 } 15 } 16 ]; 17 } 18}
decorator not support function now, so refactor ITask interface.
v.9.1: refactor order, to set value between 0 and 1. to make sure right order config easy. default value 0.5;
case order value lt than 0 will assign 0;
case order value gt than 1, order = (order % sequence.length) / sequence.length;
1 2// module A 3import {PipeTask, IPipe, PipeTask, IAsserts, IAssertDist, taskdefine, createContext, Operation, IEnvOption, ITaskContext, ITaskDefine, ITask, ITaskInfo, TaskResult, task, dynamicTask, IDynamicTasks } from 'development-core'; 4 5@task() 6export class TestPipeTask implements PipeTask { 7 // override 8 //source(context: ITaskContext, dist: IAssertDist, gulp: Gulp): TransformSource | Promise<TransformSource>{ 9 // // todo create source. 10 // // sample as: 11 // return gulp.src(context.getSrc(this.getInfo())); 12 //} 13 // override 14 pipes(context: ITaskContext, dist: IAssertDist, gulp?: Gulp): Pipe[]{ 15 //create pipes 16 return pipes 17 } 18 // override 19 //output(context: ITaskContext, dist: IAssertDist, gulp?: Gulp): OutputPipe[]{ 20 // // output pipes. 21 // return outputs; 22 //} 23} 24 25 26@task() 27export class TestTaskA implements ITask { 28 getInfo(): ITaskInfo { return this.info; } 29 constructor(private info: ITaskInfo) { 30 } 31 setup(ctx: ITaskContext, gulp): TaskResult { 32 // todo... 33 return; 34 } 35} 36 37@task({ 38 // build env task. when env.watch equals to true, auto create watch to this task. 39 oper: Operation.build | Operation.autoWatch, 40 order: 1, // last order. 41}) 42export class TestTaskE implements ITask { 43 private info:ITaskInfo; 44 constructor() { 45 } 46 getInfo(): ITaskInfo { return this.info; } 47 setInfo(info: ITaskInfo) { this.info = info; } 48 setup(ctx: ITaskContext, gulp): TaskResult { 49 // todo... 50 return 'TestTaskE'; 51 } 52} 53 54@dynamicTask() 55export class TestDynamicTask implements IDynamicTasks { 56 tasks(): IDynamicTaskOption[] { 57 return [ 58 { 59 name: 'test-tscompile', src: 'src/**/*.ts', dist: 'lib', 60 // auto create watch task for this asserts when watch in context. 61 watch: true, 62 pipes: [() => cache('typescript'), sourcemaps.init, tsProject], 63 output: [ 64 (tsmap, ctx, dt, gulp) => tsmap.dts.pipe(gulp.dest(ctx.getDist(dt))), 65 (tsmap, ctx, dt, gulp) => { 66 if (ctx.oper & Operation.release || ctx.oper & Operation.deploy) { 67 return tsmap.js.pipe(babel({ presets: ['es2015'] })) 68 .pipe(uglify()).pipe(sourcemaps.write('./sourcemaps')) 69 .pipe(gulp.dest(ctx.getDist(dt))); 70 } else { 71 return tsmap.js.pipe(sourcemaps.write('./sourcemaps')).pipe(gulp.dest(ctx.getDist(dt))); 72 } 73 } 74 ] 75 }, 76 { 77 name: 'test-test', src: 'test/**/*spec.ts', order: total => 1 / total, //second. 78 oper: Operation.test | Operation.release | Operation.deploy, 79 pipe(src) { 80 return src.pipe(mocha()) 81 .once('error', () => { 82 process.exit(1); 83 }); 84 } 85 }, 86 //{ name: 'test-watch', src: 'src/**/*.ts', watchTasks: ['tscompile'] }, 87 { name: 'test-clean', order: 0, src: 'src', dist: 'lib', task: (ctx) => del(ctx.getDist()) } 88 ]; 89 } 90} 91
1 2import * as _ from 'lodash'; 3import { ITask, IAssertOption, IEnvOption, IContextDefine, ITaskContext, ITaskConfig, taskdefine } from 'development-core'; 4 5import { INodeTaskOption } from './NodeTaskOption'; 6export * from './NodeTaskOption'; 7 8import { CleanDynamicTasks, TestDynamicTasks } from './tasks/nodeDefaultTask'; 9 10@taskdefine() 11export class NodeContextDefine implements IContextDefine { 12 13 loadConfig(option: IAssertOption, env: IEnvOption): ITaskConfig { 14 // register default asserts. 15 option.asserts = _.extend({ 16 ts: { loader: 'development-assert-ts' } 17 }, option.asserts || {}); 18 19 return <ITaskConfig>{ 20 option: option, 21 env: env 22 }; 23 } 24 // set add component or same task for this context. 25 setContext(ctx: ITaskContext) { 26 let nodeOption = ctx.option as INodeTaskOption 27 if (nodeOption.test === false) { 28 return; 29 } 30 ctx.add(<ITaskConfig>{ 31 option: <IAssertOption>{ 32 name: 'test', 33 order: nodeOption.testOrder || (total => 2 / total), 34 loader: (ctx) => { 35 return ctx.findTasks(TestDynamicTasks); 36 } 37 } 38 }); 39 //... 40 //ctx.addTask(task) 41 //ctx.removeTask(task) 42 } 43 // custome load current context tasks 44 tasks(context: ITaskContext): Promise<ITask[]> { 45 // current context tasks 46 return context.findTasks(CleanDynamicTasks); 47 } 48} 49 50 51
default order value 0.5
1 2@task({ 3 order: total => 1 / total // second order. 4}) 5export class TestTaskB implements ITask { 6 getInfo(): ITaskInfo { return this.info; } 7 constructor(private info: ITaskInfo) { 8 } 9 setup(ctx: ITaskContext, gulp): TaskResult { 10 // todo... 11 12 return ctx.taskName('TestTaskB'); 13 } 14} 15 16 17 18@task({ 19 order: 1, // last order. 20 oper: Operation.build | Operation.test 21}) 22export class TestTaskC implements ITask { 23 getInfo(): ITaskInfo { return this.info; } 24 constructor(private info: ITaskInfo) { 25 } 26 setup(ctx: ITaskContext, gulp): TaskResult { 27 // todo... 28 29 return ctx.taskName('TestTaskC'); 30 } 31} 32 33@task({ 34 order: 0, //first order. 35 oper: Operation.release | Operation.deploy 36}) 37export class TestTaskD implements ITask { 38 getInfo(): ITaskInfo { return this.info; } 39 constructor(private info: ITaskInfo) { 40 } 41 setup(ctx: ITaskContext, gulp): TaskResult { 42 // todo... 43 44 return ctx.taskName('TestTaskD'); 45 } 46} 47 48 49@task({ 50 order: (total, ctx) => (ctx.oper & Operation.release)? 1 / total : 4 / total, 51 oper: Operation.build | Operation.test 52}) 53export class TestTaskW implements ITask { 54 getInfo(): ITaskInfo { return this.info; } 55 constructor(private info: ITaskInfo) { 56 } 57 setup(ctx: ITaskContext, gulp): TaskResult { 58 // todo... 59 60 return ctx.taskName('TestTaskW'); 61 } 62} 63 64// run tasks by parallel which value is same as 0.2 65@task({ 66 order: <IOrder> { value: 0.2, runWay: RunWay.parallel } 67}) 68export class TestTaskB implements ITask { 69 getInfo(): ITaskInfo { return this.info; } 70 constructor(private info: ITaskInfo) { 71 } 72 setup(ctx: ITaskContext, gulp): TaskResult { 73 // todo... 74 75 return ctx.taskName('TestTaskor1'); 76 } 77} 78 79// run this task by parallel which value is same as 0.25 and in test env. 80@task({ 81 order: (total, ctx) => ctx.env.test ? { value: 0.25, runWay: RunWay.parallel } : 1, 82}) 83export class TestTaskB implements ITask { 84 getInfo(): ITaskInfo { return this.info; } 85 constructor(private info: ITaskInfo) { 86 } 87 setup(ctx: ITaskContext, gulp): TaskResult { 88 // todo... 89 90 return ctx.taskName('TestTaskor2'); 91 } 92} 93
1 2 3@task({ 4 group: ['test', 'node'] 5 oper: Operation.build | Operation.test 6 ... 7}) 8export class TestTaskGA implements ITask { 9 public decorator: ITaskInfo = {}; 10 constructor() { 11 } 12 setup(ctx: ITaskConfig, gulp): TaskResult { 13 // todo... 14 return 'TestTaskGA'; 15 } 16} 17@task({ 18 group: 'node', 19 oper: Operation.build | Operation.test 20 ... 21}) 22export class TestTaskGB implements ITask { 23 public decorator: ITaskInfo = {}; 24 constructor() { 25 } 26 setup(ctx: ITaskConfig, gulp): TaskResult { 27 // todo... 28 return 'TestTaskGB'; 29 } 30} 31 32@task({ 33 group: ['test', 'node'], 34 oper: Operation.build | Operation.test 35 ... 36}) 37export class TestTaskGC implements ITask { 38 public decorator: ITaskInfo = {}; 39 constructor() { 40 } 41 setup(ctx: ITaskConfig, gulp): TaskResult { 42 // todo... 43 return 'TestTaskGC'; 44 } 45} 46 47@dynamicTask({ 48 group: 'ts', 49 oper: Operation.build | Operation.test 50 ... 51}) 52export class TestTaskC implements IDynamicTasks { 53 tasks(): IDynamicTaskOption[]{ 54 return [ 55 { 56 name: 'tscompile', src: 'src/**/*.ts', dist: 'lib', 57 // auto create watch task for this asserts when watch in context. 58 watch: true, 59 pipes: [() => cache('typescript'), sourcemaps.init, tsProject], 60 output: [ 61 (tsmap, ctx, dt) => tsmap.dts.pipe(gulp.dest(ctx.getDist(dt))), 62 (tsmap, ctx, dt) => { 63 if (ctx.oper & Operation.release || ctx.oper & Operation.deploy) { 64 return tsmap.js.pipe(babel({ presets: ['es2015'] })) 65 .pipe(uglify()).pipe(sourcemaps.write('./sourcemaps')) 66 .pipe(gulp.dest(ctx.getDist(dt))); 67 } else { 68 return tsmap.js.pipe(sourcemaps.write('./sourcemaps')).pipe(gulp.dest(ctx.getDist(dt))); 69 } 70 } 71 ] 72 } 73 ] 74 } 75} 76
special pipe work or add special output work with class implements IDynamicTasks, class extends PipeTask. also you can implements IPipeTask or ITask by youself.
1 2// module use. 3import { findTasks, createContext, Operation, runTaskSequence, findTaskDefine } from 'development-core'; 4 5let ctx = createContext({ 6 env: env, 7 option: { 8 src: 'src',dist: 'lib' 9 } 10}); 11 12// dynamic 13ctx.generateTask([ 14 // dynamic 15 { 16 name: 'test', src: 'test/**/*spec.ts', order: 1, 17 oper: Operation.test | Operation.release | Operation.deploy, 18 pipe(src) { 19 return src.pipe(mocha()) 20 .once('error', () => { 21 process.exit(1); 22 }); 23 } 24 }, 25 { src: 'src/**/*.ts', name: 'watch', watchTasks: ['tscompile'] }, 26 { name: 'clean', order: 0, src: 'src', dist: 'lib', task: (ctx) 27 ... 28]); 29 30// compose context. 31let ctx2 = createContext({ 32 env: env, 33 option: { 34 src: 'src',dist: 'lib' 35 } 36}, ctx); 37//or 38ctx.add(ctx2); 39ctx.add(option); 40ctx.add(ITaskConfig); 41 42//find module or dir. 43ctx.findTasks('module a') 44 .then(module_task =>{ 45 // run task; 46 return ctx.findTasksInDir('task path'); 47 }) 48 .then((dir_task)=>{ 49 return ctx.run(); 50 }); 51
1
2// module use.
3import { findTasks, Operation, runTaskSequence, findTaskDefine } from 'development-core';
4let moduleA = require('module a');
5let tasks = findTasks(moduleA);
6let tdfs = findTaskDefine(moduleA);
7
8// run task;
9runTaskSequence(gulp, tasks, tdfs.loadConfig({src:'src', dist:'lib'}, {watch:true}));
10
1 2import * as gulp from 'gulp'; 3import { createContext, generateTask, runTaskSequence, IEnvOption, Operation } from 'development-core'; 4import * as mocha from 'gulp-mocha'; 5import * as minimist from 'minimist'; 6import * as _ from 'lodash'; 7 8const del = require('del'); 9const cache = require('gulp-cached'); 10const ts = require('gulp-typescript'); 11const sourcemaps = require('gulp-sourcemaps'); 12let tsProject = ts.createProject('tsconfig.json'); 13const uglify = require('gulp-uglify'); 14const babel = require('gulp-babel'); 15 16gulp.task('build', () => { 17 var options: IEnvOption = minimist(process.argv.slice(2), { 18 string: 'env', 19 default: { env: process.env.NODE_ENV || 'development' } 20 }); 21 return createTask(options); 22}); 23 24let createTask = (env) => { 25 26 let ctx = createContext({ 27 env: env, 28 option: { 29 src: 'src', 30 dist: 'lib', 31 // auto create watch task for this asserts or special task. 32 watch: true | [taskname|callback] 33 } 34 }); 35 36 ctx.generateTask([ 37 { 38 name: 'tscompile', src: 'src/**/*.ts', dist: 'lib', 39 // auto create watch task for this asserts when watch in context. 40 watch: true, 41 oper: Operation.build, 42 pipes: [ 43 () => cache('typescript'), 44 sourcemaps.init, 45 (ctx) => { 46 let transform = tsProject(); 47 transform.transformSourcePipe = (source) => source.pipe(transform)['js']; 48 return transform; 49 }, 50 (ctx) => babel({ presets: ['es2015'] }), 51 (ctx) => sourcemaps.write('./sourcemaps') 52 ] 53 }, 54 { 55 name: 'tscompile', src: 'src/**/*.ts', dist: 'lib', 56 oper: Operation.release | Operation.deploy, 57 pipes: [ 58 () => cache('typescript'), sourcemaps.init, tsProject 59 ], 60 output: [ 61 (tsmap, ctx, dt, gulp) => tsmap.dts.pipe(gulp.dest(ctx.getDist(dt))), 62 (tsmap, ctx, dt, gulp) => tsmap.js.pipe(babel({ presets: ['es2015'] })) 63 .pipe(uglify()).pipe(sourcemaps.write('./sourcemaps')) 64 .pipe(gulp.dest(ctx.getDist(dt))) 65 ] 66 }, 67 { 68 name: 'test', src: 'test/**/*spec.ts', order: 1, 69 oper: Operation.test | Operation.release | Operation.deploy, 70 pipe(src) { 71 return src.pipe(mocha()) 72 .once('error', () => { 73 process.exit(1); 74 }); 75 } 76 }, 77 { src: 'src/**/*.ts', name: 'watch', watchTasks: ['tscompile'] }, 78 { name: 'clean', order: 0, src: 'src', dist: 'lib', task: (ctx) => del(ctx.getDist()) } 79 ]); 80 81 return ctx.run(); 82} 83
https://github.com/zhouhoujun/development-core.git
The mocks are then available at jspm_components/development-core/development-core.js
.
Documentation is available on the development-core docs site.
MIT © Houjun
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More