Permalink
Browse files

Closes GH-1 Output valid JSON

  • Loading branch information...
1 parent 9756d44 commit c11fa0151f30770334bd6e3c89d933f5eea6ebb5 @isaacs isaacs committed with Nicholas Kinsey Feb 19, 2011
Showing with 31 additions and 29 deletions.
  1. +3 −5 bin/courier.coffee
  2. +28 −24 package.json
View
@@ -49,10 +49,8 @@ release = (options) ->
throw error if error
coffee = data.toString()
- js = CoffeeScript.compile(coffee, bare: true)
- re = /\(([\s\S]*)\);/m
- matches = re.exec js
- json = matches[1]
+ js = CoffeeScript.compile('return '+coffee)
+ json = JSON.stringify eval(js), null, 2
fs.writeFile 'package.json', json, ->
log json if options.print
@@ -61,4 +59,4 @@ if args.length <= 0
args.push '.'
if args.length > 0
- release options
+ release options
View
@@ -1,34 +1,38 @@
{
- name: 'courier',
- description: 'npm packages in CoffeeScript - (package.coffee) -> (package.json)',
- keywords: ['courier'],
- version: '0.1.0',
- author: 'Feisty Studios <courier@feistystudios.com> (http://feistystudios.com/)',
- licenses: [
+ "name": "courier",
+ "description": "npm packages in CoffeeScript - (package.coffee) -> (package.json)",
+ "keywords": [
+ "courier"
+ ],
+ "version": "0.1.0",
+ "author": "Feisty Studios <courier@feistystudios.com> (http://feistystudios.com/)",
+ "licenses": [
{
- type: 'FEISTY',
- url: 'http://github.com/feisty/license/raw/master/LICENSE'
+ "type": "FEISTY",
+ "url": "http://github.com/feisty/license/raw/master/LICENSE"
}
],
- contributors: ['Nicholas Kinsey <nicholas.kinsey@feistystudios.com>'],
- repository: {
- type: 'git',
- url: 'http://github.com/feisty/courier.git',
- private: 'git@github.com:feisty/courier.git',
- web: 'http://github.com/feisty/courier'
+ "contributors": [
+ "Nicholas Kinsey <nicholas.kinsey@feistystudios.com>"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/feisty/courier.git",
+ "private": "git@github.com:feisty/courier.git",
+ "web": "http://github.com/feisty/courier"
},
- bugs: {
- mail: 'courier@feistystudios.com',
- web: 'http://github.com/feisty/courier/issues'
+ "bugs": {
+ "mail": "courier@feistystudios.com",
+ "web": "http://github.com/feisty/courier/issues"
},
- bin: {
- courier: './bin/courier.coffee'
+ "bin": {
+ "courier": "./bin/courier.coffee"
},
- main: 'courier',
- dependencies: {
- 'coffee-script': '>= 1.0.0'
+ "main": "courier",
+ "dependencies": {
+ "coffee-script": ">= 1.0.0"
},
- engines: {
- node: '*'
+ "engines": {
+ "node": "*"
}
}

0 comments on commit c11fa01

Please sign in to comment.