Permalink
Browse files

0.7

updated CoffeeScript and optimist
cleaned up
  • Loading branch information...
1 parent 953712f commit 73d1b5e039d73772268c0d39ce4d0bb3977a55ea Nicholas Kinsey committed Apr 17, 2012
Showing with 54 additions and 58 deletions.
  1. +0 −6 Cakefile
  2. +20 −23 README.md
  3. +1 −1 VERSION
  4. +19 −11 bin/courier
  5. +1 −4 courier.coffee
  6. +6 −6 package.coffee
  7. +7 −7 package.json
View
@@ -1,6 +0,0 @@
-task 'init', 'init', ->
- invoke 'build'
-
-task 'test', 'test', ->
- # TODO
- throw 'no tests yet...'
View
@@ -4,47 +4,44 @@
/ /__ / /_/ / /_/ /_ / _ / / __/ /
\___/ \____/\____/ /_/ /_/ \___//_/
-package.coffee -> package.json (dynamic npm packages in CoffeeScript)
-
-# Motivation
-Compiling a package.coffee file to a package.json isn't as simple as it seems.
-
-Since CoffeeScript wraps objects in order to make them assignable statements. courier will love and hold you through the night. Oh and it will cleanup the generated JavaScript to keep npm happy ^w^
+npm packages in CoffeeScript (package.coffee -> package.json)
# Installation
npm -g install courier
-### Why a global install?
-Just because.
+# Motivation
+Compiling a package.coffee file to a package.json isn't as simple as it seems
# Usage
-Using courier couldn't be simpler.
-
-1. Write your npm package ("package.json") in CoffeeScript and save as package.coffee.
+1. Write your npm package `package.json` in CoffeeScript and save as `package.coffee`
2. Run `courier` against your project.
-You will now see package.json alongside package.coffee in the root of your project; ready to be installed or linked with `npm`.
+`package.json` is now alongside `package.coffee`; ready to be installed or linked with `npm`.
## Options
Use the `-p (--print)` flag for a noisy delivery.
# Dynamicism
-Since courier utilises dynamic CoffeeScript and not static JSON, npm packages can be made dynamic.
+Since courier utilises CoffeeScript and not static JSON, npm packages can be made dynamic.
For instance, the following package.coffee...
- name: 'node-foo'
+```CoffeeScript
+name: 'node-foo'
- description: 'extends node with foo'
-
- date: new Date
+description: 'extends node with foo'
+
+date: new Date
+```
...would produce the following package.json...
- {
- "name": "node-foo",
- "description": "extends node with foo",
- "date": "2011-02-23T09:25:14.491Z"
- }
+```JavaScript
+{
+ "name": "node-foo",
+ "description": "extends node with foo",
+ "date": "2011-02-23T09:25:14.491Z"
+}
+```
-For a concrete example of this behaviour, look no further than the package.coffee of this very project; where the VERSION file is read to dynamically version the npm package.
+For a concrete example of this behaviour, look no further than the package.coffee of this very project. Hint: The VERSION file is read to dynamically version the npm package.
View
@@ -1 +1 @@
-0.6.0
+0.7.0
View
@@ -5,24 +5,32 @@ path = require 'path'
# npm
CoffeeScript = require '../node_modules/coffee-script'
-optimist = require('../node_modules/optimist')
+optimist = require '../node_modules/optimist'
-usage = '''
- Usage:
- courier [OPTIONS] [PATH_TO_APP = "."]
-'''
+argv = optimist
+ .usage("npm packages in CoffeeScript (package.coffee -> package.json)")
+ .alias('v', 'version')
+ .describe('v', 'Print version')
+ .argv
-argv = optimist.usage(usage).argv
-
-if argv.v || argv.version
+if argv.v or argv.version
console.log fs.readFileSync './VERSION', 'utf8'
process.exit 0
fs.readFile 'package.coffee', 'utf8', (error, coffee) ->
- throw error if error
+ if error
+ console.log "error: #{error}"
+ process.exit -1
+
+ console.log coffee
+
+ js = CoffeeScript.compile "return {
+ #{coffee}
+ }"
+
+ console.log js
- js = CoffeeScript.compile "return #{coffee}"
json = JSON.stringify eval(js), null, 2
fs.writeFile 'package.json', json, ->
- console.log json if argv.p || argv.print
+ console.log json if argv.p || argv.print
View
@@ -1,4 +1 @@
-fs = require 'fs'
-
-modules.exports = class Courier
-Courier.VERSION = fs.readFileSync('./VERSION', 'utf8')
+modules.exports = VERSION: ((require 'fs').readFileSync './VERSION', 'utf8')
View
@@ -1,6 +1,6 @@
name: 'courier'
-description: 'package.coffee -> package.json (dynamic npm packages in CoffeeScript)'
+description: 'npm packages in CoffeeScript (package.coffee -> package.json)'
keywords: ['courier']
@@ -27,7 +27,7 @@ repository:
web: 'http://github.com/feisty/courier'
bugs:
- mail: 'courier@feistystudios.com'
+ mail: 'courier@feisty.co'
web: 'http://github.com/feisty/courier/issues'
bin:
@@ -36,11 +36,11 @@ bin:
main: 'courier'
dependencies:
- 'coffee-script': '>= 1.1.1 < 1.2'
- optimist: '>= 0.2.4 < 0.3'
+ 'coffee-script': '~1.3.1'
+ optimist: '~0.3'
engines:
- node: '>= 0.4.9 < 0.5'
- npm: '>= 1.0.15 < 1.1'
+ node: '~0.6'
+ npm: '~1.1'
preferGlobal: true
View
@@ -1,10 +1,10 @@
{
"name": "courier",
- "description": "package.coffee -> package.json (dynamic npm packages in CoffeeScript)",
+ "description": "npm packages in CoffeeScript (package.coffee -> package.json)",
"keywords": [
"courier"
],
- "version": "0.6.0",
+ "version": "0.7.0",
"author": "feisty <courier@feisty.co> (http://feisty.co)",
"licenses": [
{
@@ -25,20 +25,20 @@
"web": "http://github.com/feisty/courier"
},
"bugs": {
- "mail": "courier@feistystudios.com",
+ "mail": "courier@feisty.co",
"web": "http://github.com/feisty/courier/issues"
},
"bin": {
"courier": "./bin/courier"
},
"main": "courier",
"dependencies": {
- "coffee-script": ">= 1.1.1 < 1.2",
- "optimist": ">= 0.2.4 < 0.3"
+ "coffee-script": "~1.3.1",
+ "optimist": "~0.3"
},
"engines": {
- "node": ">= 0.4.9 < 0.5",
- "npm": ">= 1.0.15 < 1.1"
+ "node": "~0.6",
+ "npm": "~1.1"
},
"preferGlobal": true
}

0 comments on commit 73d1b5e

Please sign in to comment.