Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

proto-cli

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proto-cli - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

37

lib/http_utils.js
(function() {
var cacheResponse, fs, htmlResponse, loadFromCache;
var cacheResponse, fileResponse, fs, htmlResponse, loadFromCache, mime, path, util;
fs = require('fs');
path = require('path');
mime = require('mime');
util = require('util');
loadFromCache = require('./cache').loadFromCache;

@@ -16,3 +22,4 @@

});
return response.end(content);
response.end(content);
return util.log("[" + status_code + "] " + request.method + " " + request.url);
};

@@ -46,3 +53,4 @@

});
return response.end(cache_content);
response.end(cache_content);
return util.log("[200] " + request.method + " " + request.url);
}

@@ -52,7 +60,28 @@ });

fileResponse = function(project_dir, request, response) {
var stat, target_file;
target_file = path.join(project_dir, request.url);
try {
stat = fs.statSync(target_file);
} catch (_error) {
stat = null;
}
if (stat) {
response.writeHead(200, {
'Content-Length': stat.size,
'Content-Type': mime.lookup(target_file) || 'application/octet-stream'
});
fs.createReadStream(target_file).pipe(response);
return util.log("[200] " + request.method + " " + request.url);
} else {
return cacheResponse(request, response);
}
};
module.exports = {
htmlResponse: htmlResponse,
cacheResponse: cacheResponse
cacheResponse: cacheResponse,
fileResponse: fileResponse
};
}).call(this);

8

lib/proto.js
(function() {
var CWD, LIB_DIR, PROTO_DIR, PROTO_FILES, SETTINGS_FILE, VERSION, VIEWER_URL, authWithGitHub, cacheFileFromURL, cacheResponse, cli, createNewGist, displayUrlsFor, downloadLibs, fs, getAuthorization, getGist, getGistId, getSetting, gistProject, git, htmlResponse, initializeProject, initializeRepo, loadProjectData, migrateProject, pad, projectPath, quitWithMsg, renderer, rest, saveSetting, serveProject, stamp, sys, updateGist, _ref, _ref1,
var CWD, LIB_DIR, PROTO_DIR, PROTO_FILES, SETTINGS_FILE, VERSION, VIEWER_URL, authWithGitHub, cacheFileFromURL, cli, createNewGist, displayUrlsFor, downloadLibs, fileResponse, fs, getAuthorization, getGist, getGistId, getSetting, gistProject, git, htmlResponse, initializeProject, initializeRepo, loadProjectData, migrateProject, pad, projectPath, quitWithMsg, renderer, rest, saveSetting, serveProject, stamp, sys, updateGist, _ref, _ref1,
__slice = [].slice;

@@ -17,3 +17,3 @@

_ref = require('./http_utils'), htmlResponse = _ref.htmlResponse, cacheResponse = _ref.cacheResponse;
_ref = require('./http_utils'), htmlResponse = _ref.htmlResponse, fileResponse = _ref.fileResponse;

@@ -44,3 +44,3 @@ cacheFileFromURL = require('./cache').cacheFileFromURL;

t = "" + hour + ":" + min + ":" + sec;
return sys.puts("" + t + ": " + (args.join(' ')));
return console.info("" + t + ": " + (args.join(' ')));
};

@@ -410,3 +410,3 @@

} else {
return cacheResponse(req, res);
return fileResponse(projectPath(project_name), req, res);
}

@@ -413,0 +413,0 @@ };

@@ -38,3 +38,3 @@ (function() {

compileScriptLibraries = function(script_libraries) {
var key, lib, script_libs, url, _i, _len;
var cached_from, key, lib, script_libs, url, _i, _len;
script_libs = '';

@@ -46,6 +46,8 @@ for (_i = 0, _len = script_libraries.length; _i < _len; _i++) {

url = key;
cached_from = "data-cached_from='" + lib + "'";
} else {
url = lib;
cached_from = '';
}
script_libs += "<script src='" + url + "'></script>";
script_libs += "<script src='" + url + "' " + cached_from + "></script>";
}

@@ -52,0 +54,0 @@ return script_libs;

{
"name": "proto-cli",
"version": "1.5.1",
"version": "1.6.0",
"description": "A front-end web prototyping tool, combining markup, style, and script into a served, rendered page.",

@@ -20,5 +20,6 @@ "main": "bin/proto",

"markdown": "~0.5.0",
"mime": "^1.3.4",
"nib": "~1.0.2",
"restler": "~3.2.0",
"stylus": "~0.42.3",
"restler": "~3.2.0",
"walk": "~2.3.1"

@@ -25,0 +26,0 @@ },

# Proto
*v1.5.1*
*v1.6.0*

@@ -25,3 +25,3 @@ [Proto](https://github.com/marquee/proto) is a front-end web prototyping tool, combining markup ([Jade](http://jade-lang.com/)), script ([CoffeeScript](http://coffeescript.org)), and style ([Stylus](http://learnboost.github.com/stylus/)) into a single page. It creates a set of files each representing one of those three facets of the page, plus files for notes and settings, and serves up their rendered form. Every time the page is loaded, those files are compiled on-the-fly. It's helpful for creating prototypes using CoffeeScript, Jade, and Stylus, without having to set up a build process and environment. [CJSX](https://github.com/jsdf/coffee-react-transform) is supported, and Proto is particularly handy for prototyping [React](http://facebook.github.io/react/) components.

$ cake build
$ npm install -g .
$ npm install -g

@@ -70,5 +70,5 @@ `cake build` will compile `src/*.coffee` into `lib/*.js` (ignored by git).

This starts a server that serves the compiled markup, script, and style on the specified port (default 5000). The source files are compiled every time the page is requested.
This starts a server that serves the compiled markup, script, style, as well as any additional files, on the specified port (default 5000). The source files are compiled every time the page is requested.
The source files are compiled and inserted into a full `html` template. Libraries specified in `settings.json`, and the CSS compiled from `style.styl`, are added to the `<head>` of the page. `markup.jade` gets compiled to HTML and inserted into the `<body>`, and `script.coffee` gets compiled to JavaScript and added to the end of the `<body>`. (Take a peak at the Proto source for the [full template](https://github.com/droptype/proto/blob/master/src/renderer.coffee#L41) it uses.)
The source files are compiled and inserted into a full `html` template. Libraries specified in `settings.json`, and the CSS compiled from `style.styl`, are added to the `<head>` of the page. `markup.jade` gets compiled to HTML and inserted into the `<body>`, and `script.coffee` gets compiled to JavaScript and added to the end of the `<body>`. (Take a peak at the Proto source for the [full template](https://github.com/droptype/proto/blob/master/src/renderer.coffee#L41) it uses.) Additional files, like images, will be served as well.

@@ -108,4 +108,6 @@ #### `settings.json`

This will upload the five files in the specified project folder to an anonymous Gist. By default, the Gist is private. Adding the `--public` flag will make it a public Gist. But, anonymous Gists aren't terribly useful besides one-off sharing, so *Authenticated* Gists are recommended.
This will upload the five main files in the specified project folder to an anonymous Gist. By default, the Gist is private. Adding the `--public` flag will make it a public Gist. But, anonymous Gists aren't terribly useful besides one-off sharing, so *Authenticated* Gists are recommended. For authenticated Gists, `proto -g` can be used again to update the Gist.
Note: this will not add any additional files in the project to the Gist, since the Gist API does not support adding binary files. However, you may add those manually with `git` once the Gist has been created. Subsequent `proto -g` will include those files after they are added to the repo.
#### Authenticated

@@ -125,3 +127,3 @@

Proto includes a web viewer running at [proto.es](http://proto.es), which will render the specified Gist the same as the command-line would. It allows for easy sharing of the rendered Proto project, even specific versions of it (since it's just a git repo).
Proto includes a web viewer running at [proto.es](http://proto.es), which will render the specified Gist the same as the command-line would. It allows for easy sharing of the rendered Proto project, even specific versions of it (since it's just a git repo). However, it will not support extra files in Gists, particularly images which cannot be read through the API.

@@ -152,14 +154,3 @@ Example with the [sample project](https://gist.github.com/3894924): [proto.es/3894924](http://proto.es/3894924) ([older revision](http://proto.es/3894924/e7496f08d10dce02db7209473912a1aa0676ce13))

## FAQ
### Why not LiveReload?
[LiveReload](http://livereload.com/) is awesome and works great — in fact it works really well alongside Proto — but doesn't serve the files (and nor should it). Certain JavaScript features require the file to be served instead of loaded using `file://` for security reasons. Proto is simpler to use and provides an easy way to initialize the project. It is also intended to be opinionated about the languages and structure it supports, creating simplicity through useful defaults.
### Why can't I have (more/fewer/other) files?
Convention. Proto restricts the sources to one file for each type to limit the kinds of things that can be built with it. It's a tool for prototyping relatively small interactions, kind of like a command-line version of [Pad Hacker](http://padhacker.net) or [JSFiddle](http://jsfiddle.net). Keeping the projects simple also makes it easy for others to understand quickly and avoids filling up the Gists with libraries.
For a similar tool that caters to more complicated projects, check out [`roots`](http://roots.cx/)
## Authors

@@ -166,0 +157,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc