Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Setting up new StealJS for the first time

$
0
0
Hi,
I've been wrestling with the Quick Start instructions ( http://stealjs.com/docs/index.html#section_QuickStart ) for a while and I think it's kinda working, but not without a couple of extra steps.

I'm new to node.js, bower and grunt, but have used the old version of Steal for a few projects.

These are some comments/observations as I was following the instructions on the Quick Start page:
1. I installed Node.js by going to nodejs.org and clicking the Install button and running the MSI. So far so good.
2. Next. I opened the command line at my "BASE" folder, but I found that there was a "node.js command line" shortcut that had been created, so I ran that instead (not sure if this makes a difference). I also ran the command line as an administrator, just in case.
3a To cut a long story short, I created a file called package.json file in the BASE folder and put this in the file:
{ "name" : "barebones", "version" : "0.0.0", }

3b At the command line I ran the 3 "npm installs":
> npm install -g bower //installs bower "globally"
> npm install grunt --save-dev //installs grunt locally and adds a development dependency to package.json
> npm install steal-tools --save-dev //ditto

4a I created a bower.json file by typing "bower init" into the command line and accepting all the defaults.
4b Ran these:
> bower install steal -S //installs steal and adds a dependency to bower.json
> bower install jquery -S //ditto

5. Followed the instructions for index.html, stealconfig.js and main.js. It worked! So dev mode works so far.

The rest of the instructions were to do with building the production file: 
6. I had to make a couple of changes to the Gruntfile.js:
  1. module.exports = function (grunt) {
  2.   grunt.initConfig({
  3.     stealBuild: {
  4.       default: {
  5.         options: {
  6.           system: {
  7.             main: "main",
  8.             config: __dirname+"/stealconfig.js" //Two underscores, not one
  9.           }
  10.         }
  11.       }
  12.     }
  13.   });
  14.   grunt.loadNpmTasks('steal-tools'); //had to add this line
  15.   grunt.registerTask('build',['stealBuild']);
  16. };
7. Finally, when I tried to run "grunt build" at the command line, turns out "grunt" didn't exist. not sure if this the correct way to fix this. But I installed grunt (client?) globally using this: npm install -g grunt-cli


8. When I thought I had it, I got this error:
ERROR: ENOENT, no such file or directory 'C:\Users\bchan\Projects\newstealtest\t
raceur\bin\traceur-runtime.js' Error: ENOENT, no such file or directory 'C:\User
s\bchan\Projects\newstealtest\traceur\bin\traceur-runtime.js'

This is definitely a hacky workaround, but I copied the traceur folder from BASE\node_modules\steal-tools\node_modules into BASE.

And finally, it builds!


Bryon


Viewing all articles
Browse latest Browse all 3491

Trending Articles