Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Gear.js is a scriptable build system using simple tasks that act like a sequence of piped commands.
Features include:
To get the most out of Gear.js, you will want to install gear-lib which contains tasks for linting, minifying, and deploying JS/CSS assets.
$ npm install gear
$ npm install gear-lib
new Queue()
.read('foo.js')
.log('read foo.js')
.inspect()
.write('foobarbaz.js')
.run();
new Queue()
.read(['foo.js', {name: 'bar.js'}, 'baz.js'])
.log('read foo.js')
.inspect()
.write(['newfoo.js', 'newbar.js']) // Not writing 'baz.js'
.run();
new Queue()
.read('foo.js')
.log('Parallel Tasks')
.tasks({
read: {task: ['read', ['foo.js', 'bar.js', 'baz.js']]}
combine: {requires: 'read', task: 'concat'}
minify: {requires: 'combine', task: 'jsminify'}
print: {requires: ['read', 'combine', 'minify'], task: 'inspect'} // Runs when read, combine, and minify complete
parallel: {task: ['log', "Hello Gear.js world!"]} // Run parallel to read
}).run();
Queue constructor.
Arguments
Example
new Queue()
.log('test')
.run();
Helper method to run the specified task. Preferred task execution style is to call the task directly i.e. inspect()
instead of task('inspect')
.
Arguments
Example
new Queue()
.task('log', 'Hello, world!')
.run();
Runs the queue.
Arguments
Example
new Queue()
.log('test')
.run();
Creates a new Registry instance. Registries contain available tasks.
Arguments
Example
new Registry();
Load tasks from NPM, directory, or file.
Arguments
Example
new Registry().load({dirname: 'foo'});
Appends file contents onto queue.
Arguments
Example
// file - Filename to read.
// file.name - Filename of resource.
.read('foo')
.read(['foo', 'baz'])
.read([{name: 'foo'}, {name: 'bar'}, {name: 'baz'}])
Arguments
Write the blob to disk.
Example
.write('foo')
.write({name: 'foo'})
Concatenates blobs.
Example
.concat()
Inspects blobs.
Example
.inspect()
Arguments
Log a message.
Example
.log('Finished')
Arguments
Execute tasks in parallel with optional dependencies. Data is joined on completion.
Example
// label - Task instance name.
// label.task - Task name and optionally options.
// label.requires - List of labels that must be executed before this task runs.
.tasks({
label_1: {task: 'log'}
label_2: {task: ['log', 'Hello, world!']}
label_3: {requires: 'label_2', task: ['log', 'Hello, world 2!']}
})
## Library Tasks
Install gear-lib which contains tasks such as:
$ npm install gear-lib
## Custom Tasks
Writing a task is especially easy compared to other Node build systems. There is no need to use Gear.js internals within a task. Tasks operate on immutable blobs. Blobs have a body property. The task returns transformed data via its callback.
Arguments
Example
// example.js
// Example task creates new blob containing `string`
exports.example = function(string, blob, done) {
done(null, new blob.constructor(string)); // blob.constructor() is equivalent to Blob()
};
Running Example Task
new Queue({registry: new Registry({filename: 'example.js'})})
.example('EXAMPLE')
.run();
Gear.js takes inspiration from a few sources:
FAQs
Gear.js - Build System for Node.js and the Browser
The npm package gear receives a total of 14,914 weekly downloads. As such, gear popularity was classified as popular.
We found that gear demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.