
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
gulp-shark-automation
Advanced tools
Gulp-shark-automation is a tool for automation of front-end.It supplies two functions:
Gulp-shark-automation needs a config file:
module.exports = {
comment: '', //not required
version: '1.0.0', //not required
product: 'shark-automation', //name of product. not required
contextPath: '/', //rootpath of request.default '/'
protocol: 'http', //the protocol of product. default 'http'
port: 9100, //port of mock server. required
hostname: 'demo.shark.automation', //hostname of mock server. required
openurl: 'http://demo.shark.automation:9000/index.html', //url is opend automatically when the mock server is ready. not required
rootPath: __dirname, //rootpath of product.required
webapp: 'src/main/webapp', //path of source code.required
mock: 'src/test/mock', //path of mock files.required
scssPath: 'style/scss', //path of scss files. required
cssPath: 'style/css', //path of css files. required
imgPath: 'style/img', //path of images. required
videoPath: 'style/video', //path of video. not required
jsPath: 'js', //path of js. required
fontPath: 'fonts', //path of fonts. not required
htmlPath: 'views', //path of html. required
templatePath: 'WEB-INF/tmpl', //path of ftl. not required
ajaxPrefix: '/xhr', //rootpath of ajax request. required.
mimgPathPrefix: '/hxm', //rootpath of static file requrest. not required.
ifwebpack: true, //should use webpack to build js. not required
//required
mimgURLPrefix: {
develop: '', //the rootpath of static resource during develop phase
online: '', //the rootpath of static resource at online phase
test: '' //the rootpath of static resource at test phase
},
//need to deploy then required
deploy: {
path: '', //the folder path which contains the files need to be pushed to the repository
static: '', ////the folder path which contains the static files need to be pushed to the repository
giturl: '', //git repository url.not required
git: {
test: 'test', //test repository
online: 'deploy' //online repository
}
}
};
Gulp-shark-automation use express to make a mock server and need some mock files.Express uses the mock file related to the request path as response.For instance:request path: /xhr/demo/list.do, the related mock file is {config.mock}/xhr/demo/list.do
below shows how to start the mock server.
var gulpSharkAutomation = require('gulp-shark-automation'),
express = require('express'),
openurl = require('openurl');
var config = require('./config.js'); //config file
gulp.task('server', function(cb) {
var app = express();
var router = gulpSharkAutomation.registerServer({
baseConf: config
});
app.use(router);
app.listen(config.port, function(err) {
if (err) {
return console.log(err);
}
console.log('express listening on %d', config.port);
});
//the browser-sync task is registed by gulp-shark-automation
// It is response for hot replace or livereload when the static resource changes
runSequence('browser-sync', function() {
//open the url automatically
openurl.open(config.openurl);
cb();
});
});
Gulp-shark-automation helps you to build source code and deal the static resource such as compress、md5.You can assemble the tasks gulp-shark-automation registed to do the build.Below is the list of tasks gulp-shark-automation registed and the npm tool it depend on:
Demo:
var argv = require('yargs').argv,
require('run-sequence'),
gulpSharkAutomation = require('gulp-shark-automation');
var config = require('./config.js'); //config file
gulpSharkAutomation.registerTasks({
baseConf: config
});
gulp.task('build', function(cb) {
runSequence(
// clean folders
'clean',
// compass and copy to tmp1
['sass-preprocess', 'webpack-server'],
// // use reference in html and ftl
['useref'],
// // imagemin and copy to tmp1
'imagemin',
// // revision images
'revision-image',
// // revreplace images
['revreplace-css', 'revreplace-js'],
// // revision css,js
['revision-css', 'revision-js'],
// // revreplace html,ftl
['revreplace-html'],
// // copy to build dir
['copy-build'],
// callback
cb
);
});
The npm package which the tasks gulp-shark-automation registed depend on is config with default options.If you want to override the default option, you can do this way:
var config = require('./config.js'); //config file
gulpSharkAutomation.registerTasks({
baseConf: config,
//the key is the npm package name in camel-case you want to override
//the value is the option you want to set.It follows the npm package's mode
gulpSass: {
}
});
FAQs
We found that gulp-shark-automation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.