AgileApps Support Wiki Pre Release

Difference between revisions of "User:Aeric/HowTo:Install CoffeeScript"

From AgileApps Support Wiki
imported>Aeric
(Created page with "1. Go to http://nodejs.org/, click [Download], do the install --CoffeeScript requires Node.js to run the compiler --It uses npm (node package manager) to download & instal…")
 
imported>Aeric
 
Line 1: Line 1:
1. Go to http://nodejs.org/, click [Download], do the install
:1. Go to http://nodejs.org/, click [Download], do the install
  --CoffeeScript requires Node.js to run the compiler  
:: --CoffeeScript requires Node.js to run the compiler  
  --It uses npm (node package manager) to download & install coffescript
::  --It uses npm (node package manager) to download & install coffescript
    (bundled with Node.js!)
::    (bundled with Node.js!)
2. In File Explorer, move the nodejs folder to C:\  
 
    --In :\Program Files, or C:\Program Files (x86) on a 64 bit system    
:2. In File Explorer, move the nodejs folder to C:\  
3. Start a command shell
::    --In :\Program Files, or C:\Program Files (x86) on a 64 bit system
cd c:\nodejs
 
set path=%PATH%;%CD%
:3. Start a command shell
setx path "%PATH%   
::cd c:\nodejs
  --that command modifies the registry, so you don't have to go find env variables!
::set path=%PATH%;%CD%
4. Install Coffeescript
::setx path "%PATH%   
npm install -g coffee-script
:::  --that command modifies the registry, so you don't have to go find env variables!
  --installation folder is created:
 
    C:\Users\{user}\AppData\Roaming\npm\node_modules\coffee-script
:4. Install Coffeescript
5. Start a new shell,so the commands in coffee-script/bin can be used
::npm install -g coffee-script
6. In the command shell, verify the install:
:::  --installation folder is created:
coffee
:::    C:\Users\{user}\AppData\Roaming\npm\node_modules\coffee-script
  --after a short pause, you see the prompt for the coffe-script interpreter
 
  --coffee>
:5. Start a new shell,so the commands in coffee-script/bin can be used
  --Press Ctrl+C to exit the interpreter
 
  --Try out the "instant eval" option for a one-line command:
:6. In the command shell, verify the install:
      coffee -e "console.log num for num in [10..1]"
::coffee
      result: Count down from 10 to 1, one value per line
:::  --after a short pause, you see the prompt for the coffe-script interpreter
7. Do a test compile
:::  --coffee>
  --Create a project folder
::  --Press Ctrl+C to exit the interpreter
  --Create a file with the initial sample code from coffeescript.org (below)
::  --Try out the "instant eval" option for a one-line command:
    (sample.coffee)
:::      coffee -e "console.log num for num in [10..1]"
  --Compile it: coffee -c  
:::      result: Count down from 10 to 1, one value per line
  --Resulting .js file should match the results displayed at coffeescript.org
 
  --Notice how much cleaner and nicer it is, and much more fun it will be to  
:7. Do a test compile
    work with!
::  --Create a project folder
8. Clean up the build environment
::  --Create a file with the initial sample code from coffeescript.org (below)
  --create src/ and lib/ subfolders
:::  (sample.coffee)
  --move the .coffee file to src/
::  --Compile it: coffee -c  
  --nuke the .js file
::  --Resulting .js file should match the results displayed at coffeescript.org
  --Save and run the following command (put it build.cmd):
::  --Notice how much cleaner and nicer it is, and much more fun it will be to work with!
        coffee -c -o lib/ src/
 
  Other options to explore:
:8. Clean up the build environment
      --watch a file and recompile every time it is saved
::  --create src/ and lib/ subfolders
          coffee -w -c myfile.coffee
::  --move the .coffee file to src/
      --concatenate a list of files into a single script
::  --nuke the .js file
          coffee --join project.js --compile src/*.coffee
::  --Save and run the following command (put it build.cmd):
      --watch and recompile an entire project
:::        coffee -c -o lib/ src/
          coffee -o lib/ -cw src
 
:9. Other options to explore:
::      --watch a file and recompile every time it is saved
:::          coffee -w -c myfile.coffee
::      --concatenate a list of files into a single script
:::          coffee --join project.js --compile src/*.coffee
::      --watch and recompile an entire project
:::          coffee -o lib/ -cw src

Latest revision as of 18:51, 31 January 2012

1. Go to http://nodejs.org/, click [Download], do the install
--CoffeeScript requires Node.js to run the compiler
--It uses npm (node package manager) to download & install coffescript
(bundled with Node.js!)
2. In File Explorer, move the nodejs folder to C:\
--In :\Program Files, or C:\Program Files (x86) on a 64 bit system
3. Start a command shell
cd c:\nodejs
set path=%PATH%;%CD%
setx path "%PATH%
--that command modifies the registry, so you don't have to go find env variables!
4. Install Coffeescript
npm install -g coffee-script
--installation folder is created:
C:\Users\{user}\AppData\Roaming\npm\node_modules\coffee-script
5. Start a new shell,so the commands in coffee-script/bin can be used
6. In the command shell, verify the install:
coffee
--after a short pause, you see the prompt for the coffe-script interpreter
--coffee>
--Press Ctrl+C to exit the interpreter
--Try out the "instant eval" option for a one-line command:
coffee -e "console.log num for num in [10..1]"
result: Count down from 10 to 1, one value per line
7. Do a test compile
--Create a project folder
--Create a file with the initial sample code from coffeescript.org (below)
(sample.coffee)
--Compile it: coffee -c
--Resulting .js file should match the results displayed at coffeescript.org
--Notice how much cleaner and nicer it is, and much more fun it will be to work with!
8. Clean up the build environment
--create src/ and lib/ subfolders
--move the .coffee file to src/
--nuke the .js file
--Save and run the following command (put it build.cmd):
coffee -c -o lib/ src/
9. Other options to explore:
--watch a file and recompile every time it is saved
coffee -w -c myfile.coffee
--concatenate a list of files into a single script
coffee --join project.js --compile src/*.coffee
--watch and recompile an entire project
coffee -o lib/ -cw src