
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
gulp-metal
Advanced tools
Gulp pipelines and tasks to be shared between Metal components.
This is a collection of tasks to be used by Metal components. To use them, just install this through npm and register the tasks on your gulpfile like this:
var metal = require('gulp-metal');
metal.registerTasks(options);
As you can see, the metal function receives an optional object to customize the registered functions. Each task has its own options, but the taskPrefix option affects all task, registering them all with the provided prefix before the original names.
After calling the metal function, several tasks will then be available to run on gulp. These can be broken in different categories, so we'll explain each separately.
As we've mentioned before, Metal.js is written in ES6. Since browsers don't yet implement ES6, the original code won't run on them. There are several different ways to solve this, such as adding a ES6 polyfill like traceur. That means adding more code to the page though, as well as compiling the code at run time.
Another option is to previously build the ES6 files to ES5 equivalents. Again, there are lots of ways to do this, and lots of formats to build to. Metal.js provides a few tasks as build options that can be used out of the box.
gulp buildBuilds your project's files: css, soy and js (from ES6 code to ES5 for example). The following options can be passed to the metal function for customizing this task:
buildDest The directory where the built files should be placed. Default: build.bundleFileName The name of the final bundle file. Only used for output formats that bundle all compiled code into a single file, like when building to globals. Default: metal.js.buildSrc The glob expression that defines which js files should be built. Default: src/**/*.js.globalName The name of the global variable that should hold the exported values of the modules. Only used if the globals output format is being used. Default: metal.mainBuildJsTasks The tasks that should be run for building js. That's how you can choose the output format of the compiled js code. Default: build:globals:js.gulp watchWatches for changes on the source files, rebuilding the code to the chosen format automatically when that happens.
Metal.js also provides gulp tasks to help with testing modules built with Metal.js. The tasks assume that tests are written in karma, and so there should be a karma.conf.js file. A sample karma.conf.js file can be found at generator-metal, which works well with Metal.js, including correct coverage reports.
gulp testRuns all tests once.
gulp test:coverageRuns all tests once and shows coverage information on the terminal.
gulp test:coverage:openRuns all tests once and then opens the coverage html file on the default browser.
gulp test:browsersRuns all tests once on the following browsers: Chrome, Firefox, Safari, IE9, IE10 and IE11.
gulp test:saucelabsRuns all tests once on Saucelabs. Both username and access key need to be previously specified as environemnt variables for this to work. See karma-sauce-launcher for more details.
gulp test:watchWatches for changes to source files, rerunning tests automatically when that happens.
Finally, Metal.js provides an important task for developing with SoyComponent. If your code is using it, you'll need this task for the templates to be correctly handled and integrated with your javascript file.
gulp soyGenerates some soy templates that are necessary for integration with the SoyComponent module, and compiles them to javascript. The following options can be passed to the metal function for customizing this task:
corePathFromSoy The path from the soy files location to Metal.js's core module. Default: metal/src.soyDest The directory where the compiled soy files should be placed. Default: src.soyGeneratedDest The directory that should hold the generated soy files. Default build.soySrc The glob expression that defines the location of the soy files. Default: src/**/*.soy.FAQs
Gulp pipelines and tasks to be shared between Metal components
We found that gulp-metal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 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
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.