Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

frosting

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frosting

Task helpers for Cakefiles

  • 0.3.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Frosting

Task helpers for Cakefiles

About

I've always been a little frustrated with the node filesystem API, especially when trying to get a build process in place for a javascript project. Frosting is really not much more than an abstraction layer over the filesystem module that helps keep Cakefiles readable.

Usage

To skip right to some code, here's an example Cakefile with build tasks for a client-side javascript library:

{each} = require 'frosting'

task 'compile:dev', 'Compile development distro files', ->
  each './lib/*.coffee', ( f ) -> f.compile -> f.write "./dist/dev/#{f.basename( )}.js"

task 'compile:min', 'Compile minified distro files', ->
  each './lib/*.coffee', ( f ) -> f.compile -> f.minify -> f.write "./dist/min/#{f.basename( )}.js"

task 'compile', 'Compile all distro files', ->
  invoke 'compile:dev'
  invoke 'compile:min'

Frosting is definitely an opinionated set of build tools. It assumes that source files are being written in coffeescript and minification will be done via uglify-js.

Frosting provides a couple of convenience methods that yield a File class. This class has the necessary API for reading, writing, mutating, inspecting, compiling and minifying source files.

each

each can be used to iterate over a set of source files. It accepts a callback which will be passed a File instance for each file, and you can build as you wish from there. It can be given a glob pattern or an explicit array of files.

each './lib/*.coffee', ( f ) -> # `f` is an instance of File

# or

each [
	'./lib/foo.coffee',
	'./lib/bar.coffee',
	'./lib/baz.coffee'
], ( f ) -> # `f` is an instance of File

concat

concat is similar to each, except it simply concatenates all of the source files into one coffeescript file and yields a File instance with the combined sources already in the buffer. If given an array of filenames, they will be read and concat'd in order.

concat './lib/*.coffee', ( f ) -> # `f` is an instance of File, will only get called once

# or

concat [
	'./lib/foo.coffee',
	'./lib/bar.coffee',
	'./lib/baz.coffee'
], ( f ) -> # `f` is an instance of File, will only get called once

TODO describe the File API

FAQs

Package last updated on 25 Jun 2012

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc