Skip to content

Instantly share code, notes, and snippets.

@mrjjwright
Created May 15, 2011 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrjjwright/973191 to your computer and use it in GitHub Desktop.
Save mrjjwright/973191 to your computer and use it in GitHub Desktop.
Put this in Cakefile to write out package.coffee to NPM package.json
fs = require 'fs'
CoffeeScript = require 'coffee-script'
task "build:package", "Builds the package.json from it's coffee source", (options) ->
js = CoffeeScript.compile "return #{fs.readFileSync('package.coffee', 'utf8')}"
json = JSON.stringify eval(js), null, 2
fs.writeFileSync 'package.json', json
console.log('Successfully wrote out package.json')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment