Permalink
Browse files

Add a package npm task and check in a generated file

  • Loading branch information...
1 parent 04568d2 commit 71c06c7da413ba8c5cfd47693585f45941cd884b @mixonic mixonic committed Jan 13, 2012
Showing with 18 additions and 6 deletions.
  1. +13 −1 Cakefile
  2. +5 −5 package.json
View
@@ -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
View
@@ -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": {}
-}
+ }
+}

0 comments on commit 71c06c7

Please sign in to comment.