From 71c06c7da413ba8c5cfd47693585f45941cd884b Mon Sep 17 00:00:00 2001 From: Matthew Beale Date: Fri, 13 Jan 2012 11:01:30 -0500 Subject: [PATCH] Add a package npm task and check in a generated file --- Cakefile | 14 +++++++++++++- package.json | 10 +++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Cakefile b/Cakefile index 89486e6..b8a3ef4 100644 --- a/Cakefile +++ b/Cakefile @@ -77,7 +77,8 @@ task 'build', 'build Chosen from source', build = (cb) -> write_chosen_javascript javascript.replace(/\.js$/,'.min.js'), ( uglify.gen_code uglify.ast_squeeze uglify.ast_mangle parser.parse code ) - cb() if typeof cb is 'function' + package_npm () -> + cb() if typeof cb is 'function' catch e print_error e, file_name, file_contents @@ -94,6 +95,17 @@ task 'watch', 'watch coffee/ for changes and build Chosen', -> invoke 'build' )(file) +task 'package_npm', 'generate the package.json file for npm', package_npm = (cb) -> + try + package_file = 'package.json' + package = JSON.parse("#{fs.readFileSync package_file}") + package['version'] = version() + fs.writeFileSync package_file, JSON.stringify(package, null, 2) + console.log "Wrote #{package_file}" + cb() if typeof cb is 'function' + catch e + print_error e, package_file + run = (cmd, args, cb, err_cb) -> exec "#{cmd} #{args.join(' ')}", (err, stdout, stderr) -> if err isnt null diff --git a/package.json b/package.json index 27e5de4..070387c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "author": "harvest", "name": "chosen", - "version": "0.9.5-35-g880a30d", + "version": "0.9.6", "description": "Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.", "repository": { "type": "git", @@ -10,9 +10,9 @@ "engines": { "node": ">=0.4.0" }, - "dependencies": { + "dependencies": {}, + "devDependencies": { "coffee-script": ">= 1.2.0", "uglify-js": ">= 1.2.3" - }, - "devDependencies": {} -} + } +} \ No newline at end of file